itemengine-cypress-automation 1.0.23 → 1.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (18) hide show
  1. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsAdvanceSettingsForAllResponseAreas.js +511 -0
  2. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsBasic.js +263 -0
  3. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsResponseAccordions.js +734 -0
  4. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsStudentResponseAreaAndLayout.js +603 -0
  5. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAllOrNothingWithAlternateAnswer.js +54 -0
  6. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAlternateAnswer.js +104 -0
  7. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAutoScoredScoring.js +38 -0
  8. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextCaseSensitiveAndIgnoreExtraSpacesCheckboxes.js +174 -0
  9. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextEditTabBasicSections.js +176 -0
  10. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextEditTabScoringSection.js +150 -0
  11. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextHeaderSection.js +112 -0
  12. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextManuallyAndNonScoredScoring.js +49 -0
  13. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialDifferentWeights.js +47 -0
  14. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialDifferentWeightsWithAlternateAnswer.js +60 -0
  15. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialEqualWeights.js +45 -0
  16. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialEqualWeightsWithAlternateAnswer.js +58 -0
  17. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextSetCorrectAnswerSection.js +70 -0
  18. package/package.json +1 -1
@@ -0,0 +1,603 @@
1
+ import { specialOrMathCharacters } from "../../../fixtures/specialAndMathCharacters";
2
+ import { dialogBoxBase, fillInTheGapsTextPage } from "../../../pages";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ const css = Cypress.env('css');
5
+ let customSpecialCharacters = [':', ')', '`']
6
+
7
+ describe('Fill In the Gaps Additional settings: Student response area and layout', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Additional Settings: Student response area and layout', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
16
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
17
+ });
18
+
19
+ it('\'Student response area and layout\' label should be displayed', () => {
20
+ fillInTheGapsTextPage.studentResponseAreaAndLayoutLabel()
21
+ .verifyInnerText('Student response area and layout')
22
+ .should('be.visible');
23
+ });
24
+
25
+ it('CSS of \'Student response area and layout\' section', { tags: 'css' }, () => {
26
+ fillInTheGapsTextPage.studentResponseAreaAndLayoutLabel()
27
+ .verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.semibold);
28
+ });
29
+
30
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
31
+ });
32
+
33
+ describe('Additional Settings: Answer numeration (only while grading) dropdown', () => {
34
+ let dropdownOptions = ['Numerical', 'Uppercase alphabet', 'Lowercase alphabet'];
35
+ abortEarlySetup();
36
+ before(() => {
37
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
38
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
39
+ });
40
+
41
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
42
+
43
+ fillInTheGapsTextPage.tests.verifyAnswerNumerationContents();
44
+
45
+ it(`User should be able to select any option other than ${dropdownOptions[0]}`, () => {
46
+ fillInTheGapsTextPage.steps.selectAnswerNumerationDropdownOption(`${dropdownOptions[2]}`)
47
+ });
48
+
49
+ //TODO: We have not checked the Response numeration in Grading view
50
+ });
51
+
52
+ describe('Additional Settings: Multiline response', () => {
53
+ abortEarlySetup();
54
+ before(() => {
55
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
56
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
57
+ });
58
+
59
+ it('\'Multiline response\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
60
+ fillInTheGapsTextPage.multilineResponseLabel()
61
+ .verifyInnerText('Multiline response');
62
+ fillInTheGapsTextPage.multilineResponseCheckbox()
63
+ .should('not.be.checked');
64
+ });
65
+
66
+ it('CSS of \'Multiline response\' section - unchecked state', { tags: 'css' }, () => {
67
+ fillInTheGapsTextPage.multilineResponseCheckbox()
68
+ .parent()
69
+ .find('svg')
70
+ .should('have.css', 'fill', css.color.uncheckedCheckbox);
71
+ });
72
+
73
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
74
+
75
+ //Multiline response test cases for set correct answer section response fields
76
+ it('When the \'Multiline response\' functionality is disabled, the response fields should not have \'textarea\' field in \'Set correct answer\' section', () => {
77
+ fillInTheGapsTextPage.multilineResponseCheckbox()
78
+ .should('not.be.checked');
79
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
80
+ .each(($el) => {
81
+ cy.wrap($el)
82
+ .parents('.response-input-field')
83
+ .should('not.have.class', 'response-multiline-input-field')
84
+ .find('input[type="text"]')
85
+ .should('exist')
86
+ .parents('.response-input-field')
87
+ .find('textarea')
88
+ .should('not.exist');
89
+ });
90
+ });
91
+
92
+ it('When \'Multiline response\' functionality is disabled then the user should not be able to enter a multiline response in the \'Set correct answer\' section', () => {
93
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
94
+ .each(($el) => {
95
+ cy.wrap($el)
96
+ .type('l{enter}o{enter}r{enter}e{enter}m')
97
+ .should('have.value', 'lorem');
98
+ });
99
+ });
100
+
101
+ it('When the \'Multiline response\' functionality is enabled, the response field should have \'textarea\' field in \'Set correct answer\' section', () => {
102
+ fillInTheGapsTextPage.multilineResponseCheckbox()
103
+ .click()
104
+ .should('be.checked');
105
+ fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
106
+ .each(($el) => {
107
+ cy.wrap($el)
108
+ .should('exist')
109
+ .find('textarea')
110
+ .should('exist')
111
+ .parents('.response-multiline-input-field')
112
+ .find('input[type="text"]')
113
+ .should('not.exist');
114
+ });
115
+ });
116
+
117
+ it('When the \'Multiline response\' functionality is enabled then the user should be able to add Multiline responses in the \'Set correct answer\' section', () => {
118
+ fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
119
+ .each(($el) => {
120
+ cy.wrap($el)
121
+ .clear()
122
+ .type('l{enter}o{enter}r{enter}e{enter}m')
123
+ .should('have.text', 'l\no\nr\ne\nm​');
124
+ });
125
+ });
126
+
127
+ it('CSS of \'Multiline response\' section - checked state', { tags: 'css' }, () => {
128
+ fillInTheGapsTextPage.multilineResponseLabel()
129
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
130
+ fillInTheGapsTextPage.multilineResponseCheckbox()
131
+ .parent()
132
+ .find('g[data-name*="Rectangle"]')
133
+ .should('have.css', 'fill', css.color.activeButtons);
134
+ });
135
+
136
+ it('Accessibility of \'Multiline response\' section - checked state', { tags: 'a11y' }, () => {
137
+ cy.checkAccessibility(fillInTheGapsTextPage.multilineResponseLabel().parents('.MuiFormGroup-root'))
138
+ });
139
+
140
+ it('When the \'Multiline response\' functionality is enabled then the user should be able to enter multiline characters including the line breaks up to the set character limit', () => {
141
+ fillInTheGapsTextPage.setCharacterLimitInputField()
142
+ .should('have.value', '20');
143
+ fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
144
+ .each(($el) => {
145
+ cy.wrap($el)
146
+ .clear()
147
+ .type('l{enter}o{enter}r{enter}e{enter}m{enter}e{enter}s{enter}u{enter}m{enter}l{enter}nam')
148
+ .should('have.text', 'l\no\nr\ne\nm\ne\ns\nu\nm\nl\n​');
149
+ });
150
+ });
151
+
152
+ it('When the user disables the Multiline response functionality, the added input in the response field should appear in a single line in \'Set correct answer\' section', () => {
153
+ fillInTheGapsTextPage.multilineResponseCheckbox()
154
+ .click()
155
+ .should('not.be.checked');
156
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
157
+ .each(($el) => {
158
+ cy.wrap($el)
159
+ .should('have.value', 'loremesuml');
160
+ });
161
+ });
162
+
163
+ //Multiline response test cases for preview tab response fields
164
+ it('When the \'Multiline response\' functionality is disabled, the response field should not have \'textarea\' field in preview tab', () => {
165
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
166
+ fillInTheGapsTextPage.previewTabResponseField()
167
+ .each(($el) => {
168
+ cy.wrap($el)
169
+ .parents('.response-input-field')
170
+ .should('not.have.class', 'response-multiline-input-field')
171
+ .find('input[type="text"]')
172
+ .should('exist')
173
+ .parents('.response-input-field')
174
+ .find('textarea')
175
+ .should('not.exist')
176
+ });
177
+ });
178
+
179
+ it('When \'Multiline response\' functionality is disabled, the user should not be able to add multiline response in the preview tab response field', () => {
180
+ fillInTheGapsTextPage.previewTabResponseField()
181
+ .each(($el) => {
182
+ cy.wrap($el)
183
+ .type('l{enter}o{enter}r{enter}e{enter}m')
184
+ .should('have.value', 'lorem');
185
+ });
186
+ });
187
+
188
+ it('When the \'Multiline response\' functionality is enabled, the response field should have \'textarea\' field in the preview tab', () => {
189
+ fillInTheGapsTextPage.steps.switchToEditTab()
190
+ fillInTheGapsTextPage.multilineResponseCheckbox()
191
+ .click()
192
+ .should('be.checked');
193
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
194
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
195
+ .each(($el) => {
196
+ cy.wrap($el)
197
+ .should('exist')
198
+ .find('textarea')
199
+ .should('exist')
200
+ .parents('.response-multiline-input-field')
201
+ .find('input[type="text"]')
202
+ .should('not.exist');
203
+ });
204
+ });
205
+
206
+ it('When the \'Multiline response\' functionality is enabled then the user should be able to add Multiline responses in the preview tab', () => {
207
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
208
+ .each(($el) => {
209
+ cy.wrap($el)
210
+ .type('l{enter}o{enter}r{enter}e{enter}m')
211
+ .should('have.text', 'l\no\nr\ne\nm​');
212
+ });
213
+ });
214
+
215
+ it('When the \'Multiline response\' functionality is enabled then the user should be able to enter multiline characters including the line breaks up to the set character limit in the preview tab', () => {
216
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
217
+ .each(($el) => {
218
+ cy.wrap($el)
219
+ .clear()
220
+ .type('l{enter}o{enter}r{enter}e{enter}m{enter}e{enter}s{enter}u{enter}m{enter}l{enter}nam')
221
+ .should('have.text', 'l\no\nr\ne\nm\ne\ns\nu\nm\nl\n​');
222
+ });
223
+ });
224
+ });
225
+
226
+ describe('Additional Settings: Scoring for Multiline response', () => {
227
+ abortEarlySetup();
228
+ before(() => {
229
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
230
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
231
+ fillInTheGapsTextPage.multilineResponseCheckbox()
232
+ .click()
233
+ .should('be.checked');
234
+ });
235
+
236
+ it('When the user has enabled the Multiline functionality then user should be able to set multiline correct answers and points in the \'Set correct answer\' section', () => {
237
+ fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
238
+ .eq(0)
239
+ .type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}1')
240
+ .should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n1​');
241
+ fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
242
+ .eq(1)
243
+ .type('Response 2')
244
+ .should('have.text', 'Response 2​');
245
+ fillInTheGapsTextPage.pointsInputField()
246
+ .type('10');
247
+ });
248
+
249
+ it('When the user enters the correct multiline and single line response in the preview tab then full points should be awarded', () => {
250
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
251
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
252
+ .eq(0)
253
+ .type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}1')
254
+ .should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n1​');
255
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
256
+ .eq(1)
257
+ .type('Response 2')
258
+ .should('have.text', 'Response 2​');
259
+ fillInTheGapsTextPage.previewScoreText()
260
+ .verifyInnerText('10/10');
261
+ fillInTheGapsTextPage.previewTabCorrectAnswerContainer()
262
+ .should('not.exist');
263
+ cy.log('When the user selects show correct answer checkbox then correct icons and label should be displayed')
264
+ fillInTheGapsTextPage.showCorrectAnswerCheckbox()
265
+ .click();
266
+ fillInTheGapsTextPage.previewTabResponseFieldWrapper()
267
+ .each(($el) => {
268
+ cy.wrap($el)
269
+ .within(() => {
270
+ fillInTheGapsTextPage.correctIcon()
271
+ .should('be.visible');
272
+ });
273
+ });
274
+ fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
275
+ fillInTheGapsTextPage.steps.verifyCorrectAttemptBorder();
276
+ cy.log('Post step: Uncheck Show correct answer checkbox')
277
+ fillInTheGapsTextPage.showCorrectAnswerCheckbox()
278
+ .click()
279
+ .should('not.be.checked');
280
+ });
281
+
282
+ it('When the user enters a single line response instead of a multiline response then no points should be awarded', () => {
283
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
284
+ .eq(0)
285
+ .clear()
286
+ .type('Response 1')
287
+ .should('have.text', 'Response 1​');
288
+ fillInTheGapsTextPage.previewScoreText()
289
+ .verifyInnerText('0/10');
290
+ cy.log('When the user selects show correct answer checkbox then incorrect icon should be displayed beside Response 1 and correct icon beside the Response 2 and Incorrect label should be displayed')
291
+ fillInTheGapsTextPage.showCorrectAnswerCheckbox()
292
+ .click();
293
+ fillInTheGapsTextPage.previewTabResponseFieldWrapper()
294
+ .eq(0)
295
+ .within(() => {
296
+ fillInTheGapsTextPage.incorrectIcon()
297
+ .should('be.visible');
298
+ });
299
+ fillInTheGapsTextPage.previewTabResponseFieldWrapper()
300
+ .eq(1)
301
+ .within(() => {
302
+ fillInTheGapsTextPage.correctIcon()
303
+ .should('be.visible');
304
+ });
305
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount('fill in the gaps - text', ['R\ne\ns\np\no\nn\ns\ne\n1']);
306
+ fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
307
+ fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder()
308
+ cy.log('Post step: Uncheck Show correct answer checkbox')
309
+ fillInTheGapsTextPage.showCorrectAnswerCheckbox()
310
+ .click()
311
+ .should('not.be.checked');
312
+ });
313
+
314
+ it('When the user enters a multiline response instead of a single line response then no points should be awarded', () => {
315
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
316
+ .eq(0)
317
+ .clear()
318
+ .type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}1')
319
+ .should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n1​');
320
+ fillInTheGapsTextPage.previewTabMultilineTextArea()
321
+ .eq(1)
322
+ .clear()
323
+ .type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}2')
324
+ .should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n2​');
325
+ fillInTheGapsTextPage.previewScoreText()
326
+ .verifyInnerText('0/10');
327
+ cy.log('When the user selects show correct answer checkbox then incorrect icon should be displayed beside Response 1 and correct icon beside the Response 2 and Incorrect label should be displayed')
328
+ fillInTheGapsTextPage.showCorrectAnswerCheckbox()
329
+ .click();
330
+ fillInTheGapsTextPage.previewTabResponseFieldWrapper()
331
+ .eq(0)
332
+ .within(() => {
333
+ fillInTheGapsTextPage.correctIcon()
334
+ .should('be.visible');
335
+ });
336
+ fillInTheGapsTextPage.previewTabResponseFieldWrapper()
337
+ .eq(1)
338
+ .within(() => {
339
+ fillInTheGapsTextPage.incorrectIcon()
340
+ .should('be.visible');
341
+ });
342
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount('fill in the gaps - text', ['Response 2']);
343
+ fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
344
+ fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder();
345
+ });
346
+ });
347
+
348
+ describe('Additional Settings: Spell check section', () => {
349
+ abortEarlySetup();
350
+ before(() => {
351
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
352
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
353
+ });
354
+
355
+ it('\'Spell check\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
356
+ fillInTheGapsTextPage.spellCheckLabel()
357
+ .verifyInnerText('Spell check');
358
+ fillInTheGapsTextPage.spellCheckCheckbox()
359
+ .should('not.be.checked');
360
+ });
361
+
362
+ it('CSS of \'Spell check\' section - unchecked state', { tags: 'css' }, () => {
363
+ fillInTheGapsTextPage.spellCheckCheckbox()
364
+ .parent()
365
+ .find('svg')
366
+ .should('have.css', 'fill', css.color.uncheckedCheckbox);
367
+ });
368
+
369
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
370
+
371
+ //Spell check test cases for set correct answer section response fields
372
+ it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in \'Set correct answer\' section', () => {
373
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
374
+ .each(($el) => {
375
+ cy.wrap($el)
376
+ .should('have.attr', 'spellcheck', 'false');
377
+ });
378
+ });
379
+
380
+ it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in \'Set correct answer\' section', () => {
381
+ fillInTheGapsTextPage.spellCheckCheckbox()
382
+ .click()
383
+ .should('be.checked');
384
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
385
+ .each(($el) => {
386
+ cy.wrap($el)
387
+ .should('have.attr', 'spellcheck', 'true');
388
+ });
389
+ });
390
+
391
+ it('CSS of \'Spell check\' section - checked state', { tags: 'css' }, () => {
392
+ fillInTheGapsTextPage.spellCheckLabel()
393
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
394
+ fillInTheGapsTextPage.spellCheckCheckbox()
395
+ .parent()
396
+ .find('g[data-name*="Rectangle"]')
397
+ .should('have.css', 'fill', css.color.activeButtons);
398
+ });
399
+
400
+ it('Accessibility of \'Spell check\' section - checked state', { tags: 'a11y' }, () => {
401
+ cy.checkAccessibility(fillInTheGapsTextPage.spellCheckLabel().parents('.MuiFormGroup-root'))
402
+ });
403
+
404
+ //Spell check test cases for preview tab response fields
405
+ it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in preview tab', () => {
406
+ fillInTheGapsTextPage.spellCheckCheckbox()
407
+ .click()
408
+ .should('not.be.checked');
409
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
410
+ fillInTheGapsTextPage.previewTabResponseField()
411
+ .each(($el) => {
412
+ cy.wrap($el)
413
+ .should('have.attr', 'spellcheck', 'false');
414
+ });
415
+ });
416
+
417
+ it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in the preview tab', () => {
418
+ cy.log('Pre step: Switching to Edit tab')
419
+ fillInTheGapsTextPage.steps.switchToEditTab();
420
+ fillInTheGapsTextPage.spellCheckCheckbox()
421
+ .click()
422
+ .should('be.checked');
423
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
424
+ fillInTheGapsTextPage.previewTabResponseField()
425
+ .each(($el) => {
426
+ cy.wrap($el)
427
+ .should('have.attr', 'spellcheck', 'true');
428
+ });
429
+ });
430
+ });
431
+
432
+ describe('Additional Settings: Custom special characters section', () => {
433
+ abortEarlySetup();
434
+ before(() => {
435
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
436
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
437
+ });
438
+
439
+ fillInTheGapsTextPage.tests.verifyAdditionalSettingsCustomSpecialCharactersSection();
440
+
441
+ it('When the user checks the \'Display special characters\' checkbox then the \'Special characters\' button should be displayed when user focuses in any response field in \'Set correct answer\' section ', () => {
442
+ cy.log('Checking Custom characters button is not visible before focusing any option')
443
+ fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
444
+ .eq(0)
445
+ .should('not.have.class', 'active-response-input-field')
446
+ .should('not.be.visible');
447
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
448
+ .eq(0)
449
+ .click();
450
+ fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
451
+ .eq(0)
452
+ .should('have.class', 'active-response-input-field')
453
+ .should('be.visible');
454
+ });
455
+
456
+ it('When the user has added no input to the \'Custom special characters\' input field then the default Special characters flyout should be displayed on clicking the \'Special characters\' button in the response field', () => {
457
+ fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
458
+ .eq(0)
459
+ .should('be.visible')
460
+ .click();
461
+ fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
462
+ });
463
+
464
+ fillInTheGapsTextPage.tests.verifySpecialCharactersFlyoutSymbols()
465
+
466
+ it(`When the user clicks on a symbol in the ${specialOrMathCharacters['specialCharacters'].popupTitle} popup, then that symbol should be inserted in the response field`, () => {
467
+ cy.log('Clicking on all symbols.');
468
+ let symbolsString = specialOrMathCharacters['specialCharacters'].characters.map((icon) => icon.symbol);
469
+ symbolsString = symbolsString.join('');
470
+ fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
471
+ dialogBoxBase.steps.closeWarningPopup();
472
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
473
+ .eq(0)
474
+ .should('have.value', symbolsString);
475
+ cy.log('Post step: Clearing the set correct answer input field')
476
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
477
+ .eq(0)
478
+ .clear();
479
+ });
480
+
481
+ it('When the \'Display special characters\' checkbox is checked then user should be able to enter value in the \'Custom special characters\' input field', () => {
482
+ fillInTheGapsTextPage.customSpecialCharactersInputField()
483
+ .type(':)`')
484
+ .should('have.value', ':)`');
485
+ });
486
+
487
+ it('When the user clicks on the \'Special characters\' button in the response field then a flyout with the title \'Special characters\' and close button should be displayed', () => {
488
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
489
+ .eq(0)
490
+ .focus();
491
+ fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
492
+ .eq(0)
493
+ .should('be.visible')
494
+ .click();
495
+ fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
496
+ });
497
+
498
+ it('The flyout should contain all the added Special characters entered in the \'Custom special characters\' input field', () => {
499
+ fillInTheGapsTextPage.specialCharactersFlyoutIcon()
500
+ .each(($el, index) => {
501
+ cy.wrap($el)
502
+ .should('have.text', `${customSpecialCharacters[index]}`)
503
+ });
504
+ });
505
+
506
+ it('When the user clicks on the characters then they should be added to the set correct answer response field', () => {
507
+ fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
508
+ dialogBoxBase.steps.closeWarningPopup();
509
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
510
+ .eq(0)
511
+ .should('have.value', ':)`');
512
+ });
513
+
514
+ //Special custom characters test cases for preview tab response fields
515
+ it('When the \'Custom special characters\' functionality is disabled then the \'Special characters\' button should not be displayed in the preview tab response field', () => {
516
+ fillInTheGapsTextPage.customSpecialCharactersInputField()
517
+ .clear();
518
+ fillInTheGapsTextPage.displaySpecialCharactersCheckbox()
519
+ .click()
520
+ .should('not.be.checked');
521
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
522
+ fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
523
+ .should('not.exist');
524
+ });
525
+
526
+ it('When the user has enabled the \'Custom special characters\' functionality then the \'Special characters\' button should be displayed when user focuses in any response field in the preview tab', () => {
527
+ cy.log('Pre step: Enable the Custom special characters')
528
+ fillInTheGapsTextPage.steps.switchToEditTab();
529
+ fillInTheGapsTextPage.displaySpecialCharactersCheckbox()
530
+ .click()
531
+ .should('be.checked');
532
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
533
+ fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
534
+ .should('not.have.class', 'active-response-input-field')
535
+ .and('not.be.visible');
536
+ fillInTheGapsTextPage.previewTabResponseField()
537
+ .eq(0)
538
+ .click();
539
+ fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
540
+ .eq(0)
541
+ .should('have.class', 'active-response-input-field')
542
+ .should('be.visible');
543
+ });
544
+
545
+ it('When the user has added no input to the \'Custom special characters\' input field then the default Special characters flyout should be displayed on clicking the \'Special characters\' button in the response field', () => {
546
+ fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
547
+ .eq(0)
548
+ .should('be.visible')
549
+ .click();
550
+ fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
551
+ });
552
+
553
+ fillInTheGapsTextPage.tests.verifySpecialCharactersFlyoutSymbols()
554
+
555
+ it(`When the user clicks on a symbol in the ${specialOrMathCharacters['specialCharacters'].popupTitle} popup, then that symbol should be inserted in the response field`, () => {
556
+ cy.log('Clicking on all symbols.');
557
+ let symbolsString = specialOrMathCharacters['specialCharacters'].characters.map((icon) => icon.symbol);
558
+ symbolsString = symbolsString.join('');
559
+ fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
560
+ dialogBoxBase.steps.closeWarningPopup();
561
+ fillInTheGapsTextPage.previewTabResponseField()
562
+ .eq(0)
563
+ .should('have.value', symbolsString);
564
+ });
565
+
566
+ it('When the \'Display special characters\' checkbox is checked then user should be able to enter value in the \'Custom special characters\' input field', () => {
567
+ cy.log('Pre step: Swicth to Edit tab')
568
+ fillInTheGapsTextPage.steps.switchToEditTab()
569
+ fillInTheGapsTextPage.customSpecialCharactersInputField()
570
+ .type(':)`')
571
+ .should('have.value', ':)`');
572
+ cy.log('Post step: Switch to Preview tab')
573
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
574
+ });
575
+
576
+ it('When the user clicks on the \'Special characters\' button then a flyout with the title \'Special characters\' and close button should be displayed in the preview tab', () => {
577
+ fillInTheGapsTextPage.previewTabResponseField()
578
+ .eq(0)
579
+ .focus();
580
+ fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
581
+ .eq(0)
582
+ .should('be.visible')
583
+ .click();
584
+ fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
585
+ });
586
+
587
+ it('The flyout should contain all the added Special characters entered in the \'Custom special characters\' input field', () => {
588
+ fillInTheGapsTextPage.specialCharactersFlyoutIcon()
589
+ .each(($el, index) => {
590
+ cy.wrap($el)
591
+ .should('have.text', `${customSpecialCharacters[index]}`)
592
+ });
593
+ });
594
+
595
+ it('When the user clicks on the characters then they should be added to the preview tab input field', () => {
596
+ fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
597
+ dialogBoxBase.steps.closeWarningPopup();
598
+ fillInTheGapsTextPage.previewTabResponseField()
599
+ .eq(0)
600
+ .should('have.value', ':)`');
601
+ });
602
+ });
603
+ });
@@ -0,0 +1,54 @@
1
+ import { fillInTheGapsScoring, fillInTheGapsTextPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ describe('Create Item page - Fill in the Gaps: Scoring Section', () => {
5
+ before(() => {
6
+ cy.loginAs('admin');
7
+ });
8
+
9
+ describe('Question Preview: AutoScored - All or Nothing with alternate answer with \'Match from all responses property - \"false\"\'', () => {
10
+ abortEarlySetup();
11
+ before(() => {
12
+ cy.log('Navigate to Fill in the gaps - text question type, adding correct answer responses and alternate answer responses for autoscored - all or nothing scoring, adding points and switch to preview tab');
13
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
14
+ fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 1', 'Response 2']);
15
+ fillInTheGapsTextPage.steps.allotPoints(7);
16
+ fillInTheGapsTextPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
17
+ fillInTheGapsTextPage.alternateAnswerButton()
18
+ .click();
19
+ fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 3', 'Response 4']);
20
+ fillInTheGapsTextPage.steps.allotPoints(3);
21
+ fillInTheGapsTextPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
22
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
23
+ fillInTheGapsTextPage.allowStudentsToCheckAnswerCheckbox()
24
+ .click();
25
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
26
+ });
27
+
28
+ fillInTheGapsScoring.tests.verifyAutoScoredAllOrNothingWithAlternateAnswerAndMatchFromAllResponsesFalse('fill in the gaps - text')
29
+ });
30
+
31
+ describe('Question Preview: AutoScored - All or Nothing with alternate answer with \'Match from all responses property - \"true\"\'', () => {
32
+ abortEarlySetup();
33
+ before(() => {
34
+ cy.log('Navigate to Fill in the gaps - text question type, adding correct answer responses and alternate answer responses for autoscored - all or nothing scoring');
35
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
36
+ fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 1', 'Response 2']);
37
+ fillInTheGapsTextPage.steps.allotPoints(7);
38
+ fillInTheGapsTextPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
39
+ fillInTheGapsTextPage.alternateAnswerButton()
40
+ .click();
41
+ fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 3', 'Response 4']);
42
+ fillInTheGapsTextPage.steps.allotPoints(3);
43
+ fillInTheGapsTextPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
44
+ fillInTheGapsTextPage.matchFromAllResponsesCheckbox()
45
+ .click();
46
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
47
+ fillInTheGapsTextPage.allowStudentsToCheckAnswerCheckbox()
48
+ .click();
49
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
50
+ });
51
+
52
+ fillInTheGapsScoring.tests.verifyAutoScoredAllOrNothingWithAlternateAnswerAndMatchFromAllResponsesTrue('fill in the gaps - text')
53
+ });
54
+ });