Browse Source

test: link extended

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5848/head
Raju Udava 1 year ago committed by Pranav C
parent
commit
ec3ea3ecbf
  1. 6
      packages/nc-gui/components/virtual-cell/Links.vue
  2. 38
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  3. 1
      tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts

6
packages/nc-gui/components/virtual-cell/Links.vue

@ -65,7 +65,11 @@ const onAttachRecord = () => {
<div class="flex w-full items-center"> <div class="flex w-full items-center">
<template v-if="!isForm"> <template v-if="!isForm">
<div class="flex-grow block"> <div class="flex-grow block">
<a class="text-center pl-3" :class="{ '!text-gray-300': !value }" @click.stop.prevent="childListDlg = true"> <a
class="text-center pl-3 nc-datatype-link"
:class="{ '!text-gray-300': !value }"
@click.stop.prevent="childListDlg = true"
>
{{ textVal }} {{ textVal }}
</a> </a>
</div> </div>

38
tests/playwright/pages/Dashboard/common/Cell/index.ts

@ -77,9 +77,9 @@ export class CellPageObject extends BasePage {
} }
async inCellExpand({ index, columnHeader }: CellProps) { async inCellExpand({ index, columnHeader }: CellProps) {
await this.get({ index, columnHeader }).hover(); // await this.get({ index, columnHeader }).hover();
await this.waitForResponse({ 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/', requestUrlPathToMatch: '/api/v1/db/data/noco/',
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
}); });
@ -268,39 +268,47 @@ export class CellPageObject extends BasePage {
async verifyVirtualCell({ async verifyVirtualCell({
index, index,
columnHeader, columnHeader,
type,
count, count,
value, value,
verifyChildList = false, verifyChildList = false,
}: CellProps & { }: CellProps & {
count?: number; count?: number;
type?: 'hm' | 'bt' | 'mm';
value: string[]; value: string[];
verifyChildList?: boolean; verifyChildList?: boolean;
}) { }) {
// const count = value.length;
const cell = await this.get({ index, columnHeader }); 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 (type === 'bt') {
if (count) await expect(chips).toHaveCount(count); 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) {
for (let i = 0; i < value.length; ++i) { await chips.nth(i).locator('.name').waitFor({ state: 'visible' });
await chips.nth(i).locator('.name').waitFor({ state: 'visible' }); await chips.nth(i).locator('.name').scrollIntoViewIfNeeded();
await chips.nth(i).locator('.name').scrollIntoViewIfNeeded(); await expect(await chips.nth(i).locator('.name')).toHaveText(value[i]);
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) { if (verifyChildList) {
// open child list // open child list
await this.get({ index, columnHeader }).hover(); 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 // arrow expand doesn't exist for bt columns
if (await arrow_expand.count()) { if (await linkText.count()) {
await this.waitForResponse({ await this.waitForResponse({
uiAction: () => arrow_expand.click(), uiAction: () => linkText.click(),
requestUrlPathToMatch: '/api/v1/db', requestUrlPathToMatch: '/api/v1/db',
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
}); });

1
tests/playwright/tests/db/columnRelationalExtendedTests.spec.ts

@ -65,6 +65,7 @@ test.describe('Relational Columns', () => {
await dashboard.grid.cell.verifyVirtualCell({ await dashboard.grid.cell.verifyVirtualCell({
index: i, index: i,
columnHeader: 'Country', columnHeader: 'Country',
type: 'bt',
count: countryList[i].length, count: countryList[i].length,
value: countryList[i], value: countryList[i],
}); });

Loading…
Cancel
Save