From 565e19b1ad9b21ce631cd2283f8378ec341bf73b Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 28 Sep 2023 04:27:02 +0000 Subject: [PATCH] fix: Fixed workspace test issue --- .../pages/Dashboard/common/LeftSidebar/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts b/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts index d574e48f0c..31ca735ab2 100644 --- a/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts +++ b/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts @@ -1,4 +1,4 @@ -import { Locator } from '@playwright/test'; +import { expect, Locator } from '@playwright/test'; import { DashboardPage } from '../../index'; import BasePage from '../../../Base'; import { getTextExcludeIconText } from '../../../../tests/utils/general'; @@ -20,7 +20,7 @@ export class LeftSidebarPage extends BasePage { super(dashboard.rootPage); this.dashboard = dashboard; - this.btn_workspace = this.get().locator('.nc-sidebar-header'); + this.btn_workspace = this.get().locator('.nc-workspace-menu'); this.btn_newProject = this.get().locator('[data-testid="nc-sidebar-create-project-btn"]'); this.btn_cmdK = this.get().locator('[data-testid="nc-sidebar-search-btn"]'); this.btn_teamAndSettings = this.get().locator('[data-testid="nc-sidebar-team-settings-btn"]'); @@ -57,6 +57,10 @@ export class LeftSidebarPage extends BasePage { return await this.btn_workspace.getAttribute('data-workspace-title'); } + async verifyWorkspaceName({ title }: { title: string }) { + await expect(this.btn_workspace.locator('.nc-workspace-title')).toHaveText(title); + } + async createWorkspace({ title }: { title: string }) { await this.clickWorkspace(); await this.modal_workspace.locator('.ant-dropdown-menu-item:has-text("Create New Workspace")').waitFor(); @@ -69,6 +73,13 @@ export class LeftSidebarPage extends BasePage { await inputModal.locator('button.ant-btn-primary').click(); } + async verifyWorkspaceCount({ count }: { count: number }) { + await this.clickWorkspace(); + + // TODO: THere is one extra html attribute + await expect(this.rootPage.getByTestId('nc-workspace-list')).toHaveCount(count + 1); + } + async getWorkspaceList() { const ws = []; await this.clickWorkspace();