Browse Source

test: link extended

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5848/head
Raju Udava 2 years 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">
<template v-if="!isForm">
<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 }}
</a>
</div>

38
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'],
});

1
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],
});

Loading…
Cancel
Save