Skip to content

Commit

Permalink
test: removing exporting functions as test case crashed thanks to it.
Browse files Browse the repository at this point in the history
Also added timeout to before all
Now testing if it works (it should). If it does, i'll make all the test to pass and then refactor will be done if there's time for it before the final delivery
  • Loading branch information
GOLASOOO committed May 5, 2024
1 parent 11f7956 commit 6195ee8
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions webapp/e2e/steps/login_positive.steps.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
const { logOutUser } = require('../e2e_utils/e2e_utils_logout.js');
const { waitForPageToLoad } = require('../e2e_utils/e2e_utils_timeout.js')
const { registerUserFromRootDirectory } = require('../e2e_utils/e2e_utils_register.js')
const { defineFeature, loadFeature }=require('jest-cucumber');
const puppeteer = require('puppeteer');
const setDefaultOptions = require("expect-puppeteer").setDefaultOptions;
Expand All @@ -11,8 +8,8 @@ let browser;

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

beforeAll(async () => {
browser = process.env.GITHUB_ACTIONS
Expand All @@ -28,15 +25,31 @@ defineFeature(feature, test => {
})
.catch(() => {});

// Registering process
await expect(page).toClick("span[class='chakra-link css-1bicqx'");
await expect(page).toFill("input[id='user'", email);
await expect(page).toFill("input[id='username'", username);
await expect(page).toFill("#password", password);
await expect(page).toFill("input[id='field-:r5:']", password);
await expect(page).toClick("button[data-testid='Sign up'");

// Registering the user before the tests
let credentials = registerUserFromRootDirectory(username, page);
email = credentials[0];
username = credentials[1];
// Checking for the process to be correct
await new Promise(resolve => setTimeout(resolve, 6000));

// Checking user is in main screen
let header = await page.$eval("h2", (element) => {
return element.innerHTML
})
let value = header === "Bienvenid@ " + username || header === "Welcome " + username;
expect(value).toBeTruthy();



// Logging it out
logOutUser(page);
});
// Logging it out
await expect(page).toClick("#lateralMenuButton");
await expect(page).toClick("button[data-testid='LogOut']");

}, 120000);

test("A registered user wants to log in using his correct credentials", ({given,when,and,then}) => {

Expand Down

0 comments on commit 6195ee8

Please sign in to comment.