add 1168,190,36,49

This commit is contained in:
chalapkoStanislav 2024-06-04 13:05:25 +03:00
parent f7801a8fb2
commit 05f74cc483
13 changed files with 328 additions and 12 deletions

View File

@ -24,6 +24,7 @@ jobs:
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'
- name: Upload Playwright Report
uses: actions/upload-artifact@v3
@ -54,6 +55,7 @@ jobs:
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=firefox -gv 'PERF'
- name: Upload Playwright Report
uses: actions/upload-artifact@v3
@ -84,6 +86,7 @@ jobs:
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=webkit -gv 'PERF'
- name: Upload Playwright Report
uses: actions/upload-artifact@v3

View File

@ -27,6 +27,7 @@ jobs:
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'
- name: Upload Playwright Report
uses: actions/upload-artifact@v3

View File

@ -50,6 +50,7 @@ jobs:
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/dashboard/dashboard-teams.spec.js
- name: Upload Playwright Report
uses: actions/upload-artifact@v3

View File

@ -50,6 +50,7 @@ jobs:
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/login.spec.js
- name: Upload Playwright Report
uses: actions/upload-artifact@v3

View File

@ -50,6 +50,7 @@ jobs:
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/signup.spec.js
- name: Upload Playwright Report
uses: actions/upload-artifact@v3

View File

