itemengine-cypress-automation 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/.build_wna +4 -0
  2. package/README.md +3 -0
  3. package/currents.config.js +6 -0
  4. package/cypress/API/createItem/toggleItemMode.js +15 -0
  5. package/cypress/config-files/ildev.json +15 -0
  6. package/cypress/config-files/ilprod.json +15 -0
  7. package/cypress/config-files/ilqa.json +15 -0
  8. package/cypress/config-files/ilstage.json +15 -0
  9. package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
  10. package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
  11. package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
  12. package/cypress/fixtures/accessibilityConfig.json +6 -0
  13. package/cypress/fixtures/constants.js +18 -0
  14. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
  15. package/cypress/fixtures/specialAndMathCharacters.js +118 -0
  16. package/cypress/fixtures/theme/ilc.json +150 -0
  17. package/cypress/fixtures/theme/ngie.json +26 -0
  18. package/cypress/fixtures/uploads/20mbFile.png +0 -0
  19. package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
  20. package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
  21. package/cypress/fixtures/uploads/image.png +0 -0
  22. package/cypress/fixtures/uploads/sample.aac +0 -0
  23. package/cypress/fixtures/uploads/sample.accdb +0 -0
  24. package/cypress/fixtures/uploads/sample.csv +100 -0
  25. package/cypress/fixtures/uploads/sample.doc +0 -0
  26. package/cypress/fixtures/uploads/sample.gif +0 -0
  27. package/cypress/fixtures/uploads/sample.heic +0 -0
  28. package/cypress/fixtures/uploads/sample.heif +0 -0
  29. package/cypress/fixtures/uploads/sample.hevc +0 -0
  30. package/cypress/fixtures/uploads/sample.jpeg +0 -0
  31. package/cypress/fixtures/uploads/sample.jpg +0 -0
  32. package/cypress/fixtures/uploads/sample.mp3 +0 -0
  33. package/cypress/fixtures/uploads/sample.mp4 +0 -0
  34. package/cypress/fixtures/uploads/sample.pdf +0 -0
  35. package/cypress/fixtures/uploads/sample.ppt +0 -0
  36. package/cypress/fixtures/uploads/sample.pub +0 -0
  37. package/cypress/fixtures/uploads/sample.rtf +7902 -0
  38. package/cypress/fixtures/uploads/sample.svg +10 -0
  39. package/cypress/fixtures/uploads/sample.txt +1 -0
  40. package/cypress/fixtures/uploads/sample.wav +0 -0
  41. package/cypress/fixtures/uploads/sample.xlsx +0 -0
  42. package/cypress/fixtures/uploads/sample.xps +0 -0
  43. package/cypress/fixtures/uploads/sample.zip +0 -0
  44. package/cypress/fixtures/uploads/sample1.jpg +0 -0
  45. package/cypress/fixtures/uploads/sample1.mp3 +0 -0
  46. package/cypress/fixtures/uploads/sample1.zip +0 -0
  47. package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
  48. package/cypress/fixtures/uploads/sample2.jpg +0 -0
  49. package/cypress/fixtures/uploads/sample2.mp3 +0 -0
  50. package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
  51. package/cypress/pages/audioPlayerPage.js +628 -0
  52. package/cypress/pages/audioResponsePage.js +264 -0
  53. package/cypress/pages/components/additionalSettingsPanel.js +174 -0
  54. package/cypress/pages/components/answerNumerationComponent.js +109 -0
  55. package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
  56. package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
  57. package/cypress/pages/components/autoScoredScoringSection.js +195 -0
  58. package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
  59. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
  60. package/cypress/pages/components/ckEditorToolbar.js +64 -0
  61. package/cypress/pages/components/colorPopupComponent.js +293 -0
  62. package/cypress/pages/components/commonComponents.js +93 -0
  63. package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
  64. package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
  65. package/cypress/pages/components/createQuestionBasePage.js +225 -0
  66. package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
  67. package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
  68. package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
  69. package/cypress/pages/components/draggableOptionsContainer.js +857 -0
  70. package/cypress/pages/components/editCategoryFlyout.js +40 -0
  71. package/cypress/pages/components/equationEditorFlyout.js +158 -0
  72. package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
  73. package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
  74. package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
  75. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
  76. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
  77. package/cypress/pages/components/gridCommonComponents.js +951 -0
  78. package/cypress/pages/components/index.js +38 -0
  79. package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
  80. package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
  81. package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
  82. package/cypress/pages/components/mcqOptionsComponent.js +263 -0
  83. package/cypress/pages/components/mcqPreviewComponents.js +78 -0
  84. package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
  85. package/cypress/pages/components/mcqScoringComponent.js +120 -0
  86. package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
  87. package/cypress/pages/components/optionsWrapperComponent.js +221 -0
  88. package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
  89. package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
  90. package/cypress/pages/components/questionInstructionsComponent.js +112 -0
  91. package/cypress/pages/components/scoringSectionBase.js +308 -0
  92. package/cypress/pages/components/setPointsPopupBase.js +79 -0
  93. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
  94. package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
  95. package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
  96. package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
  97. package/cypress/pages/createItemPage.js +28 -0
  98. package/cypress/pages/dialogBoxBase.js +111 -0
  99. package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
  100. package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
  101. package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
  102. package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
  103. package/cypress/pages/essayResponseBasicPage.js +57 -0
  104. package/cypress/pages/essayResponseMathPage.js +47 -0
  105. package/cypress/pages/essayResponsePage.js +385 -0
  106. package/cypress/pages/feedbackScalePage.js +698 -0
  107. package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
  108. package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
  111. package/cypress/pages/fillInTheGapsScoring.js +5974 -0
  112. package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
  113. package/cypress/pages/fillInTheGapsTextPage.js +225 -0
  114. package/cypress/pages/highlightImagePage.js +1316 -0
  115. package/cypress/pages/highlightPage.js +870 -0
  116. package/cypress/pages/index.js +30 -0
  117. package/cypress/pages/listMatchingPage.js +1330 -0
  118. package/cypress/pages/listMatchingScoring.js +2635 -0
  119. package/cypress/pages/listOrderingPage.js +751 -0
  120. package/cypress/pages/listSortingPage.js +1201 -0
  121. package/cypress/pages/multipleSelectionGridPage.js +359 -0
  122. package/cypress/pages/multipleSelectionPage.js +88 -0
  123. package/cypress/pages/passagePage.js +426 -0
  124. package/cypress/pages/readingRulerPage.js +302 -0
  125. package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
  126. package/cypress/pages/shortTextResponsePage.js +197 -0
  127. package/cypress/pages/singleSelectionGridPage.js +370 -0
  128. package/cypress/pages/singleSelectionPage.js +65 -0
  129. package/cypress/pages/uploadResponsePage.js +110 -0
  130. package/cypress/pages/videoResponsePage.js +375 -0
  131. package/cypress/support/commands.js +140 -0
  132. package/cypress/support/e2e.js +14 -0
  133. package/cypress/support/helpers/abortEarly.js +19 -0
  134. package/cypress/support/helpers/accessibility.js +34 -0
  135. package/cypress/support/helpers/cypressUtilities.js +64 -0
  136. package/cypress/support/helpers/localStorage.js +13 -0
  137. package/cypress/support/helpers/selectText.js +77 -0
  138. package/cypress/support/helpers/utilities.js +126 -0
  139. package/cypress.config.js +76 -0
  140. package/il.yaml +14 -0
  141. package/language +1 -0
  142. package/package.json +26 -0
