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.
- Loading branch information
1 parent
1bb31cb
commit e8ba1e0
Showing
3 changed files
with
93 additions
and
78 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 |
---|---|---|
|
@@ -24,17 +24,10 @@ defineFeature(feature, test => { | |
|
||
test("A logged user wants to see the about screen of the webpage", ({given,when,and,then}) => { | ||
|
||
let username; | ||
let password; | ||
let username = "test"; | ||
|
||
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'"); | ||
await registerUserFromRootDirectory(username,page) | ||
}); | ||
|
||
when("The user presses the button for deploying the lateral menu", async () => { | ||
|
@@ -57,4 +50,28 @@ defineFeature(feature, test => { | |
afterAll((done) => { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
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]; | ||
} |
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