generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
24 changed files
with
855 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
testMatch: ["**/playing_full_game_pos*.steps.js","**/about.steps.js", "**/login_positive.steps.js"], | ||
testMatch: ["**/*.steps.js"], | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
testTimeout: 30000 | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,12 @@ let browser; | |
|
||
|
||
defineFeature(feature, test => { | ||
let username = "about_pos"; | ||
|
||
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 }) | ||
|
@@ -21,33 +22,32 @@ defineFeature(feature, test => { | |
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => {}); | ||
}); | ||
|
||
test("A logged user wants to see the about screen of the webpage", ({given,when,and,then}) => { | ||
// Registering the user before the tests | ||
await registerUserFromRootDirectory(username, page); | ||
|
||
let username; | ||
let password; | ||
|
||
given("A logged user in the main menu", async () => { | ||
username = "[email protected]" | ||
password = "password" | ||
|
||
await expect(page).toClick("button[data-testid='Login'"); | ||
await expect(page).toFill("#user", username); | ||
await expect(page).toFill("#password", password); | ||
await expect(page).toClick("button[data-testid='Login'"); | ||
// Logging it out | ||
await logOutUser(page); | ||
|
||
}, 120000); | ||
|
||
test("A logged user wants to see the about screen of the webpage", ({given,when,and,then}) => { | ||
|
||
given("A logged user in the main menu", async () => { | ||
await loginUserFromRootDirectory(username, page); | ||
}); | ||
|
||
when("The user presses the button for deploying the lateral menu", async () => { | ||
await expect(page).toClick("#lateralMenuButton"); | ||
}); | ||
|
||
and("the user presses the button for seeing the about section (i)", async () => { | ||
await new Promise(resolve => setTimeout(resolve, 5000)); // Waiting for page to fully load | ||
await expect(page).toClick("#aboutButton"); | ||
}); | ||
|
||
then("The user is presented to the about screen", async () => { | ||
await new Promise(resolve => setTimeout(resolve, 6000)); // Waiting for page to fully load | ||
await new Promise(resolve => setTimeout(resolve, 5000)); // Waiting for page to fully load | ||
let header = await page.$eval("h2", (element) => { | ||
return element.innerHTML | ||
}) | ||
|
@@ -60,4 +60,63 @@ defineFeature(feature, test => { | |
done(); | ||
browser.close(); | ||
}); | ||
}); | ||
}); | ||
async function registerUserFromRootDirectory(username, page) { | ||
// Credentials for the new user | ||
let email = username + "@email.com" | ||
let password = username + "psw" | ||
|
||
// 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'"); | ||
|
||
// Checking for the process to be correct | ||
await new Promise(resolve => setTimeout(resolve, 5000)); // Waiting for page to fully load | ||
let header = await page.$eval("h2", (element) => { | ||
return element.innerHTML | ||
}) | ||
let value = header === "Bienvenid@ " + username || header === "Welcome " + username; | ||
expect(value).toBeTruthy(); | ||
|
||
return [email, password]; | ||
} | ||
|
||
async function logOutUser(page) { | ||
// Logging out | ||
await expect(page).toClick("#lateralMenuButton"); | ||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
await expect(page).toClick("button[data-testid='LogOut']"); | ||
|
||
// Checking for the log out to be sucessful | ||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
let header = await page.$eval("button[data-testid='Login']", (element) => { | ||
return element.innerHTML | ||
}) | ||
let value = header === "Login" || "Iniciar sesión"; | ||
|
||
expect(value).toBeTruthy(); | ||
} | ||
async function loginUserFromRootDirectory(username, page) { | ||
// Credentials for the new user | ||
let email = username + "@email.com" | ||
let password = username + "psw" | ||
|
||
// login process | ||
await expect(page).toClick("button[data-testid='Login'"); | ||
await expect(page).toFill("#user", email); | ||
await expect(page).toFill("#password", password); | ||
await expect(page).toClick("button[data-testid='Login'"); | ||
|
||
// Checking for the process to be correct | ||
await new Promise(resolve => setTimeout(resolve, 5000)); // Waiting for page to fully load | ||
let header = await page.$eval("h2", (element) => { | ||
return element.innerHTML | ||
}) | ||
let value = header === "Bienvenid@ " + username || header === "Welcome " + username; | ||
expect(value).toBeTruthy(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.