forgot-password merge conflict

This commit is contained in:
Staschalapko 2024-06-04 16:19:21 +03:00
parent 6d2f907cc8
commit d1bb2a51a0
5 changed files with 82 additions and 57 deletions

View File

@ -47,6 +47,10 @@ jobs:
BASE_URL: ${{ secrets.BASE_URL }}
LOGIN_EMAIL: ${{ secrets.LOGIN_EMAIL }}
LOGIN_PWD: ${{ secrets.LOGIN_PWD }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
GMAIL_NAME: ${{ secrets.GMAIL_NAME }}
run: npx playwright test --project=chrome -gv 'PERF' ./tests/forgot-password.spec.js
- name: Upload Playwright Report
uses: actions/upload-artifact@v3

View File

@ -10,6 +10,10 @@ exports.ForgotPasswordPage = class ForgotPasswordPage extends BasePage {
this.emailInput = page.locator('#email');
this.recoverPasswordButton = page.locator('data-test=recovery-resquest-submit');
this.recoveryPwdInput = page.locator('#password-1');
this.recoveryPwdConfirmInput = page.locator('#password-2');
this.changePwdButton = page.locator('button[class*="auth_recovery__submit-btn"]');
}
async enterEmail(loginEmail) {
@ -23,4 +27,16 @@ exports.ForgotPasswordPage = class ForgotPasswordPage extends BasePage {
async isRecoverPasswordButtonDisabled() {
await expect(this.recoverPasswordButton).toBeDisabled();
}
async enterNewPwd(loginPwd) {
await this.recoveryPwdInput.fill(loginPwd);
}
async enterConfirmPwd(loginPwd) {
await this.recoveryPwdConfirmInput.fill(loginPwd);
}
async clickOnChangePwdButton() {
await this.changePwdButton.click();
}
};

View File

@ -16,13 +16,8 @@ exports.LoginPage = class LoginPage extends BasePage {
this.section = page.locator('section[class="auth-content"]');
this.loginErrorBanner = page.locator('aside[class*="context_notification__warning"] div:nth-of-type(2)');
this.createAccountLink = page.locator('a:has-text("Create an account")');
this.forgotPasswordLink = page.locator('data-test=forgot-password');
this.forgotPasswordLink = page.locator('a[data-test="forgot-password"]');
this.loginHereButton = page.locator('*[data-test="login-here-link"]');
this.forgotPasswordBtn = page.locator('a[data-test="forgot-password"]');
this.recoverySubmitBtn = page.locator('button[data-test="recovery-resquest-submit"]');
this.recoveryPwdInput = page.locator('#password-1');
this.recoveryPwdConfirmInput = page.locator('#password-2');
this.changePwdButton = page.locator('button[class*="auth_recovery__submit-btn"]')
}
async checkLoginError(text) {
@ -75,27 +70,6 @@ exports.LoginPage = class LoginPage extends BasePage {
async clickOnLoginHereLinc() {
await this.loginHereButton.click();
}
async clickOnForgotPasswordButton() {
await this.forgotPasswordBtn.click();
}
async clickOnRecoverySubmitButton() {
await this.recoverySubmitBtn.click();
}
async enterNewPwd(loginPwd) {
await this.recoveryPwdInput.fill(loginPwd);
}
async enterConfirmPwd(loginPwd) {
await this.recoveryPwdConfirmInput.fill(loginPwd);
}
async clickOnChangePwdButton() {
await this.changePwdButton.click();
}
async clickOnForgotPassword() {
await this.forgotPasswordLink.click();
}

View File

@ -3,6 +3,11 @@ const { LoginPage } = require('../pages/login-page');
const { ForgotPasswordPage } = require('../pages/forgot-password-page');
const { updateTestResults } = require('./../helpers/saveTestResults.js');
const { qase } = require('playwright-qase-reporter/dist/playwright');
const { random } = require('../helpers/string-generator');
const { RegisterPage } = require('../pages/register-page');
const { getRegisterMessage, checkRecoveryText } = require('../helpers/gmail');
const { DashboardPage } = require('../pages/dashboard/dashboard-page');
const { ProfilePage } = require('../pages/profile-page');
test(qase(50,'ON-23 Forgot password flow with invalid email'), async ({ page }) => {
const loginPage = new LoginPage(page);
@ -13,6 +18,62 @@ test(qase(50,'ON-23 Forgot password flow with invalid email'), async ({ page })
await forgotPasswordPage.isRecoverPasswordButtonDisabled();
});
test.describe(() => {
let randomName,email,invite;
test.beforeEach(async ({ page }, testInfo) => {
await testInfo.setTimeout(testInfo.timeout + 30000);
randomName = random().concat('autotest');
email = `${process.env.GMAIL_NAME}+${randomName}@gmail.com`;
const loginPage = new LoginPage(page);
const registerPage = new RegisterPage(page);
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.clickOnCreateAccount();
await registerPage.isRegisterPageOpened();
await registerPage.enterEmail(email);
await registerPage.enterPassword(process.env.LOGIN_PWD);
await registerPage.clickOnCreateAccountBtn();
await registerPage.enterFullName(randomName);
await registerPage.clickOnAcceptTermsCheckbox();
await registerPage.clickOnCreateAccountSecondBtn();
await registerPage.isRegisterEmailCorrect(email);
await page.waitForTimeout(30000);
invite = await getRegisterMessage(email);
});
test(qase(49,'ON-22 Forgot password flow'), async ({ page }) => {
const newPwd = 'TestForgotPassword123';
const dashboardPage = new DashboardPage(page);
const loginPage = new LoginPage(page);
const profilePage = new ProfilePage(page);
const forgotPasswordPage = new ForgotPasswordPage(page);
await page.goto(invite.inviteUrl);
await dashboardPage.isOnboardingNextBtnDisplayed();
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.checkOnboardingWelcomeHeader('Before you start');
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.reloadPage();
await profilePage.logout();
await loginPage.isLoginPageOpened();
await loginPage.clickOnForgotPassword();
await forgotPasswordPage.enterEmail(email);
await forgotPasswordPage.clickRecoverPasswordButton();
await page.waitForTimeout(30000);
const forgotPass = await getRegisterMessage(email);
await checkRecoveryText(forgotPass.inviteText, randomName);
await page.goto(forgotPass.inviteUrl);
await forgotPasswordPage.enterNewPwd(newPwd);
await forgotPasswordPage.enterConfirmPwd(newPwd);
await forgotPasswordPage.clickOnChangePwdButton();
await loginPage.isLoginPageOpened();
await loginPage.enterEmail(email);
await loginPage.enterPwd(newPwd);
await loginPage.clickLoginButton();
await dashboardPage.isDashboardOpenedAfterLogin();
});
});
test.afterEach(async ({ page }, testInfo) => {
await updateTestResults(testInfo.status, testInfo.retry)
});

View File

@ -114,36 +114,6 @@ test.describe(() => {
await dashboardPage.clickOnOnboardingCreateTeamButton();
await teamPage.isTeamSelected(randomName);
});
test(qase(49,'ON-22 Forgot password flow'), async ({ page }) => {
const newPwd = 'TestForgotPassword123';
const dashboardPage = new DashboardPage(page);
const loginPage = new LoginPage(page);
const profilePage = new ProfilePage(page);
await page.goto(invite.inviteUrl);
await dashboardPage.isOnboardingNextBtnDisplayed();
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.checkOnboardingWelcomeHeader('Before you start');
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.reloadPage();
await profilePage.logout();
await loginPage.isLoginPageOpened();
await loginPage.clickOnForgotPasswordButton();
await loginPage.enterEmail(email);
await loginPage.clickOnRecoverySubmitButton();
await page.waitForTimeout(30000);
const forgotPass = await getRegisterMessage(email);
await checkRecoveryText(forgotPass.inviteText, randomName);
await page.goto(forgotPass.inviteUrl);
await loginPage.enterNewPwd(newPwd);
await loginPage.enterConfirmPwd(newPwd);
await loginPage.clickOnChangePwdButton();
await loginPage.isLoginPageOpened();
await loginPage.enterEmail(email);
await loginPage.enterPwd(newPwd);
await loginPage.clickLoginButton();
await dashboardPage.isDashboardOpenedAfterLogin();
});
});
test(qase(36,'ON-9 Create demo account'), async ({ page }) => {