itemengine-cypress-automation 1.0.23 → 1.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettings.js +2060 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAlternateAnswer.js +104 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAutoScoredScoring.js +84 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextCaseSensitiveAndIgnoreExtraSpacesCheckboxes.js +174 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextEditTabBasicSections.js +176 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextEditTabScoringSection.js +150 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextHeaderSection.js +112 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextManuallyAndNonScoredScoring.js +49 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextScoringPartialDifferentWeights.js +97 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextScoringPartialEqualWeights.js +95 -0
- package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextSetCorrectAnswerSection.js +70 -0
- package/package.json +1 -1
@@ -0,0 +1,2060 @@
|
|
1
|
+
import { specialOrMathCharacters } from "../../../fixtures/specialAndMathCharacters";
|
2
|
+
import { dialogBoxBase, fillInTheGapsTextPage } from "../../../pages";
|
3
|
+
import { commonComponents } from "../../../pages/components";
|
4
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
5
|
+
const css = Cypress.env('css');
|
6
|
+
let customSpecialCharacters = [':', ')', '`']
|
7
|
+
|
8
|
+
describe('Fill In the Gaps Additional settings and Responses accordion', () => {
|
9
|
+
before(() => {
|
10
|
+
cy.loginAs('admin');
|
11
|
+
});
|
12
|
+
|
13
|
+
describe('Additional Settings accordion', () => {
|
14
|
+
abortEarlySetup();
|
15
|
+
before(() => {
|
16
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
17
|
+
});
|
18
|
+
|
19
|
+
fillInTheGapsTextPage.tests.verifyAdditonalSettingsAccordionProperties();
|
20
|
+
});
|
21
|
+
|
22
|
+
describe('Additional Settings: Advanced settings for all response areas', () => {
|
23
|
+
abortEarlySetup();
|
24
|
+
before(() => {
|
25
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
26
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
27
|
+
});
|
28
|
+
|
29
|
+
fillInTheGapsTextPage.tests.verifyAdvanceSettingsForAllResponsesLabelAndCSS();
|
30
|
+
|
31
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
32
|
+
});
|
33
|
+
|
34
|
+
describe('Additional Settings: Placeholder text', () => {
|
35
|
+
abortEarlySetup();
|
36
|
+
before(() => {
|
37
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
38
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
39
|
+
});
|
40
|
+
|
41
|
+
fillInTheGapsTextPage.tests.verifyPlaceholderTextLabelInputFieldAndCSS()
|
42
|
+
|
43
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
44
|
+
|
45
|
+
//Placeholder test cases for Set correct answer section response fields
|
46
|
+
it('When \'Placeholder text\' input field is empty then no \'Placeholder text\' should be displayed in the set correct answer response field', () => {
|
47
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
48
|
+
.should('have.value', '');
|
49
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
50
|
+
.each(($el) => {
|
51
|
+
cy.wrap($el)
|
52
|
+
.should('not.have.attr', 'placeholder');
|
53
|
+
});
|
54
|
+
});
|
55
|
+
|
56
|
+
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', () => {
|
57
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
58
|
+
.type('Lorem Ipsum')
|
59
|
+
.should('have.value', 'Lorem Ipsum');
|
60
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
61
|
+
.each(($el) => {
|
62
|
+
cy.wrap($el)
|
63
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
64
|
+
});
|
65
|
+
});
|
66
|
+
|
67
|
+
//Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
|
68
|
+
|
69
|
+
it('Accessibility of \'Placeholder text\'', { tags: 'a11y' }, () => {
|
70
|
+
cy.checkAccessibility(fillInTheGapsTextPage.setCorrectAnswerResponseField().parents('.response-input-field'));
|
71
|
+
});
|
72
|
+
|
73
|
+
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', () => {
|
74
|
+
//TODO: Need to update script after https://redmine.zeuslearning.com/issues/527580 is resolved
|
75
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
76
|
+
.eq(0)
|
77
|
+
.type('Response')
|
78
|
+
.should('have.value', 'Response')
|
79
|
+
.should('not.have.attr', 'placeholder')
|
80
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
81
|
+
.clear()
|
82
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
83
|
+
});
|
84
|
+
|
85
|
+
//Placeholder test cases for Preview tab response fields
|
86
|
+
it('When \'Placeholder text\' input field is empty then no \'Placeholder text\' should be displayed in the preview tab response field', () => {
|
87
|
+
cy.log('Pre step: Clearinng the placeholder text and switching to Preview tab')
|
88
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
89
|
+
.clear()
|
90
|
+
.should('have.value', '');
|
91
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
92
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
93
|
+
.each(($el) => {
|
94
|
+
cy.wrap($el)
|
95
|
+
.should('not.have.attr', 'placeholder');
|
96
|
+
});
|
97
|
+
});
|
98
|
+
|
99
|
+
it('When the user adds a text in the Placeholder input field, the added placeholder should be displayed in the preview tab response field', () => {
|
100
|
+
cy.log('Pre step: Switch to Edit tab')
|
101
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
102
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
103
|
+
.type('Lorem Ipsum')
|
104
|
+
.should('have.value', 'Lorem Ipsum');
|
105
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
106
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
107
|
+
.each(($el) => {
|
108
|
+
cy.wrap($el)
|
109
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
110
|
+
});
|
111
|
+
});
|
112
|
+
|
113
|
+
//Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
|
114
|
+
|
115
|
+
it('Accessibility of \'Placeholder text\'', { tags: 'a11y' }, () => {
|
116
|
+
cy.checkAccessibility(fillInTheGapsTextPage.previewTabResponseField().parents('.response-input-field'))
|
117
|
+
});
|
118
|
+
|
119
|
+
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', () => {
|
120
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
121
|
+
.eq(0)
|
122
|
+
.type('Response')
|
123
|
+
.should('have.value', 'Response')
|
124
|
+
.should('not.have.attr', 'placeholder');
|
125
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
126
|
+
.eq(0)
|
127
|
+
.clear()
|
128
|
+
.blur()
|
129
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
130
|
+
});
|
131
|
+
});
|
132
|
+
|
133
|
+
describe('Additional Settings: Type of answer input', () => {
|
134
|
+
const typeOfAnswers = ['Text', 'Number'];
|
135
|
+
abortEarlySetup();
|
136
|
+
before(() => {
|
137
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
138
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
139
|
+
});
|
140
|
+
|
141
|
+
it('\'Type of answer\' label and dropdown should be displayed and in \'Type of answer\' dropdown \'Text\' option should be selected by default', () => {
|
142
|
+
fillInTheGapsTextPage.typeOfAnswerInputLabel()
|
143
|
+
.verifyInnerText('Type of answer input');
|
144
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
145
|
+
.verifyInnerText('Text');
|
146
|
+
});
|
147
|
+
|
148
|
+
it('CSS of \'Type of answer\' dropdown', { tags: 'css' }, () => {
|
149
|
+
fillInTheGapsTextPage.typeOfAnswerInputLabel()
|
150
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
151
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
152
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
153
|
+
});
|
154
|
+
|
155
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
156
|
+
|
157
|
+
it(`Clicking on Type of answer dropdown should open a list of 2 options - ${typeOfAnswers}`, () => {
|
158
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
159
|
+
.should('be.visible');
|
160
|
+
typeOfAnswers.forEach((index, count) => {
|
161
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(count)
|
162
|
+
.verifyInnerText(index);
|
163
|
+
});
|
164
|
+
});
|
165
|
+
|
166
|
+
it('CSS of Type of answer dropdown in Active state', { tags: 'css' }, () => {
|
167
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
168
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
|
169
|
+
.should('have.css', 'background-color', css.color.liTextSelectedBg);
|
170
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
171
|
+
.should('have.css', 'background-color', css.color.transparent);
|
172
|
+
});
|
173
|
+
|
174
|
+
it('Accessibility of Type of answer dropdown in active state', { tags: 'a11y' }, () => {
|
175
|
+
cy.checkAccessibility(commonComponents.dropdownList());
|
176
|
+
});
|
177
|
+
|
178
|
+
//Type of answer input test cases for set correct answer section response fields
|
179
|
+
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', () => {
|
180
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
181
|
+
.verifyInnerText('Text');
|
182
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
183
|
+
.each(($el) => {
|
184
|
+
cy.wrap($el)
|
185
|
+
.type('Response 1')
|
186
|
+
.should('have.value', 'Response 1');
|
187
|
+
});
|
188
|
+
});
|
189
|
+
|
190
|
+
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', () => {
|
191
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
192
|
+
.click();
|
193
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
194
|
+
.click();
|
195
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
196
|
+
.each(($el) => {
|
197
|
+
cy.wrap($el)
|
198
|
+
.type('Response 1')
|
199
|
+
.should('have.value', '1');
|
200
|
+
});
|
201
|
+
});
|
202
|
+
|
203
|
+
//Type of answer input test cases for preview tab response fields
|
204
|
+
it('When \'Text\' option is set in the dropdown, then user should be able to add alpha-numeric characters in preview tab response fields', () => {
|
205
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
206
|
+
.click();
|
207
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
208
|
+
.click();
|
209
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
210
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
211
|
+
.each(($el) => {
|
212
|
+
cy.wrap($el)
|
213
|
+
.type('Response 1')
|
214
|
+
.should('have.value', 'Response 1');
|
215
|
+
});
|
216
|
+
});
|
217
|
+
|
218
|
+
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', () => {
|
219
|
+
cy.log('Switching to edit tab')
|
220
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
221
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
222
|
+
.click();
|
223
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
224
|
+
.click();
|
225
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
226
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
227
|
+
.each(($el) => {
|
228
|
+
cy.wrap($el)
|
229
|
+
.type('Response 1')
|
230
|
+
.should('have.value', '1');
|
231
|
+
});
|
232
|
+
})
|
233
|
+
});
|
234
|
+
|
235
|
+
describe('Additional Settings: Set character limit', () => {
|
236
|
+
abortEarlySetup();
|
237
|
+
before(() => {
|
238
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
239
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
240
|
+
});
|
241
|
+
|
242
|
+
it('\'Set character limit\' label and input field should be displayed and in \'Set character limit\' input field the default value should be \'20\'', () => {
|
243
|
+
fillInTheGapsTextPage.setCharacterLimitLabel()
|
244
|
+
.verifyInnerText('Set character limit')
|
245
|
+
.should('be.visible');
|
246
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
247
|
+
.should('have.value', '20')
|
248
|
+
.and('be.visible');
|
249
|
+
});
|
250
|
+
|
251
|
+
it('User should not be able to Set character limit value below 1', () => {
|
252
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
253
|
+
.clear()
|
254
|
+
.type('0')
|
255
|
+
.should('have.value', '0');
|
256
|
+
cy.get('body')
|
257
|
+
.click();
|
258
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
259
|
+
.should('not.have.value', '0')
|
260
|
+
.and('have.value', '1');
|
261
|
+
});
|
262
|
+
|
263
|
+
it('When the user removes the default set characters limit then user should be able to enter \'20\' characters', () => {
|
264
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
265
|
+
.clear()
|
266
|
+
.blur();
|
267
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
268
|
+
.eq(0)
|
269
|
+
.focus()
|
270
|
+
.type('ut placerat orci nulla')
|
271
|
+
.should('have.value', 'ut placerat orci nulla');
|
272
|
+
cy.log('Post step: Setting character limit to 20 and clearing the added text')
|
273
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
274
|
+
.type('20')
|
275
|
+
.should('have.value', '20');
|
276
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
277
|
+
.eq(0)
|
278
|
+
.clear();
|
279
|
+
});
|
280
|
+
|
281
|
+
//Set character limit test cases for set correct answer section response fields
|
282
|
+
it('User should not be able to add characters more than the default Set character limit value in the Set correct answer response fields', () => {
|
283
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
284
|
+
.each(($el) => {
|
285
|
+
cy.wrap($el)
|
286
|
+
.type('ut placerat orci nulla')
|
287
|
+
.should('have.value', 'ut placerat orci nul');
|
288
|
+
});
|
289
|
+
});
|
290
|
+
|
291
|
+
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', () => {
|
292
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
293
|
+
.each(($el) => {
|
294
|
+
cy.wrap($el)
|
295
|
+
.clear()
|
296
|
+
.type('at i{enter}n{enter}t{enter}e{enter}llu{enter}s in{enter}te gers')
|
297
|
+
.should('have.value', 'at intellus inte ger');
|
298
|
+
});
|
299
|
+
});
|
300
|
+
|
301
|
+
it('User should be able to edit the \'Set character limit\' input field', () => {
|
302
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
303
|
+
.clear()
|
304
|
+
.type('45')
|
305
|
+
.should('have.value', '45');
|
306
|
+
});
|
307
|
+
|
308
|
+
it('User should not be able to add characters more than the Set character limit value in the Set correct answers', () => {
|
309
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
310
|
+
.each(($el) => {
|
311
|
+
cy.wrap($el)
|
312
|
+
.clear()
|
313
|
+
.type('ut placerat orci nulla pellentesque dignissim e')
|
314
|
+
.should('have.value', 'ut placerat orci nulla pellentesque dignissim');
|
315
|
+
});
|
316
|
+
});
|
317
|
+
|
318
|
+
//Type of answer input test cases for preview tab response fields
|
319
|
+
it('User should not be able to add characters more than the default Set character limit value in the preview tab response fields', () => {
|
320
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
321
|
+
.clear()
|
322
|
+
.type('20')
|
323
|
+
.should('have.value', '20');
|
324
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
325
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
326
|
+
.each(($el) => {
|
327
|
+
cy.wrap($el)
|
328
|
+
.type('ut placerat orci nulla')
|
329
|
+
.should('have.value', 'ut placerat orci nul');
|
330
|
+
});
|
331
|
+
});
|
332
|
+
|
333
|
+
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', () => {
|
334
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
335
|
+
.each(($el) => {
|
336
|
+
cy.wrap($el)
|
337
|
+
.clear()
|
338
|
+
.type('at i{enter}n{enter}t{enter}e{enter}llu{enter}s in{enter}te gers')
|
339
|
+
.should('have.value', 'at intellus inte ger');
|
340
|
+
});
|
341
|
+
});
|
342
|
+
|
343
|
+
it('User should be able to edit the \'Set character limit\' input field', () => {
|
344
|
+
cy.log('Switching to edit tab')
|
345
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
346
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
347
|
+
.clear()
|
348
|
+
.type('45')
|
349
|
+
.should('have.value', '45');
|
350
|
+
});
|
351
|
+
|
352
|
+
it('User should not be able to add characters more than the Set character limit value in the preview tab response fields', () => {
|
353
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
354
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
355
|
+
.each(($el) => {
|
356
|
+
cy.wrap($el)
|
357
|
+
.type('ut placerat orci nulla pellentesque dignissim e')
|
358
|
+
.should('have.value', 'ut placerat orci nulla pellentesque dignissim');
|
359
|
+
});
|
360
|
+
});
|
361
|
+
});
|
362
|
+
|
363
|
+
describe('Additional Settings: Height and Width', () => {
|
364
|
+
abortEarlySetup();
|
365
|
+
before(() => {
|
366
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
367
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
368
|
+
});
|
369
|
+
|
370
|
+
fillInTheGapsTextPage.tests.verifyHeightAndWidthLabelInputFieldWithCSSAnda11y()
|
371
|
+
|
372
|
+
//Height and width test cases for set correct answer section response fields
|
373
|
+
//TODO: We will need to revisit below case as it will fail for mobile view
|
374
|
+
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', () => {
|
375
|
+
fillInTheGapsTextPage.heightInputField()
|
376
|
+
.should('have.value', '');
|
377
|
+
fillInTheGapsTextPage.widthInputField()
|
378
|
+
.should('have.value', '');
|
379
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
380
|
+
.each(($el) => {
|
381
|
+
cy.wrap($el)
|
382
|
+
.parents('.response-input-field')
|
383
|
+
.should('have.attr', 'height', '46px')
|
384
|
+
.and('have.attr', 'width', '13.7em')
|
385
|
+
});
|
386
|
+
});
|
387
|
+
|
388
|
+
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', () => {
|
389
|
+
fillInTheGapsTextPage.heightInputField()
|
390
|
+
.type('100')
|
391
|
+
.should('have.value', '100');
|
392
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
393
|
+
.each(($el) => {
|
394
|
+
cy.wrap($el)
|
395
|
+
.parents('.response-input-field')
|
396
|
+
.should('have.attr', 'height', '100px');
|
397
|
+
});
|
398
|
+
});
|
399
|
+
|
400
|
+
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', () => {
|
401
|
+
fillInTheGapsTextPage.heightInputField()
|
402
|
+
.clear()
|
403
|
+
.should('have.value', '');
|
404
|
+
fillInTheGapsTextPage.widthInputField()
|
405
|
+
.type('100')
|
406
|
+
.should('have.value', '100');
|
407
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
408
|
+
.each(($el) => {
|
409
|
+
cy.wrap($el)
|
410
|
+
.parents('.response-input-field')
|
411
|
+
.should('have.attr', 'width', '100px');
|
412
|
+
});
|
413
|
+
});
|
414
|
+
|
415
|
+
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', () => {
|
416
|
+
fillInTheGapsTextPage.widthInputField()
|
417
|
+
.clear()
|
418
|
+
.type('20')
|
419
|
+
.should('have.value', '20');
|
420
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
421
|
+
.each(($el) => {
|
422
|
+
cy.wrap($el)
|
423
|
+
.parents('.response-input-field')
|
424
|
+
.should('have.attr', 'width', '80px');
|
425
|
+
});
|
426
|
+
});
|
427
|
+
|
428
|
+
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', () => {
|
429
|
+
fillInTheGapsTextPage.widthInputField()
|
430
|
+
.clear()
|
431
|
+
.type('800')
|
432
|
+
.should('have.value', '800');
|
433
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
434
|
+
.each(($el) => {
|
435
|
+
cy.wrap($el)
|
436
|
+
.parents('.response-input-field')
|
437
|
+
.should('have.attr', 'width', '400px');
|
438
|
+
});
|
439
|
+
});
|
440
|
+
|
441
|
+
//Height and width test cases for preview tab response fields
|
442
|
+
//TODO: We will need to revisit below case as it will fail for mobile view
|
443
|
+
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', () => {
|
444
|
+
fillInTheGapsTextPage.widthInputField()
|
445
|
+
.clear()
|
446
|
+
.should('have.value', '');
|
447
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
448
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
449
|
+
.each(($el) => {
|
450
|
+
cy.wrap($el)
|
451
|
+
.parents('.response-input-field')
|
452
|
+
.should('have.attr', 'height', '46px')
|
453
|
+
.and('have.attr', 'width', '13.7em')
|
454
|
+
});
|
455
|
+
});
|
456
|
+
|
457
|
+
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', () => {
|
458
|
+
cy.log('Pre step: Switching to Edit tab')
|
459
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
460
|
+
fillInTheGapsTextPage.heightInputField()
|
461
|
+
.type('100')
|
462
|
+
.should('have.value', '100');
|
463
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
464
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
465
|
+
.each(($el) => {
|
466
|
+
cy.wrap($el)
|
467
|
+
.parents('.response-input-field')
|
468
|
+
.should('have.attr', 'height', '100px');
|
469
|
+
});
|
470
|
+
});
|
471
|
+
|
472
|
+
it('When the user adds \'Width\' for the response field then the response fields should get updated accordingly in the preview tab', () => {
|
473
|
+
cy.log('Pre step: Switching to Edit tab')
|
474
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
475
|
+
fillInTheGapsTextPage.heightInputField()
|
476
|
+
.clear()
|
477
|
+
.should('have.value', '');
|
478
|
+
fillInTheGapsTextPage.widthInputField()
|
479
|
+
.type('100')
|
480
|
+
.should('have.value', '100');
|
481
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
482
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
483
|
+
.each(($el) => {
|
484
|
+
cy.wrap($el)
|
485
|
+
.parents('.response-input-field')
|
486
|
+
.should('have.attr', 'width', '100px');
|
487
|
+
});
|
488
|
+
});
|
489
|
+
|
490
|
+
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', () => {
|
491
|
+
cy.log('Pre step: Switching to Edit tab')
|
492
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
493
|
+
fillInTheGapsTextPage.widthInputField()
|
494
|
+
.clear()
|
495
|
+
.type('20')
|
496
|
+
.should('have.value', '20');
|
497
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
498
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
499
|
+
.each(($el) => {
|
500
|
+
cy.wrap($el)
|
501
|
+
.parents('.response-input-field')
|
502
|
+
.should('have.attr', 'width', '80px');
|
503
|
+
});
|
504
|
+
});
|
505
|
+
|
506
|
+
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', () => {
|
507
|
+
cy.log('Pre step: Switching to Edit tab')
|
508
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
509
|
+
fillInTheGapsTextPage.widthInputField()
|
510
|
+
.clear()
|
511
|
+
.type('800')
|
512
|
+
.should('have.value', '800');
|
513
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
514
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
515
|
+
.each(($el) => {
|
516
|
+
cy.wrap($el)
|
517
|
+
.parents('.response-input-field')
|
518
|
+
.should('have.attr', 'width', '400px');
|
519
|
+
});
|
520
|
+
});
|
521
|
+
});
|
522
|
+
|
523
|
+
describe('Additional Settings : Response accordion', () => {
|
524
|
+
abortEarlySetup();
|
525
|
+
before(() => {
|
526
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
527
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
528
|
+
});
|
529
|
+
|
530
|
+
fillInTheGapsTextPage.tests.verifyAdditionalSettingsResponseAccordionLabelCSSAndA11y();
|
531
|
+
});
|
532
|
+
|
533
|
+
describe('Response Accordions: ARIA label', () => {
|
534
|
+
abortEarlySetup();
|
535
|
+
before(() => {
|
536
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
537
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
538
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(0);
|
539
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(1);
|
540
|
+
});
|
541
|
+
|
542
|
+
fillInTheGapsTextPage.tests.verifyDefaultStateOfAriaLabelInputFieldInResponseAccordionAndCSS();
|
543
|
+
|
544
|
+
//Note: a11y covered in Additional Settings: Response accordion
|
545
|
+
|
546
|
+
//ARIA label test cases for set correct answer section
|
547
|
+
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', () => {
|
548
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
549
|
+
.each(($el, count) => {
|
550
|
+
cy.wrap($el)
|
551
|
+
.should('have.attr', 'aria-label', `Add answer for response ${count + 1}`);
|
552
|
+
});
|
553
|
+
});
|
554
|
+
|
555
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('ARIA label');
|
556
|
+
|
557
|
+
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', () => {
|
558
|
+
fillInTheGapsTextPage.steps.setAriaLabelInResponseAccordion(0, 'Custom Aria Label');
|
559
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
560
|
+
.eq(0)
|
561
|
+
.should('have.attr', 'aria-label', 'Custom Aria Label');
|
562
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
563
|
+
.eq(1)
|
564
|
+
.should('have.attr', 'aria-label', 'Add answer for response 2');
|
565
|
+
});
|
566
|
+
|
567
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelVisibleOnResponseAccordion('ARIA label');
|
568
|
+
|
569
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelOnResponseAccordionCSS();
|
570
|
+
|
571
|
+
it('Accessibility of input field in \'Set correct answer\' section when custom \'ARIA label\' is set and Custom label', { tags: 'a11y' }, () => {
|
572
|
+
cy.checkAccessibility(fillInTheGapsTextPage.setCorrectAnswerResponseField().parents('.response-input-field'))
|
573
|
+
cy.checkAccessibility(fillInTheGapsTextPage.responseAccordionCustomLabel())
|
574
|
+
});
|
575
|
+
|
576
|
+
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', () => {
|
577
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
578
|
+
.eq(0)
|
579
|
+
.within(() => {
|
580
|
+
fillInTheGapsTextPage.ariaLabelInputField()
|
581
|
+
.clear()
|
582
|
+
.should('have.value', '');
|
583
|
+
});
|
584
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
585
|
+
.each(($el, count) => {
|
586
|
+
cy.wrap($el)
|
587
|
+
.should('have.attr', 'aria-label', `Add answer for response ${count + 1}`);
|
588
|
+
});
|
589
|
+
});
|
590
|
+
|
591
|
+
//ARIA label test cases for preview tab
|
592
|
+
//https://redmine.zeuslearning.com/issues/537797
|
593
|
+
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', () => {
|
594
|
+
cy.log('Pre step: Switch to Preview tab')
|
595
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
596
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
597
|
+
.each(($el, count) => {
|
598
|
+
cy.wrap($el)
|
599
|
+
.should('have.attr', 'aria-label', `Add answer for response ${count + 1}`);
|
600
|
+
});
|
601
|
+
});
|
602
|
+
|
603
|
+
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', () => {
|
604
|
+
cy.log('Pre step: Switch to Edit tab')
|
605
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
606
|
+
fillInTheGapsTextPage.steps.setAriaLabelInResponseAccordion(0, 'Custom Aria Label');
|
607
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
608
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
609
|
+
.eq(0)
|
610
|
+
.should('have.attr', 'aria-label', 'Custom Aria Label');
|
611
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
612
|
+
.eq(1)
|
613
|
+
.should('have.attr', 'aria-label', 'Add answer for response 2');
|
614
|
+
});
|
615
|
+
|
616
|
+
it('Accessibility of input field in preview tab when custom \'ARIA label\' is set', { tags: 'a11y' }, () => {
|
617
|
+
cy.checkAccessibility(fillInTheGapsTextPage.previewTabResponseField().parents('.response-input-field'))
|
618
|
+
});
|
619
|
+
|
620
|
+
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', () => {
|
621
|
+
cy.log('Pre step: Switch to Edit tab')
|
622
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
623
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
624
|
+
.eq(0)
|
625
|
+
.within(() => {
|
626
|
+
fillInTheGapsTextPage.ariaLabelInputField()
|
627
|
+
.clear()
|
628
|
+
.should('have.value', '');
|
629
|
+
});
|
630
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
631
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
632
|
+
.each(($el, count) => {
|
633
|
+
cy.wrap($el)
|
634
|
+
.should('have.attr', 'aria-label', `Add answer for response ${count + 1}`);
|
635
|
+
});
|
636
|
+
});
|
637
|
+
});
|
638
|
+
|
639
|
+
describe('Response Accordions: Placeholder text', () => {
|
640
|
+
abortEarlySetup();
|
641
|
+
before(() => {
|
642
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
643
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
644
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(0)
|
645
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(1)
|
646
|
+
});
|
647
|
+
|
648
|
+
fillInTheGapsTextPage.tests.verifyDefaultStateOfPlaceholderTextInputFieldInResponseAccordionAndCSS();
|
649
|
+
|
650
|
+
//Note: a11y covered in Additional Settings: Response accordion
|
651
|
+
|
652
|
+
//Placeholder test cases for Set correct answer section
|
653
|
+
it('When the user has not set Placeholder text in the Response accordion then placeholder should not be displayed in \'Set correct answer\' section', () => {
|
654
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
655
|
+
.each(($el) => {
|
656
|
+
cy.wrap($el)
|
657
|
+
.should('not.have.attr', 'placeholder');
|
658
|
+
});
|
659
|
+
});
|
660
|
+
|
661
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('Placeholder text');
|
662
|
+
|
663
|
+
it('When the user has set a Placeholder text in either response accordion then a placeholder text should be displayed for the respective response in \'Set correct answer\' section', () => {
|
664
|
+
fillInTheGapsTextPage.steps.setPlaceholderTextInResponseAccordion(0, 'Lorem Ipsum');
|
665
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
666
|
+
.eq(0)
|
667
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
668
|
+
});
|
669
|
+
|
670
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelVisibleOnResponseAccordion('Placeholder text');
|
671
|
+
|
672
|
+
it('When the user removes the Placeholder text from the individual responses the Placeholders should get updated accordingly in \'Set correct answer\' section', () => {
|
673
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
674
|
+
.eq(0)
|
675
|
+
.within(() => {
|
676
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
677
|
+
.clear()
|
678
|
+
.should('have.value', '');
|
679
|
+
});
|
680
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
681
|
+
.eq(0)
|
682
|
+
.should('not.have.attr', 'placeholder');
|
683
|
+
});
|
684
|
+
|
685
|
+
it('When the user has set placeholder text in the individual response areas, then it should override the placeholder text set in the \'Advanced settings for all response areas\' in the \'Set correct answer\' section', () => {
|
686
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
687
|
+
.type('Global placeholder')
|
688
|
+
.should('have.value', 'Global placeholder');
|
689
|
+
fillInTheGapsTextPage.steps.setPlaceholderTextInResponseAccordion(0, 'Lorem Ipsum');
|
690
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
691
|
+
.eq(0)
|
692
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
693
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
694
|
+
.eq(1)
|
695
|
+
.should('have.attr', 'placeholder', 'Global placeholder');
|
696
|
+
});
|
697
|
+
|
698
|
+
//Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
|
699
|
+
|
700
|
+
it('Accessibility of \'Placeholder text\' in \'Set correct answer\' section', { tags: 'a11y' }, () => {
|
701
|
+
cy.checkAccessibility(fillInTheGapsTextPage.setCorrectAnswerResponseField().parents('.response-input-field'));
|
702
|
+
});
|
703
|
+
|
704
|
+
it('When the user enters text 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', () => {
|
705
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
706
|
+
.eq(0)
|
707
|
+
.type('Response')
|
708
|
+
.should('have.value', 'Response')
|
709
|
+
.should('not.have.attr', 'placeholder');
|
710
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
711
|
+
.clear()
|
712
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
713
|
+
});
|
714
|
+
|
715
|
+
//Placeholder test cases for preview tab
|
716
|
+
it('When the user has not set Placeholder text in the Response accordion then placeholder should not be displayed in preview tab response fields', () => {
|
717
|
+
cy.log('Pre step: Clearing the set Placeholder text')
|
718
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
719
|
+
.clear()
|
720
|
+
.should('have.value', '');
|
721
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
722
|
+
.eq(0)
|
723
|
+
.within(() => {
|
724
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
725
|
+
.clear()
|
726
|
+
.should('have.value', '');
|
727
|
+
});
|
728
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
729
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
730
|
+
.each(($el) => {
|
731
|
+
cy.wrap($el)
|
732
|
+
.should('not.have.attr', 'placeholder');
|
733
|
+
});
|
734
|
+
});
|
735
|
+
|
736
|
+
it('When the user has set a Placeholder text in either individual response accordion a placeholder text should be displayed for the respective response in preview tab', () => {
|
737
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
738
|
+
fillInTheGapsTextPage.steps.setPlaceholderTextInResponseAccordion(0, 'Lorem Ipsum');
|
739
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
740
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
741
|
+
.eq(0)
|
742
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
743
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
744
|
+
.eq(1)
|
745
|
+
.should('not.have.attr', 'placeholder');
|
746
|
+
});
|
747
|
+
|
748
|
+
it('When the user removes the Placeholder text from individual responses the Placeholders should get updated accordingly for both the responses in preview tab', () => {
|
749
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
750
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
751
|
+
.eq(0)
|
752
|
+
.within(() => {
|
753
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
754
|
+
.clear()
|
755
|
+
.should('have.value', '');
|
756
|
+
});
|
757
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
758
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
759
|
+
.eq(0)
|
760
|
+
.should('not.have.attr', 'placeholder');
|
761
|
+
});
|
762
|
+
|
763
|
+
it('When the user has set placeholder text in the individual response area, then it should override the placeholder text set in the \'Advanced settings for all response areas\' in the preview tab response fields', () => {
|
764
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
765
|
+
fillInTheGapsTextPage.placeholderTextInputField()
|
766
|
+
.type('Global placeholder')
|
767
|
+
.should('have.value', 'Global placeholder');
|
768
|
+
fillInTheGapsTextPage.steps.setPlaceholderTextInResponseAccordion(0, 'Lorem Ipsum');
|
769
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
770
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
771
|
+
.eq(0)
|
772
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
773
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
774
|
+
.eq(1)
|
775
|
+
.should('have.attr', 'placeholder', 'Global placeholder');
|
776
|
+
});
|
777
|
+
|
778
|
+
//Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
|
779
|
+
|
780
|
+
it('Accessibility of \'Placeholder text\' in preview tab', { tags: 'a11y' }, () => {
|
781
|
+
cy.checkAccessibility(fillInTheGapsTextPage.previewTabResponseField().parents('.response-input-field'))
|
782
|
+
});
|
783
|
+
|
784
|
+
//https://redmine.zeuslearning.com/issues/529544
|
785
|
+
it('When the user enters text in the response field, then the placeholder text should disappear and on clearing the input field the placeholder text should re-appear in the preview tab', () => {
|
786
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
787
|
+
.eq(0)
|
788
|
+
.type('Response')
|
789
|
+
.should('have.value', 'Response')
|
790
|
+
.should('not.have.attr', 'placeholder');
|
791
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
792
|
+
.eq(0)
|
793
|
+
.clear()
|
794
|
+
.blur()
|
795
|
+
.should('have.attr', 'placeholder', 'Lorem Ipsum');
|
796
|
+
});
|
797
|
+
});
|
798
|
+
|
799
|
+
describe('Response Accordions: Type of answer input', () => {
|
800
|
+
abortEarlySetup();
|
801
|
+
const typeOfAnswers = ['Text', 'Number'];
|
802
|
+
before(() => {
|
803
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
804
|
+
cy.barsPreLoaderWait();
|
805
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
806
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(0);
|
807
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(1);
|
808
|
+
});
|
809
|
+
|
810
|
+
it('\'Type of answer\' label and dropdown should be displayed and by default in the \'Type of answer\' dropdown \'Text\' option should be selected for both response accordions', () => {
|
811
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
812
|
+
.each(($el) => {
|
813
|
+
cy.wrap($el)
|
814
|
+
.within(() => {
|
815
|
+
fillInTheGapsTextPage.typeOfAnswerInputLabel()
|
816
|
+
.verifyInnerText('Type of answer input');
|
817
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
818
|
+
.verifyInnerText('Text');
|
819
|
+
});
|
820
|
+
})
|
821
|
+
});
|
822
|
+
|
823
|
+
it('CSS of \'Type of answer\' dropdown', { tags: 'css' }, () => {
|
824
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
825
|
+
.eq(0)
|
826
|
+
.within(() => {
|
827
|
+
fillInTheGapsTextPage.typeOfAnswerInputLabel()
|
828
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
829
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
830
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
831
|
+
});
|
832
|
+
});
|
833
|
+
|
834
|
+
//Note: a11y covered in Additional Settings: Response accordion
|
835
|
+
|
836
|
+
it(`Clicking on Type of answer dropdown should open a list of 2 options - ${typeOfAnswers}`, () => {
|
837
|
+
cy.log('Checking dropdown contents for Response 1 accordion')
|
838
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
839
|
+
.eq(0)
|
840
|
+
.within(() => {
|
841
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
842
|
+
.click();
|
843
|
+
});
|
844
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
845
|
+
.should('be.visible');
|
846
|
+
typeOfAnswers.forEach((index, count) => {
|
847
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(count)
|
848
|
+
.verifyInnerText(index);
|
849
|
+
});
|
850
|
+
cy.get('body')
|
851
|
+
.click();
|
852
|
+
cy.log('Checking dropdown contents for Response 2 accordion')
|
853
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
854
|
+
.eq(1)
|
855
|
+
.within(() => {
|
856
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
857
|
+
.click();
|
858
|
+
});
|
859
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
860
|
+
.should('be.visible');
|
861
|
+
typeOfAnswers.forEach((index, count) => {
|
862
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(count)
|
863
|
+
.verifyInnerText(index);
|
864
|
+
});
|
865
|
+
});
|
866
|
+
|
867
|
+
it('CSS of Type of answer input dropdown in Active state', { tags: 'css' }, () => {
|
868
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
869
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
|
870
|
+
.should('have.css', 'background-color', css.color.liTextSelectedBg);
|
871
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
872
|
+
.should('have.css', 'background-color', css.color.transparent);
|
873
|
+
});
|
874
|
+
|
875
|
+
it('Accessibility of Type of answer input dropdown in active state', { tags: 'a11y' }, () => {
|
876
|
+
cy.checkAccessibility(commonComponents.dropdownList());
|
877
|
+
});
|
878
|
+
|
879
|
+
it('When the user has not set the Type of answer input in the response accordion then the custom label should not be displayed', () => {
|
880
|
+
fillInTheGapsTextPage.responseAccordionCustomLabel()
|
881
|
+
.should('not.exist');
|
882
|
+
});
|
883
|
+
|
884
|
+
//Type of answer input test cases for set correct answer section
|
885
|
+
it('When the user has set \'Text\' option in the response accordion, then user should be able to enter alpha-numeric characters in the \'Set correct answer\' section', () => {
|
886
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
887
|
+
.eq(0)
|
888
|
+
.type('Response 1')
|
889
|
+
.should('have.value', 'Response 1');
|
890
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
891
|
+
.eq(1)
|
892
|
+
.type('Response 1')
|
893
|
+
.should('have.value', 'Response 1');
|
894
|
+
});
|
895
|
+
|
896
|
+
it('When the user has set \'Number\' option the response accordion, then user should be able to enter only numeric characters in the \'Set correct answer\' section', () => {
|
897
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
898
|
+
.eq(1)
|
899
|
+
.within(() => {
|
900
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
901
|
+
.click();
|
902
|
+
});
|
903
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
904
|
+
.click();
|
905
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
906
|
+
.eq(1)
|
907
|
+
.within(() => {
|
908
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
909
|
+
.verifyInnerText('Number');
|
910
|
+
});
|
911
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
912
|
+
.eq(1)
|
913
|
+
.type('Response 1')
|
914
|
+
.should('have.value', '1');
|
915
|
+
});
|
916
|
+
|
917
|
+
it('When the user has set \'Number\' option in the \'Advanced settings for all response areas\' then both the options in the Response accordions should change to \'Number\'', () => {
|
918
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
919
|
+
.click();
|
920
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
921
|
+
.click();
|
922
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
923
|
+
.verifyInnerText('Number');
|
924
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
925
|
+
.each(($el) => {
|
926
|
+
cy.wrap($el)
|
927
|
+
.within(() => {
|
928
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
929
|
+
.verifyInnerText('Number');
|
930
|
+
});
|
931
|
+
});
|
932
|
+
});
|
933
|
+
|
934
|
+
it('When the user has set \'Text\' option in Response accordion then it should override the \'Number\' option set in the \'Advanced settings for all response areas\' and user should be able to enter responses accordingly in the \'Set correct answer\' section', () => {
|
935
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
936
|
+
.eq(0)
|
937
|
+
.within(() => {
|
938
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
939
|
+
.click();
|
940
|
+
});
|
941
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
942
|
+
.click();
|
943
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
944
|
+
.eq(0)
|
945
|
+
.within(() => {
|
946
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
947
|
+
.verifyInnerText('Text');
|
948
|
+
});
|
949
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
950
|
+
.eq(0)
|
951
|
+
.click()
|
952
|
+
.type('1 Response', { delay: 1000 })
|
953
|
+
.should('have.value', '1 Response');
|
954
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
955
|
+
.eq(1)
|
956
|
+
.clear()
|
957
|
+
.type('Response 1')
|
958
|
+
.should('have.value', '1');
|
959
|
+
});
|
960
|
+
|
961
|
+
it('When the user has set a Type of answer input in Response accordion then Custom label should be displayed', () => {
|
962
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
963
|
+
.eq(0)
|
964
|
+
.within(() => {
|
965
|
+
fillInTheGapsTextPage.responseAccordionCustomLabel()
|
966
|
+
.should('be.visible');
|
967
|
+
});
|
968
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
969
|
+
.eq(1)
|
970
|
+
.within(() => {
|
971
|
+
fillInTheGapsTextPage.responseAccordionCustomLabel()
|
972
|
+
.should('not.exist');
|
973
|
+
});
|
974
|
+
});
|
975
|
+
|
976
|
+
//Type of answer input test cases for preview tab
|
977
|
+
it('When the user has set \'Text\' option in the response accordion, then user should be able to enter alpha-numeric characters in preview tab response fields', () => {
|
978
|
+
cy.log('Pre step: Set the Type of answer input dropdowns to \'Text\'')
|
979
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
980
|
+
.click();
|
981
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
982
|
+
.click();
|
983
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
984
|
+
.verifyInnerText('Text');
|
985
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
986
|
+
.each(($el) => {
|
987
|
+
cy.wrap($el)
|
988
|
+
.within(() => {
|
989
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
990
|
+
.verifyInnerText('Text');
|
991
|
+
});
|
992
|
+
});
|
993
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
994
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
995
|
+
.each(($el) => {
|
996
|
+
cy.wrap($el)
|
997
|
+
.type('Response 1')
|
998
|
+
.should('have.value', 'Response 1');
|
999
|
+
});
|
1000
|
+
});
|
1001
|
+
|
1002
|
+
it('When the user has set \'Number\' option in the response accordion, then the user should be able to enter only numeric characters in preview tab response fields', () => {
|
1003
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
1004
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
1005
|
+
.eq(1)
|
1006
|
+
.within(() => {
|
1007
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
1008
|
+
.click();
|
1009
|
+
});
|
1010
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
1011
|
+
.click();
|
1012
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
1013
|
+
.eq(1)
|
1014
|
+
.within(() => {
|
1015
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
1016
|
+
.verifyInnerText('Number');
|
1017
|
+
});
|
1018
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
1019
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1020
|
+
.eq(1)
|
1021
|
+
.type('Response 1')
|
1022
|
+
.should('have.value', '1');
|
1023
|
+
});
|
1024
|
+
|
1025
|
+
it('When the user has set \'Text\' option in Response accordion then it should override the \'Number\' option set in \'Advanced settings for all response areas\' and user should be able to enter responses accordingly in the preview tab section', () => {
|
1026
|
+
cy.log('Pre step:Setting \'Number\' option in \'Advanced settings for all response areas\'')
|
1027
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
1028
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
1029
|
+
.click();
|
1030
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(1)
|
1031
|
+
.click();
|
1032
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
1033
|
+
.verifyInnerText('Number');
|
1034
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
1035
|
+
.eq(0)
|
1036
|
+
.within(() => {
|
1037
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
1038
|
+
.click();
|
1039
|
+
});
|
1040
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdownListOptions(0)
|
1041
|
+
.click();
|
1042
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
1043
|
+
.eq(0)
|
1044
|
+
.within(() => {
|
1045
|
+
fillInTheGapsTextPage.typeOfAnswerInputDropdown()
|
1046
|
+
.verifyInnerText('Text');
|
1047
|
+
});
|
1048
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
1049
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1050
|
+
.eq(0)
|
1051
|
+
.type('Response 1')
|
1052
|
+
.should('have.value', 'Response 1');
|
1053
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1054
|
+
.eq(1)
|
1055
|
+
.type('Response 1')
|
1056
|
+
.should('have.value', '1');
|
1057
|
+
});
|
1058
|
+
});
|
1059
|
+
|
1060
|
+
describe('Response Accordions: Height and Width', () => {
|
1061
|
+
abortEarlySetup();
|
1062
|
+
before(() => {
|
1063
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1064
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1065
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(0);
|
1066
|
+
fillInTheGapsTextPage.steps.expandResponseAccordion(1);
|
1067
|
+
});
|
1068
|
+
|
1069
|
+
fillInTheGapsTextPage.tests.verifyDefaultStateOfHeightAndWidthInputFieldInResponseAccordionAndCSS();
|
1070
|
+
|
1071
|
+
//Note: a11y covered in Additional Settings: Response accordion
|
1072
|
+
|
1073
|
+
//Height and width test cases for Set correct answer section
|
1074
|
+
//TODO: We will need to revisit below case as it will fail for mobile view
|
1075
|
+
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', () => {
|
1076
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1077
|
+
.each(($el) => {
|
1078
|
+
cy.wrap($el)
|
1079
|
+
.parents('.response-input-field')
|
1080
|
+
.should('have.attr', 'height', '46px')
|
1081
|
+
.and('have.attr', 'width', '13.7em');
|
1082
|
+
});
|
1083
|
+
});
|
1084
|
+
|
1085
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelNotVisibleOnResponseAccordion('Height and Width');
|
1086
|
+
|
1087
|
+
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', () => {
|
1088
|
+
fillInTheGapsTextPage.steps.setHeightInResponseAccordion(0, '100');
|
1089
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1090
|
+
.eq(0)
|
1091
|
+
.parents('.response-input-field')
|
1092
|
+
.should('have.attr', 'height', '100px');
|
1093
|
+
});
|
1094
|
+
|
1095
|
+
fillInTheGapsTextPage.tests.verifyCustomLabelVisibleOnResponseAccordion('Height and Width');
|
1096
|
+
|
1097
|
+
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', () => {
|
1098
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '100');
|
1099
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1100
|
+
.eq(0)
|
1101
|
+
.parents('.response-input-field')
|
1102
|
+
.should('have.attr', 'width', '100px');
|
1103
|
+
});
|
1104
|
+
|
1105
|
+
it('When the user has set width below 80px then the width should remain 80px in the \'Set correct answer\' section', () => {
|
1106
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '20');
|
1107
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1108
|
+
.eq(0)
|
1109
|
+
.parents('.response-input-field')
|
1110
|
+
.should('have.attr', 'width', '80px');
|
1111
|
+
});
|
1112
|
+
|
1113
|
+
it('When the user has set width above 400px then the width should remain 400px in the \'Set correct answer\' section', () => {
|
1114
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '800');
|
1115
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1116
|
+
.eq(0)
|
1117
|
+
.parents('.response-input-field')
|
1118
|
+
.should('have.attr', 'width', '400px');
|
1119
|
+
});
|
1120
|
+
|
1121
|
+
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', () => {
|
1122
|
+
fillInTheGapsTextPage.widthInputField()
|
1123
|
+
.clear()
|
1124
|
+
.type('250')
|
1125
|
+
.should('have.value', '250');
|
1126
|
+
fillInTheGapsTextPage.heightInputField()
|
1127
|
+
.clear()
|
1128
|
+
.type('180')
|
1129
|
+
.should('have.value', '180');
|
1130
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '175');
|
1131
|
+
fillInTheGapsTextPage.steps.setHeightInResponseAccordion(0, '120');
|
1132
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1133
|
+
.eq(0)
|
1134
|
+
.parents('.response-input-field')
|
1135
|
+
.should('have.attr', 'width', '175px')
|
1136
|
+
.and('have.attr', 'height', '120px');
|
1137
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1138
|
+
.eq(1)
|
1139
|
+
.parents('.response-input-field')
|
1140
|
+
.should('have.attr', 'width', '250px')
|
1141
|
+
.and('have.attr', 'height', '180px');
|
1142
|
+
});
|
1143
|
+
|
1144
|
+
//Height and width test cases for preview tab
|
1145
|
+
//TODO: We will need to revisit below case as it will fail for mobile view
|
1146
|
+
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', () => {
|
1147
|
+
cy.log('Pre step: clearing the set values of height and width to bring back the dimensions of the response field to default dimensions')
|
1148
|
+
fillInTheGapsTextPage.widthInputField()
|
1149
|
+
.clear()
|
1150
|
+
.should('have.value', '');
|
1151
|
+
fillInTheGapsTextPage.heightInputField()
|
1152
|
+
.clear()
|
1153
|
+
.should('have.value', '');
|
1154
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
1155
|
+
.each(($el) => {
|
1156
|
+
cy.wrap($el)
|
1157
|
+
.within(() => {
|
1158
|
+
fillInTheGapsTextPage.heightInputField()
|
1159
|
+
.clear()
|
1160
|
+
.should('have.value', '');
|
1161
|
+
fillInTheGapsTextPage.widthInputField()
|
1162
|
+
.clear()
|
1163
|
+
.should('have.value', '');
|
1164
|
+
});
|
1165
|
+
})
|
1166
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1167
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1168
|
+
.each(($el) => {
|
1169
|
+
cy.wrap($el)
|
1170
|
+
.parents('.response-input-field')
|
1171
|
+
.should('have.attr', 'height', '46px')
|
1172
|
+
.and('have.attr', 'width', '13.7em');
|
1173
|
+
});
|
1174
|
+
});
|
1175
|
+
|
1176
|
+
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', () => {
|
1177
|
+
cy.log('Pre step: Switch to Edit tab')
|
1178
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1179
|
+
fillInTheGapsTextPage.steps.setHeightInResponseAccordion(0, '100');
|
1180
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1181
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1182
|
+
.eq(0)
|
1183
|
+
.parents('.response-input-field')
|
1184
|
+
.should('have.attr', 'height', '100px');
|
1185
|
+
});
|
1186
|
+
|
1187
|
+
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', () => {
|
1188
|
+
cy.log('Pre step: Switch to Edit tab')
|
1189
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1190
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '100');
|
1191
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1192
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1193
|
+
.eq(0)
|
1194
|
+
.parents('.response-input-field')
|
1195
|
+
.should('have.attr', 'width', '100px');
|
1196
|
+
});
|
1197
|
+
|
1198
|
+
it('When the user has set width below 80px then the width should remain 80px in the preview tab', () => {
|
1199
|
+
cy.log('Pre step: Switch to Edit tab')
|
1200
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1201
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '20');
|
1202
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1203
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1204
|
+
.eq(0)
|
1205
|
+
.parents('.response-input-field')
|
1206
|
+
.should('have.attr', 'width', '80px');
|
1207
|
+
});
|
1208
|
+
|
1209
|
+
it('When the user has set width above 400px then the width should remain 400px in the preview tab', () => {
|
1210
|
+
cy.log('Pre step: Switch to Edit tab')
|
1211
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1212
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '800');
|
1213
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1214
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1215
|
+
.eq(0)
|
1216
|
+
.parents('.response-input-field')
|
1217
|
+
.should('have.attr', 'width', '400px');
|
1218
|
+
});
|
1219
|
+
|
1220
|
+
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', () => {
|
1221
|
+
cy.log('Pre step: Switch to Edit tab')
|
1222
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1223
|
+
fillInTheGapsTextPage.widthInputField()
|
1224
|
+
.clear()
|
1225
|
+
.type('250')
|
1226
|
+
.should('have.value', '250');
|
1227
|
+
fillInTheGapsTextPage.heightInputField()
|
1228
|
+
.clear()
|
1229
|
+
.type('180')
|
1230
|
+
.should('have.value', '180');
|
1231
|
+
fillInTheGapsTextPage.steps.setWidthInResponseAccordion(0, '175');
|
1232
|
+
fillInTheGapsTextPage.steps.setHeightInResponseAccordion(0, '120');
|
1233
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1234
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1235
|
+
.eq(0)
|
1236
|
+
.parents('.response-input-field')
|
1237
|
+
.should('have.attr', 'width', '175px')
|
1238
|
+
.and('have.attr', 'height', '120px');
|
1239
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1240
|
+
.eq(1)
|
1241
|
+
.parents('.response-input-field')
|
1242
|
+
.should('have.attr', 'width', '250px')
|
1243
|
+
.and('have.attr', 'height', '180px')
|
1244
|
+
});
|
1245
|
+
});
|
1246
|
+
|
1247
|
+
describe('Additional Settings: Answer numeration (only while grading) dropdown', () => {
|
1248
|
+
let dropdownOptions = ['Numerical', 'Uppercase alphabet', 'Lowercase alphabet'];
|
1249
|
+
abortEarlySetup();
|
1250
|
+
before(() => {
|
1251
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1252
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1253
|
+
});
|
1254
|
+
|
1255
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
1256
|
+
|
1257
|
+
fillInTheGapsTextPage.tests.verifyAnswerNumerationContents();
|
1258
|
+
|
1259
|
+
it(`User should be able to select any option other than ${dropdownOptions[0]}`, () => {
|
1260
|
+
fillInTheGapsTextPage.steps.selectAnswerNumerationDropdownOption(`${dropdownOptions[2]}`)
|
1261
|
+
});
|
1262
|
+
|
1263
|
+
//TODO: We have not checked the Response numeration in Grading view
|
1264
|
+
});
|
1265
|
+
|
1266
|
+
//Failing due to https://redmine.zeuslearning.com/issues/535989
|
1267
|
+
describe('Additional Settings: Font Size dropdown', () => {
|
1268
|
+
abortEarlySetup();
|
1269
|
+
before(() => {
|
1270
|
+
cy.log('Navigating to fill in the gaps - text type, adding question instructions and options, allotting points and expanding additional settings accordion')
|
1271
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1272
|
+
fillInTheGapsTextPage.questionInstructionsInputField()
|
1273
|
+
.type('Question Instructions');
|
1274
|
+
fillInTheGapsTextPage.pointsInputField()
|
1275
|
+
.type('4');
|
1276
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1277
|
+
.each(($element) => {
|
1278
|
+
cy.wrap($element)
|
1279
|
+
.type('Answer input');
|
1280
|
+
});
|
1281
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1282
|
+
});
|
1283
|
+
|
1284
|
+
fillInTheGapsTextPage.tests.verifyFontSizeSectionContents();
|
1285
|
+
|
1286
|
+
const fontsizes = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
|
1287
|
+
const font = ['16px', '12px', '14px', '17px', '20px', '24px'];
|
1288
|
+
fontsizes.forEach((option, count) => {
|
1289
|
+
it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size of the preview tab contents should be changed to ${option} in the \'Set Correct Answer\' section as well as in the \'Preview\' tab`, () => {
|
1290
|
+
fillInTheGapsTextPage.fontSizeDropdown()
|
1291
|
+
.click();
|
1292
|
+
fillInTheGapsTextPage.fontSizeListOptions(count)
|
1293
|
+
.click();
|
1294
|
+
fillInTheGapsTextPage.fontSizeDropdown()
|
1295
|
+
.verifyInnerText(`${option}`);
|
1296
|
+
cy.log('Checking correct answer section font size')
|
1297
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1298
|
+
.each(($element) => {
|
1299
|
+
cy.wrap($element)
|
1300
|
+
.parent()
|
1301
|
+
.should('have.attr', 'font-size', font[count]);
|
1302
|
+
});
|
1303
|
+
cy.log('Switching to Preview tab')
|
1304
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1305
|
+
cy.log('Checking Preview section font size')
|
1306
|
+
fillInTheGapsTextPage.questionInstructionsText()
|
1307
|
+
.should('have.css', 'font-size', font[count]);
|
1308
|
+
commonComponents.previewTabQuestionWrapper()
|
1309
|
+
.within(() => {
|
1310
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1311
|
+
.each(($element) => {
|
1312
|
+
cy.wrap($element)
|
1313
|
+
.parent()
|
1314
|
+
.should('have.attr', 'font-size', font[count]);
|
1315
|
+
});
|
1316
|
+
});
|
1317
|
+
fillInTheGapsTextPage.previewTabQuestionContainer()
|
1318
|
+
.should('have.css', 'font-size', font[count]);
|
1319
|
+
cy.log('Post step: Switch to Edit tab')
|
1320
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1321
|
+
});
|
1322
|
+
});
|
1323
|
+
});
|
1324
|
+
|
1325
|
+
describe('Additional Settings: Multiline response', () => {
|
1326
|
+
abortEarlySetup();
|
1327
|
+
before(() => {
|
1328
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1329
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1330
|
+
});
|
1331
|
+
|
1332
|
+
it('\'Multiline response\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
|
1333
|
+
fillInTheGapsTextPage.multilineResponseLabel()
|
1334
|
+
.verifyInnerText('Multiline response');
|
1335
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1336
|
+
.should('not.be.checked');
|
1337
|
+
});
|
1338
|
+
|
1339
|
+
it('CSS of \'Multiline response\' section - unchecked state', { tags: 'css' }, () => {
|
1340
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1341
|
+
.parent()
|
1342
|
+
.find('svg')
|
1343
|
+
.should('have.css', 'fill', css.color.uncheckedCheckbox);
|
1344
|
+
});
|
1345
|
+
|
1346
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
1347
|
+
|
1348
|
+
//Multiline response test cases for set correct answer section response fields
|
1349
|
+
it('When the \'Multiline response\' functionality is disabled, the response fields should not have \'textarea\' field in \'Set correct answer\' section', () => {
|
1350
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1351
|
+
.should('not.be.checked');
|
1352
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1353
|
+
.each(($el) => {
|
1354
|
+
cy.wrap($el)
|
1355
|
+
.parents('.response-input-field')
|
1356
|
+
.should('not.have.class', 'response-multiline-input-field')
|
1357
|
+
.find('input[type="text"]')
|
1358
|
+
.should('exist')
|
1359
|
+
.parents('.response-input-field')
|
1360
|
+
.find('textarea')
|
1361
|
+
.should('not.exist');
|
1362
|
+
});
|
1363
|
+
});
|
1364
|
+
|
1365
|
+
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', () => {
|
1366
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1367
|
+
.each(($el) => {
|
1368
|
+
cy.wrap($el)
|
1369
|
+
.type('l{enter}o{enter}r{enter}e{enter}m')
|
1370
|
+
.should('have.value', 'lorem');
|
1371
|
+
});
|
1372
|
+
});
|
1373
|
+
|
1374
|
+
it('When the \'Multiline response\' functionality is enabled, the response field should have \'textarea\' field in \'Set correct answer\' section', () => {
|
1375
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1376
|
+
.click()
|
1377
|
+
.should('be.checked');
|
1378
|
+
fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
|
1379
|
+
.each(($el) => {
|
1380
|
+
cy.wrap($el)
|
1381
|
+
.should('exist')
|
1382
|
+
.find('textarea')
|
1383
|
+
.should('exist')
|
1384
|
+
.parents('.response-multiline-input-field')
|
1385
|
+
.find('input[type="text"]')
|
1386
|
+
.should('not.exist');
|
1387
|
+
});
|
1388
|
+
});
|
1389
|
+
|
1390
|
+
it('When the \'Multiline response\' functionality is enabled then the user should be able to add Multiline responses in the \'Set correct answer\' section', () => {
|
1391
|
+
fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
|
1392
|
+
.each(($el) => {
|
1393
|
+
cy.wrap($el)
|
1394
|
+
.clear()
|
1395
|
+
.type('l{enter}o{enter}r{enter}e{enter}m')
|
1396
|
+
.should('have.text', 'l\no\nr\ne\nm');
|
1397
|
+
});
|
1398
|
+
});
|
1399
|
+
|
1400
|
+
it('CSS of \'Multiline response\' section - checked state', { tags: 'css' }, () => {
|
1401
|
+
fillInTheGapsTextPage.multilineResponseLabel()
|
1402
|
+
.verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
|
1403
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1404
|
+
.parent()
|
1405
|
+
.find('g[data-name*="Rectangle"]')
|
1406
|
+
.should('have.css', 'fill', css.color.activeButtons);
|
1407
|
+
});
|
1408
|
+
|
1409
|
+
it('Accessibility of \'Multiline response\' section - checked state', { tags: 'a11y' }, () => {
|
1410
|
+
cy.checkAccessibility(fillInTheGapsTextPage.multilineResponseLabel().parents('.MuiFormGroup-root'))
|
1411
|
+
});
|
1412
|
+
|
1413
|
+
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', () => {
|
1414
|
+
fillInTheGapsTextPage.setCharacterLimitInputField()
|
1415
|
+
.should('have.value', '20');
|
1416
|
+
fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
|
1417
|
+
.each(($el) => {
|
1418
|
+
cy.wrap($el)
|
1419
|
+
.clear()
|
1420
|
+
.type('l{enter}o{enter}r{enter}e{enter}m{enter}e{enter}s{enter}u{enter}m{enter}l{enter}nam')
|
1421
|
+
.should('have.text', 'l\no\nr\ne\nm\ne\ns\nu\nm\nl\n');
|
1422
|
+
});
|
1423
|
+
});
|
1424
|
+
|
1425
|
+
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', () => {
|
1426
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1427
|
+
.click()
|
1428
|
+
.should('not.be.checked');
|
1429
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1430
|
+
.each(($el) => {
|
1431
|
+
cy.wrap($el)
|
1432
|
+
.should('have.value', 'loremesuml');
|
1433
|
+
});
|
1434
|
+
});
|
1435
|
+
|
1436
|
+
//Multiline response test cases for preview tab response fields
|
1437
|
+
it('When the \'Multiline response\' functionality is disabled, the response field should not have \'textarea\' field in preview tab', () => {
|
1438
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1439
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1440
|
+
.each(($el) => {
|
1441
|
+
cy.wrap($el)
|
1442
|
+
.parents('.response-input-field')
|
1443
|
+
.should('not.have.class', 'response-multiline-input-field')
|
1444
|
+
.find('input[type="text"]')
|
1445
|
+
.should('exist')
|
1446
|
+
.parents('.response-input-field')
|
1447
|
+
.find('textarea')
|
1448
|
+
.should('not.exist')
|
1449
|
+
});
|
1450
|
+
});
|
1451
|
+
|
1452
|
+
it('When \'Multiline response\' functionality is disabled, the user should not be able to add multiline response in the preview tab response field', () => {
|
1453
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1454
|
+
.each(($el) => {
|
1455
|
+
cy.wrap($el)
|
1456
|
+
.type('l{enter}o{enter}r{enter}e{enter}m')
|
1457
|
+
.should('have.value', 'lorem');
|
1458
|
+
});
|
1459
|
+
});
|
1460
|
+
|
1461
|
+
it('When the \'Multiline response\' functionality is enabled, the response field should have \'textarea\' field in the preview tab', () => {
|
1462
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
1463
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1464
|
+
.click()
|
1465
|
+
.should('be.checked');
|
1466
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
1467
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1468
|
+
.each(($el) => {
|
1469
|
+
cy.wrap($el)
|
1470
|
+
.should('exist')
|
1471
|
+
.find('textarea')
|
1472
|
+
.should('exist')
|
1473
|
+
.parents('.response-multiline-input-field')
|
1474
|
+
.find('input[type="text"]')
|
1475
|
+
.should('not.exist');
|
1476
|
+
});
|
1477
|
+
});
|
1478
|
+
|
1479
|
+
it('When the \'Multiline response\' functionality is enabled then the user should be able to add Multiline responses in the preview tab', () => {
|
1480
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1481
|
+
.each(($el) => {
|
1482
|
+
cy.wrap($el)
|
1483
|
+
.type('l{enter}o{enter}r{enter}e{enter}m')
|
1484
|
+
.should('have.text', 'l\no\nr\ne\nm');
|
1485
|
+
});
|
1486
|
+
});
|
1487
|
+
|
1488
|
+
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', () => {
|
1489
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1490
|
+
.each(($el) => {
|
1491
|
+
cy.wrap($el)
|
1492
|
+
.clear()
|
1493
|
+
.type('l{enter}o{enter}r{enter}e{enter}m{enter}e{enter}s{enter}u{enter}m{enter}l{enter}nam')
|
1494
|
+
.should('have.text', 'l\no\nr\ne\nm\ne\ns\nu\nm\nl\n');
|
1495
|
+
});
|
1496
|
+
});
|
1497
|
+
});
|
1498
|
+
|
1499
|
+
describe('Additional Settings: Scoring for Multiline response', () => {
|
1500
|
+
abortEarlySetup();
|
1501
|
+
before(() => {
|
1502
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1503
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1504
|
+
fillInTheGapsTextPage.multilineResponseCheckbox()
|
1505
|
+
.click()
|
1506
|
+
.should('be.checked');
|
1507
|
+
});
|
1508
|
+
|
1509
|
+
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', () => {
|
1510
|
+
fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
|
1511
|
+
.eq(0)
|
1512
|
+
.type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}1')
|
1513
|
+
.should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n1');
|
1514
|
+
fillInTheGapsTextPage.setCorrectAnswerMultilineTextArea()
|
1515
|
+
.eq(1)
|
1516
|
+
.type('Response 2')
|
1517
|
+
.should('have.text', 'Response 2');
|
1518
|
+
fillInTheGapsTextPage.pointsInputField()
|
1519
|
+
.type('10');
|
1520
|
+
});
|
1521
|
+
|
1522
|
+
it('When the user enters the correct multiline and single line response in the preview tab then full points should be awarded', () => {
|
1523
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
1524
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1525
|
+
.eq(0)
|
1526
|
+
.type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}1')
|
1527
|
+
.should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n1');
|
1528
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1529
|
+
.eq(1)
|
1530
|
+
.type('Response 2')
|
1531
|
+
.should('have.text', 'Response 2');
|
1532
|
+
fillInTheGapsTextPage.previewScoreText()
|
1533
|
+
.verifyInnerText('10/10');
|
1534
|
+
fillInTheGapsTextPage.previewTabCorrectAnswerContainer()
|
1535
|
+
.should('not.exist');
|
1536
|
+
cy.log('When the user selects show correct answer checkbox then correct icons and label should be displayed')
|
1537
|
+
fillInTheGapsTextPage.showCorrectAnswerCheckbox()
|
1538
|
+
.click();
|
1539
|
+
fillInTheGapsTextPage.previewTabResponseFieldWrapper()
|
1540
|
+
.each(($el) => {
|
1541
|
+
cy.wrap($el)
|
1542
|
+
.within(() => {
|
1543
|
+
fillInTheGapsTextPage.correctIcon()
|
1544
|
+
.should('be.visible');
|
1545
|
+
});
|
1546
|
+
});
|
1547
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
|
1548
|
+
fillInTheGapsTextPage.steps.verifyCorrectAttemptBorder();
|
1549
|
+
cy.log('Post step: Uncheck Show correct answer checkbox')
|
1550
|
+
fillInTheGapsTextPage.showCorrectAnswerCheckbox()
|
1551
|
+
.click()
|
1552
|
+
.should('not.be.checked');
|
1553
|
+
});
|
1554
|
+
|
1555
|
+
it('When the user enters a single line response instead of a multiline response then no points should be awarded', () => {
|
1556
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1557
|
+
.eq(0)
|
1558
|
+
.clear()
|
1559
|
+
.type('Response 1')
|
1560
|
+
.should('have.text', 'Response 1');
|
1561
|
+
fillInTheGapsTextPage.previewScoreText()
|
1562
|
+
.verifyInnerText('0/10');
|
1563
|
+
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')
|
1564
|
+
fillInTheGapsTextPage.showCorrectAnswerCheckbox()
|
1565
|
+
.click();
|
1566
|
+
fillInTheGapsTextPage.previewTabResponseFieldWrapper()
|
1567
|
+
.eq(0)
|
1568
|
+
.within(() => {
|
1569
|
+
fillInTheGapsTextPage.incorrectIcon()
|
1570
|
+
.should('be.visible');
|
1571
|
+
});
|
1572
|
+
fillInTheGapsTextPage.previewTabResponseFieldWrapper()
|
1573
|
+
.eq(1)
|
1574
|
+
.within(() => {
|
1575
|
+
fillInTheGapsTextPage.correctIcon()
|
1576
|
+
.should('be.visible');
|
1577
|
+
});
|
1578
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount('fill in the gaps - text', ['R\ne\ns\np\no\nn\ns\ne\n1']);
|
1579
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
1580
|
+
fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder()
|
1581
|
+
cy.log('Post step: Uncheck Show correct answer checkbox')
|
1582
|
+
fillInTheGapsTextPage.showCorrectAnswerCheckbox()
|
1583
|
+
.click()
|
1584
|
+
.should('not.be.checked');
|
1585
|
+
});
|
1586
|
+
|
1587
|
+
it('When the user enters a multiline response instead of a single line response then no points should be awarded', () => {
|
1588
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1589
|
+
.eq(0)
|
1590
|
+
.clear()
|
1591
|
+
.type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}1')
|
1592
|
+
.should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n1');
|
1593
|
+
fillInTheGapsTextPage.previewTabMultilineTextArea()
|
1594
|
+
.eq(1)
|
1595
|
+
.clear()
|
1596
|
+
.type('R{enter}e{enter}s{enter}p{enter}o{enter}n{enter}s{enter}e{enter}2')
|
1597
|
+
.should('have.text', 'R\ne\ns\np\no\nn\ns\ne\n2');
|
1598
|
+
fillInTheGapsTextPage.previewScoreText()
|
1599
|
+
.verifyInnerText('0/10');
|
1600
|
+
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')
|
1601
|
+
fillInTheGapsTextPage.showCorrectAnswerCheckbox()
|
1602
|
+
.click();
|
1603
|
+
fillInTheGapsTextPage.previewTabResponseFieldWrapper()
|
1604
|
+
.eq(0)
|
1605
|
+
.within(() => {
|
1606
|
+
fillInTheGapsTextPage.correctIcon()
|
1607
|
+
.should('be.visible');
|
1608
|
+
});
|
1609
|
+
fillInTheGapsTextPage.previewTabResponseFieldWrapper()
|
1610
|
+
.eq(1)
|
1611
|
+
.within(() => {
|
1612
|
+
fillInTheGapsTextPage.incorrectIcon()
|
1613
|
+
.should('be.visible');
|
1614
|
+
});
|
1615
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount('fill in the gaps - text', ['Response 2']);
|
1616
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
1617
|
+
fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder();
|
1618
|
+
});
|
1619
|
+
});
|
1620
|
+
|
1621
|
+
describe('Additional Settings: Spell check section', () => {
|
1622
|
+
abortEarlySetup();
|
1623
|
+
before(() => {
|
1624
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1625
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1626
|
+
});
|
1627
|
+
|
1628
|
+
it('\'Spell check\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
|
1629
|
+
fillInTheGapsTextPage.spellCheckLabel()
|
1630
|
+
.verifyInnerText('Spell check');
|
1631
|
+
fillInTheGapsTextPage.spellCheckCheckbox()
|
1632
|
+
.should('not.be.checked');
|
1633
|
+
});
|
1634
|
+
|
1635
|
+
it('CSS of \'Spell check\' section - unchecked state', { tags: 'css' }, () => {
|
1636
|
+
fillInTheGapsTextPage.spellCheckCheckbox()
|
1637
|
+
.parent()
|
1638
|
+
.find('svg')
|
1639
|
+
.should('have.css', 'fill', css.color.uncheckedCheckbox);
|
1640
|
+
});
|
1641
|
+
|
1642
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
1643
|
+
|
1644
|
+
//Spell check test cases for set correct answer section response fields
|
1645
|
+
it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in \'Set correct answer\' section', () => {
|
1646
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1647
|
+
.each(($el) => {
|
1648
|
+
cy.wrap($el)
|
1649
|
+
.should('have.attr', 'spellcheck', 'false');
|
1650
|
+
});
|
1651
|
+
});
|
1652
|
+
|
1653
|
+
it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in \'Set correct answer\' section', () => {
|
1654
|
+
fillInTheGapsTextPage.spellCheckCheckbox()
|
1655
|
+
.click()
|
1656
|
+
.should('be.checked');
|
1657
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1658
|
+
.each(($el) => {
|
1659
|
+
cy.wrap($el)
|
1660
|
+
.should('have.attr', 'spellcheck', 'true');
|
1661
|
+
});
|
1662
|
+
});
|
1663
|
+
|
1664
|
+
it('CSS of \'Spell check\' section - checked state', { tags: 'css' }, () => {
|
1665
|
+
fillInTheGapsTextPage.spellCheckLabel()
|
1666
|
+
.verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
|
1667
|
+
fillInTheGapsTextPage.spellCheckCheckbox()
|
1668
|
+
.parent()
|
1669
|
+
.find('g[data-name*="Rectangle"]')
|
1670
|
+
.should('have.css', 'fill', css.color.activeButtons);
|
1671
|
+
});
|
1672
|
+
|
1673
|
+
it('Accessibility of \'Spell check\' section - checked state', { tags: 'a11y' }, () => {
|
1674
|
+
cy.checkAccessibility(fillInTheGapsTextPage.spellCheckLabel().parents('.MuiFormGroup-root'))
|
1675
|
+
});
|
1676
|
+
|
1677
|
+
//Spell check test cases for preview tab response fields
|
1678
|
+
it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in preview tab', () => {
|
1679
|
+
fillInTheGapsTextPage.spellCheckCheckbox()
|
1680
|
+
.click()
|
1681
|
+
.should('not.be.checked');
|
1682
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1683
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1684
|
+
.each(($el) => {
|
1685
|
+
cy.wrap($el)
|
1686
|
+
.should('have.attr', 'spellcheck', 'false');
|
1687
|
+
});
|
1688
|
+
});
|
1689
|
+
|
1690
|
+
it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in the preview tab', () => {
|
1691
|
+
cy.log('Pre step: Switching to Edit tab')
|
1692
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1693
|
+
fillInTheGapsTextPage.spellCheckCheckbox()
|
1694
|
+
.click()
|
1695
|
+
.should('be.checked');
|
1696
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1697
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1698
|
+
.each(($el) => {
|
1699
|
+
cy.wrap($el)
|
1700
|
+
.should('have.attr', 'spellcheck', 'true');
|
1701
|
+
});
|
1702
|
+
});
|
1703
|
+
});
|
1704
|
+
|
1705
|
+
describe('Additional Settings: Custom special characters section', () => {
|
1706
|
+
abortEarlySetup();
|
1707
|
+
before(() => {
|
1708
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1709
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1710
|
+
});
|
1711
|
+
|
1712
|
+
fillInTheGapsTextPage.tests.verifyAdditionalSettingsCustomSpecialCharactersSection();
|
1713
|
+
|
1714
|
+
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 ', () => {
|
1715
|
+
cy.log('Checking Custom characters button is not visible before focusing any option')
|
1716
|
+
fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
|
1717
|
+
.eq(0)
|
1718
|
+
.should('not.have.class', 'active-response-input-field')
|
1719
|
+
.should('not.be.visible');
|
1720
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1721
|
+
.eq(0)
|
1722
|
+
.click();
|
1723
|
+
fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
|
1724
|
+
.eq(0)
|
1725
|
+
.should('have.class', 'active-response-input-field')
|
1726
|
+
.should('be.visible');
|
1727
|
+
});
|
1728
|
+
|
1729
|
+
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', () => {
|
1730
|
+
fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
|
1731
|
+
.eq(0)
|
1732
|
+
.should('be.visible')
|
1733
|
+
.click();
|
1734
|
+
fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
|
1735
|
+
});
|
1736
|
+
|
1737
|
+
fillInTheGapsTextPage.tests.verifySpecialCharactersFlyoutSymbols()
|
1738
|
+
|
1739
|
+
it(`When the user clicks on a symbol in the ${specialOrMathCharacters['specialCharacters'].popupTitle} popup, then that symbol should be inserted in the response field`, () => {
|
1740
|
+
cy.log('Clicking on all symbols.');
|
1741
|
+
let symbolsString = specialOrMathCharacters['specialCharacters'].characters.map((icon) => icon.symbol);
|
1742
|
+
symbolsString = symbolsString.join('');
|
1743
|
+
fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
|
1744
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1745
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1746
|
+
.eq(0)
|
1747
|
+
.should('have.value', symbolsString);
|
1748
|
+
cy.log('Post step: Clearing the set correct answer input field')
|
1749
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1750
|
+
.eq(0)
|
1751
|
+
.clear();
|
1752
|
+
});
|
1753
|
+
|
1754
|
+
it('When the \'Display special characters\' checkbox is checked then user should be able to enter value in the \'Custom special characters\' input field', () => {
|
1755
|
+
fillInTheGapsTextPage.customSpecialCharactersInputField()
|
1756
|
+
.type(':)`')
|
1757
|
+
.should('have.value', ':)`');
|
1758
|
+
});
|
1759
|
+
|
1760
|
+
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', () => {
|
1761
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1762
|
+
.eq(0)
|
1763
|
+
.focus();
|
1764
|
+
fillInTheGapsTextPage.setCorrectAnsResponseFieldSpecialCharactersButton()
|
1765
|
+
.eq(0)
|
1766
|
+
.should('be.visible')
|
1767
|
+
.click();
|
1768
|
+
fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
|
1769
|
+
});
|
1770
|
+
|
1771
|
+
it('The flyout should contain all the added Special characters entered in the \'Custom special characters\' input field', () => {
|
1772
|
+
fillInTheGapsTextPage.specialCharactersFlyoutIcon()
|
1773
|
+
.each(($el, index) => {
|
1774
|
+
cy.wrap($el)
|
1775
|
+
.should('have.text', `${customSpecialCharacters[index]}`)
|
1776
|
+
});
|
1777
|
+
});
|
1778
|
+
|
1779
|
+
it('When the user clicks on the characters then they should be added to the set correct answer response field', () => {
|
1780
|
+
fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
|
1781
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1782
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1783
|
+
.eq(0)
|
1784
|
+
.should('have.value', ':)`');
|
1785
|
+
});
|
1786
|
+
|
1787
|
+
//Special custom characters test cases for preview tab response fields
|
1788
|
+
it('When the \'Custom special characters\' functionality is disabled then the \'Special characters\' button should not be displayed in the preview tab response field', () => {
|
1789
|
+
fillInTheGapsTextPage.customSpecialCharactersInputField()
|
1790
|
+
.clear();
|
1791
|
+
fillInTheGapsTextPage.displaySpecialCharactersCheckbox()
|
1792
|
+
.click()
|
1793
|
+
.should('not.be.checked');
|
1794
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1795
|
+
fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
|
1796
|
+
.should('not.exist');
|
1797
|
+
});
|
1798
|
+
|
1799
|
+
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', () => {
|
1800
|
+
cy.log('Pre step: Enable the Custom special characters')
|
1801
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1802
|
+
fillInTheGapsTextPage.displaySpecialCharactersCheckbox()
|
1803
|
+
.click()
|
1804
|
+
.should('be.checked');
|
1805
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1806
|
+
fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
|
1807
|
+
.should('not.have.class', 'active-response-input-field')
|
1808
|
+
.and('not.be.visible');
|
1809
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1810
|
+
.eq(0)
|
1811
|
+
.click();
|
1812
|
+
fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
|
1813
|
+
.eq(0)
|
1814
|
+
.should('have.class', 'active-response-input-field')
|
1815
|
+
.should('be.visible');
|
1816
|
+
});
|
1817
|
+
|
1818
|
+
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', () => {
|
1819
|
+
fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
|
1820
|
+
.eq(0)
|
1821
|
+
.should('be.visible')
|
1822
|
+
.click();
|
1823
|
+
fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
|
1824
|
+
});
|
1825
|
+
|
1826
|
+
fillInTheGapsTextPage.tests.verifySpecialCharactersFlyoutSymbols()
|
1827
|
+
|
1828
|
+
it(`When the user clicks on a symbol in the ${specialOrMathCharacters['specialCharacters'].popupTitle} popup, then that symbol should be inserted in the response field`, () => {
|
1829
|
+
cy.log('Clicking on all symbols.');
|
1830
|
+
let symbolsString = specialOrMathCharacters['specialCharacters'].characters.map((icon) => icon.symbol);
|
1831
|
+
symbolsString = symbolsString.join('');
|
1832
|
+
fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
|
1833
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1834
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1835
|
+
.eq(0)
|
1836
|
+
.should('have.value', symbolsString);
|
1837
|
+
});
|
1838
|
+
|
1839
|
+
it('When the \'Display special characters\' checkbox is checked then user should be able to enter value in the \'Custom special characters\' input field', () => {
|
1840
|
+
cy.log('Pre step: Swicth to Edit tab')
|
1841
|
+
fillInTheGapsTextPage.steps.switchToEditTab()
|
1842
|
+
fillInTheGapsTextPage.customSpecialCharactersInputField()
|
1843
|
+
.type(':)`')
|
1844
|
+
.should('have.value', ':)`');
|
1845
|
+
cy.log('Post step: Switch to Preview tab')
|
1846
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab()
|
1847
|
+
});
|
1848
|
+
|
1849
|
+
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', () => {
|
1850
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1851
|
+
.eq(0)
|
1852
|
+
.focus();
|
1853
|
+
fillInTheGapsTextPage.previewTabResponseFieldSpecialCharactersButton()
|
1854
|
+
.eq(0)
|
1855
|
+
.should('be.visible')
|
1856
|
+
.click();
|
1857
|
+
fillInTheGapsTextPage.steps.verifySpecialCharactersFlyoutHeaderContents();
|
1858
|
+
});
|
1859
|
+
|
1860
|
+
it('The flyout should contain all the added Special characters entered in the \'Custom special characters\' input field', () => {
|
1861
|
+
fillInTheGapsTextPage.specialCharactersFlyoutIcon()
|
1862
|
+
.each(($el, index) => {
|
1863
|
+
cy.wrap($el)
|
1864
|
+
.should('have.text', `${customSpecialCharacters[index]}`)
|
1865
|
+
});
|
1866
|
+
});
|
1867
|
+
|
1868
|
+
it('When the user clicks on the characters then they should be added to the preview tab input field', () => {
|
1869
|
+
fillInTheGapsTextPage.steps.clickingOnSpecialCharactersSymbolsFromFlyout();
|
1870
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1871
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1872
|
+
.eq(0)
|
1873
|
+
.should('have.value', ':)`');
|
1874
|
+
});
|
1875
|
+
});
|
1876
|
+
|
1877
|
+
describe('Additional Settings: Student response area and layout', () => {
|
1878
|
+
abortEarlySetup();
|
1879
|
+
before(() => {
|
1880
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1881
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1882
|
+
});
|
1883
|
+
|
1884
|
+
it('\'Student response area and layout\' label should be displayed', () => {
|
1885
|
+
fillInTheGapsTextPage.studentResponseAreaAndLayoutLabel()
|
1886
|
+
.verifyInnerText('Student response area and layout')
|
1887
|
+
.should('be.visible');
|
1888
|
+
});
|
1889
|
+
|
1890
|
+
it('CSS of \'Student response area and layout\' section', { tags: 'css' }, () => {
|
1891
|
+
fillInTheGapsTextPage.studentResponseAreaAndLayoutLabel()
|
1892
|
+
.verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.semibold);
|
1893
|
+
});
|
1894
|
+
|
1895
|
+
//Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
|
1896
|
+
});
|
1897
|
+
|
1898
|
+
describe('Additional Settings: Check Answer', () => {
|
1899
|
+
abortEarlySetup();
|
1900
|
+
before(() => {
|
1901
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1902
|
+
fillInTheGapsTextPage.questionInstructionsInputField()
|
1903
|
+
.type('Question Instructions');
|
1904
|
+
fillInTheGapsTextPage.pointsInputField()
|
1905
|
+
.type('4');
|
1906
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
1907
|
+
.each(($element) => {
|
1908
|
+
cy.wrap($element)
|
1909
|
+
.type('Answer input');
|
1910
|
+
});
|
1911
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1912
|
+
});
|
1913
|
+
|
1914
|
+
fillInTheGapsTextPage.tests.verifyCheckAnswerSectionAndPreviewTabCheckAnswerButton();
|
1915
|
+
});
|
1916
|
+
|
1917
|
+
describe('Additional Settings: Check Answer - Functionality', () => {
|
1918
|
+
abortEarlySetup();
|
1919
|
+
before(() => {
|
1920
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
1921
|
+
fillInTheGapsTextPage.questionInstructionsInputField()
|
1922
|
+
.type('Question Instructions');
|
1923
|
+
fillInTheGapsTextPage.pointsInputField()
|
1924
|
+
.type('4');
|
1925
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 1', 'Response 2']);
|
1926
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
1927
|
+
fillInTheGapsTextPage.steps.setMaximumCheckAnswerAttempts(2);
|
1928
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1929
|
+
});
|
1930
|
+
|
1931
|
+
it('When the user has not set any responses then on clicking on the Check Answer button icons should not be displayed beside both empty responses, label should not be displayed below the box', () => {
|
1932
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1933
|
+
.each(($el) => {
|
1934
|
+
cy.wrap($el)
|
1935
|
+
.should('have.value', '');
|
1936
|
+
});
|
1937
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
1938
|
+
.click();
|
1939
|
+
fillInTheGapsTextPage.correctIcon()
|
1940
|
+
.should('not.exist');
|
1941
|
+
fillInTheGapsTextPage.incorrectIcon()
|
1942
|
+
.should('not.exist');
|
1943
|
+
fillInTheGapsTextPage.correctIncorectAnswerLabel()
|
1944
|
+
.should('not.exist');
|
1945
|
+
fillInTheGapsTextPage.previewTabCorrectAnswerContainer()
|
1946
|
+
.should('not.exist')
|
1947
|
+
});
|
1948
|
+
|
1949
|
+
it('When the user has added correct response for one option then on clicking on the Check Answer button, green checkmark icon should be displayed besides the correct response, red crossmark should not be displayed beside empty response and \'Incorrect Answer\' label should be displayed below the box', () => {
|
1950
|
+
fillInTheGapsTextPage.steps.enterAnswerResponsesInPreviewTab(['Response 1']);
|
1951
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
1952
|
+
.click();
|
1953
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionCheckmarkIcon(0);
|
1954
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectIconNotVisible(1);
|
1955
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
|
1956
|
+
fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder();
|
1957
|
+
});
|
1958
|
+
|
1959
|
+
it('When the user has added correct responses then on clicking on the Check Answer button, green checkmark icon should be displayed besides the responses and \'Correct Answer\' label should be displayed below the box', () => {
|
1960
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
1961
|
+
.eq(1)
|
1962
|
+
.type('Response 2')
|
1963
|
+
.should('have.value', 'Response 2');
|
1964
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
1965
|
+
.click();
|
1966
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionCheckmarkIcon(0);
|
1967
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionCheckmarkIcon(1);
|
1968
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
|
1969
|
+
fillInTheGapsTextPage.steps.verifyCorrectAttemptBorder();
|
1970
|
+
});
|
1971
|
+
|
1972
|
+
|
1973
|
+
fillInTheGapsTextPage.tests.verifyDisabledCheckAnswerButtonWithCSSAnda11y()
|
1974
|
+
|
1975
|
+
it('When the user updates the value of Maximum check answer attempts input field, it should get reflected on the Preview tab', () => {
|
1976
|
+
cy.log('Pre step: Switching to Edit tab')
|
1977
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1978
|
+
fillInTheGapsTextPage.maximumCheckAnswerAttemptsInputField()
|
1979
|
+
.clear()
|
1980
|
+
.type(1)
|
1981
|
+
.should('have.value', '1');
|
1982
|
+
cy.log('Switching to Preview tab');
|
1983
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1984
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
1985
|
+
.should('be.enabled');
|
1986
|
+
fillInTheGapsTextPage.steps.enterAnswerResponsesInPreviewTab(['Response 1', 'Response 2']);
|
1987
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
1988
|
+
.click()
|
1989
|
+
.should('be.disabled');
|
1990
|
+
});
|
1991
|
+
|
1992
|
+
it('When the \'Maximum check answer attempts\' input field has value \'0\' and user switches to Preview tab, then the \'Check Answer\' button should be enabled and user should be able to check answer multiple times', () => {
|
1993
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
1994
|
+
fillInTheGapsTextPage.steps.clearMaximumCheckAnswerAttemptsInputField();
|
1995
|
+
fillInTheGapsTextPage.steps.addInputToMaximumCheckAnswerAttemptsInputField(0);
|
1996
|
+
cy.log('Switching to Preview tab')
|
1997
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
1998
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
1999
|
+
.should('be.enabled');
|
2000
|
+
cy.log('Clicking on \'Check Answer\' to check state of \'Check Answer\' to be enabled')
|
2001
|
+
fillInTheGapsTextPage.steps.enterAnswerResponsesInPreviewTab(['Incorrect Answer', 'Incorrect Answer'])
|
2002
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2003
|
+
.click();
|
2004
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionCrossmarkIcon(0)
|
2005
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionCrossmarkIcon(1)
|
2006
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2007
|
+
.should('be.enabled');
|
2008
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
|
2009
|
+
fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder()
|
2010
|
+
cy.log('As the user is able to check answer multiple times, verifying state of \'Check Answer\' to be enabled by adding another response')
|
2011
|
+
fillInTheGapsTextPage.steps.enterAnswerResponsesInPreviewTab(['Response 1', 'Response 2'])
|
2012
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2013
|
+
.click();
|
2014
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct')
|
2015
|
+
fillInTheGapsTextPage.steps.verifyCorrectAttemptBorder()
|
2016
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2017
|
+
.should('be.enabled');
|
2018
|
+
});
|
2019
|
+
|
2020
|
+
it('When the \'Maximum check answer attempts\' input field is empty and user switches to Preview tab, then the \'Check Answer\' button should be enabled and user should be able to check answer multiple times', () => {
|
2021
|
+
cy.log('Pre step: Switching to Edit tab')
|
2022
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
2023
|
+
fillInTheGapsTextPage.maximumCheckAnswerAttemptsInputField()
|
2024
|
+
.clear()
|
2025
|
+
.should('have.value', '');
|
2026
|
+
cy.log('Switching to Preview tab');
|
2027
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
2028
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2029
|
+
.should('be.enabled');
|
2030
|
+
cy.log('Clicking on \'Check Answer\' to check state of \'Check Answer\' to be enabled')
|
2031
|
+
fillInTheGapsTextPage.steps.enterAnswerResponsesInPreviewTab(['Incorrect Answer', 'Incorrect Answer'])
|
2032
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2033
|
+
.click();
|
2034
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionCrossmarkIcon(0)
|
2035
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionCrossmarkIcon(1)
|
2036
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2037
|
+
.should('be.enabled');
|
2038
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
|
2039
|
+
fillInTheGapsTextPage.steps.verifyIncorrectAttemptBorder()
|
2040
|
+
cy.log('As the user is able to check answer multiple times, verifying state of \'Check Answer\' to be enabled by adding another response')
|
2041
|
+
fillInTheGapsTextPage.steps.enterAnswerResponsesInPreviewTab(['Response 1', 'Response 2'])
|
2042
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2043
|
+
.click();
|
2044
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct')
|
2045
|
+
fillInTheGapsTextPage.steps.verifyCorrectAttemptBorder()
|
2046
|
+
fillInTheGapsTextPage.checkAnswerButton()
|
2047
|
+
.should('be.enabled');
|
2048
|
+
});
|
2049
|
+
});
|
2050
|
+
|
2051
|
+
describe('Additional Settings: Details section', () => {
|
2052
|
+
abortEarlySetup();
|
2053
|
+
before(() => {
|
2054
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
2055
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
2056
|
+
});
|
2057
|
+
|
2058
|
+
fillInTheGapsTextPage.tests.verifyDetailsSection();
|
2059
|
+
});
|
2060
|
+
});
|