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,511 @@
1
+ import { fillInTheGapsTextPage } from "../../../pages";
2
+ import { commonComponents } from "../../../pages/components";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ const css = Cypress.env('css');
5
+
6
+ describe('Fill In the Gaps Additional settings: Advanced settings for all response areas', () => {
7
+ before(() => {
8
+ cy.loginAs('admin');
9
+ });
10
+
11
+ describe('Additional Settings: Advanced settings for all response areas', () => {
12
+ abortEarlySetup();
13
+ before(() => {
14
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
15
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
16
+ });
17
+
18
+ fillInTheGapsTextPage.tests.verifyAdvanceSettingsForAllResponsesLabelAndCSS();
19
+
20
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
21
+ });
22
+
23
+ describe('Additional Settings: Placeholder text', () => {
24
+ abortEarlySetup();
25
+ before(() => {
26
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
27
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
28
+ });
29
+
30
+ fillInTheGapsTextPage.tests.verifyPlaceholderTextLabelInputFieldAndCSS()
31
+
32
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
33
+
34
+ //Placeholder test cases for Set correct answer section response fields
35
+ it('When \'Placeholder text\' input field is empty then no \'Placeholder text\' should be displayed in the set correct answer response field', () => {
36
+ fillInTheGapsTextPage.placeholderTextInputField()
37
+ .should('have.value', '');
38
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
39
+ .each(($el) => {
40
+ cy.wrap($el)
41
+ .should('not.have.attr', 'placeholder');
42
+ });
43
+ });
44
+
45
+ it('When the user adds a text in the Placeholder input field, the added placeholder should be displayed in the set correct answer response field', () => {
46
+ fillInTheGapsTextPage.placeholderTextInputField()
47
+ .type('Lorem Ipsum')
48
+ .should('have.value', 'Lorem Ipsum');
49
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
50
+ .each(($el) => {
51
+ cy.wrap($el)
52
+ .should('have.attr', 'placeholder', 'Lorem Ipsum');
53
+ });
54
+ });
55
+
56
+ //Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
57
+
58
+ it('Accessibility of \'Placeholder text\'', { tags: 'a11y' }, () => {
59
+ cy.checkAccessibility(fillInTheGapsTextPage.setCorrectAnswerResponseField().parents('.response-input-field'));
60
+ });
61
+
62
+ it('When the user starts typing in the response field, then the placeholder text should disappear and on clearing the input field the placeholder text should re-appear for the set correct answer section response fields', () => {
63
+ //TODO: Need to update script after https://redmine.zeuslearning.com/issues/527580 is resolved
64
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
65
+ .eq(0)
66
+ .type('Response')
67
+ .should('have.value', 'Response')
68
+ .should('not.have.attr', 'placeholder')
69
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
70
+ .clear()
71
+ .should('have.attr', 'placeholder', 'Lorem Ipsum');
72
+ });
73
+
74
+ //Placeholder test cases for Preview tab response fields
75
+ it('When \'Placeholder text\' input field is empty then no \'Placeholder text\' should be displayed in the preview tab response field', () => {
76
+ cy.log('Pre step: Clearinng the placeholder text and switching to Preview tab')
77
+ fillInTheGapsTextPage.placeholderTextInputField()
78
+ .clear()
79
+ .should('have.value', '');
80
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
81
+ fillInTheGapsTextPage.previewTabResponseField()
82
+ .each(($el) => {
83
+ cy.wrap($el)
84
+ .should('not.have.attr', 'placeholder');
85
+ });
86
+ });
87
+
88
+ it('When the user adds a text in the Placeholder input field, the added placeholder should be displayed in the preview tab response field', () => {
89
+ cy.log('Pre step: Switch to Edit tab')
90
+ fillInTheGapsTextPage.steps.switchToEditTab();
91
+ fillInTheGapsTextPage.placeholderTextInputField()
92
+ .type('Lorem Ipsum')
93
+ .should('have.value', 'Lorem Ipsum');
94
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
95
+ fillInTheGapsTextPage.previewTabResponseField()
96
+ .each(($el) => {
97
+ cy.wrap($el)
98
+ .should('have.attr', 'placeholder', 'Lorem Ipsum');
99
+ });
100
+ });
101
+
102
+ //Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
103
+
104
+ it('Accessibility of \'Placeholder text\'', { tags: 'a11y' }, () => {
105
+ cy.checkAccessibility(fillInTheGapsTextPage.previewTabResponseField().parents('.response-input-field'))
106
+ });
107
+
108
+ it('When the user starts typing in the response field, then the placeholder text should disappear and on clearing the input field the placeholder text should re-appear for the preview tab response fields', () => {
109
+ fillInTheGapsTextPage.previewTabResponseField()
110
+ .eq(0)
111
+ .type('Response')
112
+ .should('have.value', 'Response')
113
+ .should('not.have.attr', 'placeholder');
114
+ fillInTheGapsTextPage.previewTabResponseField()
115
+ .eq(0)
116
+ .clear()
117
+ .blur()
118
+ .should('have.attr', 'placeholder', 'Lorem Ipsum');
119
+ });
120
+ });
121
+
122
+ describe('Additional Settings: Type of answer input', () => {
123
+ const typeOfAnswers = ['Text', 'Number'];
124
+ abortEarlySetup();
125
+ before(() => {
126
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
127
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
128
+ });
129
+
130
+ it('\'Type of answer\' label and dropdown should be displayed and in \'Type of answer\' dropdown \'Text\' option should be selected by default', () => {
131
+ fillInTheGapsTextPage.typeOfAnswerInputLabel()
132
+ .verifyInnerText('Type of answer input');
133
+ fillInTheGapsTextPage.typeOfAnswerInputDropdown()
134
+ .verifyInnerText('Text');
135
+ });
136
+
137
+ it('CSS of \'Type of answer\' dropdown', { tags: 'css' }, () => {
138
+ fillInTheGapsTextPage.typeOfAnswerInputLabel()
139
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
140
+ fillInTheGapsTextPage.typeOfAnswerInputDropdown()
141
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
142
+ });
143
+
144
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
145
+
146
+ it(`Clicking on Type of answer dropdown should open a list of 2 options - ${typeOfAnswers}`, () => {
147
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
148
+ .should('be.visible');
149
+ typeOfAnswers.forEach((index, count) => {
150
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(count)
151
+ .verifyInnerText(index);
152
+ });
153
+ });
154
+
155
+ it('CSS of Type of answer dropdown in Active state', { tags: 'css' }, () => {
156
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
157
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
158
+ .should('have.css', 'background-color', css.color.liTextSelectedBg);
159
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
160
+ .should('have.css', 'background-color', css.color.transparent);
161
+ });
162
+
163
+ it('Accessibility of Type of answer dropdown in active state', { tags: 'a11y' }, () => {
164
+ cy.checkAccessibility(commonComponents.dropdownList());
165
+ });
166
+
167
+ //Type of answer input test cases for set correct answer section response fields
168
+ it('When \'Text\' option is set in the dropdown, then user should be able to add alpha-numeric characters in the \'Set correct answer\' section', () => {
169
+ fillInTheGapsTextPage.typeOfAnswerInputDropdown()
170
+ .verifyInnerText('Text');
171
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
172
+ .each(($el) => {
173
+ cy.wrap($el)
174
+ .type('Response 1')
175
+ .should('have.value', 'Response 1');
176
+ });
177
+ });
178
+
179
+ it('When the user selects \'Number\' option from the dropdown the the user should be able to add only numeric characters in the set correct answer response field', () => {
180
+ fillInTheGapsTextPage.typeOfAnswerInputDropdown()
181
+ .click();
182
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
183
+ .click();
184
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
185
+ .each(($el) => {
186
+ cy.wrap($el)
187
+ .type('Response 1')
188
+ .should('have.value', '1');
189
+ });
190
+ });
191
+
192
+ //Type of answer input test cases for preview tab response fields
193
+ it('When \'Text\' option is set in the dropdown, then user should be able to add alpha-numeric characters in preview tab response fields', () => {
194
+ fillInTheGapsTextPage.typeOfAnswerInputDropdown()
195
+ .click();
196
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
197
+ .click();
198
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
199
+ fillInTheGapsTextPage.previewTabResponseField()
200
+ .each(($el) => {
201
+ cy.wrap($el)
202
+ .type('Response 1')
203
+ .should('have.value', 'Response 1');
204
+ });
205
+ });
206
+
207
+ it('When the user selects \'Number\' option from the dropdown then the user should be able to add only numeric characters in the preview tab input field', () => {
208
+ cy.log('Switching to edit tab')
209
+ fillInTheGapsTextPage.steps.switchToEditTab()
210
+ fillInTheGapsTextPage.typeOfAnswerInputDropdown()
211
+ .click();
212
+ fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
213
+ .click();
214
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
215
+ fillInTheGapsTextPage.previewTabResponseField()
216
+ .each(($el) => {
217
+ cy.wrap($el)
218
+ .type('Response 1')
219
+ .should('have.value', '1');
220
+ });
221
+ })
222
+ });
223
+
224
+ describe('Additional Settings: Set character limit', () => {
225
+ abortEarlySetup();
226
+ before(() => {
227
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
228
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
229
+ });
230
+
231
+ it('\'Set character limit\' label and input field should be displayed and in \'Set character limit\' input field the default value should be \'20\'', () => {
232
+ fillInTheGapsTextPage.setCharacterLimitLabel()
233
+ .verifyInnerText('Set character limit')
234
+ .should('be.visible');
235
+ fillInTheGapsTextPage.setCharacterLimitInputField()
236
+ .should('have.value', '20')
237
+ .and('be.visible');
238
+ });
239
+
240
+ it('User should not be able to Set character limit value below 1', () => {
241
+ fillInTheGapsTextPage.setCharacterLimitInputField()
242
+ .clear()
243
+ .type('0')
244
+ .should('have.value', '0');
245
+ cy.get('body')
246
+ .click();
247
+ fillInTheGapsTextPage.setCharacterLimitInputField()
248
+ .should('not.have.value', '0')
249
+ .and('have.value', '1');
250
+ });
251
+
252
+ it('When the user removes the default set characters limit then user should be able to enter \'20\' characters', () => {
253
+ fillInTheGapsTextPage.setCharacterLimitInputField()
254
+ .clear()
255
+ .blur();
256
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
257
+ .eq(0)
258
+ .focus()
259
+ .type('ut placerat orci nulla')
260
+ .should('have.value', 'ut placerat orci nulla');
261
+ cy.log('Post step: Setting character limit to 20 and clearing the added text')
262
+ fillInTheGapsTextPage.setCharacterLimitInputField()
263
+ .type('20')
264
+ .should('have.value', '20');
265
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
266
+ .eq(0)
267
+ .clear();
268
+ });
269
+
270
+ //Set character limit test cases for set correct answer section response fields
271
+ it('User should not be able to add characters more than the default Set character limit value in the Set correct answer response fields', () => {
272
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
273
+ .each(($el) => {
274
+ cy.wrap($el)
275
+ .type('ut placerat orci nulla')
276
+ .should('have.value', 'ut placerat orci nul');
277
+ });
278
+ });
279
+
280
+ it('When tries to enter a response using Enter key in the repsonse fields then the user should not be able to do so and should be able to enter the specified number of characters only for the set correct answer section response fields', () => {
281
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
282
+ .each(($el) => {
283
+ cy.wrap($el)
284
+ .clear()
285
+ .type('at i{enter}n{enter}t{enter}e{enter}llu{enter}s in{enter}te gers')
286
+ .should('have.value', 'at intellus inte ger');
287
+ });
288
+ });
289
+
290
+ it('User should be able to edit the \'Set character limit\' input field', () => {
291
+ fillInTheGapsTextPage.setCharacterLimitInputField()
292
+ .clear()
293
+ .type('45')
294
+ .should('have.value', '45');
295
+ });
296
+
297
+ it('User should not be able to add characters more than the Set character limit value in the Set correct answers', () => {
298
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
299
+ .each(($el) => {
300
+ cy.wrap($el)
301
+ .clear()
302
+ .type('ut placerat orci nulla pellentesque dignissim e')
303
+ .should('have.value', 'ut placerat orci nulla pellentesque dignissim');
304
+ });
305
+ });
306
+
307
+ //Type of answer input test cases for preview tab response fields
308
+ it('User should not be able to add characters more than the default Set character limit value in the preview tab response fields', () => {
309
+ fillInTheGapsTextPage.setCharacterLimitInputField()
310
+ .clear()
311
+ .type('20')
312
+ .should('have.value', '20');
313
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
314
+ fillInTheGapsTextPage.previewTabResponseField()
315
+ .each(($el) => {
316
+ cy.wrap($el)
317
+ .type('ut placerat orci nulla')
318
+ .should('have.value', 'ut placerat orci nul');
319
+ });
320
+ });
321
+
322
+ it('When tries to enter a response using Enter key in the response fields then the user should not be able to do so and should be able to enter the specified number of characters only for the preview tab response fields', () => {
323
+ fillInTheGapsTextPage.previewTabResponseField()
324
+ .each(($el) => {
325
+ cy.wrap($el)
326
+ .clear()
327
+ .type('at i{enter}n{enter}t{enter}e{enter}llu{enter}s in{enter}te gers')
328
+ .should('have.value', 'at intellus inte ger');
329
+ });
330
+ });
331
+
332
+ it('User should be able to edit the \'Set character limit\' input field', () => {
333
+ cy.log('Switching to edit tab')
334
+ fillInTheGapsTextPage.steps.switchToEditTab()
335
+ fillInTheGapsTextPage.setCharacterLimitInputField()
336
+ .clear()
337
+ .type('45')
338
+ .should('have.value', '45');
339
+ });
340
+
341
+ it('User should not be able to add characters more than the Set character limit value in the preview tab response fields', () => {
342
+ fillInTheGapsTextPage.steps.switchToPreviewTab()
343
+ fillInTheGapsTextPage.previewTabResponseField()
344
+ .each(($el) => {
345
+ cy.wrap($el)
346
+ .type('ut placerat orci nulla pellentesque dignissim e')
347
+ .should('have.value', 'ut placerat orci nulla pellentesque dignissim');
348
+ });
349
+ });
350
+ });
351
+
352
+ describe('Additional Settings: Height and Width', () => {
353
+ abortEarlySetup();
354
+ before(() => {
355
+ fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
356
+ fillInTheGapsTextPage.steps.expandAdditonalSettings();
357
+ });
358
+
359
+ fillInTheGapsTextPage.tests.verifyHeightAndWidthLabelInputFieldWithCSSAnda11y()
360
+
361
+ //Height and width test cases for set correct answer section response fields
362
+ //TODO: We will need to revisit below case as it will fail for mobile view
363
+ it('When the input field of \'Height\' and \'Width\' is kept empty, the default dimension of the response field should be (197x46)px in the \'Set correct answer\' section response field', () => {
364
+ fillInTheGapsTextPage.heightInputField()
365
+ .should('have.value', '');
366
+ fillInTheGapsTextPage.widthInputField()
367
+ .should('have.value', '');
368
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
369
+ .each(($el) => {
370
+ cy.wrap($el)
371
+ .parents('.response-input-field')
372
+ .should('have.attr', 'height', '46px')
373
+ .and('have.attr', 'width', '13.7em')
374
+ });
375
+ });
376
+
377
+ it('When the user adds \'Height\' for the response field then the height of the response field should get updated accordingly in the \'Set correct answer\' section', () => {
378
+ fillInTheGapsTextPage.heightInputField()
379
+ .type('100')
380
+ .should('have.value', '100');
381
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
382
+ .each(($el) => {
383
+ cy.wrap($el)
384
+ .parents('.response-input-field')
385
+ .should('have.attr', 'height', '100px');
386
+ });
387
+ });
388
+
389
+ it('When the user adds \'Width\' for the response field then the Width of the response field should get updated accordingly in the \'Set correct answer\' section', () => {
390
+ fillInTheGapsTextPage.heightInputField()
391
+ .clear()
392
+ .should('have.value', '');
393
+ fillInTheGapsTextPage.widthInputField()
394
+ .type('100')
395
+ .should('have.value', '100');
396
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
397
+ .each(($el) => {
398
+ cy.wrap($el)
399
+ .parents('.response-input-field')
400
+ .should('have.attr', 'width', '100px');
401
+ });
402
+ });
403
+
404
+ it('When the user enters a value below 80px in the \'Width\' input field then the width of the input field should remain 80px in \'Set correct answer\' section', () => {
405
+ fillInTheGapsTextPage.widthInputField()
406
+ .clear()
407
+ .type('20')
408
+ .should('have.value', '20');
409
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
410
+ .each(($el) => {
411
+ cy.wrap($el)
412
+ .parents('.response-input-field')
413
+ .should('have.attr', 'width', '80px');
414
+ });
415
+ });
416
+
417
+ it('When the user enters a value above 400px in the \'Width\' input field then the width of the input field should remain 400px in \'Set correct answer\' section', () => {
418
+ fillInTheGapsTextPage.widthInputField()
419
+ .clear()
420
+ .type('800')
421
+ .should('have.value', '800');
422
+ fillInTheGapsTextPage.setCorrectAnswerResponseField()
423
+ .each(($el) => {
424
+ cy.wrap($el)
425
+ .parents('.response-input-field')
426
+ .should('have.attr', 'width', '400px');
427
+ });
428
+ });
429
+
430
+ //Height and width test cases for preview tab response fields
431
+ //TODO: We will need to revisit below case as it will fail for mobile view
432
+ it('When the input field of \'Height\' and \'Width\' is kept empty, the default dimension of the response field should be (197x46)px for the preview tab', () => {
433
+ fillInTheGapsTextPage.widthInputField()
434
+ .clear()
435
+ .should('have.value', '');
436
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
437
+ fillInTheGapsTextPage.previewTabResponseField()
438
+ .each(($el) => {
439
+ cy.wrap($el)
440
+ .parents('.response-input-field')
441
+ .should('have.attr', 'height', '46px')
442
+ .and('have.attr', 'width', '13.7em')
443
+ });
444
+ });
445
+
446
+ it('When the user adds \'Height\' for the response field then the height of the response field should get updated accordingly in the preview tab', () => {
447
+ cy.log('Pre step: Switching to Edit tab')
448
+ fillInTheGapsTextPage.steps.switchToEditTab();
449
+ fillInTheGapsTextPage.heightInputField()
450
+ .type('100')
451
+ .should('have.value', '100');
452
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
453
+ fillInTheGapsTextPage.previewTabResponseField()
454
+ .each(($el) => {
455
+ cy.wrap($el)
456
+ .parents('.response-input-field')
457
+ .should('have.attr', 'height', '100px');
458
+ });
459
+ });
460
+
461
+ it('When the user adds \'Width\' for the response field then the response fields should get updated accordingly in the preview tab', () => {
462
+ cy.log('Pre step: Switching to Edit tab')
463
+ fillInTheGapsTextPage.steps.switchToEditTab();
464
+ fillInTheGapsTextPage.heightInputField()
465
+ .clear()
466
+ .should('have.value', '');
467
+ fillInTheGapsTextPage.widthInputField()
468
+ .type('100')
469
+ .should('have.value', '100');
470
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
471
+ fillInTheGapsTextPage.previewTabResponseField()
472
+ .each(($el) => {
473
+ cy.wrap($el)
474
+ .parents('.response-input-field')
475
+ .should('have.attr', 'width', '100px');
476
+ });
477
+ });
478
+
479
+ it('When the user enters a value below 80px in the \'Width\' input field then the input field should remain 80px for the preview tab response fields', () => {
480
+ cy.log('Pre step: Switching to Edit tab')
481
+ fillInTheGapsTextPage.steps.switchToEditTab();
482
+ fillInTheGapsTextPage.widthInputField()
483
+ .clear()
484
+ .type('20')
485
+ .should('have.value', '20');
486
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
487
+ fillInTheGapsTextPage.previewTabResponseField()
488
+ .each(($el) => {
489
+ cy.wrap($el)
490
+ .parents('.response-input-field')
491
+ .should('have.attr', 'width', '80px');
492
+ });
493
+ });
494
+
495
+ it('When the user enters a value above 400px in the \'Width\' input field then the input field should remain 400px for preview tab repsonse field', () => {
496
+ cy.log('Pre step: Switching to Edit tab')
497
+ fillInTheGapsTextPage.steps.switchToEditTab();
498
+ fillInTheGapsTextPage.widthInputField()
499
+ .clear()
500
+ .type('800')
501
+ .should('have.value', '800');
502
+ fillInTheGapsTextPage.steps.switchToPreviewTab();
503
+ fillInTheGapsTextPage.previewTabResponseField()
504
+ .each(($el) => {
505
+ cy.wrap($el)
506
+ .parents('.response-input-field')
507
+ .should('have.attr', 'width', '400px');
508
+ });
509
+ });
510
+ });
511
+ });