itemengine-cypress-automation 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,336 @@
1
+ import { shortTextResponsePage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ describe('Short text response - Additional settings', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Additional Settings accordion', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
14
+ });
15
+
16
+ shortTextResponsePage.tests.verifyAdditonalSettingsAccordionProperties();
17
+ });
18
+
19
+ describe('Additional Settings: Font Size dropdown', () => {
20
+ abortEarlySetup();
21
+ before(() => {
22
+ cy.log('Navigating to multiple selection quetion type, adding question instructions and options, alloting points and expanding additional settings accordion')
23
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
24
+ shortTextResponsePage.questionInstructionsInputField()
25
+ .type('Question Instructions');
26
+ shortTextResponsePage.pointsInputField()
27
+ .type('4');
28
+ shortTextResponsePage.setCorrectAnswerResponseField()
29
+ .type('Answer input');
30
+ shortTextResponsePage.steps.expandAdditonalSettings();
31
+ });
32
+
33
+ shortTextResponsePage.tests.verifyFontSizeSectionContents();
34
+
35
+ //Failing due to https://redmine.zeuslearning.com/issues/526873
36
+ const fontsizes = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
37
+ const font = ['16px', '12px', '14px', '17px', '20px', '24px'];
38
+ fontsizes.forEach((option, count) => {
39
+ 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`, () => {
40
+ shortTextResponsePage.fontSizeDropdown()
41
+ .click();
42
+ shortTextResponsePage.fontSizeListOptions(count)
43
+ .click();
44
+ shortTextResponsePage.fontSizeDropdown()
45
+ .verifyInnerText(`${option}`);
46
+ cy.log('Checking correct answer section font size')
47
+ shortTextResponsePage.setCorrectAnswerResponseField()
48
+ .should('have.css', 'font-size', font[count]);
49
+ cy.log('Switching to Preview tab')
50
+ shortTextResponsePage.steps.switchToPreviewTab();
51
+ cy.log('Checking Preview section font size')
52
+ shortTextResponsePage.questionInstructionsText()
53
+ .should('have.css', 'font-size', font[count]);
54
+ shortTextResponsePage.previewTabResponseField()
55
+ .should('have.css', 'font-size', font[count]);
56
+ shortTextResponsePage.steps.switchToEditTab();
57
+ });
58
+ });
59
+ });
60
+
61
+ describe('Additional Settings: Spell check section', () => {
62
+ abortEarlySetup();
63
+ before(() => {
64
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
65
+ shortTextResponsePage.steps.expandAdditonalSettings();
66
+ });
67
+
68
+ it('\'Spell check\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
69
+ shortTextResponsePage.spellCheckLabel()
70
+ .verifyInnerText('Spell check');
71
+ shortTextResponsePage.spellCheckCheckbox()
72
+ .should('not.be.checked');
73
+ });
74
+
75
+ it('CSS of \'Spell check\' section - unchecked state', { tags: 'css' }, () => {
76
+ shortTextResponsePage.spellCheckCheckbox()
77
+ .parent()
78
+ .find('svg')
79
+ .should('have.css', 'fill', css.color.uncheckedCheckbox);
80
+ });
81
+
82
+ //Note: a11y covered in Additional settings accordion, verifyAdditonalSettingsAccordionProperties
83
+
84
+ //Spell check test cases for set correct answer section response field
85
+ it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in set correct answer section', () => {
86
+ shortTextResponsePage.setCorrectAnswerResponseFieldWrapper()
87
+ .should('have.attr', 'spellcheck', 'false');
88
+ });
89
+
90
+ it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in set correct answer section', () => {
91
+ shortTextResponsePage.spellCheckCheckbox()
92
+ .click()
93
+ .should('be.checked');
94
+ shortTextResponsePage.setCorrectAnswerResponseFieldWrapper()
95
+ .should('have.attr', 'spellcheck', 'true');
96
+ });
97
+
98
+ it('CSS of \'Spell check\' section - checked state', { tags: 'css' }, () => {
99
+ shortTextResponsePage.spellCheckLabel()
100
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
101
+ shortTextResponsePage.spellCheckCheckbox()
102
+ .parent('.icon-checkbox-selected')
103
+ .find('.checkbox-icon-border-rect')
104
+ .should('have.css', 'fill', css.color.activeButtons);
105
+ });
106
+
107
+ it('Accessibility of \'Spell check\' section - checked state', { tags: 'a11y' }, () => {
108
+ cy.checkAccessibility(shortTextResponsePage.spellCheckLabel().parents('.spell-check-checkbox-wrapper'))
109
+ });
110
+
111
+ //Spell check test cases for preview tab response field
112
+ it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in preview tab', () => {
113
+ shortTextResponsePage.spellCheckCheckbox()
114
+ .click()
115
+ .should('not.be.checked');
116
+ shortTextResponsePage.steps.switchToPreviewTab();
117
+ shortTextResponsePage.previewTabResponseFieldWrapper()
118
+ .should('have.attr', 'spellcheck', 'false');
119
+ });
120
+
121
+ it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in the preview tab', () => {
122
+ cy.log('Pre step: Switching to Edit tab')
123
+ shortTextResponsePage.steps.switchToEditTab();
124
+ shortTextResponsePage.spellCheckCheckbox()
125
+ .click()
126
+ .should('be.checked');
127
+ shortTextResponsePage.steps.switchToPreviewTab();
128
+ shortTextResponsePage.previewTabResponseFieldWrapper()
129
+ .should('have.attr', 'spellcheck', 'true');
130
+ });
131
+ });
132
+
133
+ describe('Additional Settings: Check Answer', () => {
134
+ abortEarlySetup();
135
+ before(() => {
136
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
137
+ shortTextResponsePage.questionInstructionsInputField()
138
+ .type('Question Instructions');
139
+ shortTextResponsePage.pointsInputField()
140
+ .type('4');
141
+ shortTextResponsePage.setCorrectAnswerResponseField()
142
+ .type('Answer input');
143
+ shortTextResponsePage.steps.expandAdditonalSettings();
144
+ });
145
+
146
+ shortTextResponsePage.tests.verifyCheckAnswerSectionAndPreviewTabCheckAnswerButton();
147
+ });
148
+
149
+ describe('Additional Settings: Check Answer - Functionality', () => {
150
+ abortEarlySetup();
151
+ before(() => {
152
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
153
+ shortTextResponsePage.questionInstructionsInputField()
154
+ .type('Question Instructions');
155
+ shortTextResponsePage.pointsInputField()
156
+ .type('4');
157
+ shortTextResponsePage.setCorrectAnswerResponseField()
158
+ .type('Response')
159
+ .should('have.value', 'Response');
160
+ shortTextResponsePage.steps.expandAdditonalSettings();
161
+ shortTextResponsePage.steps.setMaximumCheckAnswerAttempts(2);
162
+ shortTextResponsePage.steps.switchToPreviewTab();
163
+ });
164
+
165
+ it('When the user has not set any response then on clicking on the Check Answer button, icons should not be displayed beside both empty response, Correct/Incorrect label or border should not be displayed and \'Correct answer\' container should not be displayed below the question', () => {
166
+ shortTextResponsePage.previewTabResponseField()
167
+ .should('have.value', '');
168
+ shortTextResponsePage.checkAnswerButton()
169
+ .click();
170
+ shortTextResponsePage.correctIcon()
171
+ .should('not.exist');
172
+ shortTextResponsePage.incorrectIcon()
173
+ .should('not.exist');
174
+ shortTextResponsePage.correctIncorectAnswerLabel()
175
+ .should('not.exist');
176
+ shortTextResponsePage.correctIncorrectAnswerBorder()
177
+ .should('not.exist');
178
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
179
+ .should('not.exist');
180
+ });
181
+
182
+ it('When the user has added correct response then on clicking on the Check Answer button, green checkmark icon should be displayed, Correct/Incorrect label or border should not be displayed and \'Correct answer\' container should not be displayed below the question', () => {
183
+ shortTextResponsePage.previewTabResponseField()
184
+ .clear()
185
+ .type('Response')
186
+ .should('have.value', 'Response');
187
+ shortTextResponsePage.checkAnswerButton()
188
+ .click();
189
+ shortTextResponsePage.steps.verifyCorrectOptionCheckmarkIcon()
190
+ shortTextResponsePage.correctIncorectAnswerLabel()
191
+ .should('not.exist');
192
+ shortTextResponsePage.correctIncorrectAnswerBorder()
193
+ .should('not.exist');
194
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
195
+ .should('not.exist');
196
+ });
197
+
198
+ it('When the user has added incorrect response then on clicking on the Check Answer button, red crossmark icon should be displayed, Incorrect label or border should not be displayed and \'Correct answer\' container should not be displayed below the question', () => {
199
+ shortTextResponsePage.previewTabResponseField()
200
+ .clear()
201
+ .type('Incorrect Response')
202
+ .should('have.value', 'Incorrect Response');
203
+ shortTextResponsePage.checkAnswerButton()
204
+ .click();
205
+ shortTextResponsePage.steps.verifyIncorrectOptionCrossmarkIcon()
206
+ shortTextResponsePage.correctIncorectAnswerLabel()
207
+ .should('not.exist');
208
+ shortTextResponsePage.correctIncorrectAnswerBorder()
209
+ .should('not.exist');
210
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
211
+ .should('not.exist');
212
+ });
213
+
214
+ it('The \'Check Answer\' button should become disabled once user has reached maximum check answer attempts', () => {
215
+ shortTextResponsePage.checkAnswerButton()
216
+ .should('be.disabled');
217
+ });
218
+
219
+ it('CSS of disabled \'Check Answer\' button', { tags: 'css' }, () => {
220
+ shortTextResponsePage.checkAnswerButton()
221
+ .verifyCSS(css.color.primaryBtnDisabled, css.fontSize.default, css.fontWeight.regular);
222
+ });
223
+
224
+ it('Accessibility of disabled Check Answer button', { tags: 'a11y' }, () => {
225
+ cy.checkAccessibility(shortTextResponsePage.checkAnswerButton());
226
+ });
227
+
228
+ it('When the user updates the value of Maximum check answer attempts input field, it should get reflected on the Preview tab', () => {
229
+ cy.log('Pre step: Switching to Edit tab')
230
+ shortTextResponsePage.steps.switchToEditTab();
231
+ shortTextResponsePage.maximumCheckAnswerAttemptsInputField()
232
+ .clear()
233
+ .type(1)
234
+ .should('have.value', '1');
235
+ cy.log('Switching to Preview tab');
236
+ shortTextResponsePage.steps.switchToPreviewTab();
237
+ shortTextResponsePage.checkAnswerButton()
238
+ .should('be.enabled');
239
+ shortTextResponsePage.previewTabResponseField()
240
+ .type('Response');
241
+ shortTextResponsePage.checkAnswerButton()
242
+ .click()
243
+ .should('be.disabled');
244
+ });
245
+
246
+ 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', () => {
247
+ shortTextResponsePage.steps.switchToEditTab();
248
+ shortTextResponsePage.steps.clearMaximumCheckAnswerAttemptsInputField();
249
+ shortTextResponsePage.steps.addInputToMaximumCheckAnswerAttemptsInputField(0);
250
+ cy.log('Switching to Preview tab');
251
+ shortTextResponsePage.steps.switchToPreviewTab();
252
+ shortTextResponsePage.checkAnswerButton()
253
+ .should('be.enabled');
254
+ shortTextResponsePage.previewTabResponseField()
255
+ .type('Incorrect Response');
256
+ cy.log('Clicking on \'Check Answer\' to check state of \'Check Answer\' to be enabled')
257
+ shortTextResponsePage.checkAnswerButton()
258
+ .click();
259
+ shortTextResponsePage.checkAnswerButton()
260
+ .should('be.enabled');
261
+ shortTextResponsePage.steps.verifyIncorrectOptionCrossmarkIcon();
262
+ shortTextResponsePage.correctIncorectAnswerLabel()
263
+ .should('not.exist');
264
+ shortTextResponsePage.correctIncorrectAnswerBorder()
265
+ .should('not.exist');
266
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
267
+ .should('not.exist');
268
+ cy.log('As the user is able to check answer multiple times, verifying state of \'Check Answer\' to be enabled by adding different response and checking answer again')
269
+ shortTextResponsePage.previewTabResponseField()
270
+ .clear()
271
+ .type('Response');
272
+ shortTextResponsePage.checkAnswerButton()
273
+ .click();
274
+ shortTextResponsePage.steps.verifyCorrectOptionCheckmarkIcon();
275
+ shortTextResponsePage.correctIncorectAnswerLabel()
276
+ .should('not.exist');
277
+ shortTextResponsePage.correctIncorrectAnswerBorder()
278
+ .should('not.exist');
279
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
280
+ .should('not.exist');
281
+ shortTextResponsePage.checkAnswerButton()
282
+ .should('be.enabled');
283
+ });
284
+
285
+ 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', () => {
286
+ cy.log('Pre step: Switching to Edit tab')
287
+ shortTextResponsePage.steps.switchToEditTab();
288
+ shortTextResponsePage.maximumCheckAnswerAttemptsInputField()
289
+ .clear()
290
+ .should('have.value', '');
291
+ cy.log('Switching to Preview tab');
292
+ shortTextResponsePage.steps.switchToPreviewTab();
293
+ shortTextResponsePage.checkAnswerButton()
294
+ .should('be.enabled');
295
+ shortTextResponsePage.previewTabResponseField()
296
+ .type('Incorrect Response');
297
+ cy.log('Clicking on \'Check Answer\' to check state of \'Check Answer\' to be enabled')
298
+ shortTextResponsePage.checkAnswerButton()
299
+ .click();
300
+ shortTextResponsePage.checkAnswerButton()
301
+ .should('be.enabled');
302
+ shortTextResponsePage.steps.verifyIncorrectOptionCrossmarkIcon();
303
+ shortTextResponsePage.correctIncorectAnswerLabel()
304
+ .should('not.exist');
305
+ shortTextResponsePage.correctIncorrectAnswerBorder()
306
+ .should('not.exist');
307
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
308
+ .should('not.exist');
309
+ cy.log('As the user is able to check answer multiple times, verifying state of \'Check Answer\' to be enabled by adding different response and checking answer again')
310
+ shortTextResponsePage.previewTabResponseField()
311
+ .clear()
312
+ .type('Response');
313
+ shortTextResponsePage.checkAnswerButton()
314
+ .click();
315
+ shortTextResponsePage.steps.verifyCorrectOptionCheckmarkIcon();
316
+ shortTextResponsePage.correctIncorectAnswerLabel()
317
+ .should('not.exist');
318
+ shortTextResponsePage.correctIncorrectAnswerBorder()
319
+ .should('not.exist');
320
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
321
+ .should('not.exist');
322
+ shortTextResponsePage.checkAnswerButton()
323
+ .should('be.enabled');
324
+ });
325
+ });
326
+
327
+ describe('Additional Settings: Details section', () => {
328
+ abortEarlySetup();
329
+ before(() => {
330
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
331
+ shortTextResponsePage.steps.expandAdditonalSettings();
332
+ });
333
+
334
+ shortTextResponsePage.tests.verifyDetailsSection();
335
+ });
336
+ });
@@ -0,0 +1,154 @@
1
+ import { shortTextResponsePage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ describe('Create item page - Short text response: \'Case sensitive\' and \'Ignore spaces before and after\'', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('User can select different property (Exact or Contains text) across multiple set answer tabs (Correct answer tab and Alternate answer tabs)', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ cy.log('Navigating to Short text response question type, giving input to question instruction input field, points input field and response input field, checking the allow students to check answer checkbox and switching to preview tab');
14
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
15
+ shortTextResponsePage.questionInstructionsInputField()
16
+ .type('Question Instructions');
17
+ cy.log('Setting \'Exact\' property to the Correct tab and \'Contains text\' property to the \'Alternate 1\' tab');
18
+ shortTextResponsePage.pointsInputField()
19
+ .type('2');
20
+ shortTextResponsePage.setCorrectAnswerResponseField()
21
+ .type('Lorem ipsum');
22
+ cy.log('Adding an alternate correct answer set with more points value');
23
+ shortTextResponsePage.steps.addAlternateTab(1);
24
+ shortTextResponsePage.pointsInputField()
25
+ .type('4');
26
+ shortTextResponsePage.setCorrectAnswerResponseField()
27
+ .type('Answer input');
28
+ shortTextResponsePage.containsTextRadioButton()
29
+ .click();
30
+ shortTextResponsePage.steps.expandAdditonalSettings();
31
+ shortTextResponsePage.allowStudentsToCheckAnswerCheckbox()
32
+ .click();
33
+ shortTextResponsePage.steps.switchToPreviewTab();
34
+ });
35
+
36
+ it('When user gives an answer that is exactly same as the set correct answer text of \'Correct\' tab in the answer input field, then full score as per the points set for that tab should be displayed and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
37
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Lorem ipsum', '2/4', true);
38
+ });
39
+
40
+ it('When user gives an answer that contains the set correct answer text of \'Correct\' tab in the answer but not exact, then the score should be displayed as 0 points and when user clicks on \'Check answer\' button, a red cross mark should be displayed beside the answer', () => {
41
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Lorem ipsum dolor', '0/4', false);
42
+ });
43
+
44
+ it('When user gives an answer that contains the set correct answer text of \'Alternate 1\' tab in the answer input field but not exact, then full score should be displayed and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
45
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('this is an Answer input', '4/4', true);
46
+ });
47
+
48
+ it('When user gives an answer that does not contain the set correct answer text of \'Alternate 1\' tab in the answer input field, then the score should be displayed as 0 points and when user clicks on \'Check answer\' button, a red cross mark should be displayed beside the answer', () => {
49
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Answerinput', '0/4', false);
50
+ });
51
+ });
52
+
53
+ describe('\'Case sensitive\' property should be applied globally to all the set correct answer tabs (Correct answer tab and Alternate answer tabs)', () => {
54
+ abortEarlySetup();
55
+ before(() => {
56
+ cy.log('Navigating to Short text response question type, giving input to question instruction input field, points input field and response input field, checking the allow students to check answer checkbox and switching to preview tab');
57
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
58
+ shortTextResponsePage.questionInstructionsInputField()
59
+ .type('Question Instructions');
60
+ cy.log('Setting \'Exact\' property to the Correct tab and \'Contains text\' property to the \'Alternate 1\' tab');
61
+ shortTextResponsePage.pointsInputField()
62
+ .type('2');
63
+ shortTextResponsePage.setCorrectAnswerResponseField()
64
+ .type('Lorem ipsum');
65
+ cy.log('Adding an alternate correct answer set with more points value');
66
+ shortTextResponsePage.steps.addAlternateTab(1);
67
+ shortTextResponsePage.pointsInputField()
68
+ .type('4');
69
+ shortTextResponsePage.setCorrectAnswerResponseField()
70
+ .type('Answer input');
71
+ shortTextResponsePage.containsTextRadioButton()
72
+ .click();
73
+ shortTextResponsePage.steps.expandAdditonalSettings();
74
+ shortTextResponsePage.allowStudentsToCheckAnswerCheckbox()
75
+ .click();
76
+ shortTextResponsePage.steps.switchToPreviewTab();
77
+ });
78
+
79
+ it('\'Case sensitive\' property unchecked : When the user enters correct answer with identical casing, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
80
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Lorem ipsum', '2/4', true);
81
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Answer input', '4/4', true);
82
+ });
83
+
84
+ it('\'Case sensitive\' property unchecked : When the user enters correct answer with incorrect casing, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
85
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('lorem ipsum', '2/4', true);
86
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('answer input', '4/4', true);
87
+ });
88
+
89
+ it('\'Case sensitive\' property checked : When the user enters correct answer with identical casing, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
90
+ cy.log('Pre -step : Go to Edit tab, check \'Case sensitive\' checkbox and switch back to Preview tab');
91
+ shortTextResponsePage.steps.switchToEditTab();
92
+ shortTextResponsePage.caseSensitiveCheckbox()
93
+ .click();
94
+ shortTextResponsePage.steps.switchToPreviewTab();
95
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Lorem ipsum', '2/4', true);
96
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Answer input', '4/4', true);
97
+ });
98
+
99
+ it('\'Case sensitive\' property checked : When the user enters correct answer with incorrect casing, then the score should be displayed as 0 points and when user clicks on \'Check answer\' button, a red cross mark should be displayed beside the answer', () => {
100
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('lorem ipsum', '0/4', false);
101
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('answer input', '0/4', false);
102
+ });
103
+ });
104
+
105
+ describe('\'Ignore spaces before and after\' property should be applied globally to all the set correct answer tabs (Correct answer tab and Alternate answer tabs)', () => {
106
+ abortEarlySetup();
107
+ before(() => {
108
+ cy.log('Navigating to Short text response question type, giving input to question instruction input field, points input field and response input field, checking the allow students to check answer checkbox and switching to preview tab');
109
+ shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
110
+ shortTextResponsePage.questionInstructionsInputField()
111
+ .type('Question Instructions');
112
+ cy.log('Setting \'Exact\' property in both tabs as \'Contains text\' property by default functions like \'Ignore spaces before and after\' property');
113
+ shortTextResponsePage.pointsInputField()
114
+ .type('2');
115
+ shortTextResponsePage.setCorrectAnswerResponseField()
116
+ .type('Lorem ipsum');
117
+ cy.log('Adding an alternate correct answer set with more points value');
118
+ shortTextResponsePage.steps.addAlternateTab(1);
119
+ shortTextResponsePage.pointsInputField()
120
+ .type('4');
121
+ shortTextResponsePage.setCorrectAnswerResponseField()
122
+ .type('Answer input');
123
+ shortTextResponsePage.steps.expandAdditonalSettings();
124
+ shortTextResponsePage.allowStudentsToCheckAnswerCheckbox()
125
+ .click();
126
+ shortTextResponsePage.steps.switchToPreviewTab();
127
+ });
128
+
129
+ it('\'Ignore spaces before and after\' property checked : When the user enters correct answer with extra spaces before and after, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
130
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel(' Lorem ipsum ', '2/4', true);
131
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel(' Answer input ', '4/4', true);
132
+ });
133
+
134
+ it('\'Ignore spaces before and after\' property checked : When the user enters correct answer without extra spaces before and after, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
135
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Lorem ipsum', '2/4', true);
136
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Answer input', '4/4', true);
137
+ });
138
+
139
+ it('\'Ignore spaces before and after\' property unchecked : When the user enters correct answer with extra spaces before and after, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
140
+ cy.log('Pre - step : Go to Edit tab, uncheck \'Ignore spaces before and after\' checkbox and switch back to Preview tab');
141
+ shortTextResponsePage.steps.switchToEditTab();
142
+ shortTextResponsePage.ignoreSpacesBeforeAndAfterCheckbox()
143
+ .click();
144
+ shortTextResponsePage.steps.switchToPreviewTab();
145
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel(' Lorem ipsum ', '0/4', false);
146
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel(' Answer input ', '0/4', false);
147
+ });
148
+
149
+ it('\'Ignore spaces before and after property\' unchecked : When the user enters correct answer without extra spaces before and after, appropriate points should be given for both the correct answer and alternate answer tab responses and when user clicks on \'Check answer\' button, a green check mark should be displayed beside the answer', () => {
150
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Lorem ipsum', '2/4', true);
151
+ shortTextResponsePage.tests.verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel('Answer input', '4/4', true);
152
+ });
153
+ });
154
+ });