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,359 @@
|
|
1
|
+
import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, commonComponents, createQuestionBasePage, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase } from "./components"
|
2
|
+
import { gridCommonComponents } from "./components/gridCommonComponents"
|
3
|
+
import { studentResponseAndLayoutComponent } from "./components/studentResponseAreaAndLayoutComponent";
|
4
|
+
const css = Cypress.env('css');
|
5
|
+
|
6
|
+
const selectors = {
|
7
|
+
...commonComponents,
|
8
|
+
...gridCommonComponents,
|
9
|
+
...autoScoredSetCorrectAnswerSection,
|
10
|
+
...scoringSectionBase,
|
11
|
+
...autoScoredScoringSectionMultipleResponsesType,
|
12
|
+
...autoScoredAdditionalSettings,
|
13
|
+
...previewScoringAndShowCorrectAnswerComponent,
|
14
|
+
...autoScoredPreviewBase,
|
15
|
+
...questionInstructionsComponent,
|
16
|
+
...additionalSettingsPanel,
|
17
|
+
optionsCheckbox: () => cy.get('.choice-option-radio-button input'),
|
18
|
+
optionsCheckboxWrapper: () => cy.get('.single-selection-grid-radio-label-wrapper'),
|
19
|
+
pointsPerResponseLabel: () => cy.get('[class*="indexstyles__PartialDifferentPointsHeader"]'),
|
20
|
+
partialEqualWeightsPointsPerResponseScore: () => cy.get('[class*="indexstyles__PartialPointsDiv"]')
|
21
|
+
}
|
22
|
+
|
23
|
+
const steps = {
|
24
|
+
...createQuestionBasePage.steps,
|
25
|
+
...questionInstructionsComponent.steps,
|
26
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
27
|
+
...scoringSectionBase.steps,
|
28
|
+
...gridCommonComponents.steps,
|
29
|
+
...commonComponents.steps,
|
30
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
31
|
+
...additionalSettingsPanel.steps,
|
32
|
+
...previewScoringAndShowCorrectAnswerComponent.steps,
|
33
|
+
...autoScoredAdditionalSettings.steps,
|
34
|
+
...autoScoredPreviewBase.steps,
|
35
|
+
...autoScoredScoringSection.steps,
|
36
|
+
/**
|
37
|
+
* @param {number} questionStemIndex index of question stem
|
38
|
+
* @param {string[]} optionsArray array of options
|
39
|
+
* @description This function checkmarks the options in a question stem the set correct answer table
|
40
|
+
*/
|
41
|
+
setAnswersForQuestionStemInSetCorrectAnswerTable: (questionStemIndex, optionsArray) => {
|
42
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
43
|
+
.eq(questionStemIndex)
|
44
|
+
.within(() => {
|
45
|
+
optionsArray.forEach((options) => {
|
46
|
+
multipleSelectionGridPage.optionsCheckbox()
|
47
|
+
.eq(options)
|
48
|
+
.click()
|
49
|
+
.should('be.checked');
|
50
|
+
});
|
51
|
+
});
|
52
|
+
},
|
53
|
+
|
54
|
+
/**
|
55
|
+
* @param {number[][]} optionIndexInQuestionStemRow array of options to be selected for all question stems
|
56
|
+
* @description This function checkmarks all the options in the set correct answer table
|
57
|
+
*/
|
58
|
+
setAnswersForAllQuestionStemsInSetCorrectAnswerTable: (optionsArrayForQuestionStem) => {
|
59
|
+
optionsArrayForQuestionStem.forEach((options, questionStemIndex) => {
|
60
|
+
steps.setAnswersForQuestionStemInSetCorrectAnswerTable(questionStemIndex, options);
|
61
|
+
});
|
62
|
+
},
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @param {number} questionStemIndex index of question stem
|
66
|
+
* @param {string[]} optionsArray array of options
|
67
|
+
* @description This function checkmarks the options in a question stem the preview tab answer table
|
68
|
+
*/
|
69
|
+
setAnswersForQuestionStemInPreviewTabAnswerTable: (questionStemIndex, optionsArray) => {
|
70
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
71
|
+
.eq(questionStemIndex)
|
72
|
+
.within(() => {
|
73
|
+
optionsArray.forEach((options) => {
|
74
|
+
multipleSelectionGridPage.optionsCheckbox()
|
75
|
+
.eq(options)
|
76
|
+
.click()
|
77
|
+
.should('be.checked');
|
78
|
+
});
|
79
|
+
});
|
80
|
+
},
|
81
|
+
|
82
|
+
/**
|
83
|
+
* @param {number[][]} optionIndexInQuestionStemRow array of options to be selected for all question stems
|
84
|
+
* @description This function checkmarks all the options in the set correct answer table
|
85
|
+
*/
|
86
|
+
setAnswersForAllQuestionStemsInPreviewTabAnswerTable: (optionsArrayForQuestionStem) => {
|
87
|
+
optionsArrayForQuestionStem.forEach((optionsArray, questionStemIndex) => {
|
88
|
+
multipleSelectionGridPage.steps.setAnswersForQuestionStemInPreviewTabAnswerTable(questionStemIndex, optionsArray)
|
89
|
+
});
|
90
|
+
},
|
91
|
+
|
92
|
+
verifyTableRowCheckboxesInSetCorrectAnswerTable: (rowIndex, checkboxesCount) => {
|
93
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
94
|
+
.eq(rowIndex)
|
95
|
+
.within(() => {
|
96
|
+
multipleSelectionGridPage.optionsCheckbox()
|
97
|
+
.should('have.length', checkboxesCount)
|
98
|
+
});
|
99
|
+
},
|
100
|
+
|
101
|
+
verifyTableRowCheckboxesInPreviewTabAnswerTable: (rowIndex, checkboxesCount) => {
|
102
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
103
|
+
.eq(rowIndex)
|
104
|
+
.within(() => {
|
105
|
+
multipleSelectionGridPage.optionsCheckbox()
|
106
|
+
.should('have.length', checkboxesCount)
|
107
|
+
});
|
108
|
+
},
|
109
|
+
|
110
|
+
verifyDisabledTableRowCheckboxesInSetCorrectAnswerTable: (rowIndex) => {
|
111
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
112
|
+
.eq(rowIndex)
|
113
|
+
.within(() => {
|
114
|
+
multipleSelectionGridPage.optionsCheckbox()
|
115
|
+
.each(($el) => {
|
116
|
+
cy.wrap($el)
|
117
|
+
.should('be.disabled');
|
118
|
+
});
|
119
|
+
});
|
120
|
+
},
|
121
|
+
|
122
|
+
verifyCheckboxesUncheckedInPreviewTabAnswerTable: () => {
|
123
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
124
|
+
.each(($el) => {
|
125
|
+
cy.wrap($el)
|
126
|
+
.within(() => {
|
127
|
+
multipleSelectionGridPage.optionsCheckbox()
|
128
|
+
.each(($el) => {
|
129
|
+
cy.wrap($el)
|
130
|
+
.should('not.be.checked');
|
131
|
+
});
|
132
|
+
});
|
133
|
+
});
|
134
|
+
},
|
135
|
+
|
136
|
+
verifyEnabledUncheckedTableRowCheckboxesInSetCorrectAnswerTable: (rowIndex) => {
|
137
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
138
|
+
.eq(rowIndex)
|
139
|
+
.within(() => {
|
140
|
+
multipleSelectionGridPage.optionsCheckbox()
|
141
|
+
.each(($el) => {
|
142
|
+
cy.wrap($el)
|
143
|
+
.should('be.enabled')
|
144
|
+
.and('not.be.checked');
|
145
|
+
});
|
146
|
+
});
|
147
|
+
},
|
148
|
+
|
149
|
+
/**
|
150
|
+
* @param {number} rowIndex index of the row
|
151
|
+
* @param {number} optionIndex index of the option to be selected within the row
|
152
|
+
* @description This function verifies the incorrect icon in the preview tab table
|
153
|
+
*/
|
154
|
+
verifyIncorrectOptionsCrossmarkIcon: (rowIndex, optionsArray) => {
|
155
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
156
|
+
.eq(rowIndex)
|
157
|
+
.within(() => {
|
158
|
+
optionsArray.forEach((options) => {
|
159
|
+
multipleSelectionGridPage.optionsCheckboxWrapper()
|
160
|
+
.eq(options)
|
161
|
+
.within(() => {
|
162
|
+
gridCommonComponents.correctIncorrectIconWrapper()
|
163
|
+
.should('have.class', 'icon-incorrect')
|
164
|
+
.and('be.visible');
|
165
|
+
});
|
166
|
+
});
|
167
|
+
});
|
168
|
+
},
|
169
|
+
|
170
|
+
/**
|
171
|
+
* @param {number} rowIndex index of the row
|
172
|
+
* @param {number[]} optionsArray array of index of the option to be selected within the row
|
173
|
+
* @description This function verifies the correct icon in the preview tab table
|
174
|
+
*/
|
175
|
+
verifyCorrectOptionsCheckmarkIcon: (rowIndex, optionsArray) => {
|
176
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
177
|
+
.eq(rowIndex)
|
178
|
+
.within(() => {
|
179
|
+
optionsArray.forEach((options) => {
|
180
|
+
multipleSelectionGridPage.optionsCheckboxWrapper()
|
181
|
+
.eq(options)
|
182
|
+
.within(() => {
|
183
|
+
gridCommonComponents.correctIncorrectIconWrapper()
|
184
|
+
.should('have.class', 'icon-correct')
|
185
|
+
.and('be.visible');
|
186
|
+
});
|
187
|
+
});
|
188
|
+
});
|
189
|
+
},
|
190
|
+
|
191
|
+
|
192
|
+
verifyCorrectIncorrectIconDoesNotExist: (rowIndex, optionsArray) => {
|
193
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
194
|
+
.eq(rowIndex)
|
195
|
+
.within(() => {
|
196
|
+
optionsArray.forEach((options) => {
|
197
|
+
multipleSelectionGridPage.optionsCheckboxWrapper()
|
198
|
+
.eq(options)
|
199
|
+
.within(() => {
|
200
|
+
gridCommonComponents.correctIncorrectIconWrapper()
|
201
|
+
.should('not.exist');
|
202
|
+
});
|
203
|
+
});
|
204
|
+
});
|
205
|
+
},
|
206
|
+
|
207
|
+
resetQuestionPreview: () => {
|
208
|
+
createQuestionBasePage.steps.switchToEditTab();
|
209
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
210
|
+
steps.verifyCheckboxesUncheckedInPreviewTabAnswerTable();
|
211
|
+
},
|
212
|
+
|
213
|
+
//TODO: Make all border related changes once https://redmine.zeuslearning.com/issues/518498 is resolved
|
214
|
+
verifyCorrectAttemptBorder: () => {
|
215
|
+
gridCommonComponents.correctIncorrectAnswerBorder()
|
216
|
+
.should('have.css', 'border', `1px solid ${css.color.correctAnswer}`);
|
217
|
+
},
|
218
|
+
|
219
|
+
verifyIncorrectAttemptBorder: () => {
|
220
|
+
gridCommonComponents.correctIncorrectAnswerBorder()
|
221
|
+
.should('have.css', 'border', `1px solid ${css.color.incorrectAnswer}`);
|
222
|
+
},
|
223
|
+
|
224
|
+
verifyCorrectIncorrectBorderNotVisible: () => {
|
225
|
+
gridCommonComponents.correctIncorrectAnswerBorder()
|
226
|
+
.should('have.css', 'border')
|
227
|
+
.and('match', /0px none/);
|
228
|
+
},
|
229
|
+
|
230
|
+
//V3 - This function should be updated in all files
|
231
|
+
/**
|
232
|
+
* @param {number} points points displayed in partial equal weights points per response
|
233
|
+
* @description Verify points displayed in partial equal weights points per response
|
234
|
+
*/
|
235
|
+
verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
|
236
|
+
multipleSelectionGridPage.partialEqualWeightsPointsPerResponseScore()
|
237
|
+
.each(($element) => {
|
238
|
+
cy.wrap($element)
|
239
|
+
.verifyInnerText(`${points}`);
|
240
|
+
});
|
241
|
+
},
|
242
|
+
}
|
243
|
+
|
244
|
+
const tests = {
|
245
|
+
...createQuestionBasePage.tests,
|
246
|
+
...commonComponents.tests,
|
247
|
+
...questionInstructionsComponent.tests,
|
248
|
+
...gridCommonComponents.tests,
|
249
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
250
|
+
...autoScoredScoringSection.tests,
|
251
|
+
...scoringSectionBase.tests,
|
252
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
253
|
+
...additionalSettingsPanel.tests,
|
254
|
+
...autoScoredAdditionalSettings.tests,
|
255
|
+
...studentResponseAndLayoutComponent.tests,
|
256
|
+
verifyAllContentsOfSetCorrectAnswerTableForScoringType: (scoringType, questionStemsArray, optionsArray) => {
|
257
|
+
it(`When user has selected ${scoringType} scoring type then added question stems, options and enabled checkboxes should be displayed`, () => {
|
258
|
+
multipleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStemsArray);
|
259
|
+
multipleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(optionsArray);
|
260
|
+
for (let index = 0; index < 4; index++) {
|
261
|
+
multipleSelectionGridPage.steps.verifyEnabledUncheckedTableRowCheckboxesInSetCorrectAnswerTable(index);
|
262
|
+
}
|
263
|
+
});
|
264
|
+
},
|
265
|
+
|
266
|
+
/**
|
267
|
+
* @param {number} totalPoints the maximum points that can be scored by the user
|
268
|
+
* @description this function verifies the functionality of minimum points when penalty points are not set and user attempts incorrect answer
|
269
|
+
*/
|
270
|
+
verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (totalPoints) => {
|
271
|
+
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', () => {
|
272
|
+
cy.log('Switch to edit tab and set minimum score if attempted points')
|
273
|
+
createQuestionBasePage.steps.switchToEditTab();
|
274
|
+
scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1')
|
275
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
276
|
+
multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInPreviewTabAnswerTable([[0, 1], [0, 1, 2], [1], [1]]);
|
277
|
+
multipleSelectionGridPage.previewScoreText()
|
278
|
+
.verifyInnerText(`1/${totalPoints}`);
|
279
|
+
});
|
280
|
+
|
281
|
+
it('When user removes minimum score awarded (if attempted) points, then in Preview tab on selecting any options other than correct answers, points should not be provided', () => {
|
282
|
+
cy.log('Switch to edit tab and remove minimum score if attempted points')
|
283
|
+
createQuestionBasePage.steps.switchToEditTab();
|
284
|
+
multipleSelectionGridPage.steps.clearMinimumScoreIfAttemptedPointsField();
|
285
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
286
|
+
multipleSelectionGridPage.steps.setAnswersForQuestionStemInPreviewTabAnswerTable(2, [2]);
|
287
|
+
multipleSelectionGridPage.steps.setAnswersForQuestionStemInPreviewTabAnswerTable(3, [0]);
|
288
|
+
multipleSelectionGridPage.previewScoreText()
|
289
|
+
.verifyInnerText(`0/${totalPoints}`);
|
290
|
+
});
|
291
|
+
},
|
292
|
+
|
293
|
+
/**
|
294
|
+
*
|
295
|
+
* @param {number} scoredPoints the points scored by the user
|
296
|
+
* @param {number} totalPoints the maximum points that can be scored by the user
|
297
|
+
* @description this function verifies the functionality of Penalty points when minimum points are not set and user attempts incorrect answer
|
298
|
+
*/
|
299
|
+
verifyPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
|
300
|
+
it('When user has defined penalty points', () => {
|
301
|
+
cy.log('Pre-step: Switch to edit tab and set penalty points');
|
302
|
+
createQuestionBasePage.steps.switchToEditTab();
|
303
|
+
multipleSelectionGridPage.steps.allotPenaltyPoints('3')
|
304
|
+
|
305
|
+
cy.log('After switching to preview tab, when user adds an incorrect answer input, then 0 points should be awarded(no negative points)');
|
306
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
307
|
+
multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInPreviewTabAnswerTable([[0, 1], [0, 1, 2], [1], [1]]);
|
308
|
+
multipleSelectionGridPage.previewScoreText()
|
309
|
+
.verifyInnerText(`0/${totalPoints}`);
|
310
|
+
|
311
|
+
cy.log('When user adds a partially correct answer input, the points should be updated accordingly with deducted penalty points');
|
312
|
+
multipleSelectionGridPage.steps.resetQuestionPreview()
|
313
|
+
multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInPreviewTabAnswerTable([[0, 2], [0, 2], [0, 1], [1, 2]]);
|
314
|
+
multipleSelectionGridPage.previewScoreText()
|
315
|
+
.verifyInnerText(`${scoredPoints}/${totalPoints}`);
|
316
|
+
});
|
317
|
+
},
|
318
|
+
|
319
|
+
/**
|
320
|
+
* @param {number} scoredPoints the points scored by the user
|
321
|
+
* @param {number} totalPoints the maximum points that can be scored by the user
|
322
|
+
* @description this function verifies the functionality of Minimum score if attempted points when penalty points are set and user attempts incorrect answer
|
323
|
+
*/
|
324
|
+
verifyMinimumScoreIfAttemptedAndPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
|
325
|
+
it('When user has defined both penalty points and minimum score awarded (if attempted) points', () => {
|
326
|
+
cy.log('Pre-step: Switch to edit tab and set minimum score awarded (if attempted) points');
|
327
|
+
createQuestionBasePage.steps.switchToEditTab();
|
328
|
+
scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1');
|
329
|
+
|
330
|
+
cy.log('Switch to preview tab and give incorrect answer input to check that minimum points are displayed');
|
331
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
332
|
+
multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInPreviewTabAnswerTable([[0, 1], [0, 1, 2], [1], [1]]);
|
333
|
+
multipleSelectionGridPage.previewScoreText()
|
334
|
+
.verifyInnerText(`1/${totalPoints}`);
|
335
|
+
|
336
|
+
cy.log('When user adds a partially correct answer such that the points of the attempt(with penalty points deducted) is more than the minimum score awarded(if attempted) points');
|
337
|
+
multipleSelectionGridPage.steps.resetQuestionPreview()
|
338
|
+
multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInPreviewTabAnswerTable([[0, 2], [0, 2], [0, 1], [1, 2]]);
|
339
|
+
multipleSelectionGridPage.previewScoreText()
|
340
|
+
.verifyInnerText(`${scoredPoints}/${totalPoints}`);
|
341
|
+
|
342
|
+
cy.log('When user switches to edit tab and increases the minimum score awarded (if attempted) points to check the case for an attempt in which points of the attempt is less than minimum score awarded (if attempted) points, then the minimum score awarded (if attempted) points should be displayed to the user');
|
343
|
+
createQuestionBasePage.steps.switchToEditTab();
|
344
|
+
multipleSelectionGridPage.steps.clearMinimumScoreIfAttemptedPointsField()
|
345
|
+
scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('6')
|
346
|
+
cy.log('Switching to preview tab');
|
347
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
348
|
+
multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInPreviewTabAnswerTable([[0, 2], [0, 2], [1], [1]]);
|
349
|
+
multipleSelectionGridPage.previewScoreText()
|
350
|
+
.verifyInnerText(`6/${totalPoints}`);
|
351
|
+
});
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
export const multipleSelectionGridPage = {
|
356
|
+
...selectors,
|
357
|
+
steps,
|
358
|
+
tests
|
359
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import { additionalSettingsPanel, autoScoredPreviewBase, createQuestionBasePage, mcqAdditionalSettingsBase, mcqOptionsComponent, mcqPreviewComponents, mcqSetCorrectAnswerSection, questionInstructionsComponent, scoringSectionBase, autoScoredAdditionalSettings, autoScoredSetCorrectAnswerSection, autoScoredScoringSectionMultipleResponsesType, autoScoredScoringSection, mcqScoringComponent, previewScoringAndShowCorrectAnswerComponent, optionsWrapperComponent } from "./components"
|
2
|
+
import { mcqQuestionCommonComponents } from "./components/mcqQuestionCommonComponents";
|
3
|
+
|
4
|
+
const selectors = {
|
5
|
+
...mcqAdditionalSettingsBase,
|
6
|
+
...scoringSectionBase,
|
7
|
+
...createQuestionBasePage,
|
8
|
+
...mcqQuestionCommonComponents,
|
9
|
+
...mcqOptionsComponent,
|
10
|
+
...additionalSettingsPanel,
|
11
|
+
...mcqSetCorrectAnswerSection,
|
12
|
+
...autoScoredPreviewBase,
|
13
|
+
...questionInstructionsComponent,
|
14
|
+
...autoScoredAdditionalSettings,
|
15
|
+
...autoScoredSetCorrectAnswerSection,
|
16
|
+
...autoScoredScoringSectionMultipleResponsesType,
|
17
|
+
...previewScoringAndShowCorrectAnswerComponent,
|
18
|
+
...optionsWrapperComponent,
|
19
|
+
//Maximum and minimum answers
|
20
|
+
minimumNumberOfAnswersLabel: () => cy.get('.min-answer-label'),
|
21
|
+
maximumNumberOfAnswersLabel: () => cy.get('.max-answer-label'),
|
22
|
+
minimumAnswersInputField: () => cy.get('.min-answer-input-field input'),
|
23
|
+
maximumAnswersInputField: () => cy.get('.max-answer-input-field input'),
|
24
|
+
minMaxErrorMessage: () => cy.get('.min-max-answer-error-wrapper')
|
25
|
+
}
|
26
|
+
|
27
|
+
const steps = {
|
28
|
+
...createQuestionBasePage.steps,
|
29
|
+
...questionInstructionsComponent.steps,
|
30
|
+
...mcqOptionsComponent.steps,
|
31
|
+
...additionalSettingsPanel.steps,
|
32
|
+
...autoScoredAdditionalSettings.steps,
|
33
|
+
...mcqPreviewComponents.steps,
|
34
|
+
...mcqSetCorrectAnswerSection.steps,
|
35
|
+
...autoScoredPreviewBase.steps,
|
36
|
+
...mcqQuestionCommonComponents.steps,
|
37
|
+
...scoringSectionBase.steps,
|
38
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
39
|
+
...autoScoredScoringSection.steps,
|
40
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
41
|
+
addPartialDifferentWeightsPoints: (optionIndex, points) => {
|
42
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(optionIndex)
|
43
|
+
.within(() => {
|
44
|
+
scoringSectionBase.pointsInputField()
|
45
|
+
.clear()
|
46
|
+
.type(points, { delay: 500 })
|
47
|
+
.should('have.value', points)
|
48
|
+
.blur();
|
49
|
+
});
|
50
|
+
},
|
51
|
+
|
52
|
+
//TODO: Remove this after https://redmine.zeuslearning.com/issues/528831 is fixed
|
53
|
+
verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked: () => {
|
54
|
+
cy.log('After deselecting Show correct answer checkbox, the question preview should return to the previous state');
|
55
|
+
previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
|
56
|
+
.click()
|
57
|
+
.should('not.be.checked');
|
58
|
+
autoScoredPreviewBase.correctIcon()
|
59
|
+
.should('not.exist');
|
60
|
+
autoScoredPreviewBase.incorrectIcon()
|
61
|
+
.should('not.exist');
|
62
|
+
autoScoredPreviewBase.correctIncorectAnswerLabel()
|
63
|
+
.should('not.exist');
|
64
|
+
autoScoredPreviewBase.steps.verifyCorrectIncorrectBorderNotExists();
|
65
|
+
},
|
66
|
+
}
|
67
|
+
|
68
|
+
const tests = {
|
69
|
+
...createQuestionBasePage.tests,
|
70
|
+
...questionInstructionsComponent.tests,
|
71
|
+
...mcqOptionsComponent.tests,
|
72
|
+
...additionalSettingsPanel.tests,
|
73
|
+
...mcqAdditionalSettingsBase.tests,
|
74
|
+
...mcqSetCorrectAnswerSection.tests,
|
75
|
+
...mcqQuestionCommonComponents.tests,
|
76
|
+
...scoringSectionBase.tests,
|
77
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
78
|
+
...autoScoredScoringSection.tests,
|
79
|
+
...autoScoredAdditionalSettings.tests,
|
80
|
+
...mcqScoringComponent.tests,
|
81
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
82
|
+
}
|
83
|
+
|
84
|
+
export const multipleSelectionPage = {
|
85
|
+
...selectors,
|
86
|
+
steps,
|
87
|
+
tests
|
88
|
+
}
|