@ -37,15 +37,12 @@ async function listMessages(auth, email) {
const inboxMessages = await searchMessages('INBOX', email);
const spamMessages = await searchMessages('SPAM', email);
const messages = [...inboxMessages, ...spamMessages];
let decodedBody = '';
for (const message of messages) {
const msg = await gmail.users.messages.get({
userId: 'me',
id: message.id,
});
decodedBody = Buffer.from(msg.data.payload.parts[0].parts[0].body.data, 'base64').toString('utf-8');
}
return decodedBody;
const msg = await gmail.users.messages.get({
userId: 'me',
id: messages[0].id,
});
return Buffer.from(msg.data.payload.parts[0].parts[0].body.data, 'base64').toString('utf-8');
}
async function getRegisterMessage(email) {
@ -94,5 +91,38 @@ async function checkRegisterText(text, name) {
await expect(text).toBe(messageText);
}
module.exports = {checkInviteText, getRegisterMessage, checkRegisterText};
async function checkRecoveryText(text, name) {
const messageText = `Hello ${name}!\r\n` +
'\r\n' +
'We received a request to reset your password. Click the link below to choose a\r\n' +
'new one:\r\n' +
'\r\n' +
'\r\n' +
'\r\n' +
'If you received this email by mistake, you can safely ignore it. Your password\r\n' +
"won't be changed.\r\n" +
'\r\n' +
'Enjoy!\r\n' +
'The Penpot team.';
await expect(text).toBe(messageText);
}
async function checkNewEmailText(text, name, newEmail) {
const messageText = `Hello ${name}!\r\n` +
'\r\n' +
`We received a request to change your current email to ${newEmail}.\r\n` +
'\r\n' +
'Click to the link below to confirm the change:\r\n' +
'\r\n' +
'\r\n' +
'\r\n' +
'If you received this email by mistake, please consider changing your password\r\n' +
'for security reasons.\r\n' +
'\r\n' +
'Enjoy!\r\n' +
'The Penpot team.';
await expect(text).toBe(messageText);
}
module.exports = {checkInviteText, getRegisterMessage, checkRegisterText, checkRecoveryText, checkNewEmailText};

View File

@ -43,6 +43,8 @@ exports.TeamPage = class TeamPage extends BasePage {
this.teamOwnerSection = page.locator('//div[text()="Team members"]/..');
this.teamStatsSection = page.locator('//div[text()="Team projects"]/..');
this.membersMenuItem = page.locator('li[data-test="team-members"]');
//Invitations
this.invitationsMenuItem = page.locator('li[data-test="team-invitations"]');
this.inviteMembersToTeamButton = page.locator('a[data-test="invite-member"]');
@ -148,6 +150,12 @@ exports.TeamPage = class TeamPage extends BasePage {
}
}
async openMembersPageViaOptionsMenu() {
await this.teamOptionsMenuButton.click();
await this.membersMenuItem.click();
await this.isHeaderDisplayed('Members');
}
async openInvitationsPageViaOptionsMenu() {
await this.teamOptionsMenuButton.click();
await this.invitationsMenuItem.click();
@ -188,6 +196,26 @@ exports.TeamPage = class TeamPage extends BasePage {
await expect(this.invitationRecordStatusCell).toHaveText(status);
}
async isMultipleInvitationRecordDisplayed(email, role, status) {
const emailSelector = `//div[contains(@class, 'dashboard_team__field-email') and contains(text(), '${email}')]`
const emailLocator = await this.page.locator(emailSelector);
const roleLocator = await this.page.locator(`${emailSelector}/following-sibling::div//span`);
const statusLocator = await this.page.locator(`${emailSelector}/following-sibling::div//aside`);
await expect(emailLocator).toHaveText(email);
await expect(roleLocator).toHaveText(role);
await expect(statusLocator).toHaveText(status);
}
async isMultipleMemberRecordDisplayed(name, email, role) {
const nameSelector = `//div[contains(@class, 'team__member-name') and contains(text(), '${name}')]`
const emailLocator = await this.page.locator(`${nameSelector}/following-sibling::div`);
const roleLocator = await this.page.locator(`${nameSelector}/../../following-sibling::div//span`);
const nameLocator = await this.page.locator(nameSelector);
await expect(nameLocator).toContainText(name);
await expect(emailLocator.first()).toHaveText(email);
await expect(roleLocator).toHaveText(role);
}
async selectInvitationRoleInPopUp(role) {
await this.inviteMembersToTeamRoleSelectorButton.click();
switch (role) {

View File

@ -17,6 +17,11 @@ exports.LoginPage = class LoginPage extends BasePage {
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.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) {
@ -70,6 +75,26 @@ exports.LoginPage = class LoginPage extends BasePage {
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 isLoginPageOpened() {
await expect(this.pageTitle).toHaveText('Log into my account');
}

View File

@ -25,6 +25,10 @@ exports.ProfilePage = class ProfilePage extends BasePage {
this.profileAvatarBlock = page.locator(
'div.main_ui_settings_profile__form-container',
);
this.changeEmailBtn = page.locator('div[class="change-email"]');
this.newEmailInput = page.locator('#email-1');
this.confirmNewEmailInput = page.locator('#email-2');
this.confirmChangeEmailBtn = page.locator('div[data-test="change-email-submit"] button');
//Feedback
this.feedbackSubjectInput = page.locator('#subject');
@ -104,6 +108,15 @@ exports.ProfilePage = class ProfilePage extends BasePage {
await this.saveSettingsButton.click();
}
async changeEmail(newEmail) {
await this.profileMenuButton.click();
await this.yourAccountMenuItem.click();
await this.changeEmailBtn.click();
await this.newEmailInput.fill(newEmail);
await this.confirmNewEmailInput.fill(newEmail);
await this.confirmChangeEmailBtn.click();
}
async enterSubjectToGiveFeedbackForm(text) {
await this.feedbackSubjectInput.fill(text);
}

View File

@ -19,6 +19,7 @@ exports.RegisterPage = class RegisterPage extends BasePage {
this.fullnameInput = page.locator('input[id="fullname"]');
this.acceptTermsCheckbox = page.locator('label[for="accept-terms-and-privacy"] span');
this.regEmailNotification = page.locator('div[class*="notification-text-email"]');
this.createDemoAccountBtn = page.locator('div[class*="auth_register__demo-account"]');
}
async isRegisterPageOpened() {
@ -82,4 +83,8 @@ exports.RegisterPage = class RegisterPage extends BasePage {
await expect(this.regEmailNotification).toBeVisible();
await expect(this.regEmailNotification).toHaveText(email);
}
async clickOnCreateDemoAccountBtn() {
await this.createDemoAccountBtn.click();
}
};

View File

@ -9,6 +9,7 @@ const { updateTestResults } = require('./../../helpers/saveTestResults.js');
const { qase } = require('playwright-qase-reporter/dist/playwright');
const { getRegisterMessage, checkInviteText } = require('../../helpers/gmail');
const { LoginPage } = require('../../pages/login-page');
const { RegisterPage } = require('../../pages/register-page');
test.describe(() => {
@ -472,6 +473,110 @@ test.describe(() => {
});
});
test.describe(() => {
const team = random().concat('autotest');
const firstEditor = random().concat('autotest');
const secondEditor = random().concat('autotest');
mainTest(
qase(1168,'DA-82 Team. Invitations - invite via owner (multiple invitations, editor)'),
async ({ page }) => {
const firstEmail = `${process.env.GMAIL_NAME}+${firstEditor}@gmail.com`;
const secondEmail = `${process.env.GMAIL_NAME}+${secondEditor}@gmail.com`;
const profilePage = new ProfilePage(page);
const dashboardPage = new DashboardPage(page);
const loginPage = new LoginPage(page);
const teamPage = new TeamPage(page);
const registerPage = new RegisterPage(page);
await teamPage.createTeam(team);
await teamPage.isTeamSelected(team);
await teamPage.openInvitationsPageViaOptionsMenu();
await teamPage.clickInviteMembersToTeamButton();
await teamPage.isInviteMembersPopUpHeaderDisplayed(
'Invite members to the team',
);
await teamPage.enterEmailToInviteMembersPopUp(`${firstEmail}, ${secondEmail}`);
await teamPage.clickSendInvitationButton();
await teamPage.isSuccessMessageDisplayed('Invitation sent successfully');
await teamPage.isMultipleInvitationRecordDisplayed(
firstEmail,
'Editor',
'Pending',
);
await teamPage.isMultipleInvitationRecordDisplayed(
secondEmail,
'Editor',
'Pending'
);
await page.waitForTimeout(30000);
const firstInvite = await getRegisterMessage(firstEmail);
const secondInvite = await getRegisterMessage(secondEmail);
await checkInviteText(firstInvite.inviteText, team);
await checkInviteText(secondInvite.inviteText, team);
await profilePage.logout();
await loginPage.isLoginPageOpened();
await page.goto(firstInvite.inviteUrl);
await registerPage.isRegisterPageOpened();
await registerPage.enterEmail(firstEmail);
await registerPage.enterPassword(process.env.LOGIN_PWD);
await registerPage.clickOnCreateAccountBtn();
await registerPage.enterFullName(firstEditor);
await registerPage.clickOnAcceptTermsCheckbox();
await registerPage.clickOnCreateAccountSecondBtn();
await dashboardPage.isOnboardingNextBtnDisplayed();
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.checkOnboardingWelcomeHeader('Before you start');
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.reloadPage();
await teamPage.isTeamSelected(team);
await profilePage.logout();
await loginPage.isLoginPageOpened();
await page.goto(secondInvite.inviteUrl);
await registerPage.isRegisterPageOpened();
await registerPage.enterEmail(secondEmail);
await registerPage.enterPassword(process.env.LOGIN_PWD);
await registerPage.clickOnCreateAccountBtn();
await registerPage.enterFullName(secondEditor);
await registerPage.clickOnAcceptTermsCheckbox();
await registerPage.clickOnCreateAccountSecondBtn();
await dashboardPage.isOnboardingNextBtnDisplayed();
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.checkOnboardingWelcomeHeader('Before you start');
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.reloadPage();
await teamPage.isTeamSelected(team);
await teamPage.openMembersPageViaOptionsMenu();
await teamPage.isMultipleMemberRecordDisplayed(
firstEditor,
firstEmail,
'Editor'
);
await teamPage.isMultipleMemberRecordDisplayed(
secondEditor,
secondEmail,
'Editor'
);
},
);
test.afterEach(async ({ page }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
const loginPage = new LoginPage(page);
const profilePage = new ProfilePage(page);
await profilePage.logout();
await loginPage.isLoginPageOpened();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
await dashboardPage.isDashboardOpenedAfterLogin();
await teamPage.switchTeam(team);
await teamPage.deleteTeam(team);
});
});
test.afterEach(async ({ page }, testInfo) => {
await updateTestResults(testInfo.status, testInfo.retry)
});

View File

@ -5,6 +5,10 @@ const { LoginPage } = require('../pages/login-page');
const { expect, test } = require('@playwright/test');
const { updateTestResults } = require('./../helpers/saveTestResults.js');
const { qase } = require('playwright-qase-reporter/dist/playwright');
const { RegisterPage } = require('../pages/register-page');
const { getRegisterMessage, checkNewEmailText } = require('../helpers/gmail');
const { DashboardPage } = require('../pages/dashboard/dashboard-page');
const { TeamPage } = require('../pages/dashboard/team-page');
mainTest(qase(187,'PR-1 Edit profile name'), async ({ page }) => {
const newName = random();
@ -103,6 +107,58 @@ mainTest(qase(208,'PR-22 Send feedback email with valid data'), async ({ page })
await profilePage.isSuccessMessageDisplayed('Feedback sent');
});
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);
console.log(invite.inviteUrl);
});
test(qase(190,'PR-4 Change email to valid'), async ({ page }) => {
const newEmail = `${process.env.GMAIL_NAME}+${random().concat('autotest')}@gmail.com`;
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.changeEmail(newEmail);
await page.waitForTimeout(30000);
const changeEmail = await getRegisterMessage(email);
console.log(changeEmail.inviteUrl);
await checkNewEmailText(changeEmail.inviteText, randomName, newEmail);
await page.goto(changeEmail.inviteUrl);
await profilePage.logout();
await loginPage.isLoginPageOpened();
await loginPage.enterEmail(newEmail);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
await dashboardPage.isDashboardOpenedAfterLogin();
});
});
test.afterEach(async ({ page }, testInfo) => {
await updateTestResults(testInfo.status, testInfo.retry)
});

View File

@ -4,9 +4,10 @@ const { RegisterPage } = require('../pages/register-page');
const { updateTestResults } = require('./../helpers/saveTestResults.js');
const { qase } = require('playwright-qase-reporter/dist/playwright');
const { random } = require('../helpers/string-generator');
const { getRegisterMessage, checkRegisterText } = require('../helpers/gmail');
const { getRegisterMessage, checkRegisterText, checkRecoveryText } = require('../helpers/gmail');
const { DashboardPage } = require('../pages/dashboard/dashboard-page');
const { TeamPage } = require('../pages/dashboard/team-page');
const { ProfilePage } = require('../pages/profile-page');
test(qase(32,'ON-5 Sign up with invalid email address'), async ({ page }) => {
const loginPage = new LoginPage(page);
@ -82,7 +83,7 @@ test.describe(() => {
await dashboardPage.isOnboardingNextBtnDisplayed();
});
test.only(qase([43,44],'ON-16,17 Onboarding questions flow'), async ({ page }) => {
test(qase([43,44],'ON-16,17 Onboarding questions flow'), async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const teamPage = new TeamPage(page);
await page.goto(invite.inviteUrl);
@ -114,6 +115,52 @@ test.describe(() => {
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 }) => {
const loginPage = new LoginPage(page);
const registerPage = new RegisterPage(page);
const dashboardPage = new DashboardPage(page);
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.clickOnCreateAccount();
await registerPage.isRegisterPageOpened();
await registerPage.clickOnCreateDemoAccountBtn();
await dashboardPage.isOnboardingNextBtnDisplayed();
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.checkOnboardingWelcomeHeader('Before you start');
await dashboardPage.clickOnOnboardingNextBtn();
await dashboardPage.reloadPage();
await dashboardPage.isHeaderDisplayed('Projects');
});
test.afterEach(async ({ page }, testInfo) => {