itemengine-cypress-automation 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (16) hide show
  1. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAdditionalSettingsBasic.js +235 -0
  2. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoring.js +205 -0
  3. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoringWithAlternateAnswer.js +472 -0
  4. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabBasicSection.js +589 -0
  5. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabScoringSection.js +282 -0
  6. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridHeaderSection.js +97 -0
  7. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridManuallyAndNonScored.js +146 -0
  8. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridOptionsAdditionalSettings.js +345 -0
  9. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeights.js +188 -0
  10. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeightsWithAlternateAnswer.js +662 -0
  11. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeights.js +190 -0
  12. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeightsWIthAlternateAnswer.js +595 -0
  13. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridQuestionStemAdditionalSettings.js +258 -0
  14. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridRandomizeOptions.js +122 -0
  15. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridSetCorrectAnswerSection.js +183 -0
  16. package/package.json +1 -1
@@ -0,0 +1,258 @@
1
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ const options = ['Fully agree as true', 'Fully agree as false'];
7
+
8
+ const gridStyleDropdownOptions = ['With border', 'Row dividers', 'No border', 'Inline', 'Inline - row dividers'];
9
+ const questionStemNumerationOptions = ['None', 'Numerical', 'Uppercase alphabet', 'Lowercase alphabet'];
10
+ const numbers = ['1', '2', '3', '4'];
11
+ const lowercase = ['a', 'b', 'c', 'd'];
12
+ const uppercase = ['A', 'B', 'C', 'D'];
13
+
14
+ describe('Create Item page - Single Selection Grid: Additional settings', () => {
15
+ before(() => {
16
+ cy.loginAs('admin');
17
+ });
18
+
19
+ describe('Additional settings: Student response area and layout', () => {
20
+ abortEarlySetup();
21
+ before(() => {
22
+ cy.log('Navigating to Single selection grid question type');
23
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
24
+ singleSelectionGridPage.steps.expandAdditonalSettings();
25
+ });
26
+
27
+ singleSelectionGridPage.tests.verifyStudentResponseAreaAndLayoutLabelAndCSS();
28
+ });
29
+
30
+ describe('Additional settings: Question stem numeration contents', () => {
31
+ abortEarlySetup();
32
+ before(() => {
33
+ cy.log('Navigating to Single selection grid question type');
34
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
35
+ singleSelectionGridPage.steps.expandAdditonalSettings();
36
+ });
37
+
38
+ it(`\'Question stem numeration\' label and dropdown should be displayed and by default, ${questionStemNumerationOptions[0]} option should be selected in the dropdown`, () => {
39
+ singleSelectionGridPage.questionStemNumerationLabel()
40
+ .verifyInnerText('Question stem numeration')
41
+ .should('be.visible');
42
+ singleSelectionGridPage.questionStemNumerationDropdown()
43
+ .verifyInnerText('None')
44
+ .should('exist');
45
+ });
46
+
47
+ it('CSS of Question stem numeration section', { tags: 'css' }, () => {
48
+ singleSelectionGridPage.questionStemNumerationLabel()
49
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
50
+ singleSelectionGridPage.questionStemNumerationDropdown()
51
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
52
+ });
53
+
54
+ it(`When user clicks on the Question stem numeration dropdown a list of 4 options - ${questionStemNumerationOptions} should be displayed`, () => {
55
+ singleSelectionGridPage.steps.expandQuestionStemNumerationDropdown();
56
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationDropdownOptions(questionStemNumerationOptions);
57
+ });
58
+
59
+ it('CSS of Question stem numeration dropdown in active state', { tags: 'css' }, () => {
60
+ singleSelectionGridPage.questionStemNumerationDropdownOptions()
61
+ .eq(0)
62
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
63
+ .should('have.css', 'background-color', css.color.liTextSelectedBg);
64
+ singleSelectionGridPage.questionStemNumerationDropdownOptions()
65
+ .eq(1)
66
+ .should('have.css', 'background-color', css.color.transparent);
67
+ });
68
+
69
+ it('Accessbility of Question stem numeration dropdown in active state', { tags: 'a11y' }, () => {
70
+ it('Accessbility of Grid style dropdown in active state', { tags: 'a11y' }, () => {
71
+ cy.checkAccessibility(singleSelectionGridPage.dropdownList());
72
+ });
73
+ });
74
+ });
75
+
76
+ describe('Additional settings: Question stem numeration set correct answer section', () => {
77
+ abortEarlySetup();
78
+ before(() => {
79
+ cy.log('Navigating to Single selection grid question type');
80
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
81
+ singleSelectionGridPage.steps.addQuestionInstructions();
82
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
83
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
84
+ singleSelectionGridPage.steps.allotPoints(10);
85
+ singleSelectionGridPage.steps.expandAdditonalSettings();
86
+ });
87
+
88
+ it(`When the user selects ${questionStemNumerationOptions[0]} option from the Option stem numeration dropdown, then numeration should not be displayed in the Set correct answer table`, () => {
89
+ singleSelectionGridPage.questionStemNumerationDropdown()
90
+ .verifyInnerText(`${questionStemNumerationOptions[0]}`);
91
+ singleSelectionGridPage.questionStemNumeration()
92
+ .should('not.exist');
93
+ });
94
+
95
+ it(`When the user selects ${questionStemNumerationOptions[1]} option from the Option stem numeration dropdown, then numbers should be displayed in the Set correct answer table`, () => {
96
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption(`${questionStemNumerationOptions[1]}`);
97
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInSetCorrectAnswerTable(numbers);
98
+ });
99
+
100
+ it(`When the user selects ${questionStemNumerationOptions[2]} option from the Option stem numeration dropdown, then uppercase alphabets should be displayed in the Set correct answer table`, () => {
101
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption(`${questionStemNumerationOptions[2]}`);
102
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInSetCorrectAnswerTable(uppercase);
103
+ });
104
+
105
+ it(`When the user selects ${questionStemNumerationOptions[3]} option from the Option stem numeration dropdown, then lowercase alphabets should be displayed in the Set correct answer table`, () => {
106
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption(`${questionStemNumerationOptions[3]}`);
107
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInSetCorrectAnswerTable(lowercase);
108
+ });
109
+
110
+ it('CSS for question stem numeration', { tags: 'css' }, () => {
111
+ singleSelectionGridPage.questionStemNumeration()
112
+ .eq(0)
113
+ .verifyCSS(css.color.activeButtons, css.fontSize.default, css.fontWeight.regular)
114
+ .should('have.css', 'background-color', css.color.optionNumerationBg);
115
+ });
116
+
117
+ it('Accessibility of question stem numeration', () => {
118
+ cy.checkAccessibility(singleSelectionGridPage.questionStemNumeration().eq(0).parents('.stem-numeration-present'));
119
+ });
120
+ });
121
+
122
+ describe('Additional settings: Question stem numeration preview tab section', () => {
123
+ abortEarlySetup();
124
+ before(() => {
125
+ cy.log('Navigating to Single selection grid question type');
126
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
127
+ singleSelectionGridPage.steps.addQuestionInstructions();
128
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
129
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
130
+ singleSelectionGridPage.steps.allotPoints(10);
131
+ singleSelectionGridPage.steps.expandAdditonalSettings();
132
+ });
133
+
134
+ it(`When the user selects ${questionStemNumerationOptions[0]} option from the Option stem numeration dropdown, then numeration should not be displayed in the preview tab answer table`, () => {
135
+ singleSelectionGridPage.questionStemNumerationDropdown()
136
+ .verifyInnerText(`${questionStemNumerationOptions[0]}`);
137
+ singleSelectionGridPage.steps.switchToPreviewTab();
138
+ singleSelectionGridPage.previewTabQuestionStemNumeration()
139
+ .should('not.exist');
140
+ });
141
+
142
+ it(`When the user selects ${questionStemNumerationOptions[1]} option from the Option stem numeration dropdown, then numbers should be displayed in the preview tab answer table`, () => {
143
+ singleSelectionGridPage.steps.switchToEditTab();
144
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption(`${questionStemNumerationOptions[1]}`);
145
+ singleSelectionGridPage.steps.switchToPreviewTab();
146
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInPreviewTabAnswerTable(numbers);
147
+ });
148
+
149
+ it(`When the user selects ${questionStemNumerationOptions[2]} option from the Option stem numeration dropdown, then uppercase alphabets should be displayed in the preview tab answer table`, () => {
150
+ singleSelectionGridPage.steps.switchToEditTab();
151
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption(`${questionStemNumerationOptions[2]}`);
152
+ singleSelectionGridPage.steps.switchToPreviewTab();
153
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInPreviewTabAnswerTable(uppercase);
154
+ });
155
+
156
+ it(`When the user selects ${questionStemNumerationOptions[3]} option from the Option stem numeration dropdown, then lowercase alphabets should be displayed in the preview tab answer table`, () => {
157
+ singleSelectionGridPage.steps.switchToEditTab()
158
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption(`${questionStemNumerationOptions[3]}`);
159
+ singleSelectionGridPage.steps.switchToPreviewTab();
160
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInPreviewTabAnswerTable(lowercase);
161
+ });
162
+
163
+ it('When user selects \'Randomize options\' the numeration should be displayed in ascending order in the preview tab answer table', () => {
164
+ singleSelectionGridPage.steps.switchToEditTab();
165
+ singleSelectionGridPage.steps.selectRandomizeOptionsCheckbox();
166
+ singleSelectionGridPage.steps.switchToPreviewTab();
167
+ singleSelectionGridPage.steps.verifyQuestionStemNumerationInPreviewTabAnswerTable(lowercase);
168
+ });
169
+
170
+ it('CSS for option numeration', { tags: 'css' }, () => {
171
+ singleSelectionGridPage.previewTabQuestionStemNumeration()
172
+ .eq(0)
173
+ .verifyCSS(css.color.activeButtons, css.fontSize.default, css.fontWeight.regular)
174
+ .should('have.css', 'background-color', css.color.optionNumerationBg);
175
+ });
176
+
177
+ it('Accessibility of question stem numeration', () => {
178
+ cy.checkAccessibility(singleSelectionGridPage.previewTabQuestionStemNumeration().eq(0).parents('.stem-numeration-present'));
179
+ });
180
+ });
181
+
182
+ describe('Additional settings: Title for question stems contents', () => {
183
+ abortEarlySetup();
184
+ before(() => {
185
+ cy.log('Navigating to Single selection grid question type');
186
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
187
+ singleSelectionGridPage.steps.expandAdditonalSettings();
188
+ });
189
+
190
+ it('\'Title for question stems\' label and input field should be displayed and by default, the input field should be prefilled with \'Question stem\'', () => {
191
+ singleSelectionGridPage.titleForQuestionStemsLabel()
192
+ .verifyInnerText('Title for question stems')
193
+ .should('be.visible');
194
+ singleSelectionGridPage.titleForQuestionStemInputField()
195
+ .verifyInnerText('Question stem')
196
+ });
197
+
198
+ it('CSS of Title for question stems label and input field', { tags: 'css' }, () => {
199
+ singleSelectionGridPage.titleForQuestionStemsLabel()
200
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
201
+ singleSelectionGridPage.titleForQuestionStemInputField()
202
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.reular);
203
+ });
204
+
205
+ //Note: a11y covered in verifyAdditonalSettingsAccordionProperties
206
+ });
207
+
208
+ describe('Additional settings: Title for question stems set correct answer section', () => {
209
+ abortEarlySetup();
210
+ before(() => {
211
+ cy.log('Navigating to Single selection grid question type');
212
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
213
+ singleSelectionGridPage.steps.addQuestionInstructions();
214
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
215
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
216
+ singleSelectionGridPage.steps.allotPoints(10);
217
+ singleSelectionGridPage.steps.expandAdditonalSettings();
218
+ });
219
+
220
+ it('By default, Question stem should be displayed as the question stem title in the set correct answer table', () => {
221
+ singleSelectionGridPage.setCorrectAnswerTableQuestionStemTitle()
222
+ .verifyInnerText('Question stem');
223
+ });
224
+
225
+ it('When user enters any text in the Title for question stems then that title should be displayed the set correct answer table', () => {
226
+ singleSelectionGridPage.steps.addInputToTitleForQuestionStemInputField('Causes of Pollution');
227
+ singleSelectionGridPage.setCorrectAnswerTableQuestionStemTitle()
228
+ .verifyInnerText('Causes of Pollution');
229
+ });
230
+ });
231
+
232
+ describe('Additional settings: Title for question stems preview tab section', () => {
233
+ abortEarlySetup();
234
+ before(() => {
235
+ cy.log('Navigating to Single selection grid question type');
236
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
237
+ singleSelectionGridPage.steps.addQuestionInstructions();
238
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
239
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
240
+ singleSelectionGridPage.steps.allotPoints(10);
241
+ singleSelectionGridPage.steps.expandAdditonalSettings();
242
+ singleSelectionGridPage.steps.switchToPreviewTab();
243
+ });
244
+
245
+ it('By default, Question stem should be displayed as the question stem title in the preview tab answer table', () => {
246
+ singleSelectionGridPage.previewTabAnswerTableQuestionStemTitle()
247
+ .verifyInnerText('Question stem');
248
+ });
249
+
250
+ it('When user enters any text in the \'Title for question stems\' then that title should be displayed the preview tab answer table', () => {
251
+ singleSelectionGridPage.steps.switchToEditTab();
252
+ singleSelectionGridPage.steps.addInputToTitleForQuestionStemInputField('Causes of Pollution');
253
+ singleSelectionGridPage.steps.switchToPreviewTab();
254
+ singleSelectionGridPage.previewTabAnswerTableQuestionStemTitle()
255
+ .verifyInnerText('Causes of Pollution');
256
+ });
257
+ });
258
+ });
@@ -0,0 +1,122 @@
1
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ const options = ['Fully agree as true', 'Fully agree as false', 'Somewhat agree', 'Somewhat disagree'];
7
+
8
+ describe('Create Item page - Single Selection Grid: Randomize options functionality', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Randomize options - Functionality : Edit tab', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ cy.log('Navigating to Single selection grid question type');
17
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
18
+ cy.log('Adding question instructions, question stems, options, setting correct answer, adding points and switching to Preview tab');
19
+ singleSelectionGridPage.steps.addQuestionInstructions();
20
+ singleSelectionGridPage.steps.addOption();
21
+ singleSelectionGridPage.steps.addOption();
22
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
23
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
24
+ singleSelectionGridPage.steps.allotPoints(10);
25
+ });
26
+
27
+ it('\'Randomize options\' checkbox and label should be displayed and by default it should be unchecked', () => {
28
+ singleSelectionGridPage.randomizeOptionsCheckboxLabel()
29
+ .verifyInnerText('Randomize options')
30
+ .should('be.visible');
31
+ singleSelectionGridPage.steps.verifyRandomizeOptionsCheckboxUnchecked()
32
+ });
33
+
34
+ it('CSS of \'Randomize options\'', { tags: 'css' }, () => {
35
+ singleSelectionGridPage.randomizeOptionsCheckboxLabel()
36
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
37
+ });
38
+
39
+ it('Accessibility of \'Randomize options\'', { tags: 'a11y' }, () => {
40
+ cy.checkAccessibility(singleSelectionGridPage.randomizeOptionsCheckbox().parents('.randomize-checkbox-wrapper'))
41
+ });
42
+
43
+ it('When the \'Randomize options\' functionality is disabled, the question stems and options in the set correct answer table should be displayed in the order in which the user has set them in the \'Question stem\' and \'Options\' section', () => {
44
+ singleSelectionGridPage.steps.verifyRandomizeOptionsCheckboxUnchecked()
45
+ singleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStems);
46
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(options);
47
+ });
48
+
49
+ it('When the user enables the \'Randomize options\' functionality, then the question stems and options in the set correct answer table should be in the order in which the user has set them in the \'Question stem\' and \'Options\' section', () => {
50
+ singleSelectionGridPage.steps.selectRandomizeOptionsCheckbox()
51
+ singleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStems);
52
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(options);
53
+ });
54
+
55
+ it('CSS of \'Randomize options\' functionality - checked state', { tags: 'css' }, () => {
56
+ singleSelectionGridPage.randomizeOptionsCheckbox()
57
+ .parent('.icon-checkbox-selected')
58
+ .find('.checkbox-icon-border-rect')
59
+ .should('have.css', 'fill', css.color.activeButtons);
60
+ });
61
+
62
+ it('Accessibility of \'Randomize options\' functionality - checked state', { tags: 'a11y' }, () => {
63
+ cy.checkAccessibility(singleSelectionGridPage.randomizeOptionsCheckbox().parents('.randomize-checkbox-wrapper'))
64
+ });
65
+ });
66
+
67
+ describe('Randomize options - Functionality : Preview tab', () => {
68
+ let questionStemsArray = [];
69
+ abortEarlySetup();
70
+ before(() => {
71
+ cy.log('Navigating to Single selection grid question type');
72
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
73
+ cy.log('Adding question instructions, question stems, options, setting correct answer and adding points for Autoscored Partial equal weights scoring type and switching to Preview tab');
74
+ singleSelectionGridPage.steps.addQuestionInstructions();
75
+ singleSelectionGridPage.steps.addOption();
76
+ singleSelectionGridPage.steps.addOption();
77
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
78
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
79
+ singleSelectionGridPage.steps.allotPoints(10);
80
+ singleSelectionGridPage.steps.switchToPreviewTab();
81
+ });
82
+
83
+ it('When the \'Randomize options\' functionality is disabled, the question stems and options in the preview tab answer table should be displayed in the order in which the user has set them in the \'Question stem\' section', () => {
84
+ singleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStems);
85
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
86
+ });
87
+
88
+ it('When the user enables the \'Randomize options\' functionality, then question stems in the preview tab answer table should be displayed in a random order and the options should be displayed in the order in which the user has set them', () => {
89
+ singleSelectionGridPage.steps.switchToEditTab()
90
+ singleSelectionGridPage.steps.selectRandomizeOptionsCheckbox()
91
+ singleSelectionGridPage.steps.switchToPreviewTab();
92
+ singleSelectionGridPage.steps.verifyRandomizeQuestionStemsOrder(questionStems);
93
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
94
+ questionStemsArray = singleSelectionGridPage.steps.getQuestionStemsArray();
95
+ });
96
+
97
+ it('When the user switches to \'Edit tab\' and does not modify any question properties, then the order of the question stems and options should not change in the preview tab answer table', () => {
98
+ singleSelectionGridPage.steps.switchToEditTab();
99
+ singleSelectionGridPage.steps.switchToPreviewTab();
100
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
101
+ singleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStemsArray);
102
+ });
103
+
104
+ it('When the user switches to \'Edit tab\' and modifies any of question properties, then the order of the question stems should change and the options should be displayed in the order in which the user has set them in the preview tab answer table', () => {
105
+ singleSelectionGridPage.steps.switchToEditTab();
106
+ singleSelectionGridPage.steps.clearPointsField();
107
+ singleSelectionGridPage.steps.allotPoints(12);
108
+ singleSelectionGridPage.steps.switchToPreviewTab();
109
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
110
+ singleSelectionGridPage.steps.verifyRandomizeQuestionStemsOrder(questionStems);
111
+ singleSelectionGridPage.steps.verifyQuestionStemsAreRerandomized(questionStemsArray);
112
+ });
113
+
114
+ it('When the user disables the \'Randomize options\' functionality, then the question stems and options in the preview tab answer table should be displayed in the order in which the user has set them in the \'Question stem\' section', () => {
115
+ singleSelectionGridPage.steps.switchToEditTab()
116
+ singleSelectionGridPage.steps.deselectRandomizeOptionsCheckbox()
117
+ singleSelectionGridPage.steps.switchToPreviewTab();
118
+ singleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStems);
119
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
120
+ });
121
+ });
122
+ });
@@ -0,0 +1,183 @@
1
+ import { dialogBoxBase } from "../../../pages/dialogBoxBase";
2
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ const css = Cypress.env('css');
5
+
6
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
7
+ const options = ['Fully agree as true', 'Fully agree as false', 'Somewhat agree', 'Somewhat disagree'];
8
+
9
+ describe('Create Item page - Single Selection Grid: Set correct answer, Alternate correct answer - Edit tab cases', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Set Correct Answer section', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
18
+ });
19
+
20
+ singleSelectionGridPage.tests.verifyAutoScoredSetCorrectAnswerHeaderSectionContents('single selection grid');
21
+
22
+ it('In the Set Correct Answer section table, 4 columns and 2 rows with \'Question stem\' header and \'No question stem added\' should be displayed with disabled radio buttons should be displayed', () => {
23
+ for (let index = 0; index < 4; index++) {
24
+ singleSelectionGridPage.steps.verifyTableRowRadioButtonsInSetCorrectAnswerTable(index, 2);
25
+ singleSelectionGridPage.steps.verifyDisabledTableRowRadioButtonsInSetCorrectAnswerTable(index);
26
+ }
27
+ singleSelectionGridPage.setCorrectAnswerTableNoQuestionStemAddedLabel()
28
+ .verifyInnerText('No question stem added');
29
+ singleSelectionGridPage.setCorrectAnswerTableQuestionStemTitle()
30
+ .verifyInnerText('Question stem');
31
+ });
32
+
33
+ it('When user adds question stems and options then the radio buttons should be enabled and user should be able to set correct answer by checking the radio button besides the question stems in the table', () => {
34
+ cy.log('Pre-step: Adding question instructions, question stem and options')
35
+ singleSelectionGridPage.steps.addQuestionInstructions()
36
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
37
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options.slice(0, 2));
38
+ for (let index = 0; index < 2; index++) {
39
+ singleSelectionGridPage.steps.verifyEnabledUncheckedTableRowRadioButtonsInSetCorrectAnswerTable(index)
40
+ }
41
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(0, 1);
42
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(1, 0);
43
+ });
44
+
45
+ it('CSS of Set answer in the Correct answer tab contents', { tags: 'css' }, () => {
46
+ singleSelectionGridPage.correctTab()
47
+ .find('[class*="TabList"]')
48
+ .verifyCSS(css.color.activeButtons, css.fontSize.default, css.fontWeight.bold)
49
+ });
50
+
51
+ //Note: a11y checked in header section file
52
+
53
+ it('When user clicks on Add alternate answer button without selecting options for all question stems then a warning popup should be displayed', () => {
54
+ singleSelectionGridPage.steps.clickOnAddAlternateAnswerButton()
55
+ dialogBoxBase.dialogBox()
56
+ .should('exist');
57
+ dialogBoxBase.steps.closeWarningPopup();
58
+ });
59
+
60
+ it('When user closes the warning popup Please set correct answer error message should be displayed as user has partially selected correct answer', () => {
61
+ singleSelectionGridPage.errorMessage()
62
+ .eq(1)
63
+ .verifyInnerText('Error: Please set a correct answer.')
64
+ .should('be.visible');
65
+ });
66
+
67
+ it('When user selects all the options then the error message should disappear', () => {
68
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(2, 1);
69
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(3, 0);
70
+ singleSelectionGridPage.errorMessage()
71
+ .eq(1)
72
+ .should('not.exist');
73
+ });
74
+ });
75
+
76
+ describe('Alternate correct answer', () => {
77
+ abortEarlySetup();
78
+ before(() => {
79
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
80
+ singleSelectionGridPage.steps.addQuestionInstructions()
81
+ });
82
+
83
+ singleSelectionGridPage.tests.verifyAutoScoredAlternateAnswer();
84
+
85
+ it('When user has added points and selected correct answer in the Correct tab, then the user should be able to add alternate answer for the question using \'Add Alternate Answer\' button', () => {
86
+ cy.log('Pre step: Adding 2 options')
87
+ singleSelectionGridPage.steps.addOption();
88
+ singleSelectionGridPage.steps.addOption();
89
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
90
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
91
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([1, 3, 2, 1]);
92
+ singleSelectionGridPage.steps.allotPoints(10);
93
+ singleSelectionGridPage.steps.addAlternateTab(1);
94
+ });
95
+
96
+ it('When user adds Alternate answer tab then the question stems and option stems should be prefilled and the radio buttons should be deselected', () => {
97
+ singleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStems);
98
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(options);
99
+ for (let index = 0; index < 4; index++) {
100
+ singleSelectionGridPage.steps.verifyEnabledUncheckedTableRowRadioButtonsInSetCorrectAnswerTable(index)
101
+ }
102
+ });
103
+
104
+ it('CSS of Alternate correct answer tab', { tags: 'css' }, () => {
105
+ singleSelectionGridPage.alternateAnswerTab(1)
106
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.bold)
107
+ cy.log('CSS of inactive Correct answer tab')
108
+ singleSelectionGridPage.correctTab()
109
+ .verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.bold)
110
+ });
111
+
112
+ it('Accessibility of Alternate correct answer tab', { tags: 'a11y' }, () => {
113
+ cy.checkAccessibility(singleSelectionGridPage.correctTab().parents('[class*="AlternatePointsComponentstyles__AnswerTabWrapper"]'));
114
+ });
115
+
116
+ it('User should be able to set alternate correct answer by checking the radio buttons besides the question stems in Alternate answer tab', () => {
117
+ singleSelectionGridPage.steps.allotPoints(5);
118
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([0, 1, 2, 3]);
119
+ });
120
+
121
+ it('User should be able to add another alternate answer for the question using \'Add Alternate Answer\' button and the name for this new tab should be \'Alternate 2\'', () => {
122
+ singleSelectionGridPage.steps.addAlternateTab(2);
123
+ });
124
+
125
+ singleSelectionGridPage.tests.verifyWarningPopupAndTabNavigationWhenNoPointsAddedInAlternateTab();
126
+
127
+ //Failing due to https://redmine.zeuslearning.com/issues/532359
128
+ it('When user partially selects correct answer the Please set correct answer error message should not disappear', () => {
129
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(0, 1);
130
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(1, 0);
131
+ singleSelectionGridPage.errorMessage()
132
+ .eq(1)
133
+ .verifyInnerText('Error: Please set a correct answer.')
134
+ .should('be.visible');
135
+ });
136
+
137
+ it('When user selects all the options then the error message should disappear', () => {
138
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(2, 1);
139
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(3, 0)
140
+ singleSelectionGridPage.errorMessage()
141
+ .eq(1)
142
+ .should('not.exist');
143
+ });
144
+
145
+ it('When the user clicks on the \'Close\' button alongside alternate answer tab, alternate answer tab should get removed and the name of the alternate answer tabs should get updated accordingly', () => {
146
+ cy.log('Set correct answer and points in alternate 2 tab, then switch to Alternate 1 tab and click delete icon button');
147
+ singleSelectionGridPage.steps.allotPoints(7);
148
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([1, 0, 1, 3]);
149
+ singleSelectionGridPage.steps.navigateToAlternateTab(1);
150
+ singleSelectionGridPage.steps.deleteAlternateTab();
151
+ singleSelectionGridPage.alternateAnswerTab(2)
152
+ .should('not.exist');
153
+ singleSelectionGridPage.alternateAnswerTab(1)
154
+ .verifyInnerText('Alternate 1');
155
+ });
156
+
157
+ //Failing due to https://redmine.zeuslearning.com/issues/531902
158
+ it('On deleting option set as correct answer option in Alternate answer tab, \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'Alternate 1\' tab', () => {
159
+ singleSelectionGridPage.steps.deleteOption(0)
160
+ singleSelectionGridPage.errorMessage()
161
+ .verifyInnerText('Error: Please set a correct answer.');
162
+ singleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsDisplayed()
163
+ });
164
+
165
+ it('On reselecting correct answer option in Alternate answer tab, \'Error: Please set a correct answer.\' validation error message should disappear', () => {
166
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(1, 2);
167
+ singleSelectionGridPage.steps.verifyErrorMessageIsNotDisplayed();
168
+ singleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
169
+ });
170
+
171
+ it('On deleting a question stem no error messages should be displayed and no error icon should appear', () => {
172
+ singleSelectionGridPage.steps.deleteQuestionStem(1)
173
+ singleSelectionGridPage.steps.verifyErrorMessageIsNotDisplayed();
174
+ singleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
175
+ });
176
+
177
+ it('When the user is on \'Alternate 1\' tab then on deleting option set as correct answer option only in the Correct answer tab, tab should be switched from \'Alternate 1\' to \'CORRECT\' tab and \'Error: Please set a correct answer.\' validation error message should be thrown alongwith an error icon besides the \'Correct\' tab', () => {
178
+ singleSelectionGridPage.steps.deleteOption(1)
179
+ singleSelectionGridPage.steps.verifyActiveStateOfCorrectTab()
180
+ singleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsDisplayed()
181
+ });
182
+ });
183
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {