From ae813c4cebf8fdd92d2589a23e0a39c71e7bc61d Mon Sep 17 00:00:00 2001 From: "Dario G. Mori" Date: Sun, 5 May 2024 17:17:59 +0200 Subject: [PATCH 1/2] test:fixed run conditions --- webapp/e2e/steps/about.steps.js | 6 +++--- webapp/e2e/steps/login_positive.steps.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/e2e/steps/about.steps.js b/webapp/e2e/steps/about.steps.js index d74d7cb7..ef5e2077 100644 --- a/webapp/e2e/steps/about.steps.js +++ b/webapp/e2e/steps/about.steps.js @@ -9,8 +9,8 @@ defineFeature(feature, test => { beforeAll(async () => { browser = process.env.GITHUB_ACTIONS - ? await puppeteer.launch() - : await puppeteer.launch({ headless: false, slowMo: 100 }); + ? await puppeteer.launch({ ignoreHTTPSErrors: true}) + : await puppeteer.launch({ headless: false, slowMo: 100, ignoreHTTPSErrors: true }); page = await browser.newPage(); //Way of setting up the timeout setDefaultOptions({ timeout: 10000 }) @@ -24,7 +24,7 @@ defineFeature(feature, test => { test("A logged user wants to see the about screen of the webpage", ({given,when,and,then}) => { - let username = "test"; + let username = "t.about"; given("A logged user in the main menu", async () => { await registerUserFromRootDirectory(username,page) diff --git a/webapp/e2e/steps/login_positive.steps.js b/webapp/e2e/steps/login_positive.steps.js index 7cb114bf..7d59fe4d 100644 --- a/webapp/e2e/steps/login_positive.steps.js +++ b/webapp/e2e/steps/login_positive.steps.js @@ -7,7 +7,7 @@ let browser; defineFeature(feature, test => { - let username = "t.regis.pos"; + let username = "t.log.pos"; let email = username + "@email.com"; let password = username + "psw"; @@ -29,7 +29,7 @@ defineFeature(feature, test => { await registerUserFromRootDirectory(username, page); // Logging it out - await logOutUser(page) + await logOutUser(page); }, 120000); From b407a3c1a9c02ff4824f631214c33e2f2b9bec4f Mon Sep 17 00:00:00 2001 From: "Dario G. Mori" Date: Sun, 5 May 2024 17:32:23 +0200 Subject: [PATCH 2/2] test: added timeout --- webapp/e2e/steps/login_positive.steps.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/e2e/steps/login_positive.steps.js b/webapp/e2e/steps/login_positive.steps.js index 7d59fe4d..9243ede9 100644 --- a/webapp/e2e/steps/login_positive.steps.js +++ b/webapp/e2e/steps/login_positive.steps.js @@ -26,7 +26,7 @@ defineFeature(feature, test => { .catch(() => {}); // Registering the user before the tests - await registerUserFromRootDirectory(username, page); + await registerUserFromRootDirectory(username, page); // Logging it out await logOutUser(page); @@ -113,6 +113,7 @@ async function registerUserFromRootDirectory(username, page) { async function logOutUser(page) { // Logging out await expect(page).toClick("#lateralMenuButton"); + await new Promise(resolve => setTimeout(resolve, 5000)); // Waiting for page to fully load await expect(page).toClick("button[data-testid='LogOut']"); // Checking for the log out to be sucessful