fix: Error UI improvements for nested lists/objects (#3726)

This commit is contained in:
Kevin Young
2020-05-25 01:42:54 -05:00
committed by GitHub
parent 2ecafd3354
commit 397857855b
11 changed files with 402 additions and 34 deletions

View File

@ -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);

View 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);
});
});