Skip to content

Commit dcaef97

Browse files
committed
Fix KM editor after adding throttling
1 parent ef759c6 commit dcaef97

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

cypress/e2e/km-editor/editor/add.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ describe('KM Editor Add Entity', () => {
130130
addProp('name')
131131
addProp('database')
132132
addHeader('Authorization', 'Bearer $token')
133+
editor.awaitSave()
133134

134135
// Reopen editor again and check that the integration is there
135136
cy.visitApp('/km-editor')
@@ -470,6 +471,7 @@ describe('KM Editor Add Entity', () => {
470471
// Add answer and save
471472
editor.addInputChild('answer')
472473
cy.fillFields(followUpAnswer)
474+
editor.awaitSave()
473475

474476
// Reopen editor again and check that the answer is there
475477
cy.visitApp('/km-editor')
@@ -514,6 +516,7 @@ describe('KM Editor Add Entity', () => {
514516
// Add choice and save
515517
editor.addInputChild('choice')
516518
cy.fillFields(choice)
519+
editor.awaitSave()
517520

518521
// Reopen editor again and check that the choice is there
519522
cy.visitApp('/km-editor')

cypress/e2e/km-editor/editor/edit.spec.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('KM Editor Edit Entity', () => {
3636
editor.open(kmId)
3737
editor.traverseChildren(['Chapter 1'])
3838
cy.fillFields(chapter)
39+
editor.awaitSave()
3940

4041
// Open editor again and check that changes were saved
4142
cy.visitApp('/km-editor')
@@ -56,6 +57,7 @@ describe('KM Editor Edit Entity', () => {
5657
editor.open(kmId)
5758
editor.traverseChildren(['Findability'])
5859
cy.fillFields(metric)
60+
editor.awaitSave()
5961

6062
// Open editor again and check that changes were saved
6163
cy.visitApp('/km-editor')
@@ -75,6 +77,7 @@ describe('KM Editor Edit Entity', () => {
7577
editor.open(kmId)
7678
editor.traverseChildren(['Before Submitting the Proposal'])
7779
cy.fillFields(metric)
80+
editor.awaitSave()
7881

7982
// Open editor again and check that changes were saved
8083
cy.visitApp('/km-editor')
@@ -95,6 +98,7 @@ describe('KM Editor Edit Entity', () => {
9598
editor.traverseChildren(['Tag 1'])
9699
cy.fillFields(tag)
97100
cy.getCy('form-group_color_color-button', ':nth-child(7)').click()
101+
editor.awaitSave()
98102

99103
// Open editor again and check that changes were saved
100104
cy.visitApp('/km-editor')
@@ -139,6 +143,8 @@ describe('KM Editor Edit Entity', () => {
139143
cy.getCy('integration-input_name').clear().type('X-Auth')
140144
cy.getCy('integration-input_value').clear().type('abcd')
141145

146+
editor.awaitSave()
147+
142148
// Open editor again and check that changes were saved
143149
cy.visitApp('/km-editor')
144150
editor.open(kmId)
@@ -162,6 +168,7 @@ describe('KM Editor Edit Entity', () => {
162168
editor.open(kmId)
163169
editor.traverseChildren(['Resource Collection'])
164170
cy.fillFields({title: 'Another Resource Page',})
171+
editor.awaitSave()
165172

166173
// Open editor again and check that changes were saved
167174
cy.visitApp('/km-editor')
@@ -249,12 +256,13 @@ describe('KM Editor Edit Entity', () => {
249256
}]
250257

251258
questionTests.forEach(({ testName, originalTitle, question }) => {
252-
it(testName, () => {
259+
it.only(testName, () => {
253260
// Edit question
254261
cy.visitApp('/km-editor')
255262
editor.open(kmId)
256263
editor.traverseChildren(['Chapter 1', originalTitle])
257264
cy.fillFields(question)
265+
editor.awaitSave()
258266

259267
// Open editor again and check that changes were saved
260268
cy.visitApp('/km-editor')
@@ -338,6 +346,7 @@ describe('KM Editor Edit Entity', () => {
338346
editor.traverseChildren([...optionsQuestionPath, answerTitle])
339347
cy.checkToggle('metricMeasure-8db30660-d4e5-4c0a-bf3e-553f3f0f997a-enabled')
340348
cy.fillFields(answer)
349+
editor.awaitSave()
341350

342351
// Open editor again and check that changes were saved
343352
cy.visitApp('/km-editor')
@@ -356,6 +365,7 @@ describe('KM Editor Edit Entity', () => {
356365
editor.open(kmId)
357366
editor.traverseChildren([...multiChoiceQuestionPath, choiceTitle])
358367
cy.fillFields(choice)
368+
editor.awaitSave()
359369

360370
// Open editor again and check that changes were saved
361371
cy.visitApp('/km-editor')
@@ -375,6 +385,7 @@ describe('KM Editor Edit Entity', () => {
375385
editor.open(kmId)
376386
editor.traverseChildren([...listQuestionPath, followUpTitle])
377387
cy.fillFields(question)
388+
editor.awaitSave()
378389

379390
// Open editor again and check that changes were saved
380391
cy.visitApp('/km-editor')
@@ -394,6 +405,7 @@ describe('KM Editor Edit Entity', () => {
394405
editor.open(kmId)
395406
editor.traverseChildren([...optionsQuestionPath, urlReferenceLabel])
396407
cy.fillFields(urlReference)
408+
editor.awaitSave()
397409

398410
// Open editor again and check that changes were saved
399411
cy.visitApp('/km-editor')
@@ -412,6 +424,7 @@ describe('KM Editor Edit Entity', () => {
412424
editor.open(kmId)
413425
editor.traverseChildren([...optionsQuestionPath, resourcePageTitle])
414426
cy.fillFields(resourcePageReference)
427+
editor.awaitSave()
415428

416429
// Open editor again and check that changes were saved
417430
cy.visitApp('/km-editor')
@@ -431,6 +444,7 @@ describe('KM Editor Edit Entity', () => {
431444
editor.open(kmId)
432445
editor.traverseChildren([...optionsQuestionPath, expertTitle])
433446
cy.fillFields(expert)
447+
editor.awaitSave()
434448

435449
// Open editor again and check that changes were saved
436450
cy.visitApp('/km-editor')

cypress/support/editor-helpers.js

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function createChildren(parents) {
2525
parents.forEach(([type, fields]) => {
2626
addInputChild(type)
2727
cy.fillFields(fields)
28+
awaitSave()
2829
})
2930
}
3031

@@ -106,3 +107,9 @@ export function expectWarningsCount(count) {
106107
export function openWarnings() {
107108
cy.get('.editor-breadcrumbs .item').contains('Warnings').click()
108109
}
110+
111+
112+
export function awaitSave() {
113+
cy.get('.questionnaire-header__saving').contains('Saved')
114+
cy.get('.questionnaire-header__saving').should('not.contain', 'Saved')
115+
}

0 commit comments

Comments
 (0)