diff --git a/fixtures.js b/fixtures.js index 4d863da..f233f3e 100644 --- a/fixtures.js +++ b/fixtures.js @@ -1,23 +1,17 @@ const base = require("@playwright/test"); const { LoginPage } = require("./pages/login-page.js"); -const { DashboardPage } = require("./pages/dashboard-page.js"); -const { MainPage } = require("./pages/main-page"); +const { DashboardPage } = require("./pages/dashboard/dashboard-page.js"); const mainTest = base.test.extend({ page: async ({ page }, use) => { const loginPage = new LoginPage(page); + const dashboardPage = new DashboardPage(page); await loginPage.goto(); await loginPage.enterEmail(process.env.LOGIN_EMAIL); await loginPage.enterPwd(process.env.LOGIN_PWD); await loginPage.clickLoginButton(); - const dashboardPage = new DashboardPage(page); await dashboardPage.isDashboardOpenedAfterLogin(); await dashboardPage.isHeaderDisplayed("Projects"); - await dashboardPage.deleteProjectsIfExist(); - await dashboardPage.deleteFilesIfExist(); - await dashboardPage.createFileViaPlaceholder(); - const mainPage = new MainPage(page); - await mainPage.isMainPageLoaded(); await use(page); }, }); @@ -32,8 +26,6 @@ const dashboardTest = base.test.extend({ const dashboardPage = new DashboardPage(page); await dashboardPage.isDashboardOpenedAfterLogin(); await dashboardPage.isHeaderDisplayed("Projects"); - await dashboardPage.deleteProjectsIfExist(); - await dashboardPage.deleteFilesIfExist(); await use(page); }, }); diff --git a/helpers/string-generator.js b/helpers/string-generator.js index f09e8d7..1046c37 100644 --- a/helpers/string-generator.js +++ b/helpers/string-generator.js @@ -1,5 +1,5 @@ export const random = () => { - return Math.random().toString(36).substring(2, 7); + return Math.random().toString(36).substring(2, 9); }; export function getPlatformName() { diff --git a/package-lock.json b/package-lock.json index b28d1c9..7689674 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,17 +12,17 @@ "prettier": "^3.0.1" }, "devDependencies": { - "@playwright/test": "^1.39.0", + "@playwright/test": "^1.40.0", "dotenv": "^16.3.1" } }, "node_modules/@playwright/test": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz", - "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.0.tgz", + "integrity": "sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==", "dev": true, "dependencies": { - "playwright": "1.39.0" + "playwright": "1.40.0" }, "bin": { "playwright": "cli.js" @@ -58,12 +58,12 @@ } }, "node_modules/playwright": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz", - "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.0.tgz", + "integrity": "sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==", "dev": true, "dependencies": { - "playwright-core": "1.39.0" + "playwright-core": "1.40.0" }, "bin": { "playwright": "cli.js" @@ -76,9 +76,9 @@ } }, "node_modules/playwright-core": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz", - "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.0.tgz", + "integrity": "sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q==", "dev": true, "bin": { "playwright-core": "cli.js" @@ -104,12 +104,12 @@ }, "dependencies": { "@playwright/test": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz", - "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.0.tgz", + "integrity": "sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==", "dev": true, "requires": { - "playwright": "1.39.0" + "playwright": "1.40.0" } }, "dotenv": { @@ -126,19 +126,19 @@ "optional": true }, "playwright": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz", - "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.0.tgz", + "integrity": "sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==", "dev": true, "requires": { "fsevents": "2.3.2", - "playwright-core": "1.39.0" + "playwright-core": "1.40.0" } }, "playwright-core": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz", - "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==", + "version": "1.40.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.0.tgz", + "integrity": "sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q==", "dev": true }, "prettier": { diff --git a/package.json b/package.json index f07957d..f527681 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/penpot/penpotqa#readme", "devDependencies": { - "@playwright/test": "^1.39.0", + "@playwright/test": "^1.40.0", "dotenv": "^16.3.1" }, "dependencies": { diff --git a/pages/base-page.js b/pages/base-page.js index 05fe1ed..acd8558 100644 --- a/pages/base-page.js +++ b/pages/base-page.js @@ -1,5 +1,6 @@ const { expect } = require("@playwright/test"); const { getPlatformName } = require("../helpers/string-generator"); + exports.BasePage = class BasePage { /** * @param {import('@playwright/test').Page} page diff --git a/pages/dashboard-page.js b/pages/dashboard/dashboard-page.js similarity index 94% rename from pages/dashboard-page.js rename to pages/dashboard/dashboard-page.js index 3c14086..928e299 100644 --- a/pages/dashboard-page.js +++ b/pages/dashboard/dashboard-page.js @@ -1,5 +1,5 @@ const { expect } = require("@playwright/test"); -const { BasePage } = require("./base-page"); +const { BasePage } = require("../base-page"); exports.DashboardPage = class DashboardPage extends BasePage { /** @@ -92,8 +92,6 @@ exports.DashboardPage = class DashboardPage extends BasePage { // Import files this.fileImport = page.locator('[data-test="file-import"]'); - this.modal = page.locator('#modal'); - this.modalCloseButton = page.locator('.modal-close-button'); this.modalTitle = page.locator('.modal-header-title h2'); this.modalCancelButton = page.locator('.modal-footer .action-buttons .cancel-button'); this.modalAcceptButton = page.locator('.modal-footer .action-buttons .accept-button'); @@ -132,7 +130,7 @@ exports.DashboardPage = class DashboardPage extends BasePage { 'div.dashboard-templates-section div.title button' ); this.librariesAndTemplatesSection = page.locator( - 'div[class^="dashboard-templates-section"]' + 'div[class="dashboard-templates-section "]' ); this.librariesAndTemplatesSectionCollapsed = page.locator( 'div[class="dashboard-templates-section collapsed"]' @@ -221,7 +219,7 @@ exports.DashboardPage = class DashboardPage extends BasePage { async isDashboardOpenedAfterLogin() { await this.page.waitForURL(/.*dashboard\/team/, { waitUntil: "load" }); - await this.page.waitForResponse(/push-audit-events/); + // await this.page.waitForResponse(/push-audit-events/); } async checkNumberOfFiles(numberOfFiles) { @@ -475,19 +473,6 @@ exports.DashboardPage = class DashboardPage extends BasePage { await this.deleteFontButton.click(); } - async deleteFonts() { - for (const el of await this.fontOptionsMenuButton.elementHandles()) { - await el.click(); - await this.deleteFontMenuItem.click(); - await this.deleteFontButton.click(); - } - } - - async deleteFontsIfExist() { - const fontRecords = await this.page.$$('div[class="font-item table-row"]'); - if (fontRecords) await this.deleteFonts(); - } - async isFontsTablePlaceholderDisplayed(text) { await expect(this.fontsTablePlaceholder).toHaveText(text); } @@ -515,23 +500,39 @@ exports.DashboardPage = class DashboardPage extends BasePage { await expect(this.librariesAndTemplatesSection).toBeVisible(); } - async isLibrariesAndTemplatesSectionNotDisplayed() { + async isLibrariesAndTemplatesSectionHidden() { await expect(this.librariesAndTemplatesSectionCollapsed).toBeVisible(); } - async minimizeLibrariesAndTemplatesCarouselIfExpanded() { - if (await this.librariesAndTemplatesSection.isVisible()) { - await this.clickLibrariesAndTemplatesCarouselButton(); + async isLibrariesAndTemplatesCarouselVisible() { + try { + await this.librariesAndTemplatesSection.waitFor({ state: 'visible', timeout: 3000 }); + return true; + } catch(error) { + return false; } } - async flipRightLibrariesAndTemplatesCarousel() { - await this.librariesAndTemplatesSectionRightArrowButton.click(); - await this.header.hover(); + async minimizeLibrariesAndTemplatesCarousel() { + if (await this.isLibrariesAndTemplatesCarouselVisible) { + await this.clickLibrariesAndTemplatesCarouselButton(); + } + await this.isLibrariesAndTemplatesSectionHidden(); } - async flipLeftLibrariesAndTemplatesCarousel() { - await this.librariesAndTemplatesSectionLeftArrowButton.click(); + async maximizeLibrariesAndTemplatesCarousel() { + if (!await this.isLibrariesAndTemplatesCarouselVisible()) { + await this.clickLibrariesAndTemplatesCarouselButton(); + } + await this.isLibrariesAndTemplatesSectionDisplayed(); + } + + async flipLibrariesAndTemplatesCarousel(direction, times=1) { + if (direction === 'left') { + await this.librariesAndTemplatesSectionLeftArrowButton.click({ clickCount: times }); + } else { + await this.librariesAndTemplatesSectionRightArrowButton.click({ clickCount: times }); + } await this.header.hover(); } diff --git a/pages/team-page.js b/pages/dashboard/team-page.js similarity index 96% rename from pages/team-page.js rename to pages/dashboard/team-page.js index ec6c181..9a859d1 100644 --- a/pages/team-page.js +++ b/pages/dashboard/team-page.js @@ -1,4 +1,4 @@ -const { BasePage } = require("./base-page"); +const { BasePage } = require("../base-page"); const { expect } = require("@playwright/test"); exports.TeamPage = class TeamPage extends BasePage { @@ -115,13 +115,13 @@ exports.TeamPage = class TeamPage extends BasePage { } } - async deleteTeamsIfExist() { + async deleteTeams(teams) { 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(); + for (const team of teams) { + const teamSel = this.page.locator(`li.team-name span:text-is("${team}")`); + if (await teamSel.isVisible()) { await teamSel.click(); - await this.teamOptionsMenuButton.waitFor(); + await this.isTeamSelected(team); await this.teamOptionsMenuButton.click(); await this.deleteTeamMenuItem.click(); await this.deleteTeamButton.click(); diff --git a/pages/color-palette-popup.js b/pages/workspace/color-palette-popup.js similarity index 98% rename from pages/color-palette-popup.js rename to pages/workspace/color-palette-popup.js index 5c83e11..8d6e4e4 100644 --- a/pages/color-palette-popup.js +++ b/pages/workspace/color-palette-popup.js @@ -1,10 +1,10 @@ -const { BasePage } = require("./base-page"); +const { BasePage } = require("../base-page"); const { expect } = require("@playwright/test"); + exports.ColorPalettePopUp = class ColorPalettePopUp extends BasePage { /** * @param {import('@playwright/test').Page} page */ - constructor(page) { super(page); this.popUp = page.locator('.colorpicker-tooltip'); diff --git a/pages/workspace/design-panel.js b/pages/workspace/design-panel.js index 7ca4120..10f3290 100644 --- a/pages/workspace/design-panel.js +++ b/pages/workspace/design-panel.js @@ -1,7 +1,7 @@ const { expect } = require("@playwright/test"); const { BasePage } = require("../base-page"); -exports.DesignPanelPage = class DesignPanelPage extends BasePage { +exports.DesignPanelPage = class DesignPanelPage extends BasePage { /** * @param {import('@playwright/test').Page} page */ diff --git a/pages/workspace/layers.js b/pages/workspace/layers-panel.js similarity index 91% rename from pages/workspace/layers.js rename to pages/workspace/layers-panel.js index 192d74e..5239c85 100644 --- a/pages/workspace/layers.js +++ b/pages/workspace/layers-panel.js @@ -1,8 +1,7 @@ -const {expect} = require("@playwright/test"); +const { expect } = require("@playwright/test"); const { BasePage } = require("../base-page"); -exports.LayersPage = class LayersPage extends BasePage { - +exports.LayersPanelPage = class LayersPanelPage extends BasePage { /** * @param {import('@playwright/test').Page} page */ @@ -36,4 +35,4 @@ exports.LayersPage = class LayersPage extends BasePage { await this.layerBoardChildEllipse.click(); } -} \ No newline at end of file +} diff --git a/pages/main-page.js b/pages/workspace/main-page.js similarity index 99% rename from pages/main-page.js rename to pages/workspace/main-page.js index b12c276..d0a1fe1 100644 --- a/pages/main-page.js +++ b/pages/workspace/main-page.js @@ -1,5 +1,5 @@ const { expect } = require("@playwright/test"); -const { BasePage } = require("./base-page"); +const { BasePage } = require("../base-page"); exports.MainPage = class MainPage extends BasePage { /** @@ -576,12 +576,8 @@ exports.MainPage = class MainPage extends BasePage { this.removeSharedLibraryButton = page.locator('input[value="Remove"]'); this.publishSharedLibraryButton = page.locator('input[value="Publish"]'); this.unPublishSharedLibraryButton = page.locator('input[value="Unpublish"]'); - this.closeLibrariesPopUpButton = page.locator( - 'div[class="modal libraries-dialog"] svg[class="icon-close"]' - ); - this.addAsSharedLibraryButton = page.locator( - 'input[value="Add as Shared Library"]' - ); + this.closeLibrariesPopUpButton = page.locator('div.libraries-dialog a.close'); + this.addAsSharedLibraryButton = page.locator('input[value="Add as Shared Library"]'); this.removeAsSharedLibraryButton = page.locator('input[value="Unpublish"]'); this.sharedLibraryBadge = page.locator('span:has-text("SHARED")'); this.searchLibraryInput = page.locator('div.libraries-search input.search-input'); diff --git a/playwright.config.js b/playwright.config.js index 7bc6433..2dd373c 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -27,7 +27,7 @@ const config = { /* Retry on CI only */ retries: process.env.CI ? 2 : 2, /* Opt out of parallel tests on CI. */ - workers: 1, + workers: process.env.CI ? 2 : 2, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: "html", /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ diff --git a/tests/assets/assets-colors.spec.js b/tests/assets/assets-colors.spec.js index 2ca967a..7862dbe 100644 --- a/tests/assets/assets-colors.spec.js +++ b/tests/assets/assets-colors.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test} = require("@playwright/test"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("AS-22 Filter Colors from All Assets drop-down", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/assets/assets-components.spec.js b/tests/assets/assets-components.spec.js index 4f5734a..05a9e5e 100644 --- a/tests/assets/assets-components.spec.js +++ b/tests/assets/assets-components.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test} = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest( "AS-56 Filter Components from All Assets drop-down", diff --git a/tests/assets/assets-graphics.spec.js b/tests/assets/assets-graphics.spec.js index 877ed01..bdf7d4b 100644 --- a/tests/assets/assets-graphics.spec.js +++ b/tests/assets/assets-graphics.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest( "AS-1 Switch from Layers to Assets via clicking tab and ALT I ALT L shortcuts)", diff --git a/tests/assets/assets-shared-libraries.spec.js b/tests/assets/assets-shared-libraries.spec.js index b0b0dad..ff68296 100644 --- a/tests/assets/assets-shared-libraries.spec.js +++ b/tests/assets/assets-shared-libraries.spec.js @@ -1,25 +1,48 @@ const { mainTest } = require("../../fixtures"); const { expect, test } = require("@playwright/test"); -const { DashboardPage } = require("../../pages/dashboard-page"); -const { MainPage } = require("../../pages/main-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); -test.describe(() => { +const teamName = random().concat('autotest'); + +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 dashboardPage.createFileViaPlaceholder(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + await teamPage.deleteTeam(teamName); +}); + +test.describe('Tests with importing Penpot Libraries', () => { test.beforeEach(async ({ page }) => { - const mainPage = new MainPage(page); const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); await mainPage.backToDashboardFromFileEditor(); - await dashboardPage.clickLibrariesAndTemplatesCarouselButton(); - await dashboardPage.isLibrariesAndTemplatesSectionDisplayed(); - await dashboardPage.flipRightLibrariesAndTemplatesCarousel(); + await dashboardPage.maximizeLibrariesAndTemplatesCarousel(); + await dashboardPage.flipLibrariesAndTemplatesCarousel('right'); await dashboardPage.importSharedLibrary("Whiteboarding Kit"); - await dashboardPage.minimizeLibrariesAndTemplatesCarouselIfExpanded(); + await dashboardPage.minimizeLibrariesAndTemplatesCarousel(); await dashboardPage.reloadPage(); - await dashboardPage.openSecondFile("New File 1"); - await mainPage.isMainPageLoaded(); + }); + + test.afterEach(async ({ page }) => { + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); }); mainTest("AS-92 Import shared library from LIBRARIES pop-up",async ({ page }) => { const mainPage = new MainPage(page); + const dashboardPage = new DashboardPage(page); + await dashboardPage.openSecondFile("New File 1"); + await mainPage.isMainPageLoaded(); await mainPage.clickAssetsTab(); await mainPage.clickLibrariesTab(); await mainPage.clickAddSharedLibraryButton(); @@ -30,6 +53,9 @@ test.describe(() => { mainTest("AS-93 Remove shared library from LIBRARIES pop-up",async ({ page }) => { const mainPage = new MainPage(page); + const dashboardPage = new DashboardPage(page); + await dashboardPage.openSecondFile("New File 1"); + await mainPage.isMainPageLoaded(); await mainPage.clickAssetsTab(); await mainPage.clickLibrariesTab(); await mainPage.clickAddSharedLibraryButton(); @@ -48,12 +74,10 @@ test.describe(() => { const library2 = "CircumIcons"; const mainPage = new MainPage(page); const dashboardPage = new DashboardPage(page); - await mainPage.backToDashboardFromFileEditor(); - await dashboardPage.clickLibrariesAndTemplatesCarouselButton(); - await dashboardPage.isLibrariesAndTemplatesSectionDisplayed(); - await dashboardPage.flipRightLibrariesAndTemplatesCarousel(); + await dashboardPage.maximizeLibrariesAndTemplatesCarousel(); + await dashboardPage.flipLibrariesAndTemplatesCarousel('right'); await dashboardPage.importSharedLibrary("Circum Icons pack"); - await dashboardPage.minimizeLibrariesAndTemplatesCarouselIfExpanded(); + await dashboardPage.minimizeLibrariesAndTemplatesCarousel(); await dashboardPage.reloadPage(); await dashboardPage.openSecondFile("New File 1"); await mainPage.isMainPageLoaded(); @@ -72,51 +96,47 @@ test.describe(() => { await mainPage.searchForLibrary("uncreated library"); await mainPage.isNoMatchedLibrariesFound("uncreated library"); + await mainPage.clickCloseLibrariesPopUpButton(); }); }); -mainTest("AS-95 Publish Shared library",async ({ page }) => { - const mainPage = new MainPage(page); - const dashboardPage = new DashboardPage(page); - await mainPage.clickAssetsTab(); - await mainPage.uploadImageToFileLibraryGraphics("images/images.png"); - await mainPage.waitForChangeIsSaved(); - await mainPage.isImageUploadedToFileLibraryGraphics(); - await mainPage.clickLibrariesTab(); - await mainPage.clickPublishSharedLibraryButton(); - await mainPage.isUnpublishLibraryBtnPresent(); - await mainPage.clickCloseLibrariesPopUpButton(); - await mainPage.isSharedLibraryBadgeVisible(); - await mainPage.backToDashboardFromFileEditor(); - await dashboardPage.openSidebarItem("Libraries"); - await dashboardPage.isFilePresent("New File 1"); +test.describe('Tests wt importing Penpot Libraries', () => { + test.beforeEach(async ({ page }) => { + const mainPage = new MainPage(page); + await mainPage.clickAssetsTab(); + await mainPage.uploadImageToFileLibraryGraphics("images/images.png"); + await mainPage.waitForChangeIsSaved(); + await mainPage.isImageUploadedToFileLibraryGraphics(); + await mainPage.clickLibrariesTab(); + await mainPage.clickPublishSharedLibraryButton(); + await mainPage.isUnpublishLibraryBtnPresent(); + await mainPage.clickCloseLibrariesPopUpButton(); + await mainPage.isSharedLibraryBadgeVisible(); + await mainPage.backToDashboardFromFileEditor(); + }); + + mainTest("AS-95 Publish Shared library",async ({ page }) => { + const dashboardPage = new DashboardPage(page); + await dashboardPage.openSidebarItem("Libraries"); + await dashboardPage.isFilePresent("New File 1"); + }); + + mainTest("AS-96 Unpublish Shared library",async ({ page }) => { + const mainPage = new MainPage(page); + const dashboardPage = new DashboardPage(page); + await dashboardPage.openSidebarItem("Libraries"); + await dashboardPage.isFilePresent("New File 1"); + await dashboardPage.openFile(); + await mainPage.clickAssetsTab(); + await mainPage.clickLibrariesTab(); + await mainPage.unPublishSharedLibrary(); + await mainPage.isPublishLibraryBtnPresent(); + await mainPage.clickCloseLibrariesPopUpButton(); + await mainPage.isSharedLibraryBadgeNotVisible(); + await mainPage.backToDashboardFromFileEditor(); + await dashboardPage.openSidebarItem("Libraries"); + await dashboardPage.checkNoLibrariesExist(); + }); }); -mainTest("AS-96 Unpublish Shared library",async ({ page }) => { - const mainPage = new MainPage(page); - const dashboardPage = new DashboardPage(page); - await mainPage.clickAssetsTab(); - await mainPage.uploadImageToFileLibraryGraphics("images/images.png"); - await mainPage.waitForChangeIsSaved(); - await mainPage.isImageUploadedToFileLibraryGraphics(); - await mainPage.clickLibrariesTab(); - await mainPage.clickPublishSharedLibraryButton(); - await mainPage.isUnpublishLibraryBtnPresent(); - await mainPage.clickCloseLibrariesPopUpButton(); - await mainPage.isSharedLibraryBadgeVisible(); - await mainPage.backToDashboardFromFileEditor(); - await dashboardPage.openSidebarItem("Libraries"); - await dashboardPage.isFilePresent("New File 1"); - - await dashboardPage.openFile(); - await mainPage.clickAssetsTab(); - await mainPage.clickLibrariesTab(); - await mainPage.unPublishSharedLibrary(); - await mainPage.isPublishLibraryBtnPresent(); - await mainPage.clickCloseLibrariesPopUpButton(); - await mainPage.isSharedLibraryBadgeNotVisible(); - await mainPage.backToDashboardFromFileEditor(); - await dashboardPage.openSidebarItem("Libraries"); - await dashboardPage.checkNoLibrariesExist(); -}); diff --git a/tests/assets/assets-shortcuts-panel.spec.js b/tests/assets/assets-shortcuts-panel.spec.js index ea65582..fe6967e 100644 --- a/tests/assets/assets-shortcuts-panel.spec.js +++ b/tests/assets/assets-shortcuts-panel.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("AS-110 Open panel main menu - help&info", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/assets/assets-typographies.spec.js b/tests/assets/assets-typographies.spec.js index 225e186..f1f269c 100644 --- a/tests/assets/assets-typographies.spec.js +++ b/tests/assets/assets-typographies.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest( "AS-37 Filter Typographies from All Assets drop-down", diff --git a/tests/color/color-picker.spec.js b/tests/color/color-picker.spec.js index 68fefff..7e8cdda 100644 --- a/tests/color/color-picker.spec.js +++ b/tests/color/color-picker.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { expect, test } = require("@playwright/test"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); +const { random } = require("../../helpers/string-generator"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CP-1 Open color picker from Stroke menu", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/composition/composition-board.spec.js b/tests/composition/composition-board.spec.js index 4c34416..435101c 100644 --- a/tests/composition/composition-board.spec.js +++ b/tests/composition/composition-board.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CO-1 Change color background", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/composition/composition-comments.spec.js b/tests/composition/composition-comments.spec.js index 5d5beb7..a0e93c7 100644 --- a/tests/composition/composition-comments.spec.js +++ b/tests/composition/composition-comments.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test} = require("@playwright/test"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); +const { random } = require("../../helpers/string-generator"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); + }); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest( "CO-339 Create comment from toolbar", diff --git a/tests/composition/composition-curve.spec.js b/tests/composition/composition-curve.spec.js index cf0d9fb..34a29ff 100644 --- a/tests/composition/composition-curve.spec.js +++ b/tests/composition/composition-curve.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); +const { MainPage } = require("../../pages/workspace/main-page"); const { expect } = require("@playwright/test"); const { test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); test.describe(() => { // All tests in this describe group will get 2 retry attempts. diff --git a/tests/composition/composition-ellipse.spec.js b/tests/composition/composition-ellipse.spec.js index dc922df..81f4294 100644 --- a/tests/composition/composition-ellipse.spec.js +++ b/tests/composition/composition-ellipse.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CO-112 Create an ellipse from toolbar", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/composition/composition-flex-layout.spec.js b/tests/composition/composition-flex-layout.spec.js index accad90..9e44004 100644 --- a/tests/composition/composition-flex-layout.spec.js +++ b/tests/composition/composition-flex-layout.spec.js @@ -1,8 +1,31 @@ const { expect, test } = require("@playwright/test"); const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { LayersPage } = require("../../pages/workspace/layers"); -const { DesignPanelPage} = require("../../pages/workspace/design-panel"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { LayersPanelPage } = require("../../pages/workspace/layers-panel"); +const { DesignPanelPage } = require("../../pages/workspace/design-panel"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); test.describe("Flex Layout & Elements", async () => { test.beforeEach(async ({ page, browserName}, testInfo) => { @@ -398,7 +421,7 @@ test.describe("Flex Layout & Elements", async () => { mainTest("FL-21 Flex elements change - alignment", async ({ page }) => { const mainPage = new MainPage(page); - const layersPage = new LayersPage(page); + const layersPage = new LayersPanelPage(page); const designPanelPage = new DesignPanelPage(page); await mainPage.addFlexLayoutViaRightClick(); @@ -437,7 +460,7 @@ test.describe("Flex Layout & Elements", async () => { mainTest("FL-22 Flex elements - change margin single", async ({ page }) => { const mainPage = new MainPage(page); - const layersPage = new LayersPage(page); + const layersPage = new LayersPanelPage(page); const designPanelPage = new DesignPanelPage(page); await mainPage.addFlexLayoutViaRightClick(); @@ -546,7 +569,7 @@ test.describe("Margins & Paddings & Position", async () => { mainTest("FL-42 Use absolute position and look if element still inside a board", async ({ page }) => { const mainPage = new MainPage(page); - const layersPage = new LayersPage(page); + const layersPage = new LayersPanelPage(page); const designPanelPage = new DesignPanelPage(page); await layersPage.selectBoardChildEllipse(); diff --git a/tests/composition/composition-image.spec.js b/tests/composition/composition-image.spec.js index 6a481d3..a9cf06e 100644 --- a/tests/composition/composition-image.spec.js +++ b/tests/composition/composition-image.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); +const { MainPage } = require("../../pages/workspace/main-page"); const { expect, test } = require("@playwright/test"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CO-220 Import JPEG image", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/composition/composition-path-node-panel.spec.js b/tests/composition/composition-path-node-panel.spec.js index 54381b8..6a761cb 100644 --- a/tests/composition/composition-path-node-panel.spec.js +++ b/tests/composition/composition-path-node-panel.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test} = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest( "CO-329 Add nodes via Node panel and SHIFT PLUS shortcut", diff --git a/tests/composition/composition-path.spec.js b/tests/composition/composition-path.spec.js index d242283..b10c361 100644 --- a/tests/composition/composition-path.spec.js +++ b/tests/composition/composition-path.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); +const { MainPage } = require("../../pages/workspace/main-page"); const { expect, test } = require("@playwright/test"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CO-272 Create Path from toolbar - closed", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/composition/composition-rectangle.spec.js b/tests/composition/composition-rectangle.spec.js index 71030c4..4586367 100644 --- a/tests/composition/composition-rectangle.spec.js +++ b/tests/composition/composition-rectangle.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); -const { expect, test} = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CO-59 Create a rectangle from toolbar", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/composition/composition-text.spec.js b/tests/composition/composition-text.spec.js index bb9dbc8..f139f54 100644 --- a/tests/composition/composition-text.spec.js +++ b/tests/composition/composition-text.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); const { expect, test } = require("@playwright/test"); -const { MainPage } = require("../../pages/main-page"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("CO-162 Create a text from toolbar", async ({ page, browserName }) => { const mainPage = new MainPage(page); diff --git a/tests/dashboard/dashboard-files.spec.js b/tests/dashboard/dashboard-files.spec.js index 94145e4..55f8e1a 100644 --- a/tests/dashboard/dashboard-files.spec.js +++ b/tests/dashboard/dashboard-files.spec.js @@ -1,6 +1,24 @@ const { dashboardTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { DashboardPage } = require("../../pages/dashboard-page"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); +const { random } = require("../../helpers/string-generator"); +const { test } = require("@playwright/test"); +const { TeamPage } = require("../../pages/dashboard/team-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + await teamPage.deleteTeam(teamName); +}); dashboardTest("DA-1 Create new file in Drafts on title panel",async ({ page }) => { const dashboardPage = new DashboardPage(page); @@ -30,6 +48,7 @@ dashboardTest("DA-3 Open file in Drafts", async ({ page }) => { await dashboardPage.reloadPage(); await dashboardPage.openFile(); await mainPage.isMainPageLoaded(); + await mainPage.backToDashboardFromFileEditor(); }); dashboardTest("DA-5 Rename file in Drafts via rightclick", async ({ page }) => { @@ -288,7 +307,7 @@ dashboardTest( ); dashboardTest( - "DA-35-1 Download Penpot file in Project via rigthclick", + "DA-35-1 Download Penpot file in Project via rightclick", async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.clickAddProjectButton(); @@ -316,7 +335,7 @@ dashboardTest( ); dashboardTest( - "DA-36-1 Download standard file in Project via rigthclick", + "DA-36-1 Download standard file in Project via rightclick", async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.clickAddProjectButton(); diff --git a/tests/dashboard/dashboard-fonts.spec.js b/tests/dashboard/dashboard-fonts.spec.js index d8b770f..76faedd 100644 --- a/tests/dashboard/dashboard-fonts.spec.js +++ b/tests/dashboard/dashboard-fonts.spec.js @@ -1,11 +1,22 @@ const { dashboardTest } = require("../../fixtures"); -const { DashboardPage } = require("../../pages/dashboard-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); const { test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); -test.beforeEach(async ({ page }) => { +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); const dashboardPage = new DashboardPage(page); - await dashboardPage.openSidebarItem("Fonts"); - await dashboardPage.deleteFontsIfExist(); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + await teamPage.deleteTeam(teamName); }); dashboardTest("DA-66 Upload single font", async ({ page }) => { diff --git a/tests/dashboard/dashboard-libraries.spec.js b/tests/dashboard/dashboard-libraries.spec.js index 1d906d1..81318d5 100644 --- a/tests/dashboard/dashboard-libraries.spec.js +++ b/tests/dashboard/dashboard-libraries.spec.js @@ -1,49 +1,39 @@ const { dashboardTest } = require("../../fixtures"); -const { DashboardPage } = require("../../pages/dashboard-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); const { test, expect } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); -test.beforeEach(async ({ page }) => { +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); const dashboardPage = new DashboardPage(page); - await dashboardPage.minimizeLibrariesAndTemplatesCarouselIfExpanded(); + await teamPage.createTeam(teamName); + await dashboardPage.minimizeLibrariesAndTemplatesCarousel(); }); -dashboardTest( - "DA-128 Expand Libraries & Templates carousel", - async ({ page }) => { - const dashboardPage = new DashboardPage(page); - await dashboardPage.clickLibrariesAndTemplatesCarouselButton(); - await dashboardPage.isLibrariesAndTemplatesSectionDisplayed(); - } -); +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + await teamPage.deleteTeam(teamName); +}); -dashboardTest( - "DA-130 Flip Libraries & Templates carousel", - async ({ page }) => { +dashboardTest("DA-128 Expand Libraries & Templates carousel",async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.clickLibrariesAndTemplatesCarouselButton(); await dashboardPage.isLibrariesAndTemplatesSectionDisplayed(); - await dashboardPage.flipRightLibrariesAndTemplatesCarousel(); - await dashboardPage.flipRightLibrariesAndTemplatesCarousel(); - await dashboardPage.flipRightLibrariesAndTemplatesCarousel(); + }); + +dashboardTest("DA-130 Flip Libraries & Templates carousel",async ({ page }) => { + const dashboardPage = new DashboardPage(page); + await dashboardPage.maximizeLibrariesAndTemplatesCarousel(); + await dashboardPage.flipLibrariesAndTemplatesCarousel('right', 3); await expect(dashboardPage.librariesAndTemplatesSection).toHaveScreenshot( "libraries-carousel-flipped-right.png" ); - await dashboardPage.flipLeftLibrariesAndTemplatesCarousel(); - await dashboardPage.flipLeftLibrariesAndTemplatesCarousel(); - await dashboardPage.flipLeftLibrariesAndTemplatesCarousel(); + await dashboardPage.flipLibrariesAndTemplatesCarousel('left', 3); await expect(dashboardPage.librariesAndTemplatesSection).toHaveScreenshot( "libraries-carousel-flipped-left.png" ); } ); - -dashboardTest( - "DA-129 Minimize Libraries & Templates carousel", - async ({ page }) => { - const dashboardPage = new DashboardPage(page); - await dashboardPage.clickLibrariesAndTemplatesCarouselButton(); - await dashboardPage.isLibrariesAndTemplatesSectionDisplayed(); - await dashboardPage.clickLibrariesAndTemplatesCarouselButton(); - await dashboardPage.isLibrariesAndTemplatesSectionNotDisplayed(); - } -); diff --git a/tests/dashboard/dashboard-libraries.spec.js-snapshots/chrome/libraries-carousel-flipped-left.png b/tests/dashboard/dashboard-libraries.spec.js-snapshots/chrome/libraries-carousel-flipped-left.png index 9c6e0c3..18c36d0 100644 Binary files a/tests/dashboard/dashboard-libraries.spec.js-snapshots/chrome/libraries-carousel-flipped-left.png and b/tests/dashboard/dashboard-libraries.spec.js-snapshots/chrome/libraries-carousel-flipped-left.png differ diff --git a/tests/dashboard/dashboard-libraries.spec.js-snapshots/firefox/libraries-carousel-flipped-left.png b/tests/dashboard/dashboard-libraries.spec.js-snapshots/firefox/libraries-carousel-flipped-left.png index 7ce4e05..e0a2976 100644 Binary files a/tests/dashboard/dashboard-libraries.spec.js-snapshots/firefox/libraries-carousel-flipped-left.png and b/tests/dashboard/dashboard-libraries.spec.js-snapshots/firefox/libraries-carousel-flipped-left.png differ diff --git a/tests/dashboard/dashboard-libraries.spec.js-snapshots/webkit/libraries-carousel-flipped-left.png b/tests/dashboard/dashboard-libraries.spec.js-snapshots/webkit/libraries-carousel-flipped-left.png index 0ccf66f..631b26b 100644 Binary files a/tests/dashboard/dashboard-libraries.spec.js-snapshots/webkit/libraries-carousel-flipped-left.png and b/tests/dashboard/dashboard-libraries.spec.js-snapshots/webkit/libraries-carousel-flipped-left.png differ diff --git a/tests/dashboard/dashboard-teams.spec.js b/tests/dashboard/dashboard-teams.spec.js index 4b9e603..db89c87 100644 --- a/tests/dashboard/dashboard-teams.spec.js +++ b/tests/dashboard/dashboard-teams.spec.js @@ -1,58 +1,59 @@ const { dashboardTest } = require("../../fixtures"); -const { TeamPage } = require("../../pages/team-page"); -const { test, expect } = require("@playwright/test"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { expect } = require("@playwright/test"); const { ProfilePage } = require("../../pages/profile-page"); -const { DashboardPage } = require("../../pages/dashboard-page"); -const { MainPage } = require("../../pages/main-page"); - -test.afterEach(async ({ page }) => { - const teamPage = new TeamPage(page); - await teamPage.deleteTeamsIfExist(); -}); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { random } = require("../../helpers/string-generator"); dashboardTest("DA-76 Create a team", async ({ page }) => { + const team = random().concat('autotest'); const teamPage = new TeamPage(page); - await teamPage.createTeam("New Test Team"); - await teamPage.isTeamSelected("New Test Team"); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); + + await teamPage.deleteTeam(team); }); dashboardTest("DA-77 Team.Switch between teams", async ({ page }) => { + const team1 = 'QA Test team 1'; + const team2 = 'QA Test team 2'; const teamPage = new TeamPage(page); - const teamFirst = "QA Test Team 1"; - const teamSecond = "QA Test Team 2"; - await teamPage.createTeam(teamFirst); - await teamPage.isTeamSelected(teamFirst); - await teamPage.createTeam(teamSecond); - await teamPage.isTeamSelected(teamSecond); - await teamPage.switchTeam(teamFirst); - await teamPage.switchTeam(teamSecond); + await teamPage.createTeam(team1); + await teamPage.isTeamSelected(team1); + await teamPage.createTeam(team2); + await teamPage.isTeamSelected(team2); + await teamPage.switchTeam(team1); + await teamPage.switchTeam(team2); + + await teamPage.deleteTeams([team1, team2]); }); -dashboardTest( - "DA-78 Team Invitations - open the form via Invitations tab", - async ({ page }) => { - const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); - await teamPage.openInvitationsPageViaOptionsMenu(); - await teamPage.clickInviteMembersToTeamButton(); - await teamPage.isInviteMembersPopUpHeaderDisplayed( - "Invite members to the team" - ); +dashboardTest("DA-78 Team Invitations - open the form via Invitations tab",async ({ page }) => { + const teamPage = new TeamPage(page); + const team = random().concat('autotest'); + + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); + await teamPage.openInvitationsPageViaOptionsMenu(); + await teamPage.clickInviteMembersToTeamButton(); + await teamPage.isInviteMembersPopUpHeaderDisplayed( + "Invite members to the team" + ); + await teamPage.deleteTeam(team); } ); -dashboardTest( - "DA-79 Team Invitations - open the form via Team Hero", - async ({ page }) => { - const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); - await teamPage.clickInviteMembersTeamHeroButton(); - await teamPage.isInviteMembersPopUpHeaderDisplayed( - "Invite members to the team" - ); +dashboardTest("DA-79 Team Invitations - open the form via Team Hero",async ({ page }) => { + const teamPage = new TeamPage(page); + const team = random().concat('autotest'); + + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); + await teamPage.clickInviteMembersTeamHeroButton(); + await teamPage.isInviteMembersPopUpHeaderDisplayed("Invite members to the team"); + await teamPage.deleteTeam(team); } ); @@ -60,8 +61,10 @@ dashboardTest( "DA-80 Team Invitations - invite via owner (single invitation, editor)", async ({ page }) => { const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); + const team = random().concat('autotest'); + + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openInvitationsPageViaOptionsMenu(); await teamPage.clickInviteMembersToTeamButton(); await teamPage.isInviteMembersPopUpHeaderDisplayed( @@ -71,15 +74,17 @@ dashboardTest( await teamPage.clickSendInvitationButton(); await teamPage.isSuccessMessageDisplayed("Invitation sent successfully"); await teamPage.isInvitationRecordDisplayed("testeditor@test.com", "Editor", "Pending"); + await teamPage.deleteTeam(team); } ); dashboardTest( "DA-81 Team Invitations - invite via owner (single invitation, admin)", async ({ page }) => { + const team = random().concat('autotest'); const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openInvitationsPageViaOptionsMenu(); await teamPage.clickInviteMembersToTeamButton(); await teamPage.isInviteMembersPopUpHeaderDisplayed( @@ -96,14 +101,16 @@ dashboardTest( "Admin", "Pending" ); + await teamPage.deleteTeam(team); } ); dashboardTest("DA-89 Team.Invitations-fail to send invitation to existing team member", async ({ page }) => { const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); + const team = random().concat('autotest'); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openInvitationsPageViaOptionsMenu(); await teamPage.clickInviteMembersToTeamButton(); await teamPage.isInviteMembersPopUpHeaderDisplayed("Invite members to the team"); @@ -111,14 +118,16 @@ dashboardTest("DA-89 Team.Invitations-fail to send invitation to existing team m await teamPage.isSendInvitationBtnDisabled(); await teamPage.isSendInvitationWarningExist( "Some emails are from current team members. Their invitations will not be sent.") + await teamPage.deleteTeam(team); }); dashboardTest( "DA-90 Team Invitations - resend invitation via owner", async ({ page }) => { const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); + const team = random().concat('autotest'); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openInvitationsPageViaOptionsMenu(); await teamPage.clickInviteMembersToTeamButton(); await teamPage.isInviteMembersPopUpHeaderDisplayed( @@ -138,6 +147,7 @@ dashboardTest( await teamPage.isSuccessMessageDisplayed( "Invitation sent successfully" ); + await teamPage.deleteTeam(team); } ); @@ -145,8 +155,9 @@ dashboardTest( "DA-92 Team Invitations - delete invitation via owner", async ({ page }) => { const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); + const team = random().concat('autotest'); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openInvitationsPageViaOptionsMenu(); await teamPage.clickInviteMembersToTeamButton(); await teamPage.isInviteMembersPopUpHeaderDisplayed( @@ -164,6 +175,7 @@ dashboardTest( ); await teamPage.deleteInvitation(); await teamPage.isInvitationRecordRemoved(); + await teamPage.deleteTeam(team); } ); @@ -171,8 +183,9 @@ dashboardTest( "DA-95 Team Invitations - change role in invitation via owner", async ({ page }) => { const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); + const team = random().concat('autotest'); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openInvitationsPageViaOptionsMenu(); await teamPage.clickInviteMembersToTeamButton(); await teamPage.isInviteMembersPopUpHeaderDisplayed( @@ -194,15 +207,17 @@ dashboardTest( "Admin", "Pending" ); + await teamPage.deleteTeam(team); } ); dashboardTest( "DA-114 Team Settings - upload team profile picture", async ({ page }) => { + const team = "QA Team"; const teamPage = new TeamPage(page); - await teamPage.createTeam("New Test Team"); - await teamPage.isTeamSelected("New Test Team"); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openTeamSettingsPageViaOptionsMenu(); await teamPage.uploadTeamImage("images/images.png"); await teamPage.isInfoMessageDisplayed("Loading imageā€¦"); @@ -210,11 +225,13 @@ dashboardTest( await expect(teamPage.teamInfoSection).toHaveScreenshot( "team-profile-image.png" ); + await teamPage.deleteTeam(team); } ); dashboardTest("DA-116 Team. Settings - check 'Team members' info", async ({ page }) => { + const team = random().concat('autotest'); const teamPage = new TeamPage(page); const profilePage = new ProfilePage(page); await profilePage.openYourAccountPage(); @@ -223,26 +240,28 @@ dashboardTest("DA-116 Team. Settings - check 'Team members' info", await profilePage.uploadProfileImage("images/sample.jpeg"); await profilePage.waitInfoMessageHidden(); await profilePage.backToDashboardFromAccount(); - await teamPage.createTeam("New Test Team"); - await teamPage.isTeamSelected("New Test Team"); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await teamPage.openTeamSettingsPageViaOptionsMenu(); const teamOwner = await profilePage.getProfileFullName() + ' (Owner)'; await teamPage.isTeamOwnerInfoDisplayed(teamOwner); await teamPage.isTeamMembersInfoDisplayed("1 members"); - await expect(teamPage.teamOwnerSection).toHaveScreenshot("team-owner-block.png") -}); + await expect(teamPage.teamOwnerSection).toHaveScreenshot("team-owner-block.png"); + await teamPage.deleteTeam(team); + }); dashboardTest("DA-117 Team. Settings - check 'Team projects' info", async ({ page }) => { + const team = random().concat('autotest'); const dashboardPage = new DashboardPage(page); const teamPage = new TeamPage(page); const mainPage = new MainPage(page); const projectFirst = "QA Project 1"; const projectSecond = "QA Project 2"; - await teamPage.createTeam("New Test Team"); - await teamPage.isTeamSelected("New Test Team"); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); await dashboardPage.createProject(projectFirst); await dashboardPage.createProject(projectSecond); await dashboardPage.openSidebarItem("Drafts"); @@ -259,20 +278,25 @@ dashboardTest("DA-117 Team. Settings - check 'Team projects' info", await teamPage.isTeamProjectsInfoDisplayed("2 projects"); await teamPage.isTeamFilesInfoDisplayed("3 files"); await expect(teamPage.teamStatsSection).toHaveScreenshot("team-stats-block.png") + await teamPage.deleteTeam(team); }); dashboardTest("DA-119 Rename a team via owner", async ({ page }) => { + const team = random().concat('autotest'); + const teamNew = random().concat('autotest'); const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); - await teamPage.renameTeam("Renamed Team"); - await teamPage.isTeamSelected("Renamed Team"); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); + await teamPage.renameTeam(teamNew); + await teamPage.isTeamSelected(teamNew); + await teamPage.deleteTeams([team, teamNew]); }); dashboardTest("DA-122 Delete a team via owner", async ({ page }) => { const teamPage = new TeamPage(page); - await teamPage.createTeam("QA Team"); - await teamPage.isTeamSelected("QA Team"); - await teamPage.deleteTeam("QA Team"); - await teamPage.isTeamDeleted("QA Team"); + const team = random().concat('autotest'); + await teamPage.createTeam(team); + await teamPage.isTeamSelected(team); + await teamPage.deleteTeam(team); + await teamPage.isTeamDeleted(team); }); diff --git a/tests/dashboard/dashboard-teams.spec.js-snapshots/chrome/team-profile-image.png b/tests/dashboard/dashboard-teams.spec.js-snapshots/chrome/team-profile-image.png index 3ecb8d6..a53452b 100644 Binary files a/tests/dashboard/dashboard-teams.spec.js-snapshots/chrome/team-profile-image.png and b/tests/dashboard/dashboard-teams.spec.js-snapshots/chrome/team-profile-image.png differ diff --git a/tests/dashboard/dashboard-teams.spec.js-snapshots/firefox/team-profile-image.png b/tests/dashboard/dashboard-teams.spec.js-snapshots/firefox/team-profile-image.png index c598fd5..254ce75 100644 Binary files a/tests/dashboard/dashboard-teams.spec.js-snapshots/firefox/team-profile-image.png and b/tests/dashboard/dashboard-teams.spec.js-snapshots/firefox/team-profile-image.png differ diff --git a/tests/dashboard/dashboard-teams.spec.js-snapshots/webkit/team-profile-image.png b/tests/dashboard/dashboard-teams.spec.js-snapshots/webkit/team-profile-image.png index 2dfb56d..a29e086 100644 Binary files a/tests/dashboard/dashboard-teams.spec.js-snapshots/webkit/team-profile-image.png and b/tests/dashboard/dashboard-teams.spec.js-snapshots/webkit/team-profile-image.png differ diff --git a/tests/login.spec.js b/tests/login.spec.js index daa76a4..d45290b 100644 --- a/tests/login.spec.js +++ b/tests/login.spec.js @@ -1,6 +1,6 @@ const { test } = require("@playwright/test"); const { LoginPage } = require("../pages/login-page"); -const { DashboardPage } = require("../pages/dashboard-page"); +const { DashboardPage } = require("../pages/dashboard/dashboard-page"); test("ON-8 Login with an email address", async ({ page }) => { const loginPage = new LoginPage(page); diff --git a/tests/panels-features/panels-features-export.spec.js b/tests/panels-features/panels-features-export.spec.js index ce3b89a..9d9d4dc 100644 --- a/tests/panels-features/panels-features-export.spec.js +++ b/tests/panels-features/panels-features-export.spec.js @@ -1,5 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { random } = require("../../helpers/string-generator"); +const { test } = require("@playwright/test"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("PF-179 Add export setting via design panel", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/panels-features/panels-features-fill.spec.js b/tests/panels-features/panels-features-fill.spec.js index d669268..ad9ce07 100644 --- a/tests/panels-features/panels-features-fill.spec.js +++ b/tests/panels-features/panels-features-fill.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("PF-68 Add fill to board", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/panels-features/panels-features-grid.spec.js b/tests/panels-features/panels-features-grid.spec.js index c0a2450..92abbfe 100644 --- a/tests/panels-features/panels-features-grid.spec.js +++ b/tests/panels-features/panels-features-grid.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); +const { MainPage } = require("../../pages/workspace/main-page"); const { test, expect} = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); test.beforeEach(async ({ page}) => { const mainPage = new MainPage(page); diff --git a/tests/panels-features/panels-features-history-panel.spec.js b/tests/panels-features/panels-features-history-panel.spec.js index 4088e57..a0a8017 100644 --- a/tests/panels-features/panels-features-history-panel.spec.js +++ b/tests/panels-features/panels-features-history-panel.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { random } = require("../../helpers/string-generator"); +const { test } = require("@playwright/test"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("PF-156 Perform a change and check the status",async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/panels-features/panels-features-main-menu.spec.js b/tests/panels-features/panels-features-main-menu.spec.js index 4c3d2cb..e1774dd 100644 --- a/tests/panels-features/panels-features-main-menu.spec.js +++ b/tests/panels-features/panels-features-main-menu.spec.js @@ -1,7 +1,30 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); -const { ColorPalettePopUp } = require("../../pages/color-palette-popup"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test} = require("@playwright/test"); +const { ColorPalettePopUp } = require("../../pages/workspace/color-palette-popup"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("PF-99 Hide/show grids via shortcut CTRL '",async ({ page, browserName }) => { const mainPage = new MainPage(page); diff --git a/tests/panels-features/panels-features-pages.spec.js b/tests/panels-features/panels-features-pages.spec.js index 942c965..db73819 100644 --- a/tests/panels-features/panels-features-pages.spec.js +++ b/tests/panels-features/panels-features-pages.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("PF-114 Create new page", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/panels-features/panels-features-prototype.spec.js b/tests/panels-features/panels-features-prototype.spec.js index 1b4c101..4e3bbdd 100644 --- a/tests/panels-features/panels-features-prototype.spec.js +++ b/tests/panels-features/panels-features-prototype.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest( "PF-139 Add connector between 2 boards via mouse drag", diff --git a/tests/panels-features/panels-features-zoom.spec.js b/tests/panels-features/panels-features-zoom.spec.js index c8dbac4..1b6622c 100644 --- a/tests/panels-features/panels-features-zoom.spec.js +++ b/tests/panels-features/panels-features-zoom.spec.js @@ -1,6 +1,29 @@ const { mainTest } = require("../../fixtures"); -const { MainPage } = require("../../pages/main-page"); -const { expect } = require("@playwright/test"); +const { MainPage } = require("../../pages/workspace/main-page"); +const { expect, test } = require("@playwright/test"); +const { random } = require("../../helpers/string-generator"); +const { TeamPage } = require("../../pages/dashboard/team-page"); +const { DashboardPage } = require("../../pages/dashboard/dashboard-page"); + +const teamName = random().concat('autotest'); + +test.beforeEach( async ({ page }) => { + const teamPage = new TeamPage(page); + const dashboardPage = new DashboardPage(page); + const mainPage = new MainPage(page); + await teamPage.createTeam(teamName); + await dashboardPage.deleteProjectsIfExist(); + await dashboardPage.deleteFilesIfExist(); + await dashboardPage.createFileViaPlaceholder(); + await mainPage.isMainPageLoaded(); +}); + +test.afterEach(async ({ page }) => { + const teamPage = new TeamPage(page); + const mainPage = new MainPage(page); + await mainPage.backToDashboardFromFileEditor(); + await teamPage.deleteTeam(teamName); +}); mainTest("PF-132 Zoom +/- via top right menu", async ({ page }) => { const mainPage = new MainPage(page); diff --git a/tests/profile.spec.js b/tests/profile.spec.js index 4b8a7b9..89f97e2 100644 --- a/tests/profile.spec.js +++ b/tests/profile.spec.js @@ -2,7 +2,7 @@ const { dashboardTest } = require("../fixtures"); const { ProfilePage } = require("../pages/profile-page"); const { random } = require("../helpers/string-generator"); const { LoginPage } = require("../pages/login-page"); -const {expect} = require("@playwright/test"); +const { expect } = require("@playwright/test"); dashboardTest("PR-1 Edit profile name", async ({ page }) => { const newName = random();