Skip to content

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

fix(nc-gui): some ws collaboration test

Ramesh Mane3b7ecc9eaae5
diff --git a/packages/nc-gui/components/dashboard/TreeView/Project/CreateNewMenu.vue b/packages/nc-gui/components/dashboard/TreeView/Project/CreateNewMenu.vue
index c8e721e2f0..0746121ea0 100644
--- a/packages/nc-gui/components/dashboard/TreeView/Project/CreateNewMenu.vue
+++ b/packages/nc-gui/components/dashboard/TreeView/Project/CreateNewMenu.vue
@@ -28,7 +28,7 @@ const showBaseOption = (source: SourceType) => {
</script>
<template>
- <NcMenu variant="large" @click="vVisible = false">
+ <NcMenu variant="large" @click="vVisible = false" data-testid="nc-home-create-new-menu">
<NcMenuItem inner-class="w-full" class="nc-menu-item-combo" data-testid="create-new-table" @click="emits('newTable')">
<div class="w-full flex items-center">
<div class="flex-1 flex items-center gap-2 cursor-pointer">
diff --git a/packages/nc-gui/components/dashboard/TreeView/Project/Home.vue b/packages/nc-gui/components/dashboard/TreeView/Project/Home.vue
index e88f9b3860..89ce8a02eb 100644
--- a/packages/nc-gui/components/dashboard/TreeView/Project/Home.vue
+++ b/packages/nc-gui/components/dashboard/TreeView/Project/Home.vue
@@ -284,6 +284,7 @@ const hasTableCreatePermission = computed(() => {
class="nc-home-create-new-btn nc-home-create-new-dropdown-btn !text-brand-500 !hover:(text-brand-600) !xs:hidden !w-full !px-3"
:class="isVisibleCreateNew ? 'active' : ''"
icon-position="right"
+ data-testid="nc-home-create-new-btn"
>
<template #icon>
<GeneralIcon icon="chevronDown" class="flex-none" />
diff --git a/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts b/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts
index 9c998b5d17..2b951c3baf 100644
--- a/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts
+++ b/tests/playwright/pages/Dashboard/Sidebar/ProjectNode/index.ts
@@ -66,6 +66,7 @@ export class SidebarProjectNodeObject extends BasePage {
settingsVisible,
deleteVisible,
copyProjectInfoVisible,
+ clickBaseTitle = true,
}: {
baseTitle: string;
renameVisible?: boolean;
@@ -77,6 +78,7 @@ export class SidebarProjectNodeObject extends BasePage {
settingsVisible?: boolean;
deleteVisible?: boolean;
copyProjectInfoVisible?: boolean;
+ clickBaseTitle?: boolean;
}) {
await this.get({
baseTitle,
@@ -151,8 +153,12 @@ export class SidebarProjectNodeObject extends BasePage {
if (copyProjectInfoVisible) await expect(copyProjectInfoLocator).toBeVisible();
else await expect(copyProjectInfoLocator).toHaveCount(0);
- await this.get({
- baseTitle,
- }).click();
+ if (clickBaseTitle) {
+ await this.get({
+ baseTitle,
+ }).click();
+ } else {
+ await this.clickOptions({ baseTitle });
+ }
}
}
diff --git a/tests/playwright/pages/Dashboard/Sidebar/index.ts b/tests/playwright/pages/Dashboard/Sidebar/index.ts
index b1eafeb8a2..05eea8ebd6 100644
--- a/tests/playwright/pages/Dashboard/Sidebar/index.ts
+++ b/tests/playwright/pages/Dashboard/Sidebar/index.ts
@@ -53,6 +53,8 @@ export class SidebarPage extends BasePage {
}
async verifyCreateProjectBtn({ isVisible }: { isVisible: boolean }) {
+ await this.dashboard.leftSidebar.verifyBaseListOpen(true);
+
if (isVisible) await expect(this.createProjectBtn).toBeVisible();
else await expect(this.createProjectBtn).toHaveCount(0);
}
@@ -68,11 +70,15 @@ export class SidebarPage extends BasePage {
title,
type,
networkValidation = true,
+ navigateTobase = true,
}: {
title: string;
type: ProjectTypes;
networkValidation?: boolean;
+ navigateTobase?: boolean;
}) {
+ await this.dashboard.leftSidebar.verifyBaseListOpen(true);
+
await this.createProjectBtn.click();
if (type === ProjectTypes.DOCUMENTATION) {
await this.dashboard.get().locator('.nc-create-base-btn-docs').click();
@@ -99,6 +105,13 @@ export class SidebarPage extends BasePage {
if (type === ProjectTypes.DOCUMENTATION) {
await this.dashboard.docs.pagesList.waitForOpen({ title });
}
+
+ // By default we navigate to base home page sidebar
+ // If we want to show base list then wait for base homepage sidebar load and then try to show baselist sidebar
+ if (!navigateTobase) {
+ await this.dashboard.leftSidebar.active_base.waitFor({ state: 'visible' });
+ await this.dashboard.leftSidebar.verifyBaseListOpen(true);
+ }
}
async createView({ title, type }: { title: string; type: ViewTypes }) {
diff --git a/tests/playwright/pages/Dashboard/TreeView.ts b/tests/playwright/pages/Dashboard/TreeView.ts
index 0ee2892d34..cb16f6f277 100644
--- a/tests/playwright/pages/Dashboard/TreeView.ts
+++ b/tests/playwright/pages/Dashboard/TreeView.ts
@@ -391,7 +391,7 @@ export class TreeViewPage extends BasePage {
await this.get().getByTestId(`nc-sidebar-base-title-${title}`).click();
- await this.dashboard.leftSidebar.action_base.waitFor({ state: 'visible' });
+ await this.dashboard.leftSidebar.active_base.waitFor({ state: 'visible' });
await this.rootPage.waitForTimeout(1000);
diff --git a/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts b/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
index 078147c691..75bc2883f2 100644
--- a/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
+++ b/tests/playwright/pages/Dashboard/common/LeftSidebar/index.ts
@@ -5,6 +5,18 @@ import { getTextExcludeIconText } from '../../../../tests/utils/general';
import { isEE } from '../../../../setup/db';
import { NcContext } from '../../../../setup';
+type MiniSidebarActionType =
+ | 'ws'
+ | 'base'
+ | 'cmd-k'
+ | 'cmd-l'
+ | 'cmd-j'
+ | 'teamAndSettings'
+ | 'integration'
+ | 'feeds'
+ | 'notification'
+ | 'userInfo';
+
export class LeftSidebarPage extends BasePage {
readonly base: any;
readonly dashboard: DashboardPage;
@@ -18,7 +30,7 @@ export class LeftSidebarPage extends BasePage {
readonly miniSidebar: Locator;
- readonly action_base: Locator;
+ readonly active_base: Locator;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
@@ -33,7 +45,7 @@ export class LeftSidebarPage extends BasePage {
this.miniSidebar = this.dashboard.get().getByTestId('nc-mini-sidebar');
- this.action_base = this.get().locator('.nc-treeview-container.nc-treeview-container-active-base');
+ this.active_base = this.get().locator('.nc-treeview-container.nc-treeview-container-active-base');
}
get() {
@@ -177,11 +189,34 @@ export class LeftSidebarPage extends BasePage {
await this.rootPage.waitForTimeout(3500);
}
+ async getMiniSidebarActionLocator({ type }: { type: MiniSidebarActionType }): Promise<Locator | undefined> {
+ if (!(await this.isNewSidebar())) {
+ return undefined;
+ }
+
+ await this.miniSidebar.waitFor();
+
+ const locators = {
+ ws: this.miniSidebar.getByTestId('nc-workspace-menu'),
+ base: this.miniSidebar.getByTestId('nc-sidebar-project-btn'),
+ 'cmd-k': this.miniSidebar.getByTestId('nc-sidebar-cmd-k-btn'),
+ 'cmd-l': this.miniSidebar.getByTestId('nc-sidebar-cmd-l-btn'),
+ 'cmd-j': this.miniSidebar.getByTestId('nc-sidebar-cmd-j-btn'),
+ teamAndSettings: this.miniSidebar.getByTestId('nc-sidebar-team-settings-btn'),
+ integration: this.miniSidebar.getByTestId('nc-sidebar-integrations-btn'),
+ feeds: this.miniSidebar.getByTestId('nc-sidebar-product-feed'),
+ notification: this.miniSidebar.getByTestId('nc-sidebar-notification-btn'),
+ userInfo: this.miniSidebar.getByTestId('nc-sidebar-userinfo'),
+ };
+
+ return locators[type];
+ }
+
async miniSidebarActionClick({
type,
fallback,
}: {
- type: 'ws' | 'base' | 'cmd-k' | 'teamAndSettings' | 'integration' | 'feeds' | 'notification' | 'userInfo';
+ type: MiniSidebarActionType;
fallback?: () => Promise<void>;
}): Promise<boolean | void> {
if (!(await this.isNewSidebar())) {
@@ -194,40 +229,28 @@ export class LeftSidebarPage extends BasePage {
await this.miniSidebar.waitFor();
- switch (type) {
- case 'ws': {
- await this.miniSidebar.getByTestId('nc-workspace-menu').click();
- break;
- }
- case 'base': {
- await this.miniSidebar.getByTestId('nc-sidebar-project-btn').click();
- break;
- }
- case 'cmd-k': {
- await this.miniSidebar.getByTestId('nc-sidebar-cmd-k-btn').click();
- break;
- }
- case 'teamAndSettings': {
- await this.miniSidebar.getByTestId('nc-sidebar-team-settings-btn').click();
- break;
- }
- case 'integration': {
- await this.miniSidebar.getByTestId('nc-sidebar-integrations-btn').click();
- break;
- }
- case 'feeds': {
- await this.miniSidebar.getByTestId('nc-sidebar-product-feed').click();
- break;
- }
- case 'notification': {
- await this.miniSidebar.getByTestId('nc-sidebar-notification-btn').click();
- break;
- }
- case 'userInfo': {
- await this.miniSidebar.getByTestId('nc-sidebar-userinfo').click();
- break;
- }
+ const miniSidebarActionLocator = await this.getMiniSidebarActionLocator({ type });
+
+ if (miniSidebarActionLocator) {
+ await miniSidebarActionLocator.click();
}
+
await this.rootPage.waitForTimeout(400);
}
+
+ async verifyMiniSidebarActions({
+ types = [],
+ isVisible = true,
+ }: {
+ types: MiniSidebarActionType[];
+ isVisible: boolean;
+ }) {
+ for (const type of types) {
+ const locator = await this.getMiniSidebarActionLocator({ type });
+
+ console.log('locator', locator);
+ if (isVisible) await expect(locator).toBeVisible();
+ else await expect(locator).not.toBeVisible();
+ }
+ }
}
diff --git a/tests/playwright/pages/WorkspacePage/index.ts b/tests/playwright/pages/WorkspacePage/index.ts
index b0689c5c17..b65daba72b 100644
--- a/tests/playwright/pages/WorkspacePage/index.ts
+++ b/tests/playwright/pages/WorkspacePage/index.ts
@@ -169,7 +169,9 @@ export class WorkspacePage extends BasePage {
expect(await settings.isVisible()).toBeTruthy();
} else {
expect(await billing.isVisible()).toBeFalsy();
- expect(await settings.isVisible()).toBeFalsy();
+
+ // Settings tab is visible for all users in the workspace
+ expect(await settings.isVisible()).toBeTruthy();
}
await this.rootPage.waitForTimeout(1000);