From 11f7956dec4889e818ac4b244aeffa172b624f17 Mon Sep 17 00:00:00 2001 From: "Dario G. Mori" Date: Sun, 5 May 2024 11:01:15 +0200 Subject: [PATCH] test: readded failing test --- webapp/e2e/e2e_utils/e2e_utils_logout.js | 2 +- webapp/e2e/e2e_utils/e2e_utils_register.js | 2 +- webapp/e2e/e2e_utils/e2e_utils_timeout.js | 2 +- webapp/e2e/jest.config.js | 2 +- webapp/e2e/steps/login_positive.steps.js | 7 +++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/webapp/e2e/e2e_utils/e2e_utils_logout.js b/webapp/e2e/e2e_utils/e2e_utils_logout.js index e95238b6..2aef4803 100644 --- a/webapp/e2e/e2e_utils/e2e_utils_logout.js +++ b/webapp/e2e/e2e_utils/e2e_utils_logout.js @@ -8,7 +8,7 @@ const {waitForPageToLoad} = require('../e2e_utils/e2e_utils_timeout.js'); * * @param {*} page The website */ -export async function logOutUser(page) { +async function logOutUser(page) { // Logging out await expect(page).toClick("#lateralMenuButton"); await expect(page).toClick("button[data-testid='LogOut']"); diff --git a/webapp/e2e/e2e_utils/e2e_utils_register.js b/webapp/e2e/e2e_utils/e2e_utils_register.js index b20fc483..c72db54d 100644 --- a/webapp/e2e/e2e_utils/e2e_utils_register.js +++ b/webapp/e2e/e2e_utils/e2e_utils_register.js @@ -7,7 +7,7 @@ * @param {*} page The website * @returns An array with the credentials of the user created [email, username] */ -export async function registerUserFromRootDirectory(username, page) { +async function registerUserFromRootDirectory(username, page) { // Credentials for the new user let email = username + "@email.com" let password = username + "ps" diff --git a/webapp/e2e/e2e_utils/e2e_utils_timeout.js b/webapp/e2e/e2e_utils/e2e_utils_timeout.js index a2ad9b87..f99c2d31 100644 --- a/webapp/e2e/e2e_utils/e2e_utils_timeout.js +++ b/webapp/e2e/e2e_utils/e2e_utils_timeout.js @@ -3,7 +3,7 @@ * Auxiliar function that times out the tests for some time, so the page can be fully loaded. * @param {*} timeout_ms Amount of ms to wait. */ -export async function waitForPageToLoad(timeout_ms = 6000) { +async function waitForPageToLoad(timeout_ms = 6000) { await new Promise(resolve => setTimeout(resolve, timeout_ms)); } diff --git a/webapp/e2e/jest.config.js b/webapp/e2e/jest.config.js index 516651d5..1f4b748c 100644 --- a/webapp/e2e/jest.config.js +++ b/webapp/e2e/jest.config.js @@ -1,5 +1,5 @@ module.exports = { - testMatch: ["**/playing_full_game_pos*.steps.js","**/about.steps.js"], + testMatch: ["**/playing_full_game_pos*.steps.js","**/about.steps.js", "**/login_positive.steps.js"], moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], testTimeout: 30000 } \ No newline at end of file diff --git a/webapp/e2e/steps/login_positive.steps.js b/webapp/e2e/steps/login_positive.steps.js index 3973580f..9002aae6 100644 --- a/webapp/e2e/steps/login_positive.steps.js +++ b/webapp/e2e/steps/login_positive.steps.js @@ -1,7 +1,6 @@ -import { registerUserFromRootDirectory}from '../e2e_utils/e2e_utils_register.js'; -import { logOutUser } from '../e2e_utils/e2e_utils_logout.js'; -import { waitForPageToLoad } from '../e2e_utils/e2e_utils_timeout.js'; - +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;