Files
nocodb/tests/playwright/pages/SharedForm/index.ts
Ramesh Mane 34cc8197d4 Nc fix: Form view bug fixes (#7899)
* fix(nc-gui): show inline form field validation errors

* fix(nc-gui): display inline validation error in shared form and form builder

* fix(nc-gui): shared form default value issue

* fix(nc-gui): limit option spell mistake

* fix(nc-gui): form title update issue when toggle between grid & form view

* fix(nc-gui): form banner & logo display issue on upload

* chore(nc-gui): lint

* fix(nc-gui): show error message on press non numeric keys in numeric field

* fix(nc-gui): add key for form banner and logo

* fix(nc-gui): show currency suffix only in form

* fix(nc-gui): edit column default value input height issue

* fix(nc-gui): form checkbox field enter keypress should navigate to next question in survey form

* fix(nc-gui): escape should blur focus field in survey form

* fix(nc-gui): add currency code suffix in form view currency field

* chore(nc-gui): lint

* fix(nc-gui): add percent suffix in form view percent field

* fix(nc-gui): survey form pw test fail issue

* fix(nc-gui): filter pw test fail issue

* fix(nc-gui): add missing classname in oss

* fix(nc-gui): survey form ui break issue

* fix(nc-gui): update oss survey form file

* fix(nc-gui): in survey form branding text color should be dynamic based on form bg color

* chore(nc-gui): lint

* fix(nc-gui): ai pr review changes

* fix(nc-gui): pr review changes #2555

* fix(nc-gui): use handler instead on ternery condition
2024-03-20 20:10:34 +05:30

75 lines
2.3 KiB
TypeScript

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' });
await expect(
this.get().locator('.ant-alert-success', {
hasText: 'Successfully submitted form data',
})
).toBeVisible();
}
async clickLinkToChildList() {
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() {
await this.get().locator('.nc-close-btn').click();
}
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
//await expect(this.get().locator(`.ant-modal-title`)).toHaveText(`Link record`);
// add new record option is not available for shared form
expect(await linkRecord.locator(`button:has-text("Link more records")`).isVisible()).toBeFalsy();
// placeholder: Filter query
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) {
await this.get().locator(`.ant-card:has-text("${cardTitle}"):visible`).click();
}
}