Skip to content

Commit

Permalink
fix: some fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Toto-hitori committed May 5, 2024
1 parent 89f8204 commit b1974fd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ let browser;
defineFeature(feature, test => {

let username = "t.login.neg.bad_crd"
let user;
let password;
let user = "@email.com";
let password = "wrongpassword";

beforeAll(async () => {
browser = process.env.GITHUB_ACTIONS
Expand Down
16 changes: 6 additions & 10 deletions webapp/e2e/steps/logout_positive_logged_user.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,16 @@ defineFeature(feature, test => {
})
.catch(() => {});

// Registering the user before the tests
await registerUserFromRootDirectory(username, page);

// Logging it out
await logOutUser(page);

}, 120000);

test("A logged user wants to log out the webpage", ({given,when,and,then}) => {
let gameURL = "http://localhost:3000/dashboard/game";

given('A logged user in main menu', async () => {
await new Promise(resolve => setTimeout(resolve, 5000));
let newHeader = await page.$eval("h2", (element) => {
return element.innerHTML
})
let newValue = newHeader === "Bienvenid@ " + username || header === "Welcome " + username;
expect(newValue).toBeTruthy();
// Registering the user before the tests
await registerUserFromRootDirectory(username, page);
});

when('User presses the button for deploying the lateral menu', async() => {
Expand Down Expand Up @@ -91,3 +86,4 @@ async function registerUserFromRootDirectory(username, page) {

return [email, password];
}

Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { registerUserFromRootDirectory}from '../e2e_utils/e2e_utils_register.js';
import { waitForPageToLoad } from '../e2e_utils/e2e_utils_timeout.js';
import { logOutUser } from '../e2e_utils/e2e_utils_logout.js';
import { loginUserFromRootDirectory } from '../e2e_utils/e2e_utils_login.js'

const { defineFeature, loadFeature }=require('jest-cucumber');
const puppeteer = require('puppeteer');
const setDefaultOptions = require("expect-puppeteer").setDefaultOptions;
Expand Down
4 changes: 2 additions & 2 deletions webapp/e2e/steps/seeing_rules_positive.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ let browser;

defineFeature(feature, test => {
let username = "t.rules.pos"
let user;
let password;
let user = username + "@email.com";
let password = username + "psw";

beforeAll(async () => {
browser = process.env.GITHUB_ACTIONS
Expand Down
4 changes: 2 additions & 2 deletions webapp/e2e/steps/seeing_stats_positive.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ let browser;

defineFeature(feature, test => {
let username = "t.stats.pos"
let user;
let password;
let user = username + "@email.com";
let password = username +"psw";


beforeAll(async () => {
Expand Down

0 comments on commit b1974fd

Please sign in to comment.