Skip to content

Commit fe92cd2

Browse files
fix
1 parent db430e7 commit fe92cd2

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

tests/login.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ test.beforeEach(async ({ page }) => {
88

99
test.describe('Register and Authentication tests', () => {
1010

11-
test('CT001 - Should be able to register and do login with a new user with success', async ({ page }) => {
11+
test('CT001 - Should be able to register and do the login with a new user with success', async ({ page }) => {
1212
// Start the selected flow
1313
const oauthFlow = new OauthFlow(page);
14-
// Do the test
15-
oauthFlow.login("Testezinho da silva", "[email protected]", "12345", "12345");
14+
// Execute the flow
15+
await oauthFlow.doLogin("Testezinho da silva", "[email protected]", "12345", "12345");
1616
});
1717
});

ui/flows/oauth-flow.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@ import { RegisterPage } from '../pages/register-page';
55
export class OauthFlow {
66
constructor(private page: Page) { }
77

8-
async login(name: string, email: string, password: string, confirmationPassword: string) {
8+
async doLogin(name: string, email: string, password: string, confirmationPassword: string) {
99

1010
const loginPage = new LoginPage(this.page);
1111
const registerPage = new RegisterPage(this.page);
1212

1313
// Registration
14+
await this.page.waitForURL("https://bugbank.netlify.app/");
1415
await loginPage.clickRegisterButton();
1516
await registerPage.fillEmail(email);
1617
await registerPage.fillName(name);
1718
await registerPage.fillPassword(password);
1819
await registerPage.fillPasswordConfirmation(confirmationPassword);
1920
await registerPage.clickRegisterButton();
2021

21-
// // Registration assert
22-
// await expect(registerPage.confirmationMessage).toBeVisible();
23-
// await expect(registerPage.confirmationIcon).toBeVisible();
24-
// await registerPage.closeButton.click();
22+
// Registration assert
23+
await expect(registerPage.confirmationMessage).toBeVisible();
24+
await expect(registerPage.confirmationIcon).toBeVisible();
25+
await registerPage.closeButton.click();
2526

26-
// // Do login
27-
// await loginPage.fillEmail(email);
28-
// await loginPage.fillPassword(password);
29-
// await loginPage.clickLoginButton();
30-
// await this.page.waitForURL("https://bugbank.netlify.app/home");
31-
// await expect(this.page).toHaveURL("https://bugbank.netlify.app/home");
27+
// Do login
28+
await loginPage.fillEmail(email);
29+
await loginPage.fillPassword(password);
30+
await loginPage.clickLoginButton();
31+
await this.page.waitForURL("https://bugbank.netlify.app/home");
32+
await expect(this.page).toHaveURL("https://bugbank.netlify.app/home");
3233
}
3334
}

ui/pages/login-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class LoginPage {
2626
}
2727

2828
async clickLoginButton() {
29+
await this.loginButton.waitFor();
2930
await this.loginButton.click();
3031
}
3132

0 commit comments

Comments
 (0)