diff --git a/cypress/e2e/km-editor/editor/add.spec.js b/cypress/e2e/km-editor/editor/add.spec.js index 4b7b35a..987b1df 100644 --- a/cypress/e2e/km-editor/editor/add.spec.js +++ b/cypress/e2e/km-editor/editor/add.spec.js @@ -470,6 +470,7 @@ describe('KM Editor Add Entity', () => { // Add answer and save editor.addInputChild('answer') cy.fillFields(followUpAnswer) + editor.awaitSave() // Reopen editor again and check that the answer is there cy.visitApp('/km-editor') @@ -514,6 +515,7 @@ describe('KM Editor Add Entity', () => { // Add choice and save editor.addInputChild('choice') cy.fillFields(choice) + editor.awaitSave() // Reopen editor again and check that the choice is there cy.visitApp('/km-editor') diff --git a/cypress/e2e/km-editor/editor/edit.spec.js b/cypress/e2e/km-editor/editor/edit.spec.js index 9e1ea64..b68049b 100644 --- a/cypress/e2e/km-editor/editor/edit.spec.js +++ b/cypress/e2e/km-editor/editor/edit.spec.js @@ -36,6 +36,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren(['Chapter 1']) cy.fillFields(chapter) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -56,6 +57,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren(['Findability']) cy.fillFields(metric) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -75,6 +77,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren(['Before Submitting the Proposal']) cy.fillFields(metric) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -95,6 +98,7 @@ describe('KM Editor Edit Entity', () => { editor.traverseChildren(['Tag 1']) cy.fillFields(tag) cy.getCy('form-group_color_color-button', ':nth-child(7)').click() + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -139,6 +143,8 @@ describe('KM Editor Edit Entity', () => { cy.getCy('integration-input_name').clear().type('X-Auth') cy.getCy('integration-input_value').clear().type('abcd') + editor.awaitSave() + // Open editor again and check that changes were saved cy.visitApp('/km-editor') editor.open(kmId) @@ -162,6 +168,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren(['Resource Collection']) cy.fillFields({title: 'Another Resource Page',}) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -255,6 +262,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren(['Chapter 1', originalTitle]) cy.fillFields(question) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -338,6 +346,7 @@ describe('KM Editor Edit Entity', () => { editor.traverseChildren([...optionsQuestionPath, answerTitle]) cy.checkToggle('metricMeasure-8db30660-d4e5-4c0a-bf3e-553f3f0f997a-enabled') cy.fillFields(answer) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -356,6 +365,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren([...multiChoiceQuestionPath, choiceTitle]) cy.fillFields(choice) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -375,6 +385,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren([...listQuestionPath, followUpTitle]) cy.fillFields(question) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -394,6 +405,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren([...optionsQuestionPath, urlReferenceLabel]) cy.fillFields(urlReference) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -412,6 +424,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren([...optionsQuestionPath, resourcePageTitle]) cy.fillFields(resourcePageReference) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') @@ -431,6 +444,7 @@ describe('KM Editor Edit Entity', () => { editor.open(kmId) editor.traverseChildren([...optionsQuestionPath, expertTitle]) cy.fillFields(expert) + editor.awaitSave() // Open editor again and check that changes were saved cy.visitApp('/km-editor') diff --git a/cypress/support/editor-helpers.js b/cypress/support/editor-helpers.js index 812ba9d..ac3bfca 100644 --- a/cypress/support/editor-helpers.js +++ b/cypress/support/editor-helpers.js @@ -25,6 +25,7 @@ export function createChildren(parents) { parents.forEach(([type, fields]) => { addInputChild(type) cy.fillFields(fields) + awaitSave() }) } @@ -106,3 +107,9 @@ export function expectWarningsCount(count) { export function openWarnings() { cy.get('.editor-breadcrumbs .item').contains('Warnings').click() } + + +export function awaitSave() { + cy.get('.questionnaire-header__saving').contains('Saved') + cy.get('.questionnaire-header__saving').should('not.contain', 'Saved') +}