From ec3ea3ecbff2bb0e23ed1a0b25fdc6d7780640cf Mon Sep 17 00:00:00 2001
From: Raju Udava <86527202+dstala@users.noreply.github.com>
Date: Thu, 15 Jun 2023 19:35:16 +0530
Subject: [PATCH] test: link extended
Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
---
.../nc-gui/components/virtual-cell/Links.vue | 6 ++-
.../pages/Dashboard/common/Cell/index.ts | 38 +++++++++++--------
.../db/columnRelationalExtendedTests.spec.ts | 1 +
3 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/packages/nc-gui/components/virtual-cell/Links.vue b/packages/nc-gui/components/virtual-cell/Links.vue
index fee954d0ee..08230d01ce 100644
--- a/packages/nc-gui/components/virtual-cell/Links.vue
+++ b/packages/nc-gui/components/virtual-cell/Links.vue
@@ -65,7 +65,11 @@ const onAttachRecord = () => {
diff --git a/tests/playwright/pages/Dashboard/common/Cell/index.ts b/tests/playwright/pages/Dashboard/common/Cell/index.ts
index a86f273270..f5f39d934b 100644
--- a/tests/playwright/pages/Dashboard/common/Cell/index.ts
+++ b/tests/playwright/pages/Dashboard/common/Cell/index.ts
@@ -77,9 +77,9 @@ export class CellPageObject extends BasePage {
}
async inCellExpand({ index, columnHeader }: CellProps) {
- await this.get({ index, columnHeader }).hover();
+ // await this.get({ index, columnHeader }).hover();
await this.waitForResponse({
- uiAction: () => this.get({ index, columnHeader }).locator('.nc-action-icon >> nth=0').click(),
+ uiAction: () => this.get({ index, columnHeader }).locator('.nc-datatype-link').click(),
requestUrlPathToMatch: '/api/v1/db/data/noco/',
httpMethodsToMatch: ['GET'],
});
@@ -268,39 +268,47 @@ export class CellPageObject extends BasePage {
async verifyVirtualCell({
index,
columnHeader,
+ type,
count,
value,
verifyChildList = false,
}: CellProps & {
count?: number;
+ type?: 'hm' | 'bt' | 'mm';
value: string[];
verifyChildList?: boolean;
}) {
- // const count = value.length;
const cell = await this.get({ index, columnHeader });
- const chips = cell.locator('.chips > .chip');
+ const linkText = await cell.locator('.nc-datatype-link');
- await this.get({ index, columnHeader }).scrollIntoViewIfNeeded();
+ await cell.scrollIntoViewIfNeeded();
- // verify chip count & contents
- if (count) await expect(chips).toHaveCount(count);
+ if (type === 'bt') {
+ const chips = cell.locator('.chips > .chip');
+ console.log('chips', await chips.count());
+ await expect(await chips.count()).toBe(count);
- // verify only the elements that are passed in
- for (let i = 0; i < value.length; ++i) {
- await chips.nth(i).locator('.name').waitFor({ state: 'visible' });
- await chips.nth(i).locator('.name').scrollIntoViewIfNeeded();
- await expect(await chips.nth(i).locator('.name')).toHaveText(value[i]);
+ for (let i = 0; i < value.length; ++i) {
+ await chips.nth(i).locator('.name').waitFor({ state: 'visible' });
+ await chips.nth(i).locator('.name').scrollIntoViewIfNeeded();
+ await expect(await chips.nth(i).locator('.name')).toHaveText(value[i]);
+ }
+ return;
+ }
+
+ // verify chip count & contents
+ if (count) {
+ await expect(await cell.innerText()).toContain(`${count} ${count === 1 ? 'Link' : 'Links'}`);
}
if (verifyChildList) {
// open child list
await this.get({ index, columnHeader }).hover();
- const arrow_expand = await this.get({ index, columnHeader }).locator('.nc-arrow-expand');
// arrow expand doesn't exist for bt columns
- if (await arrow_expand.count()) {
+ if (await linkText.count()) {
await this.waitForResponse({
- uiAction: () => arrow_expand.click(),
+ uiAction: () => linkText.click(),
requestUrlPathToMatch: '/api/v1/db',
httpMethodsToMatch: ['GET'],
});
diff --git a/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts b/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts
index 25fb924d66..c636d41efe 100644
--- a/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts
+++ b/tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts
@@ -65,6 +65,7 @@ test.describe('Relational Columns', () => {
await dashboard.grid.cell.verifyVirtualCell({
index: i,
columnHeader: 'Country',
+ type: 'bt',
count: countryList[i].length,
value: countryList[i],
});