fix: Error UI improvements for nested lists/objects (#3726)
This commit is contained in:
@ -15,9 +15,6 @@ import {
|
||||
assertEntryDeleted,
|
||||
assertWorkflowStatus,
|
||||
updateWorkflowStatusInEditor,
|
||||
validateObjectFieldsAndExit,
|
||||
validateNestedObjectFieldsAndExit,
|
||||
validateListFieldsAndExit,
|
||||
unpublishEntry,
|
||||
publishEntryInEditor,
|
||||
duplicateEntry,
|
||||
@ -26,7 +23,7 @@ import {
|
||||
publishAndCreateNewEntryInEditor,
|
||||
publishAndDuplicateEntryInEditor,
|
||||
} from '../utils/steps';
|
||||
import { setting1, setting2, workflowStatus, editorStatus, publishTypes } from '../utils/constants';
|
||||
import { workflowStatus, editorStatus, publishTypes } from '../utils/constants';
|
||||
|
||||
const entry1 = {
|
||||
title: 'first title',
|
||||
@ -74,21 +71,6 @@ describe('Test Backend Editorial Workflow', () => {
|
||||
exitEditor();
|
||||
});
|
||||
|
||||
it('can validate object fields', () => {
|
||||
login();
|
||||
validateObjectFieldsAndExit(setting1);
|
||||
});
|
||||
|
||||
it('can validate fields nested in an object field', () => {
|
||||
login();
|
||||
validateNestedObjectFieldsAndExit(setting1);
|
||||
});
|
||||
|
||||
it('can validate list fields', () => {
|
||||
login();
|
||||
validateListFieldsAndExit(setting2);
|
||||
});
|
||||
|
||||
it('can publish an editorial workflow entry', () => {
|
||||
login();
|
||||
createPostAndExit(entry1);
|
||||
|
109
cypress/integration/field_validations_spec.js
Normal file
109
cypress/integration/field_validations_spec.js
Normal file
@ -0,0 +1,109 @@
|
||||
import '../utils/dismiss-local-backup';
|
||||
import {
|
||||
login,
|
||||
validateObjectFieldsAndExit,
|
||||
validateNestedObjectFieldsAndExit,
|
||||
validateListFieldsAndExit,
|
||||
validateNestedListFieldsAndExit,
|
||||
} from '../utils/steps';
|
||||
import { setting1, setting2 } from '../utils/constants';
|
||||
|
||||
const nestedListConfig = {
|
||||
collections: [
|
||||
{},
|
||||
{},
|
||||
{
|
||||
name: 'settings',
|
||||
label: 'Settings',
|
||||
editor: { preview: false },
|
||||
files: [
|
||||
{},
|
||||
{},
|
||||
{
|
||||
name: 'hotel_locations',
|
||||
label: 'Hotel Locations',
|
||||
file: '_data/hotel_locations.yml',
|
||||
fields: [
|
||||
{
|
||||
label: 'Country',
|
||||
name: 'country',
|
||||
widget: 'string',
|
||||
},
|
||||
{
|
||||
label: 'Hotel Locations',
|
||||
name: 'hotel_locations',
|
||||
widget: 'list',
|
||||
fields: [
|
||||
{
|
||||
label: 'Cities',
|
||||
name: 'cities',
|
||||
widget: 'list',
|
||||
fields: [
|
||||
{
|
||||
label: 'City',
|
||||
name: 'city',
|
||||
widget: 'string',
|
||||
},
|
||||
{
|
||||
label: 'Number of Hotels in City',
|
||||
name: 'number_of_hotels_in_city',
|
||||
widget: 'number',
|
||||
},
|
||||
{
|
||||
label: 'City Locations',
|
||||
name: 'city_locations',
|
||||
widget: 'list',
|
||||
fields: [
|
||||
{
|
||||
label: 'Hotel Name',
|
||||
name: 'hotel_name',
|
||||
widget: 'string',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
describe('Test Backend Editorial Workflow', () => {
|
||||
after(() => {
|
||||
cy.task('teardownBackend', { backend: 'test' });
|
||||
});
|
||||
|
||||
before(() => {
|
||||
Cypress.config('defaultCommandTimeout', 4000);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.task('setupBackend', { backend: 'test' });
|
||||
});
|
||||
|
||||
it('can validate object fields', () => {
|
||||
login();
|
||||
validateObjectFieldsAndExit(setting1);
|
||||
});
|
||||
|
||||
it('can validate fields nested in an object field', () => {
|
||||
login();
|
||||
validateNestedObjectFieldsAndExit(setting1);
|
||||
});
|
||||
|
||||
it('can validate list fields', () => {
|
||||
login();
|
||||
validateListFieldsAndExit(setting2);
|
||||
});
|
||||
|
||||
it('can validate deeply nested list fields', () => {
|
||||
cy.task('updateConfig', nestedListConfig);
|
||||
|
||||
login();
|
||||
validateNestedListFieldsAndExit(setting2);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user