多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.5 KiB

import { expect, Page } from '@playwright/test';
import BasePage from '../Base';
import { CellPageObject } from '../Dashboard/common/Cell';
export class SharedFormPage extends BasePage {
readonly cell: CellPageObject;
constructor(rootPage: Page) {
super(rootPage);
this.cell = new CellPageObject(this);
}
get() {
return this.rootPage.locator('html');
}
async submit() {
await this.waitForResponse({
uiAction: async () => await this.get().getByTestId('shared-form-submit-button').first().click(),
httpMethodsToMatch: ['POST'],
requestUrlPathToMatch: '/rows',
});
await this.rootPage.waitForTimeout(200);
}
async verifySuccessMessage() {
await this.rootPage.locator('.nc-shared-form-success-msg').waitFor({ state: 'visible', timeout: 10000 });
await expect(
this.get().locator('.ant-alert-success', {
hasText: 'Successfully submitted form data',
})
).toBeVisible();
}
async clickLinkToChildList() {
1 year ago
await this.get().locator('.nc-virtual-cell').hover();
await this.get().locator('.nc-action-icon').click({ force: true });
//await this.get().locator('button[data-testid="nc-child-list-button-link-to"]').click();
}
async closeLinkToChildList() {
Nc feat/link record dropdown (#8345) * feat(nc-gui): link record dropdown setup * fix(nc-gui): move link record pagination to the bottom * feat(nc-gui): link record new design * fix(nc-gui): update bank state subtitle * fix(nc-gui): small changes * fix(nc-gui): update skeleton of link records item * fix(nc-gui): ui break issue * fix(nc-gui): increase z index of link dropdown overlay * fix(nc-gui): update link record dropdown header * fix(nc-gui): update link record dropdown * fix(nc-gui): new changes * fix: remove margin * fix(nc-gui): unlinked records empty state alignment * fix(nc-gui): make tooltip text size 14px * fix(nc-gui): reduce subtext font size * fix(nc-gui): link record item rich text cell alignment issue * fix(nc-gui): on esc link record dropdown should close * fix(nc-gui): update link record header and footer height * fix(nc-gui): add link record dropdown for bt cell * fix(nc-gui): fix invalid offset issue * fix(nc-gui): link record z index issue * fix: PW link unlink corrections * fix(nc-gui): link record dropdown close on outside issue in expanded form * fix(nc-gui): close dropdown after adding link in bt cell * fix(nc-gui): allow close link record dropdown on esc * fix(nc-gui): add link record dropdown in mm component * fix(nc-gui): add link record dropdown in hm component * fix(nc-gui): add link record dropdown in oo component * fix: auto close for BT * fix: ltar modal operations * fix: close link modal * fix: PW tests (wip) * test: fix link modal close in share view * test: fix LTAR in cell handling * fix(nc-gui): reduce link items skeleton height * fix(nc-gui): expanded form open issue on clicking bt cell record * fix(nc-gui): hide back btn if user directly opens record list dropdown * fix(nc-gui): reset offset when user opens link record dropdwon and switch between linked and unlinked records * fix(nc-gui): link record item height * fix(nc-gui): linked record list reload issue on link/unlink * fix(nc-gui): link record item subtext fields width should be same * fix(nc-gui): email, url cell truncate text issue * fix(nc-gui): shared form link record dropdwon ui * chore(nc-gui): lint * fix(nc-gu): small changes * fix(nc-gui): ai review changes * fix(nc-gui): link record list offset issue * fix(nc-gui): show plus btn in bt cell even if it is not blank * fix(nc-gui): barcode visiblility issue in link record dropdown * fix(nc-gui): do not focus links cell plus btn on close dropdown * fix(nc-gui): text color * fix(nc-gui): skip showing qr code null value * fix(nc-gui): virtual cell margin left issue in link record dropdwon * fix(nc-gui): link record subtext order should be same as default view col order * chore(nc-gui): lint * refactor(nocodb): add default view column order in col meta * fix(nc-gui): update default view order on reordering column from fields menu --------- Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
7 months ago
// await this.get().locator('.nc-close-btn').click();
await this.rootPage.keyboard.press('Escape');
}
async verifyChildList(cardTitle?: string[]) {
await this.get().locator('.nc-modal-link-record').waitFor();
const linkRecord = this.get();
// DOM element validation
// title: Link Record
// button: Add new record
// icon: reload
1 year ago
//await expect(this.get().locator(`.ant-modal-title`)).toHaveText(`Link record`);
// add new record option is not available for shared form
1 year ago
expect(await linkRecord.locator(`button:has-text("Link more records")`).isVisible()).toBeFalsy();
// placeholder: Filter query
1 year ago
expect(await linkRecord.locator('.nc-excluded-search').isVisible()).toBeTruthy();
{
const childList = linkRecord.locator(`.ant-card`);
await expect.poll(() => linkRecord.locator(`.ant-card`).count()).toBe(cardTitle.length);
for (let i = 0; i < cardTitle.length; i++) {
expect(await childList.nth(i).textContent()).toContain(cardTitle[i]);
}
}
}
async selectChildList(cardTitle: string) {
Nc feat/link record dropdown (#8345) * feat(nc-gui): link record dropdown setup * fix(nc-gui): move link record pagination to the bottom * feat(nc-gui): link record new design * fix(nc-gui): update bank state subtitle * fix(nc-gui): small changes * fix(nc-gui): update skeleton of link records item * fix(nc-gui): ui break issue * fix(nc-gui): increase z index of link dropdown overlay * fix(nc-gui): update link record dropdown header * fix(nc-gui): update link record dropdown * fix(nc-gui): new changes * fix: remove margin * fix(nc-gui): unlinked records empty state alignment * fix(nc-gui): make tooltip text size 14px * fix(nc-gui): reduce subtext font size * fix(nc-gui): link record item rich text cell alignment issue * fix(nc-gui): on esc link record dropdown should close * fix(nc-gui): update link record header and footer height * fix(nc-gui): add link record dropdown for bt cell * fix(nc-gui): fix invalid offset issue * fix(nc-gui): link record z index issue * fix: PW link unlink corrections * fix(nc-gui): link record dropdown close on outside issue in expanded form * fix(nc-gui): close dropdown after adding link in bt cell * fix(nc-gui): allow close link record dropdown on esc * fix(nc-gui): add link record dropdown in mm component * fix(nc-gui): add link record dropdown in hm component * fix(nc-gui): add link record dropdown in oo component * fix: auto close for BT * fix: ltar modal operations * fix: close link modal * fix: PW tests (wip) * test: fix link modal close in share view * test: fix LTAR in cell handling * fix(nc-gui): reduce link items skeleton height * fix(nc-gui): expanded form open issue on clicking bt cell record * fix(nc-gui): hide back btn if user directly opens record list dropdown * fix(nc-gui): reset offset when user opens link record dropdwon and switch between linked and unlinked records * fix(nc-gui): link record item height * fix(nc-gui): linked record list reload issue on link/unlink * fix(nc-gui): link record item subtext fields width should be same * fix(nc-gui): email, url cell truncate text issue * fix(nc-gui): shared form link record dropdwon ui * chore(nc-gui): lint * fix(nc-gu): small changes * fix(nc-gui): ai review changes * fix(nc-gui): link record list offset issue * fix(nc-gui): show plus btn in bt cell even if it is not blank * fix(nc-gui): barcode visiblility issue in link record dropdown * fix(nc-gui): do not focus links cell plus btn on close dropdown * fix(nc-gui): text color * fix(nc-gui): skip showing qr code null value * fix(nc-gui): virtual cell margin left issue in link record dropdwon * fix(nc-gui): link record subtext order should be same as default view col order * chore(nc-gui): lint * refactor(nocodb): add default view column order in col meta * fix(nc-gui): update default view order on reordering column from fields menu --------- Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
7 months ago
await this.get()
.locator(`.ant-card:has-text("${cardTitle}"):visible`)
.locator('.nc-list-item-link-unlink-btn')
.click();
}
fieldLabel({ title }: { title: string }) {
return this.get()
.getByTestId(`nc-shared-form-item-${title.replace(' ', '')}`)
.locator('.nc-form-column-label');
}
async getFormFieldErrors({ title }: { title: string }) {
const field = this.get().getByTestId(`nc-shared-form-item-${title.replace(' ', '')}`);
await field.scrollIntoViewIfNeeded();
const fieldErrorEl = field.locator('.ant-form-item-explain');
return {
locator: fieldErrorEl,
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
if (hasError !== undefined) {
if (hasError) {
await fieldErrorEl.waitFor({ state: 'visible' });
await expect(fieldErrorEl).toBeVisible();
} else {
await expect(fieldErrorEl).not.toBeVisible();
}
}
if (hasErrorMsg !== undefined) {
await fieldErrorEl.waitFor({ state: 'visible' });
await expect(fieldErrorEl.locator('> div').filter({ hasText: hasErrorMsg }).first()).toHaveText(hasErrorMsg);
}
},
};
}
}