Browse Source

fix: Fixed workspace test issue

pull/6498/head
Muhammed Mustafa 11 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 { DashboardPage } from '../../index';
import BasePage from '../../../Base'; import BasePage from '../../../Base';
import { getTextExcludeIconText } from '../../../../tests/utils/general'; import { getTextExcludeIconText } from '../../../../tests/utils/general';
@ -20,7 +20,7 @@ export class LeftSidebarPage extends BasePage {
super(dashboard.rootPage); super(dashboard.rootPage);
this.dashboard = dashboard; 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_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_cmdK = this.get().locator('[data-testid="nc-sidebar-search-btn"]');
this.btn_teamAndSettings = this.get().locator('[data-testid="nc-sidebar-team-settings-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'); 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 }) { async createWorkspace({ title }: { title: string }) {
await this.clickWorkspace(); await this.clickWorkspace();
await this.modal_workspace.locator('.ant-dropdown-menu-item:has-text("Create New Workspace")').waitFor(); 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(); 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() { async getWorkspaceList() {
const ws = []; const ws = [];
await this.clickWorkspace(); await this.clickWorkspace();

Loading…
Cancel
Save