mirror of
https://github.com/nocodb/nocodb.git
synced 2026-02-02 02:47:29 +00:00
test(nc-gui): form view field validation test fail issue
This commit is contained in:
@@ -666,7 +666,7 @@ export class FormPage extends BasePage {
|
||||
// ant-form-item-explain
|
||||
const field = this.get().locator(`[data-testid="nc-form-fields"][data-title="${title}"]`);
|
||||
await field.scrollIntoViewIfNeeded();
|
||||
const fieldErrorEl = field.locator('.ant-form-item-explain-error');
|
||||
const fieldErrorEl = field.locator('.ant-form-item-explain');
|
||||
|
||||
return {
|
||||
locator: fieldErrorEl,
|
||||
|
||||
@@ -150,22 +150,24 @@ export class SurveyFormPage extends BasePage {
|
||||
}
|
||||
|
||||
async getFormFieldErrors() {
|
||||
const fieldErrorEl = this.get().locator('.ant-form-item-explain-error');
|
||||
const fieldErrorEl = this.get().locator('.ant-form-item-explain');
|
||||
return {
|
||||
locator: fieldErrorEl,
|
||||
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
|
||||
if (hasError !== undefined) {
|
||||
if (hasError) {
|
||||
await expect(fieldErrorEl).toBeVisible();
|
||||
await expect(fieldErrorEl.locator('.ant-form-item-explain-error').first()).toBeVisible();
|
||||
} else {
|
||||
await expect(fieldErrorEl).not.toBeVisible();
|
||||
await expect(fieldErrorEl.locator('.ant-form-item-explain-error').first()).not.toBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasErrorMsg !== undefined) {
|
||||
await expect(fieldErrorEl).toBeVisible();
|
||||
await expect(fieldErrorEl.locator('.ant-form-item-explain-error').first()).toBeVisible();
|
||||
|
||||
await expect(fieldErrorEl.locator('> div').filter({ hasText: hasErrorMsg }).first()).toHaveText(hasErrorMsg);
|
||||
await expect(
|
||||
fieldErrorEl.locator('.ant-form-item-explain-error').filter({ hasText: hasErrorMsg }).first()
|
||||
).toHaveText(hasErrorMsg);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -85,7 +85,7 @@ export class SharedFormPage extends BasePage {
|
||||
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-error');
|
||||
const fieldErrorEl = field.locator('.ant-form-item-explain');
|
||||
return {
|
||||
locator: fieldErrorEl,
|
||||
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
|
||||
|
||||
Reference in New Issue
Block a user