Skip to content

Commit 5bff07a

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

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
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

+24-2
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)
@@ -161,13 +167,14 @@ describe('KM Editor Edit Entity', () => {
161167
cy.visitApp('/km-editor')
162168
editor.open(kmId)
163169
editor.traverseChildren(['Resource Collection'])
164-
cy.fillFields({title: 'Another Resource Page',})
170+
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')
168175
editor.open(kmId)
169176
editor.traverseChildren(['Another Resource Page'])
170-
cy.checkFields({title: 'Another Resource Page',})
177+
cy.checkFields({ title: 'Another Resource Page', })
171178
})
172179
})
173180

@@ -254,7 +261,16 @@ describe('KM Editor Edit Entity', () => {
254261
cy.visitApp('/km-editor')
255262
editor.open(kmId)
256263
editor.traverseChildren(['Chapter 1', originalTitle])
264+
265+
if (question.s_type) {
266+
cy.fillFields({ s_type: question.s_type })
267+
editor.awaitSave()
268+
269+
delete question.s_type
270+
}
271+
257272
cy.fillFields(question)
273+
editor.awaitSave()
258274

259275
// Open editor again and check that changes were saved
260276
cy.visitApp('/km-editor')
@@ -338,6 +354,7 @@ describe('KM Editor Edit Entity', () => {
338354
editor.traverseChildren([...optionsQuestionPath, answerTitle])
339355
cy.checkToggle('metricMeasure-8db30660-d4e5-4c0a-bf3e-553f3f0f997a-enabled')
340356
cy.fillFields(answer)
357+
editor.awaitSave()
341358

342359
// Open editor again and check that changes were saved
343360
cy.visitApp('/km-editor')
@@ -356,6 +373,7 @@ describe('KM Editor Edit Entity', () => {
356373
editor.open(kmId)
357374
editor.traverseChildren([...multiChoiceQuestionPath, choiceTitle])
358375
cy.fillFields(choice)
376+
editor.awaitSave()
359377

360378
// Open editor again and check that changes were saved
361379
cy.visitApp('/km-editor')
@@ -375,6 +393,7 @@ describe('KM Editor Edit Entity', () => {
375393
editor.open(kmId)
376394
editor.traverseChildren([...listQuestionPath, followUpTitle])
377395
cy.fillFields(question)
396+
editor.awaitSave()
378397

379398
// Open editor again and check that changes were saved
380399
cy.visitApp('/km-editor')
@@ -394,6 +413,7 @@ describe('KM Editor Edit Entity', () => {
394413
editor.open(kmId)
395414
editor.traverseChildren([...optionsQuestionPath, urlReferenceLabel])
396415
cy.fillFields(urlReference)
416+
editor.awaitSave()
397417

398418
// Open editor again and check that changes were saved
399419
cy.visitApp('/km-editor')
@@ -412,6 +432,7 @@ describe('KM Editor Edit Entity', () => {
412432
editor.open(kmId)
413433
editor.traverseChildren([...optionsQuestionPath, resourcePageTitle])
414434
cy.fillFields(resourcePageReference)
435+
editor.awaitSave()
415436

416437
// Open editor again and check that changes were saved
417438
cy.visitApp('/km-editor')
@@ -431,6 +452,7 @@ describe('KM Editor Edit Entity', () => {
431452
editor.open(kmId)
432453
editor.traverseChildren([...optionsQuestionPath, expertTitle])
433454
cy.fillFields(expert)
455+
editor.awaitSave()
434456

435457
// Open editor again and check that changes were saved
436458
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)