itemengine-cypress-automation 1.0.29 → 1.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (15) hide show
  1. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettings.js +0 -292
  2. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettingsResponseAccordion.js +299 -0
  3. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsAllOrNothingScoring.js +1 -180
  4. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsAllOrNothingWithAlternateAnswer.js +186 -0
  5. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsPartialDifferentWeightsScoring.js +0 -87
  6. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsPartialDifferentWeightsWithAlternateAnswer.js +95 -0
  7. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsPartialEqualWeightsScoring.js +0 -86
  8. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsPartialEqualWeightsWithAlternateAnswer.js +94 -0
  9. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropStandardOptionPartialDifferentWeightsScoring.js +0 -75
  10. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropStandardOptionPartialDifferentWeightsWithAlternateAnswer.js +83 -0
  11. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropStandardOptionsAllOrNothingwithAlternateAnswer.js +74 -0
  12. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropStandardOptionsAutoScoredAllOrNothingScoring.js +0 -67
  13. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropStandardOptionsPartialEqualWeightsScoring.js +0 -74
  14. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropStandardOptionsPartialEqualWeightsWithAlternateAnswer.js +82 -0
  15. package/package.json +1 -1
@@ -16,18 +16,6 @@ describe('Fill In the Gaps Additional settings and Responses accordion', () => {
16
16
  fillInTheGapsDragAndDropPage.tests.verifyAdditonalSettingsAccordionProperties();
17
17
  });
18
18
 