@@ -0,0 +1,426 @@
1
+ import constants from "../fixtures/constants";
2
+ import utilities from "../support/helpers/utilities";
3
+ import { additionalSettingsPanel, ckEditorToolbar, commonComponents, createQuestionBasePage, equationEditorFlyout } from "./components";
4
+ import { dialogBoxBase } from "./dialogBoxBase";
5
+ import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
6
+ const css = Cypress.env('css');
7
+
8
+ const selectors = {
9
+ ...commonComponents,
10
+ ...ckEditorToolbar,
11
+ ...equationEditorFlyout,
12
+ ...additionalSettingsPanel,
13
+ //TODO: Need to update selectors https://redmine.zeuslearning.com/issues/518498
14
+ headingLabel: () => cy.get('.inline-text-property-label').eq(0),
15
+ headingInputField: () => cy.get('.inline-text-question-prefix-wrapper input').eq(0),
16
+ contentLabel: () => cy.get('.content-label'),
17
+ enableMultipageContentLabel: () => cy.get('[data-ngie-testid="enable-multi-page-content-checkbox"] .MuiFormControlLabel-label'),
18
+ enableMultipageContentLabelCheckbox: () => cy.get('[data-ngie-testid="enable-multi-page-content-checkbox"] input'),
19
+ bodyLabel: () => cy.get('.additional-settings-label').eq(0),
20
+ bodyInputField: () => cy.get('[title="Enter body"]'),
21
+ addPageButton: () => cy.get('.add-option'),
22
+ deletePageButton: () => cy.get('.icon-Delete'),
23
+ bodyWrapper: () => cy.get('.edit-mcq-option-wrapper'),
24
+ bodyNumeration: () => cy.get('[class*="SingleOptionstyle__AdornmentDiv"]'),
25
+ //Preview
26
+ previewHeadingText: () => cy.get('[class*="TabsComponentstyles__PreviewWrapper"] .passage_Heading'),
27
+ previewTabBody: () => cy.get('.question-text-wrapper'),
28
+ previousPageButton: () => cy.get('.pagination-button[data-at="previous"]'),
29
+ nextPageButton: () => cy.get('.pagination-button[data-at="next"]'),
30
+ noPreviewText: () => cy.get('[class*="PassagePreviewstyles__NoPreview"]'),
31
+ paginationText: () => cy.get('.pagination-text'),
32
+ previewWrapper: () => cy.get('[class*="TabsComponentstyles__PreviewWrapper"]'),
33
+ // additionalSettings
34
+ additionalSettingsFleschKincaidLabel: () => cy.get('.inline-text-property-label').eq(1),
35
+ additionalSettingsLexileLabel: () => cy.get('.inline-text-property-label').eq(2),
36
+ additionalSettingsFleschKincaidInputField: () => cy.get('.MuiInputBase-root [aria-label="Flesch-Kincaid"]'),
37
+ additionalSettingsLexileInputField: () => cy.get('.MuiInputBase-root [aria-label="Lexile"]')
38
+ }
39
+
40
+ const steps = {
41
+ ...createQuestionBasePage.steps,
42
+ ...commonComponents.steps,
43
+ ...ckEditorToolbar.steps,
44
+ ...equationEditorFlyout.steps,
45
+ ...additionalSettingsPanel.steps,
46
+
47
+ verifyHeadingPlaceholder: () => {
48
+ passagePage.headingInputField()
49
+ .should('have.attr', 'placeholder', 'Enter heading');
50
+ },
51
+
52
+ verifyBodyPlaceholder: () => {
53
+ passagePage.bodyInputField()
54
+ .should('have.attr', 'data-cke-editorplaceholder', 'Enter body');
55
+ },
56
+
57
+ addHeadingText: () => {
58
+ passagePage.headingInputField()
59
+ .type('Globalization', { delay: 0 })
60
+ .blur();
61
+ },
62
+
63
+ addInputTextToBodyInputField: (inputTextArray) => {
64
+ inputTextArray.forEach((inputText, index) => {
65
+ passagePage.bodyInputField()
66
+ .eq(index)
67
+ .type(inputText)
68
+ .should('have.text', inputText)
69
+ .blur();
70
+ });
71
+ },
72
+
73
+ focusInBodyInputField: (index) => {
74
+ passagePage.bodyInputField()
75
+ .eq(index)
76
+ .focus();
77
+ },
78
+
79
+ focusInHeadingInputField: () => {
80
+ passagePage.headingInputField()
81
+ .focus();
82
+ },
83
+
84
+ focusOutOfBodyInputField: (index) => {
85
+ passagePage.bodyInputField()
86
+ .eq(index)
87
+ .blur();
88
+ },
89
+
90
+ focusOutOfHeadingInputField: () => {
91
+ passagePage.headingInputField()
92
+ .blur();
93
+ },
94
+
95
+ verifyHeadingInputFieldErrorMessage: () => {
96
+ passagePage.headingLabel()
97
+ .parents('.passage')
98
+ .within(() => {
99
+ commonComponents.errorMessage()
100
+ .eq(0)
101
+ .verifyInnerText('Error: Heading is required.');
102
+ });
103
+ },
104
+
105
+ verifyBodyInputFieldErrorMessage: () => {
106
+ passagePage.bodyLabel()
107
+ .parents('.passage')
108
+ .within(() => {
109
+ commonComponents.errorMessage()
110
+ .eq(1)
111
+ .verifyInnerText('Error: Body is required.');
112
+ });
113
+ },
114
+
115
+ addBoldTextInputToBodyInputField: (index) => {
116
+ passagePage.bodyInputField()
117
+ .eq(index)
118
+ .type('This is a bold option')
119
+ .should('have.text', '​​​​​​​This is a bold option');
120
+ },
121
+
122
+ verifyImageAndAltTextInBodyInputField: (index) => {
123
+ passagePage.bodyInputField()
124
+ .eq(index)
125
+ .find('img')
126
+ .should('have.attr', 'src', constants.foxImageLink)
127
+ .and('have.attr', 'alt', constants.foxImageAltText);
128
+ },
129
+
130
+ verifyEquationInBodyInputField: (index) => {
131
+ passagePage.bodyInputField()
132
+ .eq(index)
133
+ .find('[data-widget="ngie_equation"]')
134
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
135
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
136
+ },
137
+
138
+ verifyLinkInBodyInputField: (index) => {
139
+ passagePage.bodyInputField()
140
+ .eq(index)
141
+ .find('a')
142
+ .should('have.text', 'lorem')
143
+ .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
144
+ },
145
+
146
+ verifyBoldTextInBodyInputField: (index) => {
147
+ passagePage.bodyInputField()
148
+ .eq(index)
149
+ .find('strong')
150
+ .should('exist')
151
+ .should('have.text', '​​​​​​​This is a bold option');
152
+ },
153
+
154
+ verifyTextInBodyInputField: (index, bodyInputText) => {
155
+ passagePage.bodyInputField()
156
+ .eq(index)
157
+ .should('have.text', bodyInputText);
158
+ },
159
+
160
+ addPage: () => {
161
+ passagePage.addPageButton()
162
+ .click();
163
+ },
164
+
165
+ deletePage: (index) => {
166
+ passagePage.deletePageButton()
167
+ .eq(index)
168
+ .click();
169
+ },
170
+
171
+ verifyDeletePageButtonDisabled: () => {
172
+ passagePage.deletePageButton()
173
+ .should('be.disabled');
174
+ },
175
+
176
+ verifyDragHandleButtonDisabled: () => {
177
+ commonComponents.dragHandleButton()
178
+ .parents('[class*="SingleOptionstyle__IconWrapper"]')
179
+ .should('have.attr', 'draggable', 'false');
180
+ },
181
+
182
+ verifyDeletePageButtonEnabled: () => {
183
+ passagePage.deletePageButton()
184
+ .should('be.enabled');
185
+ },
186
+
187
+ verifyDragHandleButtonEnabled: () => {
188
+ commonComponents.dragHandleButton()
189
+ .parents('[class*="SingleOptionstyle__IconWrapper"]')
190
+ .should('have.attr', 'draggable', 'true');
191
+ },
192
+
193
+ verifyBodyContents: (index) => {
194
+ passagePage.bodyWrapper()
195
+ .eq(index)
196
+ .within(() => {
197
+ passagePage.bodyInputField()
198
+ .should('have.attr', 'data-cke-editorplaceholder', 'Enter body');
199
+ commonComponents.dragHandleButton()
200
+ .should('exist');
201
+ passagePage.deletePageButton()
202
+ .should('exist');
203
+ passagePage.bodyNumeration()
204
+ .should('have.text', index + 1);
205
+ });
206
+ },
207
+
208
+ verifyDisabledDeletePageButtonTooltip: () => {
209
+ passagePage.deletePageButton()
210
+ .eq(0)
211
+ .trigger('mouseover', { force: true })
212
+ commonComponents.tooltipText()
213
+ .should('have.text', 'Minimum one page is required.');
214
+ passagePage.deletePageButton()
215
+ .eq(0)
216
+ .trigger('mouseout', { force: true });
217
+ commonComponents.tooltipText()
218
+ .should('not.exist');
219
+ },
220
+
221
+ verifyDragHandleButtonTooltip: () => {
222
+ commonComponents.dragHandleButton()
223
+ .eq(0)
224
+ .verifyTooltip('Drag to reorder');
225
+ },
226
+
227
+ verifyDeletePageButtonTooltip: () => {
228
+ passagePage.deletePageButton()
229
+ .eq(0)
230
+ .verifyTooltip('Delete page');
231
+ },
232
+
233
+ verifyBodyPlaceholderTextNotExist: () => {
234
+ passagePage.bodyInputField()
235
+ .should('not.have.attr', 'data-cke-editorplaceholder');
236
+ },
237
+
238
+ verifyHeadingPlaceholderTextDisappear: () => {
239
+ passagePage.headingInputField()
240
+ .should('not.have.attr', 'placeholder');
241
+ },
242
+
243
+ verifyEnableMultiPageContentCheckboxUnchecked: () => {
244
+ passagePage.enableMultipageContentLabelCheckbox()
245
+ .should('not.be.checked');
246
+ },
247
+
248
+ clearBodyInputField: () => {
249
+ passagePage.bodyInputField()
250
+ .clear();
251
+ },
252
+
253
+ checkMultipageContentCheckbox: () => {
254
+ passagePage.enableMultipageContentLabelCheckbox()
255
+ .click()
256
+ .should('be.checked');
257
+ },
258
+
259
+ uncheckMultipageContentCheckbox: () => {
260
+ passagePage.enableMultipageContentLabelCheckbox()
261
+ .click()
262
+ .should('not.be.checked');
263
+ },
264
+ //Preview
265
+ verifyImageAddedToBodyInPreviewTab: () => {
266
+ passagePage.previewTabBody()
267
+ .find('img')
268
+ .should('have.attr', 'src', constants.foxImageLink)
269
+ .and('have.attr', 'alt', constants.foxImageAltText);
270
+ },
271
+
272
+ verifyEquationAddedToBodyInPreviewTab: () => {
273
+ passagePage.previewTabBody()
274
+ .contains(constants.CKEditorInputFieldEnteredEquationText)
275
+ passagePage.previewTabBody()
276
+ .find('[role="math"]')
277
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
278
+ },
279
+
280
+ verifyLinkAddedToBodyInPreviewTab: () => {
281
+ passagePage.previewTabBody()
282
+ .should('have.text', 'lorem')
283
+ .find('a')
284
+ .should('have.attr', 'href', `${Cypress.config().baseUrl}`)
285
+ },
286
+
287
+ verifyBoldTextAddedToBodyInPreviewTab: () => {
288
+ passagePage.previewTabBody()
289
+ .find('strong')
290
+ .should('exist')
291
+ .should('have.text', 'This is a bold option')
292
+ },
293
+
294
+ verifyPreviousPageButtonDisabled: () => {
295
+ passagePage.previousPageButton()
296
+ .should('be.disabled');
297
+ },
298
+
299
+ verifyNextPageButtonDisabled: () => {
300
+ passagePage.nextPageButton()
301
+ .should('be.disabled');
302
+ },
303
+
304
+ verifyPreviousPageButtonEnabled: () => {
305
+ passagePage.previousPageButton()
306
+ .should('be.enabled');
307
+ },
308
+
309
+ verifyNextPageButtonEnabled: () => {
310
+ passagePage.nextPageButton()
311
+ .should('be.enabled');
312
+ },
313
+
314
+ navigateToNextPage: () => {
315
+ passagePage.nextPageButton()
316
+ .click();
317
+ },
318
+
319
+ navigateToPreviousPage: () => {
320
+ passagePage.previousPageButton()
321
+ .click();
322
+ },
323
+
324
+ hoverOnNextPageButton: () => {
325
+ passagePage.nextPageButton()
326
+ .realHover()
327
+ },
328
+
329
+ hoverAwayFromNextPageButton: () => {
330
+ passagePage.nextPageButton()
331
+ .realHover({ position: 'topLeft' })
332
+ },
333
+
334
+ hoverOnPreviousPageButton: () => {
335
+ passagePage.previousPageButton()
336
+ .realHover()
337
+ },
338
+
339
+ hoverAwayFromPreviousPageButton: () => {
340
+ passagePage.previousPageButton()
341
+ .realHover({ position: 'topLeft' })
342
+ },
343
+
344
+ // additional settings
345
+ addAndVerifyTextInFleschKincaidInputField: (text) => {
346
+ passagePage.additionalSettingsFleschKincaidInputField()
347
+ .type(text, { delay: 0 })
348
+ .blur()
349
+ .should('have.attr', 'value', text);
350
+ },
351
+
352
+ addAndVerifyTextInLexileInputField: (text) => {
353
+ passagePage.additionalSettingsLexileInputField()
354
+ .type(text, { delay: 0 })
355
+ .blur()
356
+ .should('have.attr', 'value', text);
357
+ },
358
+
359
+ addTextToTeacherGuidelinesInputField: () => {
360
+ passagePage.additionalSettingsTeacherGuidelinesInputField()
361
+ .type('Teacher scoring guidelines', { delay: 0 })
362
+ .blur();
363
+ },
364
+
365
+ /**
366
+ * @param {number} currentPage shows the current page
367
+ * @param {number} TotalPages shows the total no of pages
368
+ * @description this function verifies pagination text displayed in the preview tab
369
+ */
370
+ verifyPaginationText: (currentPage, TotalPages) => {
371
+ passagePage.paginationText()
372
+ .should('have.text', `${currentPage} of ${TotalPages}`);
373
+ },
374
+ }
375
+
376
+ const tests = {
377
+ ...equationEditorFlyout.tests,
378
+ ...commonComponents.tests,
379
+ ...createQuestionBasePage.tests,
380
+ ...additionalSettingsPanel.tests,
381
+
382
+ // header section
383
+ verifyCancelButton: () => {
384
+ it('When user has made no edits and clicks on Cancel button, the user should be directed back to the \'Select a Question\' page', () => {
385
+ createQuestionBasePage.cancelButton()
386
+ .click();
387
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.selectAQuestionHeaderText(), 'visible');
388
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.questionTypeOptionTitle(), 'visible');
389
+ });
390
+
391
+ it('When user has made some edits/changes and clicks on Cancel button, a popup should be displayed', () => {
392
+ selectQuestionResourceToolPage.steps.selectResourceType('Passage');
393
+ utilities.verifyElementVisibilityState(passagePage.headingInputField(), 'visible');
394
+ passagePage.steps.addHeadingText();
395
+ createQuestionBasePage.cancelButton()
396
+ .click();
397
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible')
398
+ });
399
+
400
+ dialogBoxBase.tests.verifyContentsOfLeavePagePopupWithCSSAnda11y();
401
+
402
+ it(`Clicking on \'No, I'd like to go back\' button should close the popup and user should remain on the edit interface of the question`, () => {
403
+ dialogBoxBase.buttonReject()
404
+ .click();
405
+ createQuestionBasePage.editTab()
406
+ .should('have.attr', 'aria-selected', 'true')
407
+ passagePage.headingInputField()
408
+ .should('have.attr', 'value', 'Globalization')
409
+ });
410
+
411
+ it(`Clicking on \'Yes, I want to leave this page\' button should should discard all changes and direct the user to the \'Select a question\' page.`, () => {
412
+ createQuestionBasePage.cancelButton()
413
+ .click();
414
+ dialogBoxBase.buttonAccept()
415
+ .click();
416
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.selectAQuestionHeaderText(), 'visible');
417
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.questionTypeOptionTitle(), 'visible');
418
+ });
419
+ },
420
+ }
421
+
422
+ export const passagePage = {
423
+ ...selectors,
424
+ steps,
425
+ tests
426
+ }