Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chalapkoStanislav committed Apr 9, 2024
1 parent db7d31e commit bc17b24
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const mainTest = base.test.extend({
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand Down Expand Up @@ -93,6 +94,7 @@ const performanceTest = base.test.extend({
page: async ({ page, workingFile }, use) => {
const loginPage = new LoginPage(page);
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand Down
10 changes: 10 additions & 0 deletions pages/base-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ exports.BasePage = class BasePage {
this.detachInstanceOption = page.locator(
'ul[class*="workspace_context_menu"] span:has-text("Detach instance")',
);
this.acceptCookieButton = page.locator(
'button[class*="CookieConsent_accept"]',
);
}

async clearInput(input, browserName) {
Expand Down Expand Up @@ -297,4 +300,11 @@ exports.BasePage = class BasePage {
async isWrapperMessageVisible() {
await expect(this.wrapperMessage).toBeVisible({timeout: 10000});
}

async acceptCookie() {
if (await this.acceptCookieButton.isVisible()) {
await this.acceptCookieButton.click();
}
await expect(this.acceptCookieButton).not.toBeVisible();
}
};
2 changes: 2 additions & 0 deletions tests/login.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { updateTestResults } = require('./../helpers/saveTestResults.js');
test('ON-8 Login with an email address', async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -16,6 +17,7 @@ test('ON-8 Login with an email address', async ({ page }) => {
test('ON-13 Login with invalid email address', async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.enterEmail('test@com');
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.isEmailInputErrorDisplayed('Enter a valid email please');
Expand Down

0 comments on commit bc17b24

Please sign in to comment.