Skip to content

Commit

Permalink
Fix KM editor after adding throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
janslifka committed Oct 18, 2024
1 parent ef759c6 commit b45defd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cypress/e2e/km-editor/editor/add.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
14 changes: 14 additions & 0 deletions cypress/e2e/km-editor/editor/edit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand Down Expand Up @@ -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)
Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand Down
7 changes: 7 additions & 0 deletions cypress/support/editor-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function createChildren(parents) {
parents.forEach(([type, fields]) => {
addInputChild(type)
cy.fillFields(fields)
awaitSave()
})
}

Expand Down Expand Up @@ -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')
}

0 comments on commit b45defd

Please sign in to comment.