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,951 @@
|
|
1
|
+
import { commonComponents } from "./commonComponents";
|
2
|
+
import { optionsWrapperComponent } from "./optionsWrapperComponent";
|
3
|
+
const css = Cypress.env('css');
|
4
|
+
|
5
|
+
const selectors = {
|
6
|
+
optionNumeration: () => cy.get('[class*="SingleOptionstyle__AdornmentWrapper"]'),
|
7
|
+
//Question Stem section
|
8
|
+
questionStemLabel: () => cy.get('.options-label').eq(0),
|
9
|
+
addQuestionStemButton: () => cy.get('.add-option-wrapper-cls button').eq(0),
|
10
|
+
buttonDeleteQuestionStem: () => cy.get('[aria-label*="Delete stem"]'),
|
11
|
+
//TODO: Need to add unique class name once available https://redmine.zeuslearning.com/issues/518498
|
12
|
+
questionStemWrapper: () => cy.get('.edit-mcq-options-wrapper').eq(0).find('.edit-mcq-option-wrapper'),
|
13
|
+
questionStemInputField: () => cy.get('[title="Enter question stem"]'),
|
14
|
+
//Options section
|
15
|
+
optionsLabel: () => cy.get('.options-label').eq(1),
|
16
|
+
addOptionButton: () => cy.get('.add-option-wrapper-cls button').eq(1),
|
17
|
+
optionWrapper: () => cy.get('.edit-mcq-options-wrapper').eq(1).find('.edit-mcq-option-wrapper'),
|
18
|
+
optionInputField: () => cy.get('[title="Enter option"]'),
|
19
|
+
buttonDeleteOption: () => cy.get('[aria-label*="Delete option"]'),
|
20
|
+
//Set correct answer section
|
21
|
+
setCorrectAnswerTable: () => cy.get('.single-selection-grid-wrapper'),
|
22
|
+
setCorrectAnswerTableRow: () => cy.get('[data-testid*="MUIDataTableBodyRow"]'),
|
23
|
+
setCorrectAnswerTableHeader: () => cy.get('.table-header.option-header-cell'),
|
24
|
+
setCorrectAnswerTableInlineOptions: () => cy.get('.single-selection-grid-radio-label-wrapper .question-text-wrapper'),
|
25
|
+
setCorrectAnswerTableNoQuestionStemAddedLabel: () => cy.get('.option-label.all-stem-empty'),
|
26
|
+
setCorrectAnswerTableQuestionStemTitle: () => cy.get('[id*="stem-header-id"] .question-text-wrapper'),
|
27
|
+
setCorrectAnswertableQuestionStem: () => cy.get('.stem-cell-data .question-text-wrapper'),
|
28
|
+
//Preview tab
|
29
|
+
previewTabAnswerTableQuestionStemTitle: () => cy.get('.edit-question-preview-wrapper [class*="TableHeaderstyles__ContentWrapper"]').eq(0),
|
30
|
+
previewTabAnswerTableNoQuestionStemAddedLabel: () => cy.get('.edit-question-preview-wrapper .option-label.all-stem-empty'),
|
31
|
+
previewTabAnswerTableRow: () => cy.get('.edit-question-preview-wrapper [data-testid*="MUIDataTableBodyRow"]'),
|
32
|
+
previewTabAnswerTableHeader: () => cy.get('.edit-question-preview-wrapper .table-header.option-header-cell'),
|
33
|
+
previewTabAnswertableQuestionStem: () => cy.get('.edit-question-preview-wrapper .stem-cell-data .question-text-wrapper'),
|
34
|
+
previewTabAnswerTable: () => cy.get('.edit-question-preview-wrapper .single-selection-grid-wrapper'),
|
35
|
+
previewTabAnswerTableInlineOptions: () => cy.get('.edit-question-preview-wrapper .single-selection-grid-radio-label-wrapper .question-text-wrapper'),
|
36
|
+
//Randomize options
|
37
|
+
randomizeOptionsCheckbox: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] input'),
|
38
|
+
randomizeOptionsCheckboxLabel: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] .MuiFormControlLabel-label'),
|
39
|
+
//Scoring
|
40
|
+
partialEqualWeightsPointsPerResponseScore: () => cy.get('.partial-different-points-wrapper [aria-label*="Points per response"]'),
|
41
|
+
partialDifferentWeightsPointsInputField: () => cy.get('.partial-different-points-wrapper .points-input-field input[type="text"]'),
|
42
|
+
correctIncorrectIconWrapper: () => cy.get('.tick-icon-wrapper'),
|
43
|
+
correctIncorrectAnswerBorder: () => cy.get('.edit-question-preview-wrapper [class*="indexstyles__CorrectIncorrectBorderWrapper"]'),
|
44
|
+
//Additional settings
|
45
|
+
gridStyleLabel: () => cy.get('#Grid-style-dropdown-label'),
|
46
|
+
gridStyleDropdown: () => cy.get('#Grid-style-select'),
|
47
|
+
gridStyleDropdownOptions: () => cy.get('[aria-labelledby*="Grid-style-dropdown-label"] .dropdown-menu-item'),
|
48
|
+
questionStemNumerationLabel: () => cy.get('#Question-stem-numeration-dropdown-label'),
|
49
|
+
questionStemNumerationDropdown: () => cy.get('#Question-stem-numeration-select'),
|
50
|
+
questionStemNumerationDropdownOptions: () => cy.get('[aria-labelledby*="Question-stem-numeration-dropdown-label"] .dropdown-menu-item'),
|
51
|
+
questionStemNumeration: () => cy.get('.stem-numeration-wrapper'),
|
52
|
+
previewTabQuestionStemNumeration: () => cy.get('.edit-question-preview-wrapper .stem-numeration-wrapper'),
|
53
|
+
titleForQuestionStemsLabel: () => cy.get('[class*="SingleSelectionGridstyles__InlineTextWrapper"] .additional-settings-label').eq(0),
|
54
|
+
titleForQuestionStemInputField: () => cy.get('[title="Title for question stems"]'),
|
55
|
+
titleForOptionsLabel: () => cy.get('[class*="SingleSelectionGridstyles__InlineTextWrapper"] .additional-settings-label').eq(1),
|
56
|
+
titleForOptionsInputField: () => cy.get('[title="Title for options"]'),
|
57
|
+
setCorrectAnswerTableOptionsTitle: () => cy.get('.options-title'),
|
58
|
+
setCorrectAnswerTableQuestionStemWrapper: () => cy.get('[class*="TableHeaderstyles__ContentWrapper"]').eq(0),
|
59
|
+
previewTabAnswerTableOptionsTitle: () => cy.get('.edit-question-preview-wrapper .options-title'),
|
60
|
+
questionStemWidthLabel: () => cy.get('[aria-labelledby="Question stem width"]'),
|
61
|
+
questionStemWidthInputField: () => cy.get('[aria-label="Question stem width"]'),
|
62
|
+
optionsWidthLabel: () => cy.get('[aria-labelledby="Option width"]'),
|
63
|
+
optionWidthInputField: () => cy.get('[aria-label="Option width"]'),
|
64
|
+
previousButton: () => cy.get('.left-side-button-wrapper button'),
|
65
|
+
nextButton: () => cy.get('.right-side-button-wrapper button')
|
66
|
+
}
|
67
|
+
|
68
|
+
const steps = {
|
69
|
+
addQuestionStem: () => {
|
70
|
+
gridCommonComponents.addQuestionStemButton()
|
71
|
+
.click()
|
72
|
+
.focus()
|
73
|
+
.blur();
|
74
|
+
},
|
75
|
+
|
76
|
+
deleteQuestionStem: (index) => {
|
77
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
78
|
+
.eq(index)
|
79
|
+
.click();
|
80
|
+
},
|
81
|
+
|
82
|
+
verifyQuestionStemDisabledDeleteButton: (index) => {
|
83
|
+
gridCommonComponents.questionStemWrapper()
|
84
|
+
.eq(index)
|
85
|
+
.within(() => {
|
86
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
87
|
+
.should('be.disabled');
|
88
|
+
});
|
89
|
+
},
|
90
|
+
|
91
|
+
verifyAddQuestionStemLabel: () => {
|
92
|
+
gridCommonComponents.addQuestionStemButton()
|
93
|
+
.verifyInnerText('Add question stem')
|
94
|
+
.should('be.visible');
|
95
|
+
},
|
96
|
+
|
97
|
+
verifyQuestionStemErrorMessageIsNotDisplayed: (index) => {
|
98
|
+
gridCommonComponents.questionStemWrapper()
|
99
|
+
.eq(index)
|
100
|
+
.within(() => {
|
101
|
+
commonComponents.errorMessage()
|
102
|
+
.should('not.exist');
|
103
|
+
});
|
104
|
+
},
|
105
|
+
|
106
|
+
verifyQuestionStemErrorMessageIsDisplayed: (index) => {
|
107
|
+
gridCommonComponents.questionStemWrapper()
|
108
|
+
.eq(index)
|
109
|
+
.within(() => {
|
110
|
+
commonComponents.errorMessage()
|
111
|
+
.should('have.text', 'Error: Question stem is required.');
|
112
|
+
});
|
113
|
+
},
|
114
|
+
|
115
|
+
addInputToQuestionStemField: (stemIndex, responseFieldText) => {
|
116
|
+
gridCommonComponents.questionStemInputField()
|
117
|
+
.eq(stemIndex)
|
118
|
+
.type(responseFieldText, { delay: 0 })
|
119
|
+
.should('have.text', responseFieldText);
|
120
|
+
},
|
121
|
+
|
122
|
+
addInputToAllQuestionStemFields: (responseTextArray) => {
|
123
|
+
responseTextArray.forEach((responseFieldText, optionIndex) => {
|
124
|
+
steps.addInputToQuestionStemField(optionIndex, responseFieldText)
|
125
|
+
});
|
126
|
+
},
|
127
|
+
|
128
|
+
verifyQuestionStemContents: (index) => {
|
129
|
+
gridCommonComponents.questionStemWrapper()
|
130
|
+
.eq(index)
|
131
|
+
.within(() => {
|
132
|
+
optionsWrapperComponent.optionsInputField()
|
133
|
+
.should('have.attr', 'data-cke-editorplaceholder', 'Enter question stem')
|
134
|
+
commonComponents.dragHandleButton()
|
135
|
+
.should('exist');
|
136
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
137
|
+
.should('be.visible');
|
138
|
+
gridCommonComponents.optionNumeration()
|
139
|
+
.should('have.text', index + 1);
|
140
|
+
});
|
141
|
+
},
|
142
|
+
|
143
|
+
verifyDragHandleTooltipForQuestionStem: () => {
|
144
|
+
gridCommonComponents.questionStemWrapper()
|
145
|
+
.eq(0)
|
146
|
+
.within(() => {
|
147
|
+
commonComponents.dragHandleButton()
|
148
|
+
.trigger('mouseover');
|
149
|
+
});
|
150
|
+
commonComponents.tooltipText()
|
151
|
+
.should('have.text', 'Drag to reorder');
|
152
|
+
gridCommonComponents.questionStemWrapper()
|
153
|
+
.eq(0)
|
154
|
+
.within(() => {
|
155
|
+
commonComponents.dragHandleButton()
|
156
|
+
.trigger('mouseout');
|
157
|
+
});
|
158
|
+
commonComponents.tooltipText()
|
159
|
+
.should('not.exist');
|
160
|
+
},
|
161
|
+
|
162
|
+
|
163
|
+
verifyDeleteButtonTooltipForQuestionStem: () => {
|
164
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
165
|
+
.eq(0)
|
166
|
+
.trigger('mouseover');
|
167
|
+
commonComponents.tooltipText()
|
168
|
+
.should('have.text', 'Delete stem');
|
169
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
170
|
+
.eq(0)
|
171
|
+
.trigger('mouseout');
|
172
|
+
commonComponents.tooltipText()
|
173
|
+
.should('not.exist');
|
174
|
+
},
|
175
|
+
|
176
|
+
verifyDisabledDeleteButtonTooltipForQuestionStem: () => {
|
177
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
178
|
+
.trigger('mouseover', { force: true });
|
179
|
+
commonComponents.tooltipText()
|
180
|
+
.should('have.text', 'Minimum one question stem is required');
|
181
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
182
|
+
.trigger('mouseout', { force: true });
|
183
|
+
commonComponents.tooltipText()
|
184
|
+
.should('not.exist');
|
185
|
+
},
|
186
|
+
|
187
|
+
focusInAndFocusOutOfQuestionStemInputField: (index) => {
|
188
|
+
gridCommonComponents.questionStemWrapper()
|
189
|
+
.eq(index)
|
190
|
+
.within(() => {
|
191
|
+
gridCommonComponents.questionStemInputField()
|
192
|
+
.click()
|
193
|
+
.blur();
|
194
|
+
});
|
195
|
+
},
|
196
|
+
|
197
|
+
/**
|
198
|
+
* @param {number} countOfQuestionStems count of question stem input fields
|
199
|
+
* @description this function verifies the number of question stem input fields
|
200
|
+
*/
|
201
|
+
verifyCountOfQuestionStemInputFields: (countOfQuestionStems) => {
|
202
|
+
gridCommonComponents.questionStemWrapper()
|
203
|
+
.should('have.length', countOfQuestionStems);
|
204
|
+
},
|
205
|
+
|
206
|
+
//Options
|
207
|
+
verifyAddOptionsButton: () => {
|
208
|
+
gridCommonComponents.addOptionButton()
|
209
|
+
.verifyInnerText('Add option')
|
210
|
+
.should('be.visible');
|
211
|
+
},
|
212
|
+
|
213
|
+
addOption: () => {
|
214
|
+
gridCommonComponents.addOptionButton()
|
215
|
+
.click();
|
216
|
+
},
|
217
|
+
|
218
|
+
deleteOption: (index) => {
|
219
|
+
gridCommonComponents.buttonDeleteOption()
|
220
|
+
.eq(index)
|
221
|
+
.click();
|
222
|
+
},
|
223
|
+
|
224
|
+
verifyOptionsLabel: () => {
|
225
|
+
//V3- Need to update once common functions are available
|
226
|
+
gridCommonComponents.optionsLabel()
|
227
|
+
.verifyInnerText('Options')
|
228
|
+
.should('be.visible');
|
229
|
+
},
|
230
|
+
|
231
|
+
|
232
|
+
/**
|
233
|
+
* @param {number} optionIndex
|
234
|
+
* @description this function checks if delete option button is enabled
|
235
|
+
*/
|
236
|
+
verifyOptionsDeleteButtonEnabled: (optionIndex) => {
|
237
|
+
gridCommonComponents.optionWrapper()
|
238
|
+
.eq(optionIndex)
|
239
|
+
.within(() => {
|
240
|
+
commonComponents.steps.verifyDeleteButtonEnabled()
|
241
|
+
});
|
242
|
+
},
|
243
|
+
|
244
|
+
/**
|
245
|
+
* @param {number} index of the option
|
246
|
+
* @description verify the enter option input field, drag handle, delete button and option numeration
|
247
|
+
*/
|
248
|
+
verifyOptionsContents: (index) => {
|
249
|
+
gridCommonComponents.optionWrapper()
|
250
|
+
.eq(index)
|
251
|
+
.within(() => {
|
252
|
+
optionsWrapperComponent.optionsInputField()
|
253
|
+
.should('have.attr', 'data-cke-editorplaceholder', 'Enter option');
|
254
|
+
commonComponents.dragHandleButton()
|
255
|
+
.should('exist');
|
256
|
+
gridCommonComponents.buttonDeleteOption()
|
257
|
+
.should('be.visible');
|
258
|
+
gridCommonComponents.optionNumeration()
|
259
|
+
.should('have.text', index + 1);
|
260
|
+
});
|
261
|
+
},
|
262
|
+
|
263
|
+
verifyOptionsDeleteButtonDisabled: (index) => {
|
264
|
+
gridCommonComponents.optionWrapper()
|
265
|
+
.eq(index)
|
266
|
+
.within(() => {
|
267
|
+
gridCommonComponents.buttonDeleteOption()
|
268
|
+
.should('be.disabled');
|
269
|
+
});
|
270
|
+
},
|
271
|
+
|
272
|
+
addInputToOptionField: (optionIndex, responseFieldText) => {
|
273
|
+
gridCommonComponents.optionInputField()
|
274
|
+
.eq(optionIndex)
|
275
|
+
.type(responseFieldText, { delay: 0 })
|
276
|
+
.should('have.text', responseFieldText);
|
277
|
+
},
|
278
|
+
|
279
|
+
addInputToAllOptionsFields: (responseTextArray) => {
|
280
|
+
responseTextArray.forEach((responseFieldText, optionIndex) => {
|
281
|
+
steps.addInputToOptionField(optionIndex, responseFieldText);
|
282
|
+
});
|
283
|
+
},
|
284
|
+
|
285
|
+
verifyOptionsErrorMessageIsDisplayed: (index) => {
|
286
|
+
gridCommonComponents.optionWrapper()
|
287
|
+
.eq(index)
|
288
|
+
.within(() => {
|
289
|
+
commonComponents.errorMessage()
|
290
|
+
.should('have.text', 'Error: Option is required.');
|
291
|
+
});
|
292
|
+
},
|
293
|
+
|
294
|
+
verifyOptionsErrorMessageIsNotDisplayed: (index) => {
|
295
|
+
gridCommonComponents.optionWrapper()
|
296
|
+
.eq(index)
|
297
|
+
.within(() => {
|
298
|
+
commonComponents.errorMessage()
|
299
|
+
.should('not.exist');
|
300
|
+
});
|
301
|
+
},
|
302
|
+
|
303
|
+
verifyDragHandleTooltipForOption: () => {
|
304
|
+
gridCommonComponents.optionWrapper()
|
305
|
+
.eq(0)
|
306
|
+
.within(() => {
|
307
|
+
commonComponents.dragHandleButton()
|
308
|
+
.trigger('mouseover');
|
309
|
+
});
|
310
|
+
commonComponents.tooltipText()
|
311
|
+
.should('have.text', 'Drag to reorder');
|
312
|
+
gridCommonComponents.optionWrapper()
|
313
|
+
.eq(0)
|
314
|
+
.within(() => {
|
315
|
+
commonComponents.dragHandleButton()
|
316
|
+
.trigger('mouseout');
|
317
|
+
});
|
318
|
+
commonComponents.tooltipText()
|
319
|
+
.should('not.exist');
|
320
|
+
},
|
321
|
+
|
322
|
+
verifyDeleteButtonTooltipForOption: () => {
|
323
|
+
gridCommonComponents.buttonDeleteOption()
|
324
|
+
.eq(0)
|
325
|
+
.trigger('mouseover');
|
326
|
+
commonComponents.tooltipText()
|
327
|
+
.should('have.text', 'Delete option');
|
328
|
+
gridCommonComponents.buttonDeleteOption()
|
329
|
+
.eq(0)
|
330
|
+
.trigger('mouseout');
|
331
|
+
commonComponents.tooltipText()
|
332
|
+
.should('not.exist');
|
333
|
+
},
|
334
|
+
|
335
|
+
verifyDisabledDeleteButtonTooltipForOption: () => {
|
336
|
+
gridCommonComponents.buttonDeleteOption()
|
337
|
+
.eq(0)
|
338
|
+
.trigger('mouseover', { force: true });
|
339
|
+
commonComponents.tooltipText()
|
340
|
+
.should('have.text', 'Minimum two options are required');
|
341
|
+
gridCommonComponents.buttonDeleteOption()
|
342
|
+
.eq(0)
|
343
|
+
.trigger('mouseout', { force: true });
|
344
|
+
commonComponents.tooltipText()
|
345
|
+
.should('not.exist');
|
346
|
+
},
|
347
|
+
|
348
|
+
focusInAndFocusOutOfOptionsInputField: (index) => {
|
349
|
+
gridCommonComponents.optionWrapper()
|
350
|
+
.eq(index)
|
351
|
+
.within(() => {
|
352
|
+
gridCommonComponents.optionInputField()
|
353
|
+
.click()
|
354
|
+
.blur();
|
355
|
+
});
|
356
|
+
},
|
357
|
+
|
358
|
+
/**
|
359
|
+
* @param {number} countOfOptionsInputField count of options input fields
|
360
|
+
* @description this function verifies the number of options input fields
|
361
|
+
*/
|
362
|
+
verifyCountOfOptionsInputField: (countOfOptionsInputField) => {
|
363
|
+
gridCommonComponents.optionInputField()
|
364
|
+
.should('have.length', countOfOptionsInputField);
|
365
|
+
},
|
366
|
+
|
367
|
+
//Set correct answer section
|
368
|
+
/**
|
369
|
+
* @param {number} rowIndex index of the row
|
370
|
+
* @description this function verifies that an row does not exist
|
371
|
+
*/
|
372
|
+
verifyTableRowDoesNotExistInSetCorrectAnswerTable: (rowIndex) => {
|
373
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
374
|
+
.eq(rowIndex)
|
375
|
+
.should('not.exist');
|
376
|
+
},
|
377
|
+
|
378
|
+
/**
|
379
|
+
* @param {string[]} questionStemsArray array of question stems
|
380
|
+
* @description this function verifies the question stems in the set correct answer table
|
381
|
+
*/
|
382
|
+
verifyQuestionStemsInSetCorrectAnswerTable: (questionStemsArray) => {
|
383
|
+
questionStemsArray.forEach((questionStemsFieldtext, optionIndex) => {
|
384
|
+
gridCommonComponents.setCorrectAnswertableQuestionStem()
|
385
|
+
.eq(optionIndex)
|
386
|
+
.should('have.text', questionStemsFieldtext);
|
387
|
+
});
|
388
|
+
},
|
389
|
+
|
390
|
+
/**
|
391
|
+
* @param {number} columnIndex index of the column
|
392
|
+
* @description this function verifies that an column exists and is empty
|
393
|
+
*/
|
394
|
+
verifyEmptyTableHeaderInSetCorrectAnswerTable: (index) => {
|
395
|
+
gridCommonComponents.setCorrectAnswerTableHeader()
|
396
|
+
.eq(index)
|
397
|
+
.should('be.visible')
|
398
|
+
.verifyInnerText('');
|
399
|
+
},
|
400
|
+
|
401
|
+
/**
|
402
|
+
* @param {number} columnIndex index of the column
|
403
|
+
* @description this function verifies that an column does not exist
|
404
|
+
*/
|
405
|
+
verifyTableHeaderDoesNotExistInSetCorrectAnswerTable: (index) => {
|
406
|
+
gridCommonComponents.setCorrectAnswerTableHeader()
|
407
|
+
.eq(index)
|
408
|
+
.should('not.exist');
|
409
|
+
},
|
410
|
+
|
411
|
+
/**
|
412
|
+
* @param {string[]} optionsTextArray string of options
|
413
|
+
* @description this function verifies the options present in the table header of preview tab answer table
|
414
|
+
*/
|
415
|
+
verifyTableHeaderContentsInSetCorrectAnswerTable: (optionsTextArray) => {
|
416
|
+
optionsTextArray.forEach((optionsText, index) => {
|
417
|
+
gridCommonComponents.setCorrectAnswerTableHeader()
|
418
|
+
.eq(index)
|
419
|
+
.should('have.text', optionsText)
|
420
|
+
});
|
421
|
+
},
|
422
|
+
|
423
|
+
//Preview tab
|
424
|
+
/**
|
425
|
+
* @param {number} rowIndex index of the row
|
426
|
+
* @description this function verifies that an row does not exist
|
427
|
+
*/
|
428
|
+
verifyTableRowDoesNotExistInPreviewTabAnswerTable: (index) => {
|
429
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
430
|
+
.eq(index)
|
431
|
+
.should('not.exist');
|
432
|
+
},
|
433
|
+
|
434
|
+
/**
|
435
|
+
* @param {string[]} questionStemsArray array of question stems
|
436
|
+
* @description this function verifies the question stems in the preview tab answer table
|
437
|
+
*/
|
438
|
+
verifyQuestionStemsInPreviewTabAnswerTable: (questionStemsArray) => {
|
439
|
+
questionStemsArray.forEach((questionStemsFieldtext, optionIndex) => {
|
440
|
+
gridCommonComponents.previewTabAnswertableQuestionStem()
|
441
|
+
.eq(optionIndex)
|
442
|
+
.should('have.text', questionStemsFieldtext);
|
443
|
+
});
|
444
|
+
},
|
445
|
+
|
446
|
+
/**
|
447
|
+
* @param {number} columnIndex index of the column
|
448
|
+
* @description this function verifies that an column exists and is empty
|
449
|
+
*/
|
450
|
+
verifyEmptyTableHeaderInPreviewTabAnswerTable: (index) => {
|
451
|
+
gridCommonComponents.previewTabAnswerTableHeader()
|
452
|
+
.eq(index)
|
453
|
+
.should('be.visible')
|
454
|
+
.verifyInnerText('');
|
455
|
+
},
|
456
|
+
|
457
|
+
/**
|
458
|
+
* @param {number} columnIndex index of the column
|
459
|
+
* @description this function verifies that an column does not exist
|
460
|
+
*/
|
461
|
+
verifyColumnHeaderDoesNotExistInPreviewTabAnswerTable: (columnIndex) => {
|
462
|
+
gridCommonComponents.previewTabAnswerTableHeader()
|
463
|
+
.eq(columnIndex)
|
464
|
+
.should('not.exist');
|
465
|
+
},
|
466
|
+
|
467
|
+
/**
|
468
|
+
* @param {string[]} optionsTextArray string of options
|
469
|
+
* @description this function verifies the options present in the table header of preview tab answer table
|
470
|
+
*/
|
471
|
+
verifyTableHeaderContentsInPreviewTabAnswerTable: (optionsTextArray) => {
|
472
|
+
optionsTextArray.forEach((optionsText, index) => {
|
473
|
+
gridCommonComponents.previewTabAnswerTableHeader()
|
474
|
+
.eq(index)
|
475
|
+
.should('have.text', optionsText)
|
476
|
+
});
|
477
|
+
},
|
478
|
+
|
479
|
+
//Scoring
|
480
|
+
/**
|
481
|
+
* @param {number} points the points to be displayed in the partial equal weights points field
|
482
|
+
* @description this function checks the points per response in partial equal weights
|
483
|
+
*/
|
484
|
+
verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
|
485
|
+
gridCommonComponents.partialEqualWeightsPointsPerResponseScore()
|
486
|
+
.each(($element) => {
|
487
|
+
cy.wrap($element)
|
488
|
+
.verifyInnerText(points);
|
489
|
+
});
|
490
|
+
},
|
491
|
+
|
492
|
+
/**
|
493
|
+
* @description this function checks if the partial different weights points field is empty and visible
|
494
|
+
*/
|
495
|
+
verifyPartialDifferentWeightsPointsInputFieldIsEmpty: () => {
|
496
|
+
gridCommonComponents.partialDifferentWeightsPointsInputField()
|
497
|
+
.each(($element) => {
|
498
|
+
cy.wrap($element)
|
499
|
+
.should('have.value', '')
|
500
|
+
.and('exist');
|
501
|
+
});
|
502
|
+
},
|
503
|
+
|
504
|
+
/**
|
505
|
+
* @description this function checks if the partial different weights points field is disabled
|
506
|
+
*/
|
507
|
+
verifyPartialDifferentWeightsPointsInputFieldIsDisabled: () => {
|
508
|
+
gridCommonComponents.partialDifferentWeightsPointsInputField()
|
509
|
+
.each(($element) => {
|
510
|
+
cy.wrap($element)
|
511
|
+
.should('be.disabled');
|
512
|
+
});
|
513
|
+
},
|
514
|
+
|
515
|
+
/**
|
516
|
+
* @description this function checks if the partial different weights points field is enabled
|
517
|
+
*/
|
518
|
+
verifyPartialDifferentWeightsPointsInputFieldIsEnabled: () => {
|
519
|
+
gridCommonComponents.partialDifferentWeightsPointsInputField()
|
520
|
+
.each(($element) => {
|
521
|
+
cy.wrap($element)
|
522
|
+
.should('be.enabled');
|
523
|
+
});
|
524
|
+
},
|
525
|
+
|
526
|
+
/**
|
527
|
+
* @param {number[]} pointsArray the array of points to be alloted to each question stem
|
528
|
+
* @description this function allots points to all the question stems
|
529
|
+
*/
|
530
|
+
allotPartialDifferentWeightsToAllPointsFields: (pointsArray) => {
|
531
|
+
pointsArray.forEach((points, columnIndex) => {
|
532
|
+
gridCommonComponents.partialDifferentWeightsPointsInputField()
|
533
|
+
.eq(columnIndex)
|
534
|
+
.clear()
|
535
|
+
.type(points, { delay: 0 })
|
536
|
+
.should('have.value', points);
|
537
|
+
});
|
538
|
+
},
|
539
|
+
|
540
|
+
//Randomize options
|
541
|
+
getQuestionStemsArray: () => {
|
542
|
+
const questionStemsArray = []
|
543
|
+
gridCommonComponents.previewTabAnswertableQuestionStem()
|
544
|
+
.each(($el) => {
|
545
|
+
cy.wrap($el)
|
546
|
+
.invoke('text')
|
547
|
+
.then((text) => {
|
548
|
+
questionStemsArray.push(text);
|
549
|
+
});
|
550
|
+
});
|
551
|
+
return questionStemsArray;
|
552
|
+
},
|
553
|
+
|
554
|
+
verifyRandomizeOptionsCheckboxUnchecked: () => {
|
555
|
+
gridCommonComponents.randomizeOptionsCheckbox()
|
556
|
+
.should('exist')
|
557
|
+
.should('not.be.checked');
|
558
|
+
},
|
559
|
+
|
560
|
+
selectRandomizeOptionsCheckbox: () => {
|
561
|
+
gridCommonComponents.randomizeOptionsCheckbox()
|
562
|
+
.click()
|
563
|
+
.should('be.checked');
|
564
|
+
},
|
565
|
+
|
566
|
+
deselectRandomizeOptionsCheckbox: () => {
|
567
|
+
gridCommonComponents.randomizeOptionsCheckbox()
|
568
|
+
.click()
|
569
|
+
.should('not.be.checked');
|
570
|
+
},
|
571
|
+
|
572
|
+
verifyRandomizeQuestionStemsOrder: (questionStemsArray) => {
|
573
|
+
let currentQuestionStems = [...questionStemsArray]
|
574
|
+
for (let index = 0; index < currentQuestionStems.length; index++) {
|
575
|
+
gridCommonComponents.previewTabAnswertableQuestionStem()
|
576
|
+
.eq(index)
|
577
|
+
.then(($element) => {
|
578
|
+
expect($element.text()).to.be.oneOf(currentQuestionStems);
|
579
|
+
currentQuestionStems = currentQuestionStems.filter((value) => value !== $element.text())
|
580
|
+
});
|
581
|
+
};
|
582
|
+
gridCommonComponents.steps.verifyQuestionStemsAreRerandomized(questionStemsArray)
|
583
|
+
},
|
584
|
+
|
585
|
+
/**
|
586
|
+
* @param {string[]} previousOrderOfQuestionStemsArray array of previous order of the question stems
|
587
|
+
* @description this function verifies that the order of the question stems is different from the previous order
|
588
|
+
*/
|
589
|
+
verifyQuestionStemsAreRerandomized: (previousOrderOfQuestionStemsArray) => {
|
590
|
+
gridCommonComponents.previewTabAnswertableQuestionStem()
|
591
|
+
.should('not.have.text', '')
|
592
|
+
.and('not.have.text', previousOrderOfQuestionStemsArray.join(''));
|
593
|
+
},
|
594
|
+
|
595
|
+
verifyPleaseSetACorrectAnswerErrorMessage: () => {
|
596
|
+
commonComponents.errorMessage()
|
597
|
+
.eq(1)
|
598
|
+
.verifyInnerText('Error: Please set a correct answer.')
|
599
|
+
.should('be.visible');
|
600
|
+
},
|
601
|
+
|
602
|
+
navigateForwardUsingNextButton: () => {
|
603
|
+
gridCommonComponents.nextButton()
|
604
|
+
.click();
|
605
|
+
},
|
606
|
+
|
607
|
+
navigateBackwardUsingPreviousButton: () => {
|
608
|
+
gridCommonComponents.previousButton()
|
609
|
+
.click();
|
610
|
+
},
|
611
|
+
|
612
|
+
expandGridStyleDropdown: () => {
|
613
|
+
gridCommonComponents.gridStyleDropdown()
|
614
|
+
.click();
|
615
|
+
},
|
616
|
+
|
617
|
+
/**
|
618
|
+
* @param {string} dropdownOption the parameter should be one of 'With border', 'Row dividers', 'No border', 'Inline', 'Inline - row dividers'
|
619
|
+
* @description This function selects an dropdown option
|
620
|
+
*/
|
621
|
+
selectGridStyleDropdownOption: (dropdownOption) => {
|
622
|
+
steps.expandGridStyleDropdown()
|
623
|
+
gridCommonComponents.gridStyleDropdownOptions()
|
624
|
+
.contains(dropdownOption)
|
625
|
+
.click();
|
626
|
+
},
|
627
|
+
|
628
|
+
/**
|
629
|
+
* @param {array} dropdownOptionsArray array of grid style dropdown options
|
630
|
+
* @description This function is used to verify the grid style dropdown options
|
631
|
+
*/
|
632
|
+
verifyGridStyleDropdownOptions: (dropdownOptionsArray) => {
|
633
|
+
gridCommonComponents.gridStyleDropdownOptions()
|
634
|
+
.each(($el, index) => {
|
635
|
+
cy.wrap($el)
|
636
|
+
.should('have.text', dropdownOptionsArray[index])
|
637
|
+
});
|
638
|
+
},
|
639
|
+
|
640
|
+
expandQuestionStemNumerationDropdown: () => {
|
641
|
+
gridCommonComponents.questionStemNumerationDropdown()
|
642
|
+
.click();
|
643
|
+
},
|
644
|
+
|
645
|
+
/**
|
646
|
+
* @param {string} dropdownOption string of the dropdown option to be selected
|
647
|
+
*/
|
648
|
+
selectQuestionStemNumerationDropdownOption: (dropdownOption) => {
|
649
|
+
steps.expandQuestionStemNumerationDropdown()
|
650
|
+
gridCommonComponents.questionStemNumerationDropdownOptions()
|
651
|
+
.contains(dropdownOption)
|
652
|
+
.click();
|
653
|
+
},
|
654
|
+
|
655
|
+
/**
|
656
|
+
* @param {*} dropdownOptionsArray array of question stem numeration dropdown options
|
657
|
+
* @description This function is used to verify the question stem numeration dropdown options
|
658
|
+
*/
|
659
|
+
verifyQuestionStemNumerationDropdownOptions: (dropdownOptionsArray) => {
|
660
|
+
gridCommonComponents.questionStemNumerationDropdownOptions()
|
661
|
+
.each(($el, index) => {
|
662
|
+
cy.wrap($el)
|
663
|
+
.should('have.text', dropdownOptionsArray[index])
|
664
|
+
});
|
665
|
+
},
|
666
|
+
|
667
|
+
/**
|
668
|
+
* @param {number[]} numerationArray array of numeration i.e. numbers, lowercase, uppercase
|
669
|
+
* @description This function verifies the numeration in set correct answer table
|
670
|
+
*/
|
671
|
+
verifyQuestionStemNumerationInSetCorrectAnswerTable: (numerationArray) => {
|
672
|
+
gridCommonComponents.setCorrectAnswerTable()
|
673
|
+
.within(() => {
|
674
|
+
gridCommonComponents.questionStemNumeration()
|
675
|
+
.each(($el, index) => {
|
676
|
+
cy.wrap($el)
|
677
|
+
.should('have.text', numerationArray[index]);
|
678
|
+
});
|
679
|
+
});
|
680
|
+
},
|
681
|
+
|
682
|
+
/**
|
683
|
+
* @param {number[]} numerationArray array of numeration i.e. numbers, lowercase, uppercase
|
684
|
+
* @description This function verifies the numeration in preview tab answer table
|
685
|
+
*/
|
686
|
+
verifyQuestionStemNumerationInPreviewTabAnswerTable: (numerationArray) => {
|
687
|
+
gridCommonComponents.previewTabAnswerTable()
|
688
|
+
.within(() => {
|
689
|
+
gridCommonComponents.questionStemNumeration()
|
690
|
+
.each(($el, index) => {
|
691
|
+
cy.wrap($el)
|
692
|
+
.should('have.text', numerationArray[index]);
|
693
|
+
});
|
694
|
+
});
|
695
|
+
},
|
696
|
+
|
697
|
+
/**
|
698
|
+
* @param {string} titleText text to be added to the Title for Question stem input field
|
699
|
+
* @description This function adds input to the Title for Question stem input field
|
700
|
+
*/
|
701
|
+
addInputToTitleForQuestionStemInputField: (titleText) => {
|
702
|
+
gridCommonComponents.titleForQuestionStemInputField()
|
703
|
+
.clear()
|
704
|
+
.type(titleText)
|
705
|
+
.should('have.text', titleText)
|
706
|
+
.blur();
|
707
|
+
},
|
708
|
+
|
709
|
+
/**
|
710
|
+
* @param {string} titleText text to be added to the Title for Options input field
|
711
|
+
* @description This function adds input to the Title for Options input field
|
712
|
+
*/
|
713
|
+
addInputToTitleForOptionsInputField: (titleText) => {
|
714
|
+
gridCommonComponents.titleForOptionsInputField()
|
715
|
+
.type(titleText)
|
716
|
+
.verifyInnerText(titleText)
|
717
|
+
.blur();
|
718
|
+
},
|
719
|
+
|
720
|
+
/**
|
721
|
+
* @param {number} questionStemWidth width to be added to the Question stem width input field
|
722
|
+
* @description This function adds input to the Question stem width input field
|
723
|
+
*/
|
724
|
+
addInputToQuestionStemWidthInputField: (questionStemWidth) => {
|
725
|
+
gridCommonComponents.questionStemWidthInputField()
|
726
|
+
.clear()
|
727
|
+
.type(questionStemWidth)
|
728
|
+
.should('have.value', questionStemWidth);
|
729
|
+
},
|
730
|
+
|
731
|
+
/**
|
732
|
+
* @param {number} questionStemWidth width to be added to the Options width input field
|
733
|
+
* @description This function adds input to the Options width input field
|
734
|
+
*/
|
735
|
+
addInputToOptionsWidthInputField: (optionsWidth) => {
|
736
|
+
gridCommonComponents.optionWidthInputField()
|
737
|
+
.clear()
|
738
|
+
.type(optionsWidth)
|
739
|
+
.should('have.value', optionsWidth);
|
740
|
+
},
|
741
|
+
|
742
|
+
/**
|
743
|
+
* @param {number} minWidth
|
744
|
+
* @param {number} maxWidth
|
745
|
+
* @description This function verifies min and max width of question stem
|
746
|
+
*/
|
747
|
+
verifyQuestionStemWidthInSetCorrectAnswerTable: (minWidth, maxWidth) => {
|
748
|
+
gridCommonComponents.setCorrectAnswerTableQuestionStemWrapper()
|
749
|
+
.should('have.css', 'max-width', `${maxWidth}px`)
|
750
|
+
.and('have.css', 'min-width', `${minWidth}px`);
|
751
|
+
},
|
752
|
+
|
753
|
+
/**
|
754
|
+
* @param {number} minWidth
|
755
|
+
* @param {number} maxWidth
|
756
|
+
* @description This function verifies min and max width of question stem
|
757
|
+
*/
|
758
|
+
verifyQuestionStemWidthInPreviewTabAnswerTable: (minWidth, maxWidth) => {
|
759
|
+
gridCommonComponents.previewTabAnswerTableQuestionStemTitle()
|
760
|
+
.should('have.css', 'min-width', `${minWidth}px`)
|
761
|
+
.and('have.css', 'max-width', `${maxWidth}px`)
|
762
|
+
},
|
763
|
+
|
764
|
+
/**
|
765
|
+
* @param {number} width
|
766
|
+
* @description this function verifies width of the table header
|
767
|
+
*/
|
768
|
+
verifyTableHeaderWidthInSetCorrectAnswerTable: (width) => {
|
769
|
+
gridCommonComponents.setCorrectAnswerTableHeader()
|
770
|
+
.each(($el) => {
|
771
|
+
cy.wrap($el)
|
772
|
+
.should('have.css', 'width', `${width}px`)
|
773
|
+
});
|
774
|
+
},
|
775
|
+
|
776
|
+
/**
|
777
|
+
* @param {number} width
|
778
|
+
* @description this function verifies width of the table header
|
779
|
+
*/
|
780
|
+
verifyTableHeaderWidthInPreviewTabAnswerTable: (width) => {
|
781
|
+
gridCommonComponents.previewTabAnswerTableHeader()
|
782
|
+
.each(($el) => {
|
783
|
+
cy.wrap($el)
|
784
|
+
.should('have.css', 'width', `${width}px`)
|
785
|
+
});
|
786
|
+
},
|
787
|
+
|
788
|
+
/**
|
789
|
+
* @param {string} option inline option to be verified
|
790
|
+
* @param {number} optionIndex index of the option
|
791
|
+
* @description this function verfies inline options in the set correct answer table
|
792
|
+
*/
|
793
|
+
verifyInlineOptionsTextContentInSetCorrectAnswerTable: (optionIndex, option) => {
|
794
|
+
gridCommonComponents.setCorrectAnswerTableInlineOptions()
|
795
|
+
.eq(optionIndex)
|
796
|
+
.should('have.text', option)
|
797
|
+
},
|
798
|
+
|
799
|
+
/**
|
800
|
+
* @param {string} option inline option to be verified
|
801
|
+
* @param {number} optionIndex index of the option
|
802
|
+
* @description this function verfies inline options in the preview tab answer table
|
803
|
+
*/
|
804
|
+
verifyInlineOptionsTextContentInPreviewTabAnswerTable: (optionIndex, option) => {
|
805
|
+
gridCommonComponents.previewTabAnswerTableInlineOptions()
|
806
|
+
.eq(optionIndex)
|
807
|
+
.should('have.text', option)
|
808
|
+
}
|
809
|
+
}
|
810
|
+
|
811
|
+
const tests = {
|
812
|
+
verifyCSSOfQuestionStemContents: () => {
|
813
|
+
it('CSS of Question stems section', { tags: 'css' }, () => {
|
814
|
+
gridCommonComponents.questionStemLabel()
|
815
|
+
.verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
|
816
|
+
gridCommonComponents.questionStemWrapper()
|
817
|
+
.eq(0)
|
818
|
+
.within(() => {
|
819
|
+
commonComponents.dragHandleButton()
|
820
|
+
.verifyCSS(css.color.secondaryBtnActive, css.fontSize.normal, css.fontWeight.regular);
|
821
|
+
gridCommonComponents.buttonDeleteQuestionStem()
|
822
|
+
.verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
|
823
|
+
gridCommonComponents.questionStemInputField()
|
824
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
|
825
|
+
//Failing due to https://redmine.zeuslearning.com/issues/531397
|
826
|
+
gridCommonComponents.optionNumeration()
|
827
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.regular);
|
828
|
+
});
|
829
|
+
gridCommonComponents.addQuestionStemButton()
|
830
|
+
.verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.medium);
|
831
|
+
});
|
832
|
+
},
|
833
|
+
|
834
|
+
verifyCSSOfAddedStemInSetCorrectAnswerTable: () => {
|
835
|
+
it('CSS of added question stem in \'Set Correct Answer\' section table', { tags: 'css' }, () => {
|
836
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
837
|
+
.eq(0)
|
838
|
+
.find('td')
|
839
|
+
.eq(0)
|
840
|
+
.should('have.css', 'background-color', css.color.optionsBg);
|
841
|
+
gridCommonComponents.setCorrectAnswerTableRow()
|
842
|
+
.eq(1)
|
843
|
+
.find('td')
|
844
|
+
.eq(0)
|
845
|
+
.should('have.css', 'background-color', css.color.defaultBackground);
|
846
|
+
});
|
847
|
+
},
|
848
|
+
|
849
|
+
verifyCSSAnda11yQuestionStemErrorMessage: () => {
|
850
|
+
it('CSS of error message', { tags: 'css' }, () => {
|
851
|
+
gridCommonComponents.questionStemWrapper()
|
852
|
+
.eq(0)
|
853
|
+
.within(() => {
|
854
|
+
commonComponents.errorMessage()
|
855
|
+
.verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
|
856
|
+
});
|
857
|
+
});
|
858
|
+
|
859
|
+
it('Accessibility of error message', { tags: 'a11y' }, () => {
|
860
|
+
cy.checkAccessibility(commonComponents.errorMessage());
|
861
|
+
});
|
862
|
+
},
|
863
|
+
|
864
|
+
verifyCSSOfPreviewTabAnswerTable: () => {
|
865
|
+
it('CSS of added question stem in \'Preview\' tab table', { tags: 'css' }, () => {
|
866
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
867
|
+
.eq(2)
|
868
|
+
.find('td')
|
869
|
+
.eq(0)
|
870
|
+
.should('have.css', 'background-color', css.color.optionsBg);
|
871
|
+
gridCommonComponents.previewTabAnswerTableRow()
|
872
|
+
.eq(3)
|
873
|
+
.find('td')
|
874
|
+
.eq(0)
|
875
|
+
.should('have.css', 'background-color', css.color.defaultBackground);
|
876
|
+
});
|
877
|
+
},
|
878
|
+
|
879
|
+
verifyCSSOfOptionsContents: () => {
|
880
|
+
it('CSS of Options section', { tags: 'css' }, () => {
|
881
|
+
gridCommonComponents.optionsLabel()
|
882
|
+
.verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
|
883
|
+
gridCommonComponents.optionWrapper()
|
884
|
+
.eq(0)
|
885
|
+
.within(() => {
|
886
|
+
commonComponents.dragHandleButton()
|
887
|
+
.verifyCSS(css.color.secondaryBtnActive, css.fontSize.normal, css.fontWeight.regular);
|
888
|
+
gridCommonComponents.buttonDeleteOption()
|
889
|
+
.verifyPseudoClassBeforeProperty('color', css.color.deleteIcon)
|
890
|
+
.should('have.css', 'opacity', '0.5');
|
891
|
+
gridCommonComponents.optionInputField()
|
892
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
|
893
|
+
//Failing due to https://redmine.zeuslearning.com/issues/531397
|
894
|
+
gridCommonComponents.optionNumeration()
|
895
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.regular);
|
896
|
+
});
|
897
|
+
gridCommonComponents.addOptionButton()
|
898
|
+
.verifyCSS(css.color.secondaryBtnActive, css.fontSize.normal, css.fontWeight.medium);
|
899
|
+
});
|
900
|
+
},
|
901
|
+
|
902
|
+
verifyCSSAnda11yOfEnabledDeleteButton: () => {
|
903
|
+
it('CSS of enabled \'Delete\' option button', { tags: 'css' }, () => {
|
904
|
+
gridCommonComponents.buttonDeleteOption()
|
905
|
+
.eq(0)
|
906
|
+
.verifyPseudoClassBeforeProperty('color', css.color.deleteIcon)
|
907
|
+
.should('have.css', 'opacity', '1');
|
908
|
+
});
|
909
|
+
|
910
|
+
it('Accessibility of enabled \'Delete\' option button', { tags: 'a11y' }, () => {
|
911
|
+
cy.checkAccessibility(gridCommonComponents.buttonDeleteOption())
|
912
|
+
});
|
913
|
+
},
|
914
|
+
|
915
|
+
verifyCSSAnda11yOfOptionsErrorMessage: () => {
|
916
|
+
it('CSS of error message', { tags: 'css' }, () => {
|
917
|
+
gridCommonComponents.optionWrapper()
|
918
|
+
.eq(0)
|
919
|
+
.within(() => {
|
920
|
+
commonComponents.errorMessage()
|
921
|
+
.verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
|
922
|
+
});
|
923
|
+
});
|
924
|
+
|
925
|
+
it('Accessibility of error message', { tags: 'a11y' }, () => {
|
926
|
+
cy.checkAccessibility(commonComponents.errorMessage());
|
927
|
+
});
|
928
|
+
},
|
929
|
+
|
930
|
+
verifyCSSOfHeaderTextInSetCorrectAnswerTable: () => {
|
931
|
+
it('CSS of header text in set correct answer table', { tags: 'css' }, () => {
|
932
|
+
gridCommonComponents.setCorrectAnswerTableHeader()
|
933
|
+
.find('.question-text-wrapper')
|
934
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.semibold);
|
935
|
+
});
|
936
|
+
},
|
937
|
+
|
938
|
+
verifyCSSOfHeaderTextInPreviewTabAnswerTable: () => {
|
939
|
+
it('CSS of header text in preview tab answer table', { tags: 'css' }, () => {
|
940
|
+
gridCommonComponents.previewTabAnswerTableHeader()
|
941
|
+
.find('.question-text-wrapper')
|
942
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.semibold);
|
943
|
+
});
|
944
|
+
}
|
945
|
+
}
|
946
|
+
|
947
|
+
export const gridCommonComponents = {
|
948
|
+
...selectors,
|
949
|
+
steps,
|
950
|
+
tests
|
951
|
+
}
|