Files
nocodb/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
Ramesh Mane e808ef4a15 Nc Fix: Update extension UI as per new design (#9306)
* fix(nc-gui): show extension as floating

* chore(nc-gui): add puzzle icon

* fix(nc-gui): toolbar searchbox auto close issue on clearing input value

* fix(nc-gui): update extension header

* fix(nc-gui): update extension panel as per new design

* fix(nc-gui): update extension icons

* fix(nc-gui): mionr extension panel corrections

* feat(nc-gui): extension reorder support

* fix(nc-gui): extension reorder issue

* fix(nc-gui): extension min height issue

* fix(nc-gui): extension error screen

* fix(nc-gui): extension fullscreen padding

* fix(nc-gui): update extension marketplace modal

* fix(nc-gui): update extension details modal

* fix(nc-gui): some changes

* fix(nc-gui): some review changes

* fix(nc-gui): some review changes

* fix(nc-gui): update extension header

* fix(nc-gui): update extension title input box

* fix(nc-gui): enable extension is cloud

* fix(nc-gui): add extension subtitle support

* feat(nc-gui): allow user to add extension description in markdown file

* fix(nc-gui): add cmdk topbar btn in all screens

* fix(nc-gui): meta.glob() as option deprecated warning

* fix(nc-gui): minor changes

* fix(nc-gui): make cmdk icon smaller

* fix(nc-gui): monor review changes

* misc: alignment & text for desc

* fix(nc-gui): extension review changes

* fix(nc-gui): extension topbar btn ui updates

* fix(nc-gui): update extension header icon size

* fix(nc-gui): use description md file instead of plain text in manifest

* fix(nc-gui): update extension modal size

* fix(nc-gui): cmdk test update

* chore(nc-gui): lint

* fix(nc-gui): minor changes

* fix(nc-gui): update extension details panel gap

* fix: minor alignments

---------

Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
2024-08-23 12:29:11 +05:30

116 lines
3.9 KiB
TypeScript

import { expect, Locator } from '@playwright/test';
import { DashboardPage } from '../../index';
import BasePage from '../../../Base';
import { getTextExcludeIconText } from '../../../../tests/utils/general';
import { isEE } from '../../../../setup/db';
import { NcContext } from '../../../../setup';
export class LeftSidebarPage extends BasePage {
readonly base: any;
readonly dashboard: DashboardPage;
readonly btn_workspace: Locator;
readonly btn_newProject: Locator;
// readonly btn_cmdK: Locator;
readonly btn_teamAndSettings: Locator;
readonly modal_workspace: Locator;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
this.btn_workspace = this.get().locator('.nc-workspace-menu');
this.btn_newProject = this.get().locator('[data-testid="nc-sidebar-create-base-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.modal_workspace = this.rootPage.locator('.nc-dropdown-workspace-menu');
}
get() {
return this.dashboard.get().locator('.nc-sidebar');
}
async createProject({ title, context }: { title: string; context: NcContext }) {
title = isEE() ? title : `nc-${context.workerId}-${title}`;
await this.btn_newProject.click();
await this.rootPage.locator('.ant-modal-content:has-text(" Create Base")').waitFor();
await this.rootPage.locator('.ant-modal-content:has-text(" Create Base")').locator('input').fill(title);
await this.rootPage
.locator('.ant-modal-content:has-text(" Create Base")')
.locator('button.ant-btn-primary')
.click();
}
async clickTeamAndSettings() {
await this.btn_teamAndSettings.click();
}
async clickWorkspace() {
await this.btn_workspace.click();
}
async clickHome() {}
async getWorkspaceName() {
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();
await this.modal_workspace.locator('.ant-dropdown-menu-item:has-text("Create New Workspace")').click();
const inputModal = this.rootPage.locator('div.ant-modal.active');
await inputModal.waitFor();
await inputModal.locator('input').clear();
await inputModal.locator('input').fill(title);
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();
const nodes = this.modal_workspace.locator('[data-testid="nc-workspace-list"]');
for (let i = 0; i < (await nodes.count()); i++) {
ws.push(await getTextExcludeIconText(nodes.nth(i)));
}
ws.push(await this.getWorkspaceName());
await this.rootPage.keyboard.press('Escape');
return ws;
}
async openWorkspace(param: { title: any }) {
await this.clickWorkspace();
const nodes = this.modal_workspace.locator('[data-testid="nc-workspace-list"]');
await this.rootPage.waitForTimeout(2000);
for (let i = 0; i < (await nodes.count()); i++) {
const text = await getTextExcludeIconText(nodes.nth(i));
if (text.toLowerCase() === param.title.toLowerCase()) {
await nodes.nth(i).click({ force: true });
break;
}
}
await this.rootPage.keyboard.press('Escape');
await this.rootPage.waitForTimeout(3500);
}
}