19
- describe('Additional Settings: Advanced settings for all Response Areas', () => {
20
- abortEarlySetup();
21
- before(() => {
22
- fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
23
- cy.barsPreLoaderWait();
24
- fillInTheGapsDragAndDropPage.steps.expandAdditonalSettings();
25
- });
26
-
27
- fillInTheGapsDragAndDropPage.tests.verifyAdvanceSettingsForAllResponsesLabelAndCSS();
28
-
29
- });
30
-
31
19
  describe('Additional Settings: Height and Width', () => {
32
20
  abortEarlySetup();
33
21
  before(() => {
@@ -194,286 +182,6 @@ describe('Fill In the Gaps Additional settings and Responses accordion', () => {
194
182
  fillInTheGapsDragAndDropPage.tests.verifyAdditionalSettingsResponseAccordionLabelCSSAndA11y();
195
183
  });
196
184
 
197
- describe('Response Accordions: ARIA label', () => {
198
- abortEarlySetup();
199
- before(() => {
200
- fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
201
- cy.barsPreLoaderWait();
202
- fillInTheGapsDragAndDropPage.steps.expandAdditonalSettings();
203
- fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(0);
204
- fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(1);
205
- });
206
-
207
- fillInTheGapsDragAndDropPage.tests.verifyDefaultStateOfAriaLabelInputFieldInResponseAccordionAndCSS();
208
-
209
- //Note: a11y covered in Additional Settings: Response accordion
210
-
211
- //ARIA label test cases for set correct answer section
212
- it('When the user has not set \'ARIA label\' input field then the default \'ARIA label\' should be present for the \'Set correct answer\' section response field', () => {
213
- for (let index = 0; index < 2; index++) {
214
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
215
- .eq(index)
216
- .should('have.attr', 'aria-label', 'Response Area');
217
- };
218
- });
219
-
220
- fillInTheGapsDragAndDropPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('ARIA label');
221
-
222
- it('When the user has set \'ARIA label\' in the response accordion then it should be present for the \'Set correct answer\' section response field and for the other response field, value of the aria-label should remain the same', () => {
223
- fillInTheGapsDragAndDropPage.steps.setAriaLabelInResponseAccordion(0, 'Custom Aria Label');
224
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
225
- .eq(0)
226
- .should('have.attr', 'aria-label', 'Custom Aria Label');
227
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
228
- .eq(1)
229
- .should('have.attr', 'aria-label', 'Response Area');
230
- });
231
-
232
- fillInTheGapsDragAndDropPage.tests.verifyCustomLabelVisibleOnResponseAccordion('ARIA label');
233
-
234
- fillInTheGapsDragAndDropPage.tests.verifyCustomLabelOnResponseAccordionCSS();
235
-
236
- it('Accessibility of input field in \'Set correct answer\' section when custom \'ARIA label\' is set and Custom label', { tags: 'a11y' }, () => {
237
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea())
238
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.responseAccordionCustomLabel())
239
- });
240
-
241
- it('When the user clears the set value in the \'ARIA label\' input field, then the default \'ARIA label\' should be present for the response fields in the \'Set correct answer\' section', () => {
242
- fillInTheGapsDragAndDropPage.responseAccordionWrapper()
243
- .eq(0)
244
- .within(() => {
245
- fillInTheGapsDragAndDropPage.ariaLabelInputField()
246
- .clear()
247
- .should('have.value', '')
248
- .blur();
249
- });
250
- for (let index = 0; index < 2; index++) {
251
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
252
- .eq(index)
253
- .should('have.attr', 'aria-label', 'Response Area');
254
- };
255
- });
256
-
257
- //ARIA label test cases for preview tab
258
- it('When the user has not set \'ARIA label\' input field then in the preview tab default \'ARIA label\' should be present for the response field in the preview tab', () => {
259
- cy.log('Pre step: Switch to Preview tab')
260
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
261
- for (let index = 0; index < 2; index++) {
262
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
263
- .eq(index)
264
- .should('have.attr', 'aria-label', 'Response Area');
265
- };
266
- });
267
-
268
- it('When the user has set \'ARIA label\' in the response accordion then it should be present for the response field in the preview tab', () => {
269
- cy.log('Pre step: Switch to Edit tab')
270
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
271
- fillInTheGapsDragAndDropPage.steps.setAriaLabelInResponseAccordion(0, 'Custom Aria Label');
272
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
273
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
274
- .eq(0)
275
- .should('have.attr', 'aria-label', 'Custom Aria Label');
276
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
277
- .eq(1)
278
- .should('have.attr', 'aria-label', 'Response Area');
279
- });
280
-
281
- it('Accessibility of input field in preview tab when custom \'ARIA label\' is set', { tags: 'a11y' }, () => {
282
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewTabResponseArea())
283
- });
284
-
285
- it('When the user clears the set value in the \'ARIA label\' input field, then the default \'ARIA label\' should be present for the response field in the preview tab', () => {
286
- cy.log('Pre step: Switch to Edit tab')
287
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
288
- fillInTheGapsDragAndDropPage.responseAccordionWrapper()
289
- .eq(0)
290
- .within(() => {
291
- fillInTheGapsDragAndDropPage.ariaLabelInputField()
292
- .clear()
293
- .should('have.value', '');
294
- });
295
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
296
- for (let index = 0; index < 2; index++) {
297
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
298
- .eq(index)
299
- .should('have.attr', 'aria-label', 'Response Area');
300
- };
301
- });
302
- });
303
-
304
- describe('Response Accordions: Height and Width', () => {
305
- abortEarlySetup();
306
- before(() => {
307
- fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
308
- cy.barsPreLoaderWait();
309
- fillInTheGapsDragAndDropPage.steps.expandAdditonalSettings();
310
- fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(0);
311
- fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(1);
312
- });
313
-
314
- fillInTheGapsDragAndDropPage.tests.verifyDefaultStateOfHeightAndWidthInputFieldInResponseAccordionAndCSS();
315
-
316
- //Note: a11y covered in Additional Settings: Response accordion
317
-
318
- //TODO: We will need to revisit below case as it will fail for mobile view
319
- it('When the user has not set \'Height\' and \'Width\' for response fields then the default dimension of the response field in the \'Set correct answer\' section response fields should be (197x46)px', () => {
320
- for (let index = 0; index < 2; index++) {
321
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
322
- .eq(index)
323
- .should('have.attr', 'height', '46.000')
324
- .and('have.attr', 'width', '197.000px');
325
- };
326
- });
327
-
328
- fillInTheGapsDragAndDropPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('Height and Width');
329
-
330
- it('When the user has set \'Height\' for the response field then the Height of the response field should get updated accordingly in the \'Set correct answer\' section', () => {
331
- fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '100');
332
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
333
- .eq(0)
334
- .should('have.attr', 'height', '100.000');
335
- });
336
-
337
- fillInTheGapsDragAndDropPage.tests.verifyCustomLabelVisibleOnResponseAccordion('Height and Width');
338
-
339
- it('When the user has set \'Width\' for the response field then the Width of the response field should get updated accordingly in the \'Set correct answer\' section', () => {
340
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '100');
341
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
342
- .eq(0)
343
- .should('have.attr', 'width', '100.000px');
344
- });
345
-
346
- it('When the user has set width below 80px then the width should remain 80px in the \'Set correct answer\' section', () => {
347
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '20');
348
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
349
- .eq(0)
350
- .should('have.attr', 'width', '80.000px');
351
- });
352
-
353
- it('When the user has set width above 400px then the width should remain 400px in the \'Set correct answer\' section', () => {
354
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '800');
355
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
356
- .eq(0)
357
- .should('have.attr', 'width', '400.000px');
358
- });
359
-
360
- it('When the user has set \'Height\' and \'Width\' in the individual responses accordion then it should override the \'Height\' and \'Width\'set in the \'Advanced settings for all response areas\' in the \'Set correct answer\' section', () => {
361
- fillInTheGapsDragAndDropPage.widthInputField()
362
- .clear()
363
- .type('250')
364
- .should('have.value', '250');
365
- fillInTheGapsDragAndDropPage.heightInputField()
366
- .clear()
367
- .type('180')
368
- .should('have.value', '180');
369
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '175');
370
- fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '120');
371
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
372
- .eq(0)
373
- .should('have.attr', 'width', '175.000px')
374
- .and('have.attr', 'height', '120.000');
375
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
376
- .eq(1)
377
- .should('have.attr', 'width', '250.000px')
378
- .and('have.attr', 'height', '180.000');
379
- });
380
-
381
- //Height and width test cases for preview tab
382
- //TODO: We will need to revisit below case as it will fail for mobile view
383
- it('When the user has not set \'Height\' and \'Width\' for the response accordion then the default dimension of the response field in the preview tab response field should be (197x46)px', () => {
384
- cy.log('Pre step: clearing the set values of height and width to bring back the dimensions of the response field to default dimensions')
385
- fillInTheGapsDragAndDropPage.widthInputField()
386
- .clear()
387
- .should('have.value', '');
388
- fillInTheGapsDragAndDropPage.heightInputField()
389
- .clear()
390
- .should('have.value', '');
391
- for (let index = 0; index < 2; index++) {
392
- fillInTheGapsDragAndDropPage.responseAccordionWrapper()
393
- .eq(index)
394
- .within(() => {
395
- fillInTheGapsDragAndDropPage.heightInputField()
396
- .clear()
397
- .should('have.value', '');
398
- fillInTheGapsDragAndDropPage.widthInputField()
399
- .clear()
400
- .should('have.value', '');
401
- });
402
- };
403
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
404
- for (let index = 0; index < 2; index++) {
405
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
406
- .eq(index)
407
- .should('have.attr', 'height', '46.000')
408
- .and('have.attr', 'width', '197.000px');
409
- };
410
- });
411
-
412
- it('When the user has set \'Height\' for the response field then the height of the preview tab response field should get updated accordingly in the preview tab', () => {
413
- cy.log('Pre step: Switch to Edit tab')
414
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
415
- fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '100');
416
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
417
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
418
- .eq(0)
419
- .should('have.attr', 'height', '100.000');
420
- });
421
-
422
- it('When the user has set \'Width\' for the response field then the width of the preview tab response field should get updated accordingly in the preview tab', () => {
423
- cy.log('Pre step: Switch to Edit tab')
424
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
425
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '100');
426
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
427
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
428
- .eq(0)
429
- .should('have.attr', 'width', '100.000px');
430
- });
431
-
432
- it('When the user has set width below 80px then the width should remain 80px in the preview tab', () => {
433
- cy.log('Pre step: Switch to Edit tab')
434
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
435
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '20');
436
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
437
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
438
- .eq(0)
439
- .should('have.attr', 'width', '80.000px');
440
- });
441
-
442
- it('When the user has set width above 400px then the width should remain 400px in the preview tab', () => {
443
- cy.log('Pre step: Switch to Edit tab')
444
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
445
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '800');
446
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
447
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
448
- .eq(0)
449
- .should('have.attr', 'width', '400.000px');
450
- });
451
-
452
- it('When the user has set \'Height\' and \'Width\' in the individual responses accordion then it should override the \'Height\' and \'Width\'set in the \'Advanced settings for all response areas\' in the preview tab', () => {
453
- cy.log('Pre step: Switch to Edit tab')
454
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
455
- fillInTheGapsDragAndDropPage.widthInputField()
456
- .clear()
457
- .type('250')
458
- .should('have.value', '250');
459
- fillInTheGapsDragAndDropPage.heightInputField()
460
- .clear()
461
- .type('180')
462
- .should('have.value', '180');
463
- fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '175');
464
- fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '120');
465
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
466
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
467
- .eq(0)
468
- .should('have.attr', 'width', '175.000px')
469
- .and('have.attr', 'height', '120.000');
470
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
471
- .eq(1)
472
- .should('have.attr', 'width', '250.000px')
473
- .and('have.attr', 'height', '180.000')
474
- });
475
- });
476
-
477
185
  describe('Additional Settings: Check Answer', () => {
478
186
  abortEarlySetup();
479
187
  before(() => {
@@ -0,0 +1,299 @@
1
+ import { fillInTheGapsDragAndDropPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ describe('Fill In the Gaps Additional settings and Responses accordion', () => {
5
+ before(() => {
6
+ cy.loginAs('admin');
7
+ });
8
+
9
+ describe('Additional Settings: Advanced settings for all Response Areas', () => {
10
+ abortEarlySetup();
11
+ before(() => {
12
+ fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
13
+ cy.barsPreLoaderWait();
14
+ fillInTheGapsDragAndDropPage.steps.expandAdditonalSettings();
15
+ });
16
+
17
+ fillInTheGapsDragAndDropPage.tests.verifyAdvanceSettingsForAllResponsesLabelAndCSS();
18
+ });
19
+
20
+ describe('Response Accordions: ARIA label', () => {
21
+ abortEarlySetup();
22
+ before(() => {
23
+ fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
24
+ cy.barsPreLoaderWait();
25
+ fillInTheGapsDragAndDropPage.steps.expandAdditonalSettings();
26
+ fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(0);
27
+ fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(1);
28
+ });
29
+
30
+ fillInTheGapsDragAndDropPage.tests.verifyDefaultStateOfAriaLabelInputFieldInResponseAccordionAndCSS();
31
+
32
+ //Note: a11y covered in Additional Settings: Response accordion
33
+
34
+ //ARIA label test cases for set correct answer section
35
+ it('When the user has not set \'ARIA label\' input field then the default \'ARIA label\' should be present for the \'Set correct answer\' section response field', () => {
36
+ for (let index = 0; index < 2; index++) {
37
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
38
+ .eq(index)
39
+ .should('have.attr', 'aria-label', 'Response Area');
40
+ };
41
+ });
42
+
43
+ fillInTheGapsDragAndDropPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('ARIA label');
44
+
45
+ it('When the user has set \'ARIA label\' in the response accordion then it should be present for the \'Set correct answer\' section response field and for the other response field, value of the aria-label should remain the same', () => {
46
+ fillInTheGapsDragAndDropPage.steps.setAriaLabelInResponseAccordion(0, 'Custom Aria Label');
47
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
48
+ .eq(0)
49
+ .should('have.attr', 'aria-label', 'Custom Aria Label');
50
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
51
+ .eq(1)
52
+ .should('have.attr', 'aria-label', 'Response Area');
53
+ });
54
+
55
+ fillInTheGapsDragAndDropPage.tests.verifyCustomLabelVisibleOnResponseAccordion('ARIA label');
56
+
57
+ fillInTheGapsDragAndDropPage.tests.verifyCustomLabelOnResponseAccordionCSS();
58
+
59
+ it('Accessibility of input field in \'Set correct answer\' section when custom \'ARIA label\' is set and Custom label', { tags: 'a11y' }, () => {
60
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea())
61
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.responseAccordionCustomLabel())
62
+ });
63
+
64
+ it('When the user clears the set value in the \'ARIA label\' input field, then the default \'ARIA label\' should be present for the response fields in the \'Set correct answer\' section', () => {
65
+ fillInTheGapsDragAndDropPage.responseAccordionWrapper()
66
+ .eq(0)
67
+ .within(() => {
68
+ fillInTheGapsDragAndDropPage.ariaLabelInputField()
69
+ .clear()
70
+ .should('have.value', '')
71
+ .blur();
72
+ });
73
+ for (let index = 0; index < 2; index++) {
74
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
75
+ .eq(index)
76
+ .should('have.attr', 'aria-label', 'Response Area');
77
+ };
78
+ });
79
+
80
+ //ARIA label test cases for preview tab
81
+ it('When the user has not set \'ARIA label\' input field then in the preview tab default \'ARIA label\' should be present for the response field in the preview tab', () => {
82
+ cy.log('Pre step: Switch to Preview tab')
83
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
84
+ for (let index = 0; index < 2; index++) {
85
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
86
+ .eq(index)
87
+ .should('have.attr', 'aria-label', 'Response Area');
88
+ };
89
+ });
90
+
91
+ it('When the user has set \'ARIA label\' in the response accordion then it should be present for the response field in the preview tab', () => {
92
+ cy.log('Pre step: Switch to Edit tab')
93
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
94
+ fillInTheGapsDragAndDropPage.steps.setAriaLabelInResponseAccordion(0, 'Custom Aria Label');
95
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
96
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
97
+ .eq(0)
98
+ .should('have.attr', 'aria-label', 'Custom Aria Label');
99
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
100
+ .eq(1)
101
+ .should('have.attr', 'aria-label', 'Response Area');
102
+ });
103
+
104
+ it('Accessibility of input field in preview tab when custom \'ARIA label\' is set', { tags: 'a11y' }, () => {
105
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewTabResponseArea())
106
+ });
107
+
108
+ it('When the user clears the set value in the \'ARIA label\' input field, then the default \'ARIA label\' should be present for the response field in the preview tab', () => {
109
+ cy.log('Pre step: Switch to Edit tab')
110
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
111
+ fillInTheGapsDragAndDropPage.responseAccordionWrapper()
112
+ .eq(0)
113
+ .within(() => {
114
+ fillInTheGapsDragAndDropPage.ariaLabelInputField()
115
+ .clear()
116
+ .should('have.value', '');
117
+ });
118
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
119
+ for (let index = 0; index < 2; index++) {
120
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
121
+ .eq(index)
122
+ .should('have.attr', 'aria-label', 'Response Area');
123
+ };
124
+ });
125
+ });
126
+
127
+ describe('Response Accordions: Height and Width', () => {
128
+ abortEarlySetup();
129
+ before(() => {
130
+ fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
131
+ cy.barsPreLoaderWait();
132
+ fillInTheGapsDragAndDropPage.steps.expandAdditonalSettings();
133
+ fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(0);
134
+ fillInTheGapsDragAndDropPage.steps.expandResponseAccordion(1);
135
+ });
136
+
137
+ fillInTheGapsDragAndDropPage.tests.verifyDefaultStateOfHeightAndWidthInputFieldInResponseAccordionAndCSS();
138
+
139
+ //Note: a11y covered in Additional Settings: Response accordion
140
+
141
+ //TODO: We will need to revisit below case as it will fail for mobile view
142
+ it('When the user has not set \'Height\' and \'Width\' for response fields then the default dimension of the response field in the \'Set correct answer\' section response fields should be (197x46)px', () => {
143
+ for (let index = 0; index < 2; index++) {
144
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
145
+ .eq(index)
146
+ .should('have.attr', 'height', '46.000')
147
+ .and('have.attr', 'width', '197.000px');
148
+ };
149
+ });
150
+
151
+ fillInTheGapsDragAndDropPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('Height and Width');
152
+
153
+ it('When the user has set \'Height\' for the response field then the Height of the response field should get updated accordingly in the \'Set correct answer\' section', () => {
154
+ fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '100');
155
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
156
+ .eq(0)
157
+ .should('have.attr', 'height', '100.000');
158
+ });
159
+
160
+ fillInTheGapsDragAndDropPage.tests.verifyCustomLabelVisibleOnResponseAccordion('Height and Width');
161
+
162
+ it('When the user has set \'Width\' for the response field then the Width of the response field should get updated accordingly in the \'Set correct answer\' section', () => {
163
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '100');
164
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
165
+ .eq(0)
166
+ .should('have.attr', 'width', '100.000px');
167
+ });
168
+
169
+ it('When the user has set width below 80px then the width should remain 80px in the \'Set correct answer\' section', () => {
170
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '20');
171
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
172
+ .eq(0)
173
+ .should('have.attr', 'width', '80.000px');
174
+ });
175
+
176
+ it('When the user has set width above 400px then the width should remain 400px in the \'Set correct answer\' section', () => {
177
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '800');
178
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
179
+ .eq(0)
180
+ .should('have.attr', 'width', '400.000px');
181
+ });
182
+
183
+ it('When the user has set \'Height\' and \'Width\' in the individual responses accordion then it should override the \'Height\' and \'Width\'set in the \'Advanced settings for all response areas\' in the \'Set correct answer\' section', () => {
184
+ fillInTheGapsDragAndDropPage.widthInputField()
185
+ .clear()
186
+ .type('250')
187
+ .should('have.value', '250');
188
+ fillInTheGapsDragAndDropPage.heightInputField()
189
+ .clear()
190
+ .type('180')
191
+ .should('have.value', '180');
192
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '175');
193
+ fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '120');
194
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
195
+ .eq(0)
196
+ .should('have.attr', 'width', '175.000px')
197
+ .and('have.attr', 'height', '120.000');
198
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
199
+ .eq(1)
200
+ .should('have.attr', 'width', '250.000px')
201
+ .and('have.attr', 'height', '180.000');
202
+ });
203
+
204
+ //Height and width test cases for preview tab
205
+ //TODO: We will need to revisit below case as it will fail for mobile view
206
+ it('When the user has not set \'Height\' and \'Width\' for the response accordion then the default dimension of the response field in the preview tab response field should be (197x46)px', () => {
207
+ cy.log('Pre step: clearing the set values of height and width to bring back the dimensions of the response field to default dimensions')
208
+ fillInTheGapsDragAndDropPage.widthInputField()
209
+ .clear()
210
+ .should('have.value', '');
211
+ fillInTheGapsDragAndDropPage.heightInputField()
212
+ .clear()
213
+ .should('have.value', '');
214
+ for (let index = 0; index < 2; index++) {
215
+ fillInTheGapsDragAndDropPage.responseAccordionWrapper()
216
+ .eq(index)
217
+ .within(() => {
218
+ fillInTheGapsDragAndDropPage.heightInputField()
219
+ .clear()
220
+ .should('have.value', '');
221
+ fillInTheGapsDragAndDropPage.widthInputField()
222
+ .clear()
223
+ .should('have.value', '');
224
+ });
225
+ };
226
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
227
+ for (let index = 0; index < 2; index++) {
228
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
229
+ .eq(index)
230
+ .should('have.attr', 'height', '46.000')
231
+ .and('have.attr', 'width', '197.000px');
232
+ };
233
+ });
234
+
235
+ it('When the user has set \'Height\' for the response field then the height of the preview tab response field should get updated accordingly in the preview tab', () => {
236
+ cy.log('Pre step: Switch to Edit tab')
237
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
238
+ fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '100');
239
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
240
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
241
+ .eq(0)
242
+ .should('have.attr', 'height', '100.000');
243
+ });
244
+
245
+ it('When the user has set \'Width\' for the response field then the width of the preview tab response field should get updated accordingly in the preview tab', () => {
246
+ cy.log('Pre step: Switch to Edit tab')
247
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
248
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '100');
249
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
250
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
251
+ .eq(0)
252
+ .should('have.attr', 'width', '100.000px');
253
+ });
254
+
255
+ it('When the user has set width below 80px then the width should remain 80px in the preview tab', () => {
256
+ cy.log('Pre step: Switch to Edit tab')
257
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
258
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '20');
259
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
260
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
261
+ .eq(0)
262
+ .should('have.attr', 'width', '80.000px');
263
+ });
264
+
265
+ it('When the user has set width above 400px then the width should remain 400px in the preview tab', () => {
266
+ cy.log('Pre step: Switch to Edit tab')
267
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
268
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '800');
269
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
270
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
271
+ .eq(0)
272
+ .should('have.attr', 'width', '400.000px');
273
+ });
274
+
275
+ it('When the user has set \'Height\' and \'Width\' in the individual responses accordion then it should override the \'Height\' and \'Width\'set in the \'Advanced settings for all response areas\' in the preview tab', () => {
276
+ cy.log('Pre step: Switch to Edit tab')
277
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
278
+ fillInTheGapsDragAndDropPage.widthInputField()
279
+ .clear()
280
+ .type('250')
281
+ .should('have.value', '250');
282
+ fillInTheGapsDragAndDropPage.heightInputField()
283
+ .clear()
284
+ .type('180')
285
+ .should('have.value', '180');
286
+ fillInTheGapsDragAndDropPage.steps.setWidthInResponseAccordion(0, '175');
287
+ fillInTheGapsDragAndDropPage.steps.setHeightInResponseAccordion(0, '120');
288
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
289
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
290
+ .eq(0)
291
+ .should('have.attr', 'width', '175.000px')
292
+ .and('have.attr', 'height', '120.000');
293
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
294
+ .eq(1)
295
+ .should('have.attr', 'width', '250.000px')
296
+ .and('have.attr', 'height', '180.000')
297
+ });
298
+ });
299
+ });