mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 06:56: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
|
// ant-form-item-explain
|
||||||
const field = this.get().locator(`[data-testid="nc-form-fields"][data-title="${title}"]`);
|
const field = this.get().locator(`[data-testid="nc-form-fields"][data-title="${title}"]`);
|
||||||
await field.scrollIntoViewIfNeeded();
|
await field.scrollIntoViewIfNeeded();
|
||||||
const fieldErrorEl = field.locator('.ant-form-item-explain-error');
|
const fieldErrorEl = field.locator('.ant-form-item-explain');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
locator: fieldErrorEl,
|
locator: fieldErrorEl,
|
||||||
|
|||||||
@@ -150,22 +150,24 @@ export class SurveyFormPage extends BasePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getFormFieldErrors() {
|
async getFormFieldErrors() {
|
||||||
const fieldErrorEl = this.get().locator('.ant-form-item-explain-error');
|
const fieldErrorEl = this.get().locator('.ant-form-item-explain');
|
||||||
return {
|
return {
|
||||||
locator: fieldErrorEl,
|
locator: fieldErrorEl,
|
||||||
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
|
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
|
||||||
if (hasError !== undefined) {
|
if (hasError !== undefined) {
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
await expect(fieldErrorEl).toBeVisible();
|
await expect(fieldErrorEl.locator('.ant-form-item-explain-error').first()).toBeVisible();
|
||||||
} else {
|
} else {
|
||||||
await expect(fieldErrorEl).not.toBeVisible();
|
await expect(fieldErrorEl.locator('.ant-form-item-explain-error').first()).not.toBeVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrorMsg !== undefined) {
|
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 }) {
|
async getFormFieldErrors({ title }: { title: string }) {
|
||||||
const field = this.get().getByTestId(`nc-shared-form-item-${title.replace(' ', '')}`);
|
const field = this.get().getByTestId(`nc-shared-form-item-${title.replace(' ', '')}`);
|
||||||
await field.scrollIntoViewIfNeeded();
|
await field.scrollIntoViewIfNeeded();
|
||||||
const fieldErrorEl = field.locator('.ant-form-item-explain-error');
|
const fieldErrorEl = field.locator('.ant-form-item-explain');
|
||||||
return {
|
return {
|
||||||
locator: fieldErrorEl,
|
locator: fieldErrorEl,
|
||||||
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
|
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user