Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

test: update some pw test

Ramesh Mane0dee2f23ef76
diff --git a/packages/nc-gui/components/workspace/BaseListModal/BaseNode.vue b/packages/nc-gui/components/workspace/BaseListModal/BaseNode.vue
index 06797cf069..c1a1952cca 100644
--- a/packages/nc-gui/components/workspace/BaseListModal/BaseNode.vue
+++ b/packages/nc-gui/components/workspace/BaseListModal/BaseNode.vue
@@ -110,6 +110,8 @@ const onMenuClick = (e: Event) => {
:tabindex="0"
class="nc-base-node group relative flex items-center gap-3 p-3 rounded-xl cursor-pointer border-1 transition-all border-nc-border-gray-medium hover:border-nc-border-gray-dark hover:shadow-sm"
:class="{ 'is-marked': isMarked, 'is-editing': editMode }"
+ :data-id="base.id"
+ :data-testid="`nc-base-list-modal-base-title-${base.title}`"
@click="handleSelect"
@keydown.enter.stop="handleSelect"
>
diff --git a/tests/playwright/pages/Dashboard/ProjectView/index.ts b/tests/playwright/pages/Dashboard/ProjectView/index.ts
index 7d091bbc33..d260fa74ff 100644
--- a/tests/playwright/pages/Dashboard/ProjectView/index.ts
+++ b/tests/playwright/pages/Dashboard/ProjectView/index.ts
@@ -55,8 +55,6 @@ export class ProjectViewPage extends BasePage {
}
async openOverview() {
- await this.dashboard.leftSidebar.verifyBaseListOpen(false);
-
if (await this.get().isVisible()) return;
await this.sidebar_overview_btn.click();
diff --git a/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts b/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts
index d89e755d81..04ace08603 100644
--- a/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts
+++ b/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts
@@ -34,25 +34,20 @@ export class SidebarProjectNodeObject extends BasePage {
}
async verifyTableAddBtn({ baseTitle, visible }: { baseTitle: string; visible: boolean }) {
- await this.sidebar.dashboard.leftSidebar.verifyBaseListOpen(true);
+ await this.sidebar.baseNode.verifyActiveProject({ baseTitle, open: true });
await this.get({
baseTitle,
}).waitFor({ state: 'visible' });
- await this.get({
- baseTitle,
- }).scrollIntoViewIfNeeded();
- await this.get({
- baseTitle,
- }).hover();
- const addBtn = this.get({
- baseTitle,
- }).getByTestId('nc-sidebar-add-base-entity');
+ // The createNewButton (.nc-home-create-new-btn) is now used to add tables
+ const createNewBtn = this.sidebar.dashboard.get().locator('.nc-home-create-new-btn');
if (visible) {
- await expect(addBtn).toBeVisible();
- } else await expect(addBtn).toHaveCount(0);
+ await expect(createNewBtn).toBeVisible();
+ } else {
+ await expect(createNewBtn).toHaveCount(0);
+ }
}
async verifyProjectOptions({
@@ -165,33 +160,34 @@ export class SidebarProjectNodeObject extends BasePage {
async verifyActiveProject({ baseTitle, open = false }: { baseTitle: string; open?: boolean }) {
if (!(await this.sidebar.dashboard.leftSidebar.isMiniSidebarVisible())) return true;
- const isBaseListSidebar = await this.sidebar.dashboard.leftSidebar.verifyBaseListOpen(false);
- // If base home page sidebar is open then verify base title is same as baseTitle
- if (!isBaseListSidebar) {
- const baseLocator = await this.get({ baseTitle }).getAttribute('class');
+ const baseMiniSidebarItem = await this.sidebar.dashboard.leftSidebar.getMiniSidebarActionLocator({ type: 'base' });
- // If active project is same as baseTitle then return true
- if (baseLocator?.includes('nc-project-header')) return true;
+ const isActive = (await baseMiniSidebarItem.locator('.nc-mini-sidebar-btn').getAttribute('class')).includes(
+ 'active-base'
+ );
- if (!open) return false;
-
- // If it is not same base home page sidebar then go to base list and open
- await this.sidebar.dashboard.leftSidebar.verifyBaseListOpen(true);
+ // If base sidebar is not visible click base minisidebar icon
+ if (!isActive) {
+ await baseMiniSidebarItem.click();
}
- if (!open) return false;
+ const ncProjectHeader = this.sidebar.get().locator('.nc-project-header');
- await this.get({
- baseTitle,
- }).waitFor({ state: 'visible' });
+ await ncProjectHeader.waitFor();
- await this.get({
- baseTitle,
- }).scrollIntoViewIfNeeded();
+ const isActiveProject =
+ (await ncProjectHeader.getAttribute('data-testid')) === `nc-sidebar-base-title-${baseTitle}`;
- await this.get({
- baseTitle,
- }).click();
+ // If active project is same as baseTitle then return true
+ if (isActiveProject) return true;
+
+ if (!open) return false;
+
+ // If it is not the same base, open the base list modal and navigate to it
+ await this.sidebar.dashboard.leftSidebar.openBaseListModal();
+ await this.sidebar.dashboard.rootPage.waitForTimeout(300);
+
+ await this.sidebar.dashboard.leftSidebar.baseListModal.clickBase(baseTitle);
await this.sidebar.dashboard.leftSidebar.active_base.waitFor({ state: 'visible' });
diff --git a/tests/playwright/pages/Dashboard/TreeView.ts b/tests/playwright/pages/Dashboard/TreeView.ts
index 789ebe1c09..279a1dcdc1 100644
--- a/tests/playwright/pages/Dashboard/TreeView.ts
+++ b/tests/playwright/pages/Dashboard/TreeView.ts
@@ -24,28 +24,20 @@ export class TreeViewPage extends BasePage {
return this.dashboard.get().locator('.nc-treeview-container');
}
- getAddNewTableBtn({ baseTitle }: { baseTitle: string }) {
- return this.dashboard
- .get()
- .getByTestId(`nc-sidebar-base-title-${baseTitle}`)
- .locator('[data-testid="nc-sidebar-add-base-entity"]');
+ getAddNewTableBtn() {
+ // The createNewButton (.nc-home-create-new-btn) is now used to add tables
+ return this.createNewButton;
}
private async openProjectContextMenu({ baseTitle }: { baseTitle: string }) {
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
+ await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle, open: true });
await this.dashboard.get().getByTestId(`nc-sidebar-base-title-${baseTitle}`).hover();
const baseTitleElement = this.dashboard.get().getByTestId(`nc-sidebar-base-title-${baseTitle}`);
- if (
- (await baseTitleElement.isVisible()) &&
- !(await baseTitleElement.locator('[data-testid="nc-sidebar-context-menu"]').isVisible())
- ) {
- return await baseTitleElement.click();
- }
-
- await baseTitleElement.locator('[data-testid="nc-sidebar-context-menu"]').click();
+ return await baseTitleElement.click();
}
async isVisible() {
@@ -81,8 +73,10 @@ export class TreeViewPage extends BasePage {
}
async openBase({ title }: { title: string }) {
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
+ await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle: title, open: true });
+ // Click on the base node to expand it (show tables)
const nodes = this.get().locator(`[data-testid="nc-sidebar-base-${title.toLowerCase()}"]`);
await nodes.waitFor();
await nodes.click();
@@ -124,10 +118,12 @@ export class TreeViewPage extends BasePage {
baseTitle?: string;
sourceTitle?: string;
}) {
- await this.dashboard.leftSidebar.verifyBaseListOpen(!!baseTitle);
-
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
if (baseTitle) {
await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle, open: true });
+ } else {
+ // Just close the modal if no baseTitle is specified
+ await this.dashboard.leftSidebar.closeBaseListModal();
}
if (sourceTitle) {
@@ -189,6 +185,8 @@ export class TreeViewPage extends BasePage {
mode?: string;
baseTitle: string;
}) {
+ await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle, open: true });
+
if (type === 'script') {
await this.createNewButton.click();
await this.dashboard.get().locator('.nc-dropdown.active').waitFor();
@@ -196,35 +194,13 @@ export class TreeViewPage extends BasePage {
} else {
if (skipOpeningModal) return;
- await this.dashboard.leftSidebar.miniSidebarActionClick({ type: 'base' });
- await this.rootPage.waitForTimeout(500);
-
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
- const verifyBaseListOpen = true;
-
switch (type) {
case 'table': {
- if (verifyBaseListOpen) {
- await this.get().getByTestId(`nc-sidebar-base-title-${baseTitle}`).hover();
-
- await this.get()
- .getByTestId(`nc-sidebar-base-${baseTitle}`)
- .getByTestId('nc-sidebar-add-base-entity')
- .click();
- } else {
- const isCreateNewDropdown = (await this.createNewButton.getAttribute('class')).includes(
- 'nc-home-create-new-dropdown-btn'
- );
-
- if (!isCreateNewDropdown) {
- return await this.createNewButton.click();
- } else {
- await this.createNewButton.click();
- await this.dashboard.get().locator('.nc-dropdown.active').waitFor();
-
- await this.dashboard.get().locator('.nc-dropdown.active').getByTestId(`create-new-${type}`).click();
- }
- }
+ await this.createNewButton.click();
+ await this.dashboard.get().locator('.nc-dropdown.active').waitFor();
+
+ await this.dashboard.get().locator('.nc-dropdown.active').getByTestId(`create-new-${type}`).click();
+
break;
}
}
@@ -288,8 +264,7 @@ export class TreeViewPage extends BasePage {
baseTitle?: string;
sourceTitle?: string;
}) {
- await this.dashboard.leftSidebar.verifyBaseListOpen(!!baseTitle);
-
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
if (baseTitle) {
await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle, open: true });
}
@@ -444,12 +419,15 @@ export class TreeViewPage extends BasePage {
const count = param.role.toLowerCase() === 'creator' || param.role.toLowerCase() === 'owner' ? 1 : 0;
if (param.mode !== 'shareBase') {
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
+ await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle: param.baseTitle, open: true });
+
const pjtNode = await this.getProject({ title: param.baseTitle });
await pjtNode.hover();
- // add new table button & context menu is visible only for owner & creator
- await expect(pjtNode.locator('[data-testid="nc-sidebar-add-base-entity"]')).toHaveCount(count);
+ // createNewButton (.nc-home-create-new-btn) is visible only for owner & creator
+ // context menu is visible for all roles
+ await expect(this.createNewButton).toHaveCount(count);
await expect(pjtNode.locator('[data-testid="nc-sidebar-context-menu"]')).toHaveCount(1);
await this.openProject({ title: param.baseTitle, context });
@@ -466,17 +444,12 @@ export class TreeViewPage extends BasePage {
async openProject({ title, context }: { title: string; context: NcContext }) {
title = this.scopedProjectTitle({ title, context });
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
-
- await this.get().getByTestId(`nc-sidebar-base-title-${title}`).click();
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
+ await this.dashboard.sidebar.baseNode.verifyActiveProject({ baseTitle: title, open: true });
await this.dashboard.leftSidebar.active_base.waitFor({ state: 'visible' });
await this.rootPage.waitForTimeout(1000);
-
- // // TODO: FIx why base click is not always registering
- // await this.get().getByTestId(`nc-sidebar-base-title-${title}`).click();
- // await this.rootPage.waitForTimeout(1000);
}
scopedProjectTitle({ title, context }: { title: string; context: NcContext }) {
@@ -495,8 +468,7 @@ export class TreeViewPage extends BasePage {
param.title = this.scopedProjectTitle({ title: param.title, context: param.context });
param.newTitle = this.scopedProjectTitle({ title: param.newTitle, context: param.context });
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
-
+ // openProjectContextMenu ensures the base is active in the sidebar
await this.openProjectContextMenu({ baseTitle: param.title });
const contextMenu = this.dashboard.get().locator('.ant-dropdown-menu.nc-scrollbar-md:visible').last();
await contextMenu.waitFor();
@@ -509,10 +481,9 @@ export class TreeViewPage extends BasePage {
}
async deleteProject(param: { title: string; context: NcContext }) {
- await this.dashboard.leftSidebar.verifyBaseListOpen(true);
-
param.title = this.scopedProjectTitle({ title: param.title, context: param.context });
+ // openProjectContextMenu ensures the base is active in the sidebar
await this.openProjectContextMenu({ baseTitle: param.title });
const contextMenu = this.dashboard.get().locator('.ant-dropdown-menu.nc-scrollbar-md:visible').last();
await contextMenu.waitFor();
diff --git a/tests/playwright/pages/Dashboard/common/BaseListModal/index.ts b/tests/playwright/pages/Dashboard/common/BaseListModal/index.ts
new file mode 100644
index 0000000000..c82a91dfe0
--- /dev/null
+++ b/tests/playwright/pages/Dashboard/common/BaseListModal/index.ts
@@ -0,0 +1,213 @@
+import { expect, Locator } from '@playwright/test';
+import { DashboardPage } from '../../index';
+import BasePage from '../../../Base';
+import { isEE } from '../../../../setup/db';
+
+export class BaseListModalPage extends BasePage {
+ readonly dashboard: DashboardPage;
+ readonly modal: Locator;
+
+ constructor(dashboard: DashboardPage) {
+ super(dashboard.rootPage);
+ this.dashboard = dashboard;
+ this.modal = this.rootPage.locator('.nc-workspace-base-list-modal-wrapper');
+ }
+
+ get() {
+ return this.modal;
+ }
+
+ async isOpen() {
+ return this.modal.isVisible();
+ }
+
+ async waitForOpen() {
+ await this.modal.waitFor({ state: 'visible' });
+ // Wait for modal animation to complete
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ async waitForClose() {
+ await this.modal.waitFor({ state: 'hidden' });
+ }
+
+ async close() {
+ if (await this.isOpen()) {
+ await this.rootPage.keyboard.press('Escape');
+ await this.waitForClose();
+ }
+ }
+
+ async searchBases(query: string) {
+ const searchInput = this.modal.locator('.nc-workspace-base-search input');
+ await searchInput.fill(query);
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ async clearSearch() {
+ const searchInput = this.modal.locator('.nc-workspace-base-search input');
+ await searchInput.clear();
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ // Base operations
+ getBaseNode(baseTitle: string): Locator {
+ // Use data-testid for precise matching
+ return this.modal.getByTestId(`nc-base-list-modal-base-title-${baseTitle}`);
+ }
+
+ getBaseNodeById(baseId: string): Locator {
+ // Use data-id for matching by base ID
+ return this.modal.locator(`.nc-base-node[data-id="${baseId}"]`);
+ }
+
+ async clickBase(baseTitle: string) {
+ const baseNode = this.getBaseNode(baseTitle);
+ await baseNode.waitFor({ state: 'visible' });
+ await baseNode.scrollIntoViewIfNeeded();
+ await baseNode.click();
+
+ await this.waitForClose();
+ }
+
+ async openBaseMenu(baseTitle: string) {
+ const baseNode = this.getBaseNode(baseTitle);
+ await baseNode.hover();
+ await baseNode.locator('.nc-base-node-menu-btn').click();
+ await this.rootPage.waitForTimeout(200);
+ }
+
+ async renameBase(baseTitle: string, newTitle: string) {
+ await this.openBaseMenu(baseTitle);
+ await this.rootPage.getByTestId('nc-base-node-rename').click();
+ const baseNode = this.getBaseNode(baseTitle);
+ const input = baseNode.locator('input');
+ await input.fill(newTitle);
+ await input.press('Enter');
+ await this.rootPage.waitForTimeout(500);
+ }
+
+ async toggleBaseStarred(baseTitle: string) {
+ await this.openBaseMenu(baseTitle);
+ await this.rootPage.getByTestId('nc-base-node-starred').click();
+ await this.rootPage.waitForTimeout(500);
+ }
+
+ async duplicateBase(baseTitle: string) {
+ await this.openBaseMenu(baseTitle);
+ await this.rootPage.getByTestId('nc-base-node-duplicate').click();
+ }
+
+ async openBaseErd(baseTitle: string) {
+ await this.openBaseMenu(baseTitle);
+ await this.rootPage.getByTestId('nc-base-node-erd').click();
+ }
+
+ async openBaseSettings(baseTitle: string) {
+ await this.openBaseMenu(baseTitle);
+ await this.rootPage.getByTestId('nc-base-node-settings').click();
+ await this.waitForClose();
+ }
+
+ async deleteBase(baseTitle: string) {
+ await this.openBaseMenu(baseTitle);
+ await this.rootPage.getByTestId('nc-base-node-delete').click();
+ }
+
+ // Workspace operations (EE only)
+ getWorkspaceNode(workspaceTitle: string): Locator {
+ // Use the title class for precise matching
+ return this.modal.locator('.nc-workspace-node').filter({
+ has: this.rootPage.locator('.nc-workspace-node-title', { hasText: workspaceTitle }),
+ });
+ }
+
+ async isWorkspaceSelected(workspaceTitle: string): Promise<boolean> {
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ const classAttr = await workspaceNode.getAttribute('class');
+ return classAttr?.includes('nc-selected-workspace-node') ?? false;
+ }
+
+ async selectWorkspace(workspaceTitle: string) {
+ if (!isEE()) return;
+
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ await workspaceNode.click();
+ await this.rootPage.waitForTimeout(500);
+ }
+
+ async switchWorkspace(workspaceTitle: string) {
+ if (!isEE()) return;
+
+ // Check if this workspace is already selected/active
+ if (await this.isWorkspaceSelected(workspaceTitle)) {
+ // Already on this workspace, just close the modal
+ await this.close();
+ return;
+ }
+
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ // Click the navigate icon to switch to workspace
+ await workspaceNode.locator('.nc-workspace-node-navigate-icon').click();
+ await this.rootPage.waitForTimeout(1000);
+ }
+
+ async createWorkspace() {
+ if (!isEE()) return;
+
+ const createBtn = this.modal.locator('button:has-text("New Workspace")');
+ await createBtn.click();
+ }
+
+ /**
+ * Click the create base button in the modal header
+ */
+ async clickCreateBase() {
+ const createBtn = this.modal.locator('[data-testid="nc-sidebar-create-base-btn"]');
+ await createBtn.click();
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ /**
+ * Opens the create base menu using keyboard shortcut (Option/Alt + D)
+ * This works from anywhere in the app, modal doesn't need to be open
+ */
+ async openCreateBaseMenuViaShortcut() {
+ await this.rootPage.keyboard.press('Alt+d');
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ // Filter operations
+ async setFilter(filter: 'all' | 'starred' | 'private' | 'owned' | 'managed') {
+ const filterDropdown = this.modal.locator('.nc-bases-header [data-testid="nc-base-filter-dropdown"]');
+ await filterDropdown.click();
+ await this.rootPage.waitForTimeout(200);
+
+ const filterOption = this.rootPage.locator(`.ant-dropdown:visible .ant-dropdown-menu-item:has-text("${filter}")`);
+ await filterOption.click();
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ // Verification methods
+ async verifyBaseExists(baseTitle: string) {
+ const baseNode = this.getBaseNode(baseTitle);
+ await expect(baseNode).toBeVisible();
+ }
+
+ async verifyBaseNotExists(baseTitle: string) {
+ const baseNode = this.getBaseNode(baseTitle);
+ await expect(baseNode).not.toBeVisible();
+ }
+
+ async verifyBaseCount(count: number) {
+ const baseNodes = this.modal.locator('.nc-base-node');
+ await expect(baseNodes).toHaveCount(count);
+ }
+
+ async verifyWorkspaceSelected(workspaceTitle: string) {
+ if (!isEE()) return;
+
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ await expect(workspaceNode).toHaveClass(/nc-selected-workspace-node/);
+ }
+}
diff --git a/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts b/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
index 0f31b13e95..80d87f5793 100644
--- a/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
+++ b/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
@@ -1,9 +1,9 @@
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';
+import { BaseListModalPage } from '../BaseListModal';
type MiniSidebarActionType =
| 'ws'
@@ -20,6 +20,7 @@ type MiniSidebarActionType =
export class LeftSidebarPage extends BasePage {
readonly base: any;
readonly dashboard: DashboardPage;
+ readonly baseListModal: BaseListModalPage;
readonly btn_workspace: Locator;
readonly btn_newProject: Locator;
@@ -27,6 +28,7 @@ export class LeftSidebarPage extends BasePage {
readonly btn_teamAndSettings: Locator;
readonly modal_workspace: Locator;
+ readonly modal_baseList: Locator;
readonly miniSidebar: Locator;
@@ -35,13 +37,17 @@ export class LeftSidebarPage extends BasePage {
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
+ this.baseListModal = new BaseListModalPage(dashboard);
this.btn_workspace = this.get().locator('.nc-workspace-menu');
- this.btn_newProject = this.get().locator('[data-testid="nc-sidebar-create-base-btn"]');
+ // Create button is now inside the modal's header, not the sidebar
+ // Using rootPage to search anywhere in the page (modal or sidebar)
+ this.btn_newProject = this.rootPage.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');
+ this.modal_baseList = this.rootPage.locator('.nc-workspace-base-list-modal-wrapper');
this.miniSidebar = this.dashboard.get().locator('[data-testid="nc-mini-sidebar"]');
@@ -64,25 +70,51 @@ export class LeftSidebarPage extends BasePage {
return (await this.miniSidebar.count()) > 0;
}
+ /**
+ * Opens or verifies the base list modal is open
+ * @param open - If true, opens the modal if it's not already open
+ * @returns boolean indicating if modal is open
+ */
async verifyBaseListOpen(open: boolean = false) {
if (!(await this.isNewSidebar())) return true;
- if (!(await this.get().isVisible())) {
- await this.miniSidebarActionClick({ type: 'base' });
+ const isModalOpen = await this.modal_baseList.isVisible();
+
+ if (!isModalOpen && open) {
+ // Click workspace menu to open the base list modal
+ await this.miniSidebarActionClick({ type: 'ws' });
+ await this.baseListModal.waitForOpen();
}
- const classAttr = await this.get().locator('.nc-treeview-container').getAttribute('class');
+ // Wait for the modal transition to complete
+ await this.rootPage.waitForTimeout(300);
- const isListOpen = classAttr?.includes('nc-treeview-container-base-list') ?? false;
+ return await this.modal_baseList.isVisible();
+ }
- if (!isListOpen && open) {
- await this.miniSidebarActionClick({ type: 'base' });
+ /**
+ * Opens the base list modal
+ */
+ async openBaseListModal() {
+ if (!(await this.modal_baseList.isVisible())) {
+ await this.miniSidebarActionClick({ type: 'ws' });
+ await this.baseListModal.waitForOpen();
}
+ }
- // Wait for the sidebar list transition to complete
- await this.rootPage.waitForTimeout(500);
+ /**
+ * Closes the base list modal if open
+ */
+ async closeBaseListModal() {
+ await this.baseListModal.close();
+ }
- return isListOpen;
+ /**
+ * Opens the create base menu using keyboard shortcut (Option/Alt + D)
+ */
+ async openCreateBaseMenuViaShortcut() {
+ await this.rootPage.keyboard.press('Alt+d');
+ await this.rootPage.waitForTimeout(300);
}
async createProject({ title, context }: { title: string; context: NcContext }) {
@@ -146,10 +178,15 @@ export class LeftSidebarPage extends BasePage {
}
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();
+ // Open the base list modal
+ await this.openBaseListModal();
+
+ // Click the "New Workspace" button in the modal
+ const newWorkspaceBtn = this.modal_baseList.locator('button:has-text("New Workspace")');
+ await newWorkspaceBtn.waitFor();
+ await newWorkspaceBtn.click();
+ // Fill in the workspace creation dialog
const inputModal = this.rootPage.locator('div.ant-modal.active');
await inputModal.waitFor();
await inputModal.locator('input').clear();
@@ -158,43 +195,72 @@ export class LeftSidebarPage extends BasePage {
}
async verifyWorkspaceCount({ count }: { count: number }) {
- await this.clickWorkspace();
+ // Open the base list modal
+ await this.openBaseListModal();
+
+ // Count workspace nodes in the modal
+ const workspaceNodes = this.modal_baseList.locator('.nc-workspace-node');
+ await expect(workspaceNodes).toHaveCount(count);
- // TODO: THere is one extra html attribute
- await expect(this.rootPage.getByTestId('nc-workspace-list')).toHaveCount(count + 1);
+ // Close the modal
+ await this.closeBaseListModal();
+ }
+
+ getWorkspaceNode(workspaceTitle: string) {
+ // Use the title class for precise matching
+ return this.modal_baseList.locator('.nc-workspace-node').filter({
+ has: this.rootPage.locator('.nc-workspace-node-title', { hasText: workspaceTitle }),
+ });
+ }
+
+ async isWorkspaceSelected(workspaceTitle: string): Promise<boolean> {
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ const classAttr = await workspaceNode.getAttribute('class');
+ return classAttr?.includes('nc-selected-workspace-node') ?? false;
}
async getWorkspaceList() {
- const ws = [];
- await this.clickWorkspace();
- const nodes = this.modal_workspace.locator('[data-testid="nc-workspace-list"]');
+ const ws: string[] = [];
+
+ // Open the base list modal
+ await this.openBaseListModal();
+
+ // Get workspace titles from the modal using the title class
+ const titles = this.modal_baseList.locator('.nc-workspace-node-title');
+ const count = await titles.count();
- for (let i = 0; i < (await nodes.count()); i++) {
- ws.push(await getTextExcludeIconText(nodes.nth(i)));
+ for (let i = 0; i < count; i++) {
+ const title = await titles.nth(i).textContent();
+ if (title) ws.push(title.trim());
}
- ws.push(await this.getWorkspaceName());
- await this.rootPage.keyboard.press('Escape');
+ // Close the modal
+ await this.closeBaseListModal();
return ws;
}
- async openWorkspace(param: { title: any }) {
- await this.clickWorkspace();
- const nodes = this.modal_workspace.locator('[data-testid="nc-workspace-list"]');
+ async openWorkspace(param: { title: string }) {
+ // Open the base list modal
+ await this.openBaseListModal();
+ await this.rootPage.waitForTimeout(300);
- await this.rootPage.waitForTimeout(2000);
-
- for (let i = 0; i < (await nodes.count()); i++) {
- const text = await getTextExcludeIconText(nodes.nth(i).getByTestId('nc-workspace-list-title'));
- if (text.toLowerCase() === param.title.toLowerCase()) {
- await nodes.nth(i).click({ force: true });
- break;
- }
+ // Check if this workspace is already selected/active
+ if (await this.isWorkspaceSelected(param.title)) {
+ // Already on this workspace, just close the modal
+ await this.closeBaseListModal();
+ return;
}
- await this.rootPage.keyboard.press('Escape');
- await this.rootPage.waitForTimeout(3500);
+ // Find and click the navigate icon for the workspace
+ const workspaceNode = this.getWorkspaceNode(param.title);
+ await workspaceNode.locator('.nc-workspace-node-navigate-icon').click();
+
+ // Wait for navigation
+ await this.rootPage.waitForTimeout(2000);
+
+ // Close modal if still open
+ await this.closeBaseListModal();
}
async getMiniSidebarActionLocator({ type }: { type: MiniSidebarActionType }): Promise<Locator | undefined> {
diff --git a/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts b/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts
index cfe7fa9899..66da523d79 100644
--- a/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts
+++ b/tests/playwright/pages/Dashboard/common/WorkspaceMenu/index.ts
@@ -10,21 +10,84 @@ export class WorkspaceMenuObject extends BasePage {
}
get() {
- return this.rootPage.locator(`.nc-dropdown-workspace-menu`);
+ // Return the new base list modal instead of dropdown
+ return this.rootPage.locator(`.nc-workspace-base-list-modal-wrapper`);
+ }
+
+ getModal() {
+ return this.rootPage.locator('.nc-workspace-base-list-modal-wrapper');
+ }
+
+ async isModalOpen() {
+ return this.getModal().isVisible();
}
async toggle() {
await this.rootPage.locator('[data-testid="nc-workspace-menu"]').click();
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ async openModal() {
+ if (!(await this.isModalOpen())) {
+ await this.toggle();
+ await this.getModal().waitFor({ state: 'visible' });
+ }
+ }
+
+ async closeModal() {
+ if (await this.isModalOpen()) {
+ await this.rootPage.keyboard.press('Escape');
+ await this.getModal().waitFor({ state: 'hidden' });
+ }
+ }
+
+ getWorkspaceNode(workspaceTitle: string) {
+ // Use the title class for precise matching
+ return this.getModal()
+ .locator('.nc-workspace-node')
+ .filter({
+ has: this.rootPage.locator('.nc-workspace-node-title', { hasText: workspaceTitle }),
+ });
+ }
+
+ async isWorkspaceSelected(workspaceTitle: string): Promise<boolean> {
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ const classAttr = await workspaceNode.getAttribute('class');
+ return classAttr?.includes('nc-selected-workspace-node') ?? false;
}
async switchWorkspace({ workspaceTitle }: { workspaceTitle: string }) {
- await this.toggle();
- await this.rootPage.waitForTimeout(2500);
- await this.rootPage.locator('.ant-dropdown-menu').getByTestId('nc-workspace-list').getByText(workspaceTitle).click({
- force: true,
- });
- await this.rootPage.keyboard.press('Escape');
- await this.rootPage.waitForTimeout(4000);
+ // Open the base list modal
+ await this.openModal();
+ await this.rootPage.waitForTimeout(300);
+
+ // Check if this workspace is already selected/active
+ if (await this.isWorkspaceSelected(workspaceTitle)) {
+ // Already on this workspace, just close the modal
+ await this.closeModal();
+ return;
+ }
+
+ // Click the navigate icon to switch to workspace
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ await workspaceNode.locator('.nc-workspace-node-navigate-icon').click();
+
+ await this.rootPage.waitForTimeout(2000);
+
+ // Close modal if still open
+ await this.closeModal();
+ }
+
+ async selectWorkspace({ workspaceTitle }: { workspaceTitle: string }) {
+ // Open the base list modal
+ await this.openModal();
+ await this.rootPage.waitForTimeout(300);
+
+ // Click the workspace node to select (view its bases, not navigate)
+ const workspaceNode = this.getWorkspaceNode(workspaceTitle);
+ await workspaceNode.click();
+
+ await this.rootPage.waitForTimeout(500);
}
async click({ menu, subMenu }: { menu: string; subMenu: string }) {
@@ -45,4 +108,31 @@ export class WorkspaceMenuObject extends BasePage {
});
await this.rootPage.waitForTimeout(2500);
}
+
+ // Base operations through the modal
+ async clickBase({ baseTitle }: { baseTitle: string }) {
+ await this.openModal();
+ await this.rootPage.waitForTimeout(300);
+
+ const baseNode = this.getModal().locator('.nc-base-node').filter({ hasText: baseTitle });
+ await baseNode.click();
+
+ // Modal should close after selecting a base
+ await this.rootPage.waitForTimeout(500);
+ }
+
+ async searchBases(query: string) {
+ await this.openModal();
+ const searchInput = this.getModal().locator('.nc-workspace-base-search input');
+ await searchInput.fill(query);
+ await this.rootPage.waitForTimeout(300);
+ }
+
+ /**
+ * Opens the create base menu using keyboard shortcut (Option/Alt + D)
+ */
+ async openCreateBaseMenuViaShortcut() {
+ await this.rootPage.keyboard.press('Alt+d');
+ await this.rootPage.waitForTimeout(300);
+ }
}
diff --git a/tests/playwright/pages/Dashboard/index.ts b/tests/playwright/pages/Dashboard/index.ts
index d7de696f7d..0ce4d30efb 100644
--- a/tests/playwright/pages/Dashboard/index.ts
+++ b/tests/playwright/pages/Dashboard/index.ts
@@ -115,8 +115,8 @@ export class DashboardPage extends BasePage {
}
async clickOnBaseMenuLink() {
- // Open base list sidebar if it is not open
- await this.leftSidebar.verifyBaseListOpen(true);
+ // Ensure the base is active/open in the sidebar (opens from modal if needed)
+ await this.sidebar.baseNode.verifyActiveProject({ baseTitle: this.base.title, open: true });
const baseMenuLocator = this.rootPage.locator(`.base-title-node:has-text("${this.base.title}")`).first();
@@ -124,7 +124,7 @@ export class DashboardPage extends BasePage {
await baseMenuLocator.scrollIntoViewIfNeeded();
await baseMenuLocator.hover();
- await baseMenuLocator.locator('[data-testid="nc-sidebar-context-menu"]').first().click();
+ await baseMenuLocator.click();
}
async verifyTeamAndSettingsLinkIsVisible() {
diff --git a/tests/playwright/pages/WorkspacePage/CollaborationPage.ts b/tests/playwright/pages/WorkspacePage/CollaborationPage.ts
index 5439ab31fe..26977a7f01 100644
--- a/tests/playwright/pages/WorkspacePage/CollaborationPage.ts
+++ b/tests/playwright/pages/WorkspacePage/CollaborationPage.ts
@@ -42,8 +42,15 @@ export class CollaborationPage extends BasePage {
// flaky test: wait for the input to be ready
await this.rootPage.waitForTimeout(500);
- // email
- await input_email.fill(email + ' ');
+ // email - use clipboard paste instead of fill for more reliable input
+ const emailWithSpace = email + ' ';
+ await this.rootPage.evaluate(async text => {
+ await navigator.clipboard.writeText(text);
+ }, emailWithSpace);
+ await input_email.focus();
+ // Use platform-specific paste shortcut
+ const modifier = process.platform === 'darwin' ? 'Meta' : 'Control';
+ await this.rootPage.keyboard.press(`${modifier}+v`);
// role
await selector_role.first().click();
diff --git a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts
index 07fa5ef2f3..b8d3977ce7 100644
--- a/tests/playwright/tests/db/columns/columnUserSelect.spec.ts
+++ b/tests/playwright/tests/db/columns/columnUserSelect.spec.ts
@@ -47,9 +47,8 @@ async function beforeEachInit({ page }: { page: any }) {
await dashboard.leftSidebar.clickTeamAndSettings();
- for (const user of roleDb) {
- await collaborationPage.addUsers(user.email, user.role);
- }
+ // Since all are editor role, add bulk users
+ await collaborationPage.addUsers(users.join(', '), 'editor');
}
return { dashboard, context, api };