Skip to content

Commit

Permalink
set up tests for run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
KateMaruk committed Nov 26, 2023
1 parent 09e522c commit 1a0ce17
Show file tree
Hide file tree
Showing 32 changed files with 49 additions and 61 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"main": "index.js",
"scripts": {
"test": "npx playwright test --project=chrome -gv 'PERF'",
"file": "npx playwright test -g \"AS-27 File library colors - create group\" --project=chrome",
"spec": "npx playwright test tests/assets/assets-colors.spec.js --project=chrome",
"firefox": "npx playwright test --project=firefox -gv 'PERF'",
"webkit": "npx playwright test --project=webkit -gv 'PERF'",
"performance": "npx playwright test --retries=1 --project=chrome -g 'PERF'",
Expand Down
16 changes: 16 additions & 0 deletions pages/dashboard/team-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ exports.TeamPage = class TeamPage extends BasePage {
}
}

async deleteTeamsIfExist() {
await this.openTeamsListIfClosed();
for (const teamName of await this.teamListItem.allInnerTexts()) {
if (!teamName.includes("Your Penpot")) {
const teamSel = this.page.locator(`li.team-name span.team-text:text-is("${teamName}")`).last();
await teamSel.click();
await this.teamOptionsMenuButton.waitFor();
await this.teamOptionsMenuButton.click();
await this.deleteTeamMenuItem.click();
await this.deleteTeamButton.click();
await expect(this.teamCurrentBtn).toHaveText("Your Penpot");
await this.openTeamsListIfClosed();
}
}
}

async isTeamDeleted(teamName) {
await this.openTeamsListIfClosed();
for (const el of await this.teamCurrentNameDiv.elementHandles()) {
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const config = {
snapshotPathTemplate: `{testDir}/{testFileDir}/{testFileName}-snapshots/{projectName}/{arg}{ext}`,
testDir: "./tests",
/* Maximum time one test can run for. */
timeout: process.env.CI ? 60 * 1000 : 50 * 1000,
timeout: process.env.CI ? 60 * 1000 : 555550 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
Expand Down
3 changes: 1 addition & 2 deletions tests/assets/assets-colors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/assets/assets-components.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/assets/assets-graphics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/assets/assets-shared-libraries.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ test.beforeEach( async ({ page }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
});

Expand Down
3 changes: 1 addition & 2 deletions tests/assets/assets-shortcuts-panel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/assets/assets-typographies.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/color/color-picker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-board.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-comments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-curve.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-ellipse.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
5 changes: 2 additions & 3 deletions tests/composition/composition-flex-layout.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand All @@ -28,7 +27,7 @@ test.afterEach(async ({ page }) => {
});

test.describe("Flex Layout & Elements", async () => {
test.beforeEach(async ({ page, browserName}, testInfo) => {
test.beforeEach(async ({ page, browserName }, testInfo) => {
testInfo.setTimeout(testInfo.timeout + 10000);
const mainPage = new MainPage(page);
await mainPage.clickCreateBoardButton();
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-path-node-panel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-rectangle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/composition/composition-text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName)
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/dashboard/dashboard-files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ test.beforeEach( async ({ page }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
});

test.afterEach(async ({ page }) => {
Expand Down
3 changes: 1 addition & 2 deletions tests/dashboard/dashboard-fonts.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ test.beforeEach( async ({ page }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
});

test.afterEach(async ({ page }) => {
Expand Down
1 change: 1 addition & 0 deletions tests/dashboard/dashboard-libraries.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test.beforeEach( async ({ page }) => {
const teamPage = new TeamPage(page);
const dashboardPage = new DashboardPage(page);
await teamPage.createTeam(teamName);
await teamPage.isTeamSelected(teamName);
await dashboardPage.minimizeLibrariesAndTemplatesCarousel();
});

Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-export.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-fill.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-grid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-history-panel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-main-menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-prototype.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions tests/panels-features/panels-features-zoom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ test.beforeEach( async ({ page }) => {
const dashboardPage = new DashboardPage(page);
const mainPage = new MainPage(page);
await teamPage.createTeam(teamName);
await dashboardPage.deleteProjectsIfExist();
await dashboardPage.deleteFilesIfExist();
await teamPage.isTeamSelected(teamName);
await dashboardPage.createFileViaPlaceholder();
await mainPage.isMainPageLoaded();
});
Expand Down
6 changes: 3 additions & 3 deletions tests/signup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { test } = require("@playwright/test");
const { LoginPage } = require("../pages/login-page")
const { RegisterPage } = require("../pages/register-page")

test("ON-5 Sign up with invalid email address",async ({page}) => {
test("ON-5 Sign up with invalid email address", async ({ page }) => {
const loginPage = new LoginPage(page);
const registerPage = new RegisterPage(page);
await loginPage.goto();
Expand All @@ -15,7 +15,7 @@ test("ON-5 Sign up with invalid email address",async ({page}) => {
await registerPage.isCreateAccountBtnDisabled();
});

test("ON-6 Sign up with no password", async ({page}) => {
test("ON-6 Sign up with no password", async ({ page }) => {
const loginPage = new LoginPage(page);
const registerPage = new RegisterPage(page);
await loginPage.goto();
Expand All @@ -29,7 +29,7 @@ test("ON-6 Sign up with no password", async ({page}) => {
await registerPage.isCreateAccountBtnDisabled();
});

test("ON-7 Sign up with incorrect password", async ({page}) => {
test("ON-7 Sign up with incorrect password", async ({ page }) => {
const loginPage = new LoginPage(page);
const registerPage = new RegisterPage(page);
await loginPage.goto();
Expand Down

0 comments on commit 1a0ce17

Please sign in to comment.