itemengine-cypress-automation 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.build_wna +4 -0
- package/README.md +3 -0
- package/currents.config.js +6 -0
- package/cypress/API/createItem/toggleItemMode.js +15 -0
- package/cypress/config-files/ildev.json +15 -0
- package/cypress/config-files/ilprod.json +15 -0
- package/cypress/config-files/ilqa.json +15 -0
- package/cypress/config-files/ilstage.json +15 -0
- package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
- package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
- package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
- package/cypress/fixtures/accessibilityConfig.json +6 -0
- package/cypress/fixtures/constants.js +18 -0
- package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
- package/cypress/fixtures/specialAndMathCharacters.js +118 -0
- package/cypress/fixtures/theme/ilc.json +150 -0
- package/cypress/fixtures/theme/ngie.json +26 -0
- package/cypress/fixtures/uploads/20mbFile.png +0 -0
- package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
- package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
- package/cypress/fixtures/uploads/image.png +0 -0
- package/cypress/fixtures/uploads/sample.aac +0 -0
- package/cypress/fixtures/uploads/sample.accdb +0 -0
- package/cypress/fixtures/uploads/sample.csv +100 -0
- package/cypress/fixtures/uploads/sample.doc +0 -0
- package/cypress/fixtures/uploads/sample.gif +0 -0
- package/cypress/fixtures/uploads/sample.heic +0 -0
- package/cypress/fixtures/uploads/sample.heif +0 -0
- package/cypress/fixtures/uploads/sample.hevc +0 -0
- package/cypress/fixtures/uploads/sample.jpeg +0 -0
- package/cypress/fixtures/uploads/sample.jpg +0 -0
- package/cypress/fixtures/uploads/sample.mp3 +0 -0
- package/cypress/fixtures/uploads/sample.mp4 +0 -0
- package/cypress/fixtures/uploads/sample.pdf +0 -0
- package/cypress/fixtures/uploads/sample.ppt +0 -0
- package/cypress/fixtures/uploads/sample.pub +0 -0
- package/cypress/fixtures/uploads/sample.rtf +7902 -0
- package/cypress/fixtures/uploads/sample.svg +10 -0
- package/cypress/fixtures/uploads/sample.txt +1 -0
- package/cypress/fixtures/uploads/sample.wav +0 -0
- package/cypress/fixtures/uploads/sample.xlsx +0 -0
- package/cypress/fixtures/uploads/sample.xps +0 -0
- package/cypress/fixtures/uploads/sample.zip +0 -0
- package/cypress/fixtures/uploads/sample1.jpg +0 -0
- package/cypress/fixtures/uploads/sample1.mp3 +0 -0
- package/cypress/fixtures/uploads/sample1.zip +0 -0
- package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
- package/cypress/fixtures/uploads/sample2.jpg +0 -0
- package/cypress/fixtures/uploads/sample2.mp3 +0 -0
- package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
- package/cypress/pages/audioPlayerPage.js +628 -0
- package/cypress/pages/audioResponsePage.js +264 -0
- package/cypress/pages/components/additionalSettingsPanel.js +174 -0
- package/cypress/pages/components/answerNumerationComponent.js +109 -0
- package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
- package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
- package/cypress/pages/components/autoScoredScoringSection.js +195 -0
- package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
- package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
- package/cypress/pages/components/ckEditorToolbar.js +64 -0
- package/cypress/pages/components/colorPopupComponent.js +293 -0
- package/cypress/pages/components/commonComponents.js +93 -0
- package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
- package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
- package/cypress/pages/components/createQuestionBasePage.js +225 -0
- package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
- package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
- package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
- package/cypress/pages/components/draggableOptionsContainer.js +857 -0
- package/cypress/pages/components/editCategoryFlyout.js +40 -0
- package/cypress/pages/components/equationEditorFlyout.js +158 -0
- package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
- package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
- package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
- package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
- package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
- package/cypress/pages/components/gridCommonComponents.js +951 -0
- package/cypress/pages/components/index.js +38 -0
- package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
- package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
- package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
- package/cypress/pages/components/mcqOptionsComponent.js +263 -0
- package/cypress/pages/components/mcqPreviewComponents.js +78 -0
- package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
- package/cypress/pages/components/mcqScoringComponent.js +120 -0
- package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
- package/cypress/pages/components/optionsWrapperComponent.js +221 -0
- package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
- package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
- package/cypress/pages/components/questionInstructionsComponent.js +112 -0
- package/cypress/pages/components/scoringSectionBase.js +308 -0
- package/cypress/pages/components/setPointsPopupBase.js +79 -0
- package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
- package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
- package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
- package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
- package/cypress/pages/createItemPage.js +28 -0
- package/cypress/pages/dialogBoxBase.js +111 -0
- package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
- package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
- package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
- package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
- package/cypress/pages/essayResponseBasicPage.js +57 -0
- package/cypress/pages/essayResponseMathPage.js +47 -0
- package/cypress/pages/essayResponsePage.js +385 -0
- package/cypress/pages/feedbackScalePage.js +698 -0
- package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
- package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
- package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
- package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
- package/cypress/pages/fillInTheGapsScoring.js +5974 -0
- package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
- package/cypress/pages/fillInTheGapsTextPage.js +225 -0
- package/cypress/pages/highlightImagePage.js +1316 -0
- package/cypress/pages/highlightPage.js +870 -0
- package/cypress/pages/index.js +30 -0
- package/cypress/pages/listMatchingPage.js +1330 -0
- package/cypress/pages/listMatchingScoring.js +2635 -0
- package/cypress/pages/listOrderingPage.js +751 -0
- package/cypress/pages/listSortingPage.js +1201 -0
- package/cypress/pages/multipleSelectionGridPage.js +359 -0
- package/cypress/pages/multipleSelectionPage.js +88 -0
- package/cypress/pages/passagePage.js +426 -0
- package/cypress/pages/readingRulerPage.js +302 -0
- package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
- package/cypress/pages/shortTextResponsePage.js +197 -0
- package/cypress/pages/singleSelectionGridPage.js +370 -0
- package/cypress/pages/singleSelectionPage.js +65 -0
- package/cypress/pages/uploadResponsePage.js +110 -0
- package/cypress/pages/videoResponsePage.js +375 -0
- package/cypress/support/commands.js +140 -0
- package/cypress/support/e2e.js +14 -0
- package/cypress/support/helpers/abortEarly.js +19 -0
- package/cypress/support/helpers/accessibility.js +34 -0
- package/cypress/support/helpers/cypressUtilities.js +64 -0
- package/cypress/support/helpers/localStorage.js +13 -0
- package/cypress/support/helpers/selectText.js +77 -0
- package/cypress/support/helpers/utilities.js +126 -0
- package/cypress.config.js +76 -0
- package/il.yaml +14 -0
- package/language +1 -0
- package/package.json +26 -0
@@ -0,0 +1,260 @@
|
|
1
|
+
import { fillInTheGapsTextPage } from "./fillInTheGapsTextPage";
|
2
|
+
import { fillInTheGapsDropdownPage } from "./fillInTheGapsDropdownPage";
|
3
|
+
import { autoScoredScoringSectionMultipleResponsesType, fillInTheGapsCommonComponents, scoringSectionBase } from "./components";
|
4
|
+
import { autoScoredSetCorrectAnswerSection } from "./components";
|
5
|
+
|
6
|
+
const tests = {
|
7
|
+
verifyPointsInEditTabForAutoScoredAllOrNothingWhenMatchFromAllResponsesIsTrue: (questionType) => {
|
8
|
+
it('When the user adds alternate answer and enables the \'Match from all responses\' functionality, the points field should be in disabled state and should have the value of points same as set in the \'Correct\' tab', () => {
|
9
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerButton()
|
10
|
+
.click();
|
11
|
+
switch (questionType) {
|
12
|
+
case 'fill in the gaps - text':
|
13
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 3', 'Response 4']);
|
14
|
+
break;
|
15
|
+
case 'fill in the gaps - dropdown':
|
16
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'healthy');
|
17
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'decreasingly');
|
18
|
+
break;
|
19
|
+
default:
|
20
|
+
throw new Error('Invalid question type');
|
21
|
+
};
|
22
|
+
scoringSectionBase.steps.allotPoints(3);
|
23
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
24
|
+
.click()
|
25
|
+
.should('be.checked');
|
26
|
+
scoringSectionBase.pointsInputField()
|
27
|
+
.should('have.value', '7')
|
28
|
+
.and('be.disabled');
|
29
|
+
});
|
30
|
+
|
31
|
+
it('When the user adds another tab, the new alternate answer tab should also have the same point value as the \'Correct\' tab', () => {
|
32
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerButton()
|
33
|
+
.click();
|
34
|
+
scoringSectionBase.pointsInputField()
|
35
|
+
.should('have.value', '7')
|
36
|
+
.and('be.disabled');
|
37
|
+
});
|
38
|
+
|
39
|
+
it('When the user has already set different points in the alternate answer tab and then enables the \'Match from all responses\' functionality, the points field in the \'Alternate\' tab should get disabled and should have the value of points same as set in the \'Correct\' tab', () => {
|
40
|
+
cy.log('Pre:step - unchecking the \'Match from all responses\' checkbox and updating the points')
|
41
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
42
|
+
.click()
|
43
|
+
.should('not.be.checked');
|
44
|
+
switch (questionType) {
|
45
|
+
case 'fill in the gaps - text':
|
46
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 5', 'Response 6']);
|
47
|
+
break;
|
48
|
+
case 'fill in the gaps - dropdown':
|
49
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'progressively');
|
50
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'decreasingly');
|
51
|
+
break;
|
52
|
+
default:
|
53
|
+
throw new Error('Invalid question type');
|
54
|
+
};
|
55
|
+
scoringSectionBase.pointsInputField()
|
56
|
+
.type('10');
|
57
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
58
|
+
.click()
|
59
|
+
.should('be.checked');
|
60
|
+
scoringSectionBase.pointsInputField()
|
61
|
+
.should('have.value', '7')
|
62
|
+
.and('be.disabled');
|
63
|
+
});
|
64
|
+
|
65
|
+
it('When the user disables the \'Match from all responses\' functionality, the score should go back to their previously set values', () => {
|
66
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
67
|
+
.click()
|
68
|
+
.should('not.be.checked');
|
69
|
+
scoringSectionBase.pointsInputField()
|
70
|
+
.should('have.value', '10');
|
71
|
+
autoScoredSetCorrectAnswerSection.correctTab()
|
72
|
+
.click();
|
73
|
+
scoringSectionBase.pointsInputField()
|
74
|
+
.should('have.value', '7');
|
75
|
+
});
|
76
|
+
},
|
77
|
+
|
78
|
+
verifyPointsInEditTabForAutoScoredPartialEqualWeightsWhenMatchFromAllResponsesIsTrue: (questionType) => {
|
79
|
+
it('When the user adds alternate answer and enables the \'Match from all responses\' functionality, the points field should be in disabled state and should have the value of points same as set in the \'Correct\' tab', () => {
|
80
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerButton()
|
81
|
+
.click();
|
82
|
+
switch (questionType) {
|
83
|
+
case 'fill in the gaps - text':
|
84
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 3', 'Response 4']);
|
85
|
+
break;
|
86
|
+
case 'fill in the gaps - dropdown':
|
87
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'healthy');
|
88
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'decreasingly');
|
89
|
+
break;
|
90
|
+
default:
|
91
|
+
throw new Error('Invalid question type');
|
92
|
+
};
|
93
|
+
scoringSectionBase.steps.allotPoints(3);
|
94
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
95
|
+
.click()
|
96
|
+
.should('be.checked');
|
97
|
+
scoringSectionBase.pointsInputField()
|
98
|
+
.should('have.value', '7')
|
99
|
+
.and('be.disabled');
|
100
|
+
fillInTheGapsCommonComponents.partialEqualWeightsPointsPerResponseScore()
|
101
|
+
.each(($element) => {
|
102
|
+
cy.wrap($element)
|
103
|
+
.verifyInnerText('3.5');
|
104
|
+
});
|
105
|
+
});
|
106
|
+
|
107
|
+
it('When the user adds another tab, the new alternate answer tab should also have the same point value as the \'Correct\' tab', () => {
|
108
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerButton()
|
109
|
+
.click();
|
110
|
+
scoringSectionBase.pointsInputField()
|
111
|
+
.should('have.value', '7')
|
112
|
+
.and('be.disabled');
|
113
|
+
fillInTheGapsCommonComponents.partialEqualWeightsPointsPerResponseScore()
|
114
|
+
.each(($element) => {
|
115
|
+
cy.wrap($element)
|
116
|
+
.verifyInnerText('3.5');
|
117
|
+
});
|
118
|
+
});
|
119
|
+
|
120
|
+
it('When the user has already set different points in the alternate answer tab and then enables the \'Match from all responses\' functionality, the points field in the \'Alternate\' tab should get disabled and should have the value of points same as set in the \'Correct\' tab', () => {
|
121
|
+
switch (questionType) {
|
122
|
+
case 'fill in the gaps - text':
|
123
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 5', 'Response 6']);
|
124
|
+
break;
|
125
|
+
case 'fill in the gaps - dropdown':
|
126
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'progressively');
|
127
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'decreasingly');
|
128
|
+
break;
|
129
|
+
default:
|
130
|
+
throw new Error('Invalid question type');
|
131
|
+
};
|
132
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
133
|
+
.click()
|
134
|
+
.should('not.be.checked');
|
135
|
+
scoringSectionBase.pointsInputField()
|
136
|
+
.type(10);
|
137
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
138
|
+
.click()
|
139
|
+
.should('be.checked');
|
140
|
+
scoringSectionBase.pointsInputField()
|
141
|
+
.should('have.value', '7')
|
142
|
+
.and('be.disabled');
|
143
|
+
fillInTheGapsCommonComponents.partialEqualWeightsPointsPerResponseScore()
|
144
|
+
.each(($element) => {
|
145
|
+
cy.wrap($element)
|
146
|
+
.verifyInnerText('3.5');
|
147
|
+
});
|
148
|
+
});
|
149
|
+
|
150
|
+
it('When the user disables the \'Match from all responses\' functionality, the score should go back to their previously set values', () => {
|
151
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
152
|
+
.click()
|
153
|
+
.should('not.be.checked');
|
154
|
+
scoringSectionBase.pointsInputField()
|
155
|
+
.should('have.value', '10');
|
156
|
+
fillInTheGapsCommonComponents.partialEqualWeightsPointsPerResponseScore()
|
157
|
+
.each(($element) => {
|
158
|
+
cy.wrap($element)
|
159
|
+
.verifyInnerText('5');
|
160
|
+
});
|
161
|
+
autoScoredSetCorrectAnswerSection.correctTab()
|
162
|
+
.click();
|
163
|
+
scoringSectionBase.pointsInputField()
|
164
|
+
.should('have.value', '7');
|
165
|
+
});
|
166
|
+
},
|
167
|
+
|
168
|
+
verifyPointsInEditTabForAutoScoredPartialDifferentWeightsWhenMatchFromAllResponsesIsTrue: (questionType) => {
|
169
|
+
let partialDifferentWeightPoints = [1, 7];
|
170
|
+
it('When the user adds alternate answer and enables the \'Match from all responses\' functionality, the points field should be in disabled state and should have the value of points same as set in the \'Correct\' tab', () => {
|
171
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerButton()
|
172
|
+
.click();
|
173
|
+
switch (questionType) {
|
174
|
+
case 'fill in the gaps - text':
|
175
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 3', 'Response 4']);
|
176
|
+
break;
|
177
|
+
case 'fill in the gaps - dropdown':
|
178
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'healthy');
|
179
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'decreasingly');
|
180
|
+
break;
|
181
|
+
default:
|
182
|
+
throw new Error('Invalid question type');
|
183
|
+
};
|
184
|
+
autoScoredScoringSectionMultipleResponsesType.steps.addPartialDifferentWeightsPoints([2, 8]);
|
185
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
186
|
+
.click()
|
187
|
+
.should('be.checked');
|
188
|
+
partialDifferentWeightPoints.forEach((points, count) => {
|
189
|
+
scoringSectionBase.pointsInputField()
|
190
|
+
.eq(count)
|
191
|
+
.should('have.value', points)
|
192
|
+
.and('be.disabled');
|
193
|
+
});
|
194
|
+
});
|
195
|
+
|
196
|
+
it('When the user adds another tab, the new alternate answer tab should also have the same point value as the \'Correct\' tab', () => {
|
197
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerButton()
|
198
|
+
.click();
|
199
|
+
partialDifferentWeightPoints.forEach((points, count) => {
|
200
|
+
scoringSectionBase.pointsInputField()
|
201
|
+
.eq(count)
|
202
|
+
.should('have.value', points)
|
203
|
+
.and('be.disabled');
|
204
|
+
});
|
205
|
+
});
|
206
|
+
|
207
|
+
//https://redmine.zeuslearning.com/issues/528115
|
208
|
+
it('When the user has already set different points in the alternate answer tab and then enables the \'Match from all responses\' functionality, the points field in the \'Alternate\' tab should get disabled and should have the value of points same as set in the \'Correct\' tab', () => {
|
209
|
+
cy.log('Pre:step - unchecking the \'Match from all responses\' checkbox and updating the points')
|
210
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
211
|
+
.click()
|
212
|
+
.should('not.be.checked');
|
213
|
+
switch (questionType) {
|
214
|
+
case 'fill in the gaps - text':
|
215
|
+
fillInTheGapsTextPage.steps.setCorrectAnswerResponses(['Response 5', 'Response 6']);
|
216
|
+
break;
|
217
|
+
case 'fill in the gaps - dropdown':
|
218
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'progressively');
|
219
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'decreasingly');
|
220
|
+
break;
|
221
|
+
default:
|
222
|
+
throw new Error('Invalid question type');
|
223
|
+
};
|
224
|
+
autoScoredScoringSectionMultipleResponsesType.steps.addPartialDifferentWeightsPoints([3, 9]);
|
225
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
226
|
+
.click()
|
227
|
+
.should('be.checked');
|
228
|
+
partialDifferentWeightPoints.forEach((points, count) => {
|
229
|
+
scoringSectionBase.pointsInputField()
|
230
|
+
.eq(count)
|
231
|
+
.should('have.value', points)
|
232
|
+
.and('be.disabled');
|
233
|
+
});
|
234
|
+
});
|
235
|
+
|
236
|
+
it('When the user disables the \'Match from all responses\' functionality, the score should go back to their previously set values', () => {
|
237
|
+
let pointsSetInAlternateTab = [3, 9];
|
238
|
+
let pointsSetInCorrectTab = [1, 7];
|
239
|
+
fillInTheGapsCommonComponents.matchFromAllResponsesCheckbox()
|
240
|
+
.click()
|
241
|
+
.should('not.be.checked');
|
242
|
+
pointsSetInAlternateTab.forEach((points, count) => {
|
243
|
+
scoringSectionBase.pointsInputField()
|
244
|
+
.eq(count)
|
245
|
+
.should('have.value', points);
|
246
|
+
});
|
247
|
+
autoScoredSetCorrectAnswerSection.correctTab()
|
248
|
+
.click();
|
249
|
+
pointsSetInCorrectTab.forEach((points, count) => {
|
250
|
+
scoringSectionBase.pointsInputField()
|
251
|
+
.eq(count)
|
252
|
+
.should('have.value', points);
|
253
|
+
});
|
254
|
+
});
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
export const fillInTheGapsSetCorrectAnswerSection = {
|
259
|
+
tests
|
260
|
+
}
|
@@ -0,0 +1,225 @@
|
|
1
|
+
import { questionInstructionsComponent, scoringSectionBase, createQuestionBasePage, additionalSettingsPanel, commonComponents, autoScoredPreviewBase, autoScoredAdditionalSettings, autoScoredSetCorrectAnswerSection, autoScoredScoringSectionMultipleResponsesType, autoScoredScoringSection, fillInTheGapsCommonComponents, specialCharactersFlyoutComponent, specialAndCustomSpecialCharactersComponent, previewScoringAndShowCorrectAnswerComponent } from "./components";
|
2
|
+
import { answerNumerationComponent } from "./components/answerNumerationComponent";
|
3
|
+
const css = Cypress.env('css');
|
4
|
+
|
5
|
+
const selectors = {
|
6
|
+
...scoringSectionBase,
|
7
|
+
...createQuestionBasePage,
|
8
|
+
...additionalSettingsPanel,
|
9
|
+
...questionInstructionsComponent,
|
10
|
+
...commonComponents,
|
11
|
+
...autoScoredSetCorrectAnswerSection,
|
12
|
+
...autoScoredAdditionalSettings,
|
13
|
+
...autoScoredPreviewBase,
|
14
|
+
...autoScoredScoringSectionMultipleResponsesType,
|
15
|
+
...fillInTheGapsCommonComponents,
|
16
|
+
...specialCharactersFlyoutComponent,
|
17
|
+
...specialAndCustomSpecialCharactersComponent,
|
18
|
+
...previewScoringAndShowCorrectAnswerComponent,
|
19
|
+
...answerNumerationComponent,
|
20
|
+
setCorrectAnswerResponseField: () => cy.get('.response-input-field input[type="text"]'),
|
21
|
+
caseSensitiveLabel: () => cy.get('[data-ngie-testid="case-sensitive-checkbox"] .MuiFormControlLabel-label'),
|
22
|
+
ignoreSpacesBeforeAndAfterLabel: () => cy.get('[data-ngie-testid="ignore-spaces-before-and-after-checkbox"] .MuiFormControlLabel-label'),
|
23
|
+
matchFromAllResponsesLabel: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] .MuiFormControlLabel-label'),
|
24
|
+
caseSensitiveCheckbox: () => cy.get('[data-ngie-testid="case-sensitive-checkbox"] input'),
|
25
|
+
ignoreSpacesBeforeAndAfterCheckbox: () => cy.get('[data-ngie-testid="ignore-spaces-before-and-after-checkbox"] input'),
|
26
|
+
matchFromAllResponsesCheckbox: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] input'),
|
27
|
+
//Additional settings
|
28
|
+
multilineResponseLabel: () => cy.get('[data-ngie-testid="multiline-response-checkbox"] .MuiFormControlLabel-label'),
|
29
|
+
multilineResponseCheckbox: () => cy.get('[data-ngie-testid="multiline-response-checkbox"] input'),
|
30
|
+
setCorrectAnswerMultilineTextArea: () => cy.get('.response-multiline-input-field'),
|
31
|
+
previewTabMultilineTextArea: () => cy.get('.cloze-with-text-response-preview-wrapper .response-multiline-input-field'),
|
32
|
+
spellCheckLabel: () => cy.get('[data-ngie-testid="spell-check-checkbox"] .MuiFormControlLabel-label'),
|
33
|
+
spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input'),
|
34
|
+
previewTabResponseFieldSpecialCharactersButton: () => cy.get('.cloze-with-text-response-preview-wrapper .custon-special-character-button'),
|
35
|
+
typeOfAnswerInputLabel: () => cy.get('.additional-settings-label[id*="Type-of-Answer-input"]'),
|
36
|
+
typeOfAnswerInputDropdown: () => cy.get('.drop-down-parent[id*="Type-of-Answer-input"]').eq(0),
|
37
|
+
typeOfAnswerInputDropdownListOptions: (optionNumber) => cy.get('[aria-labelledby*="Type-of-Answer-input"] .dropdown-menu-item').eq(optionNumber),
|
38
|
+
setCharacterLimitLabel: () => cy.get('[aria-labelledby="Set character limit"]'),
|
39
|
+
setCharacterLimitInputField: () => cy.get('.dropdown-wrapper .text-input-field input[type="text"]').eq(0),
|
40
|
+
//Preview tab
|
41
|
+
previewTabResponseField: () => cy.get('.cloze-with-text-response-preview-wrapper [type="text"]'),
|
42
|
+
previewTabResponseFieldWrapper: () => cy.get('.cloze-with-text-answer-status-response-preview-wrapper'),
|
43
|
+
}
|
44
|
+
|
45
|
+
const steps = {
|
46
|
+
...createQuestionBasePage.steps,
|
47
|
+
...questionInstructionsComponent.steps,
|
48
|
+
...scoringSectionBase.steps,
|
49
|
+
...additionalSettingsPanel.steps,
|
50
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
51
|
+
...autoScoredPreviewBase.steps,
|
52
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
53
|
+
...autoScoredScoringSection.steps,
|
54
|
+
...autoScoredAdditionalSettings.steps,
|
55
|
+
...fillInTheGapsCommonComponents.steps,
|
56
|
+
...specialCharactersFlyoutComponent.steps,
|
57
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
58
|
+
...answerNumerationComponent.steps,
|
59
|
+
expandResponseAccordion: (responseIndex) => {
|
60
|
+
fillInTheGapsTextPage.responseAccordionWrapper()
|
61
|
+
.eq(responseIndex)
|
62
|
+
.find('.additional-settings-panel')
|
63
|
+
.should('have.attr', 'aria-expanded', 'false')
|
64
|
+
.click()
|
65
|
+
.should('have.attr', 'aria-expanded', 'true');
|
66
|
+
},
|
67
|
+
|
68
|
+
setCorrectAnswerResponses: (responseTextArray) => {
|
69
|
+
responseTextArray.forEach((responseFieldText, count) => {
|
70
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
71
|
+
.eq(count)
|
72
|
+
.type(responseFieldText)
|
73
|
+
.should('have.value', responseFieldText);
|
74
|
+
});
|
75
|
+
},
|
76
|
+
|
77
|
+
verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel: (answerInput, score, isCorrect) => {
|
78
|
+
cy.log('Pre-requisite: This can only be used for questions with single response fields');
|
79
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
80
|
+
.clear()
|
81
|
+
.type(answerInput)
|
82
|
+
.blur();
|
83
|
+
previewScoringAndShowCorrectAnswerComponent.previewScoreText()
|
84
|
+
.verifyInnerText(score);
|
85
|
+
autoScoredPreviewBase.checkAnswerButton()
|
86
|
+
.realClick();
|
87
|
+
if (isCorrect) {
|
88
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionCheckmarkIcon('0');
|
89
|
+
autoScoredPreviewBase.steps.verifyCorrectIncorrectAnswerLabel('Correct');
|
90
|
+
} else {
|
91
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionCrossmarkIcon('0');
|
92
|
+
autoScoredPreviewBase.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
93
|
+
};
|
94
|
+
},
|
95
|
+
|
96
|
+
enterAnswerResponsesInPreviewTab: (responseTextArray) => {
|
97
|
+
responseTextArray.forEach((responseFieldText, count) => {
|
98
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
99
|
+
.eq(count)
|
100
|
+
.clear()
|
101
|
+
.type(responseFieldText)
|
102
|
+
.should('have.value', responseFieldText);
|
103
|
+
});
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
const tests = {
|
108
|
+
...commonComponents.tests,
|
109
|
+
...createQuestionBasePage.tests,
|
110
|
+
...questionInstructionsComponent.tests,
|
111
|
+
...additionalSettingsPanel.tests,
|
112
|
+
...scoringSectionBase.tests,
|
113
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
114
|
+
...autoScoredAdditionalSettings.tests,
|
115
|
+
...autoScoredScoringSection.tests,
|
116
|
+
...fillInTheGapsCommonComponents.tests,
|
117
|
+
...specialCharactersFlyoutComponent.tests,
|
118
|
+
...specialAndCustomSpecialCharactersComponent.tests,
|
119
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
120
|
+
...autoScoredScoringSectionMultipleResponsesType.tests,
|
121
|
+
...answerNumerationComponent.tests,
|
122
|
+
verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
|
123
|
+
it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
|
124
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseFieldLabel()
|
125
|
+
.eq(0)
|
126
|
+
.verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.regular);
|
127
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
128
|
+
.eq(0)
|
129
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
|
130
|
+
});
|
131
|
+
|
132
|
+
it('By default, an empty points input field and two empty response fields with labels \'Response 1\' and \'Response 2\' should be present', () => {
|
133
|
+
fillInTheGapsTextPage.pointsInputField()
|
134
|
+
.should('have.value', '');
|
135
|
+
for (let index = 0; index < 2; index++) {
|
136
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseFieldLabel()
|
137
|
+
.eq(index)
|
138
|
+
.verifyInnerText(`Response ${index + 1}`);
|
139
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
140
|
+
.eq(index)
|
141
|
+
.should('be.visible');
|
142
|
+
};
|
143
|
+
});
|
144
|
+
|
145
|
+
it('User should be able to enter text in the empty response field', () => {
|
146
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
147
|
+
.eq(0)
|
148
|
+
.type('Lorem Ipsum')
|
149
|
+
.should('have.value', 'Lorem Ipsum');
|
150
|
+
});
|
151
|
+
|
152
|
+
it(`When the user has only partially filled response fields out of the available response fields, \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'${tabName}\'`, () => {
|
153
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
154
|
+
.eq(1)
|
155
|
+
.focus()
|
156
|
+
.blur();
|
157
|
+
commonComponents.errorMessage()
|
158
|
+
.should('have.text', 'Error: Please set a correct answer.');
|
159
|
+
if (tabName == 'Correct tab') {
|
160
|
+
autoScoredSetCorrectAnswerSection.correctTab()
|
161
|
+
.within(() => {
|
162
|
+
autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
|
163
|
+
.should('be.visible');
|
164
|
+
});
|
165
|
+
} else {
|
166
|
+
autoScoredSetCorrectAnswerSection.alternateAnswerTab(1)
|
167
|
+
.within(() => {
|
168
|
+
autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
|
169
|
+
.should('be.visible');
|
170
|
+
});
|
171
|
+
};
|
172
|
+
});
|
173
|
+
|
174
|
+
autoScoredSetCorrectAnswerSection.tests.verifyCSSAndA11yOfAutoScoredSetCorrectAnswerErrorMessage();
|
175
|
+
|
176
|
+
it('CSS of response field error state', { tags: 'css' }, () => {
|
177
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
178
|
+
.eq(1)
|
179
|
+
.parents('.response-input-field')
|
180
|
+
.should('have.css', 'background-color', css.color.errorFieldBg)
|
181
|
+
.find('fieldset')
|
182
|
+
.should('have.css', 'border', `1px solid ${css.color.errorFieldBorder}`)
|
183
|
+
});
|
184
|
+
|
185
|
+
it('Accessibility of response field error state', { tags: 'a11y' }, () => {
|
186
|
+
cy.checkAccessibility(fillInTheGapsTextPage.setCorrectAnswerResponseField().parents('.cloze-with-text-response-form-controls-wrapper'));
|
187
|
+
});
|
188
|
+
|
189
|
+
it('When the user has added text in all the available response fields, the error message should disappear', () => {
|
190
|
+
fillInTheGapsTextPage.setCorrectAnswerResponseField()
|
191
|
+
.eq(1)
|
192
|
+
.type('dolor sit amet')
|
193
|
+
.should('have.value', 'dolor sit amet');
|
194
|
+
commonComponents.errorMessage()
|
195
|
+
.should('not.exist');
|
196
|
+
});
|
197
|
+
|
198
|
+
autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
|
199
|
+
},
|
200
|
+
|
201
|
+
verifyMinimumScoreAwardedForIncorrectAnswer: (totalPoints) => {
|
202
|
+
it('When user has provided minimum score awarded (if attempted) points, then in Preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
|
203
|
+
cy.log('Switch to edit tab and set minimum score if attempted points')
|
204
|
+
createQuestionBasePage.steps.switchToEditTab();
|
205
|
+
scoringSectionBase.minimumScoreIfAttemptedInputField()
|
206
|
+
.type('1')
|
207
|
+
.should('have.value', '1');
|
208
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
209
|
+
fillInTheGapsTextPage.previewTabResponseField()
|
210
|
+
.eq(0)
|
211
|
+
.type('Incorrect answer')
|
212
|
+
.blur();
|
213
|
+
previewScoringAndShowCorrectAnswerComponent.previewScoreText()
|
214
|
+
.then(($points) => {
|
215
|
+
expect($points.text()).to.equal(`1/${totalPoints}`);
|
216
|
+
});
|
217
|
+
});
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
export const fillInTheGapsTextPage = {
|
222
|
+
...selectors,
|
223
|
+
steps,
|
224
|
+
tests
|
225
|
+
}
|