Skip to content

Commit

Permalink
fix(test): dashboard-teams tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chalapkoStanislav committed Nov 12, 2024
1 parent 32e9de3 commit 6f9ab37
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
9 changes: 7 additions & 2 deletions pages/dashboard/dashboard-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ exports.DashboardPage = class DashboardPage extends BasePage {
}

async fillOnboardingQuestions() {
await expect(this.onboardingFirstHeader).toHaveText('Help us get to know you');
await this.isOnboardingFirstQuestionsVisible();
await this.selectRadioButton('Work');
await this.selectDropdownOptions('Testing before self-hosting');
await this.clickOnNextButton();
Expand All @@ -788,15 +788,20 @@ exports.DashboardPage = class DashboardPage extends BasePage {
await this.selectGetStartedQuestion('Prototyping');
await this.clickOnNextButton();
await this.selectRadioButton('YouTube');
await this.page.waitForTimeout(1000);
await this.clickOnStartButton();
await this.page.waitForTimeout(1000);
await this.clickOnOnboardingContinueBtn();
await this.page.waitForTimeout(1000);
await this.clickOnOnboardingContinueWithoutTeamButton();
await this.page.waitForTimeout(3000);
await this.skipWhatNewsPopUp();
await this.page.waitForTimeout(3000);
await this.skipPluginsPopUp();
}

async fillOnboardingFirstQuestions() {
await expect(this.onboardingFirstHeader).toHaveText('Help us get to know you');
await this.isOnboardingFirstQuestionsVisible();
await this.selectRadioButton('Work');
await this.selectDropdownOptions('Testing before self-hosting');
await this.clickOnNextButton();
Expand Down
4 changes: 4 additions & 0 deletions pages/login-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ exports.LoginPage = class LoginPage extends BasePage {
async isLoginPageOpened() {
await expect(this.pageTitle).toHaveText('Log into my account');
}

async waitLoginPage(timeout = 30) {
await this.emailInput.waitFor({state: 'visible', timeout: timeout*1000});
}
};
4 changes: 2 additions & 2 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const config = {
baseURL: process.env.BASE_URL,
headless: true,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
video: 'on-first-retry',
trace: 'on',
video: 'on',
},
projects: [
{
Expand Down
40 changes: 20 additions & 20 deletions tests/dashboard/dashboard-teams.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1854,8 +1854,8 @@ mainTest.describe(() => {
await mainPage.clickPencilBoxButton();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -1868,8 +1868,8 @@ mainTest.describe(() => {

await teamPage.clickGoToPenpotButton();
await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand Down Expand Up @@ -1904,8 +1904,8 @@ mainTest.describe(() => {

await mainPage.clickPencilBoxButton();
await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -1918,8 +1918,8 @@ mainTest.describe(() => {

await teamPage.clickGoToPenpotButton();
await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand Down Expand Up @@ -1947,8 +1947,8 @@ mainTest.describe(() => {
const badURL = await mainPage.makeBadDashboardUrl(currentURL);

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -1961,8 +1961,8 @@ mainTest.describe(() => {

await teamPage.clickGoToPenpotButton();
await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.LOGIN_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand Down Expand Up @@ -2029,8 +2029,8 @@ test.describe(() => {
await mainPage.clickPencilBoxButton();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2049,8 +2049,8 @@ test.describe(() => {
await dashboardPage.isDashboardOpenedAfterLogin();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(email);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2059,7 +2059,7 @@ test.describe(() => {
const requestMessage = await waitRequestMessage(page, email, 40);
await checkConfirmAccessText(
requestMessage.inviteText,
'9z0700h',
'QA Engineer',
process.env.SECOND_EMAIL,
team,
);
Expand All @@ -2086,8 +2086,8 @@ test.describe(() => {
const currentURL = await mainPage.getUrl();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2106,8 +2106,8 @@ test.describe(() => {
await dashboardPage.isDashboardOpenedAfterLogin();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(email);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2117,7 +2117,7 @@ test.describe(() => {

await checkDashboardConfirmAccessText(
requestMessage.inviteText,
'9z0700h',
'QA Engineer',
process.env.SECOND_EMAIL,
team,
);
Expand All @@ -2136,8 +2136,8 @@ test.describe(() => {
await mainPage.clickPencilBoxButton();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2156,8 +2156,8 @@ test.describe(() => {
await dashboardPage.isDashboardOpenedAfterLogin();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(email);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2166,7 +2166,7 @@ test.describe(() => {
const requestMessage = await waitRequestMessage(page, email, 40);
await checkYourPenpotConfirmAccessText(
requestMessage.inviteText,
'9z0700h',
'QA Engineer',
process.env.SECOND_EMAIL,
team,
);
Expand All @@ -2190,8 +2190,8 @@ test.describe(() => {
await mainPage.clickPencilBoxButton();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(process.env.SECOND_EMAIL);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2210,8 +2210,8 @@ test.describe(() => {
await dashboardPage.isDashboardOpenedAfterLogin();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(email);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand All @@ -2220,7 +2220,7 @@ test.describe(() => {
const requestMessage = await waitRequestMessage(page, email, 40);
await checkYourPenpotViewModeConfirmAccessText(
requestMessage.inviteText,
'9z0700h',
'QA Engineer',
process.env.SECOND_EMAIL,
team,
);
Expand All @@ -2239,8 +2239,8 @@ test.describe(() => {
await mainPage.clickPencilBoxButton();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.acceptCookie();
await loginPage.clickOnCreateAccount();
await registerPage.isRegisterPageOpened();
Expand Down Expand Up @@ -2270,8 +2270,8 @@ test.describe(() => {
await dashboardPage.isDashboardOpenedAfterLogin();

await profilePage.logout();
await loginPage.waitLoginPage();
await loginPage.isLoginPageOpened();
await loginPage.goto();
await loginPage.enterEmail(email);
await loginPage.enterPwd(process.env.LOGIN_PWD);
await loginPage.clickLoginButton();
Expand Down

0 comments on commit 6f9ab37

Please sign in to comment.