Browse Source

fix: Fixed workspace test issue

pull/6498/head
Muhammed Mustafa 10 months ago
parent
commit
565e19b1ad
  1. 15
      tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts

15
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();

Loading…
Cancel
Save