From 30edca024af3d517ae5b47faa8af67bff533cdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Tue, 25 Jun 2024 15:23:44 +0200 Subject: [PATCH] :sparkles: Remove unneeded draftsFile and newFile locators in dashboard POM --- frontend/playwright/ui/pages/DashboardPage.js | 5 +---- frontend/playwright/ui/specs/dashboard.spec.js | 5 +++-- frontend/playwright/ui/visual-specs/visual-dashboard.spec.js | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/frontend/playwright/ui/pages/DashboardPage.js b/frontend/playwright/ui/pages/DashboardPage.js index 95b63befd..76fd633d1 100644 --- a/frontend/playwright/ui/pages/DashboardPage.js +++ b/frontend/playwright/ui/pages/DashboardPage.js @@ -64,15 +64,11 @@ export class DashboardPage extends BaseWebSocketPage { this.projectName = page.getByText("Project 1"); this.draftsLink = this.sidebar.getByText("Drafts"); - this.draftsFile = page.getByText(/New File 1/); - this.fontsLink = this.sidebar.getByText("Fonts"); - this.libsLink = this.sidebar.getByText("Libraries"); this.searchButton = page.getByRole("button", { name: "dashboard-search" }); this.searchInput = page.getByPlaceholder("Search…"); - this.newFileName = page.getByText("New File 3"); this.teamDropdown = this.sidebar.getByRole("button", { name: "Your Penpot" }); this.userAccount = this.sidebar.getByRole("button", { name: /Princesa Leia/ }); @@ -183,6 +179,7 @@ export class DashboardPage extends BaseWebSocketPage { await this.page.goto( `#/dashboard/team/${DashboardPage.anyTeamId}/projects/${DashboardPage.draftProjectId}`, ); + await expect(this.mainHeading).toHaveText("Drafts"); } async goToAccount() { diff --git a/frontend/playwright/ui/specs/dashboard.spec.js b/frontend/playwright/ui/specs/dashboard.spec.js index 515ad2b77..3e105199c 100644 --- a/frontend/playwright/ui/specs/dashboard.spec.js +++ b/frontend/playwright/ui/specs/dashboard.spec.js @@ -35,11 +35,12 @@ test("User goes to draft page", async ({ page }) => { await expect(dashboardPage.mainHeading).toHaveText("Drafts"); }); -test("User loads the draft page", async ({ page }) => { +test("Lists files in the drafts page", async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.setupDrafts(); await dashboardPage.goToDrafts(); - await expect(dashboardPage.draftsFile).toBeVisible(); + await expect(dashboardPage.page.getByRole("button", { name: /New File 1/ })).toBeVisible(); + await expect(dashboardPage.page.getByRole("button", { name: /New File 2/ })).toBeVisible(); }); diff --git a/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js b/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js index c157d9159..d0dfa9677 100644 --- a/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js +++ b/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js @@ -77,7 +77,6 @@ test("User goes to a full dashboard", async ({ page }) => { await dashboardPage.goToDashboard(); - await expect(dashboardPage.draftsFile).toBeVisible(); await expect(dashboardPage.page).toHaveScreenshot(); }); @@ -121,10 +120,10 @@ test("User goes to a full search page", async ({ page }) => { await dashboardPage.goToSearch(); await expect(dashboardPage.searchInput).toBeVisible(); - await dashboardPage.searchInput.fill("New"); + await dashboardPage.searchInput.fill("3"); await expect(dashboardPage.mainHeading).toHaveText("Search results"); - await expect(dashboardPage.newFileName).toBeVisible(); + await expect(dashboardPage.page.getByRole("button", { name: "New File 3" })).toBeVisible(); await expect(dashboardPage.page).toHaveScreenshot(); });