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,870 @@
|
|
1
|
+
import utilities from "../support/helpers/utilities";
|
2
|
+
import constants from "../fixtures/constants";
|
3
|
+
import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, ckEditorToolbar, commonComponents, createQuestionBasePage, equationEditorFlyout, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase, studentResponseAndLayoutComponent } from "./components"
|
4
|
+
import { dialogBoxBase } from "./dialogBoxBase";
|
5
|
+
import { setPointsPopupBase } from "./components/setPointsPopupBase";
|
6
|
+
const css = Cypress.env('css');
|
7
|
+
|
8
|
+
const dropdownOptions = ['Any', 'Paragraph', 'Sentence', 'Word'];
|
9
|
+
|
10
|
+
const paragraphTextArray = ['All animals have a unique role to play in maintaining the balance of nature.', 'A lot of animal species exist in both, land and water. As a result, each of them has a purpose for their existence.', 'The animals divide into specific groups in biology. Amphibians are those which can live on both, land and water.', 'Mammals are ones which give birth to their offspring in the womb and have mammary glands.']
|
11
|
+
|
12
|
+
const colorLibrary = css.highlightColorLibrary;
|
13
|
+
|
14
|
+
const selectors = {
|
15
|
+
...questionInstructionsComponent,
|
16
|
+
...commonComponents,
|
17
|
+
...ckEditorToolbar,
|
18
|
+
...dialogBoxBase,
|
19
|
+
...autoScoredScoringSectionMultipleResponsesType,
|
20
|
+
...additionalSettingsPanel,
|
21
|
+
...setPointsPopupBase,
|
22
|
+
...scoringSectionBase,
|
23
|
+
...autoScoredSetCorrectAnswerSection,
|
24
|
+
...autoScoredAdditionalSettings,
|
25
|
+
|
26
|
+
questionLabel: () => cy.get('[class*="Highlightstyles__QuestionComponentWrapper"] .title-casing'),
|
27
|
+
questionInputField: () => cy.get('[class*="Highlightstyles__QuestionComponentWrapper"] [title="Question"]'),
|
28
|
+
optionSpan: () => cy.get('span'),
|
29
|
+
option: () => cy.get('.highlighted'),
|
30
|
+
//text selection dropdown
|
31
|
+
textSelectionLabel: () => cy.get('#Text-selection-dropdown-label'),
|
32
|
+
textSelectionDropdown: () => cy.get('#Text-selection-select'),
|
33
|
+
textSelectionDropdownList: () => cy.get('ul[aria-labelledby*="Text-selection-dropdown-label"]'),
|
34
|
+
textSelectionDropdownListOptions: () => cy.get('ul[aria-labelledby*="Text-selection-dropdown-label"] li'),
|
35
|
+
//highlight options section
|
36
|
+
highlightOptionsLabel: () => cy.get('.highlightOptions-label-wrapper'),
|
37
|
+
highlightOptionsHighlightCounter: () => cy.get('[class*="Highlightstyles__CountWrapper"]'),
|
38
|
+
highlightOptionsTextFieldWrapper: () => cy.get('[class*="Highlightstyles__HighLightWrapper"]'),
|
39
|
+
highlightOptionsSectionTextWrapper: () => cy.get('[class*="Highlightstyles__HighLightWrapper"] [data-testid="question-instruction-element"]'),
|
40
|
+
highlightOptionsParagraphs: () => cy.get('[class*="Highlightstyles__HighLightWrapper"] p'),
|
41
|
+
highlightOptionsSpans: () => cy.get('[class*="Highlightstyles__HighLightWrapper"] span'),
|
42
|
+
colorLibraryButton: () => cy.get('.color-library-wrapper button').eq(0),
|
43
|
+
colorLibraryColorOptionButton: () => cy.get('.color-library-content'),
|
44
|
+
colorLibrarySelectedColorIcon: () => cy.get('[class*="ColorLibrarystyle__BtnSelectionWrapper"]'),
|
45
|
+
clearHighlightButton: () => cy.get('.color-library-wrapper button').eq(1),
|
46
|
+
//set correct answer section
|
47
|
+
setCorrectAnswerTextFieldWrapper: () => cy.get('[class*="Highlightstyles__Wrapper"]'),
|
48
|
+
setCorrectAnswerTextWrapper: () => cy.get('[class*="Highlightstyles__HighlightPreviewWrapper"] [data-testid="question-instruction-element"]'),
|
49
|
+
setCorrectAnswerParagraphs: () => cy.get('[class*="Highlightstyles__Wrapper"] p'),
|
50
|
+
setCorrectAnswerSpans: () => cy.get('[class*="Highlightstyles__Wrapper"] span'),
|
51
|
+
setCorrectAnswerOption: () => cy.get('[class*="Highlightstyles__Wrapper"] .highlighted'),
|
52
|
+
setPointsButton: () => cy.get('[class*="Highlightstyles__SetPointsPopupWrapper"] button'),
|
53
|
+
setPointsPopupSaveButton: () => cy.get('.compact-popup-accept-button'),
|
54
|
+
setPointsPopupCancelButton: () => cy.get('.compact-popup-reject-button'),
|
55
|
+
setPointsPopupOptions: () => cy.get('[class*="SetPointsPopupstyle__MappedAnswer"]'),
|
56
|
+
setPointsPopupPointsLabel: () => cy.get('[class*="SetPointsPopupstyle__PointLabel"]'),
|
57
|
+
//Check this after https://redmine.zeuslearning.com/issues/542344 is fixed
|
58
|
+
pointsPerResponseLabelAndScore: () => cy.get('[class*="Highlightstyles__PartialPointsPerResponseLabel"]'),
|
59
|
+
//preview tab
|
60
|
+
previewTabQuestionContainer: () => cy.get('.highlight-preview-wrapper'),
|
61
|
+
previewTabParagraphs: () => cy.get('.highlight-preview-wrapper p'),
|
62
|
+
previewTabSpans: () => cy.get('.highlight-preview-wrapper span'),
|
63
|
+
previewTabOption: () => cy.get('.highlight-preview-wrapper .highlighted'),
|
64
|
+
//additional settings
|
65
|
+
maximumNumberOfAnswersLabel: () => cy.get('.maximum-answers'),
|
66
|
+
maximumAnswersInputField: () => cy.get('[class*="StudentResponseComponentstyle__OptionWrapper"] input'),
|
67
|
+
}
|
68
|
+
|
69
|
+
const steps = {
|
70
|
+
...createQuestionBasePage.steps,
|
71
|
+
...questionInstructionsComponent.steps,
|
72
|
+
...ckEditorToolbar.steps,
|
73
|
+
...equationEditorFlyout.steps,
|
74
|
+
...dialogBoxBase.steps,
|
75
|
+
...scoringSectionBase.steps,
|
76
|
+
...previewScoringAndShowCorrectAnswerComponent.steps,
|
77
|
+
...autoScoredPreviewBase.steps,
|
78
|
+
...additionalSettingsPanel.steps,
|
79
|
+
...autoScoredAdditionalSettings.steps,
|
80
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
81
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
82
|
+
...setPointsPopupBase.steps,
|
83
|
+
...autoScoredScoringSection.steps,
|
84
|
+
...commonComponents.steps,
|
85
|
+
|
86
|
+
addInputToQuestionInputField: (text) => {
|
87
|
+
highlightPage.questionInputField()
|
88
|
+
.type(text);
|
89
|
+
},
|
90
|
+
|
91
|
+
clearQuestionInputField: () => {
|
92
|
+
highlightPage.questionInputField()
|
93
|
+
.clear();
|
94
|
+
},
|
95
|
+
|
96
|
+
focusInQuestionInputField: () => {
|
97
|
+
highlightPage.questionInputField()
|
98
|
+
.focus();
|
99
|
+
},
|
100
|
+
|
101
|
+
focusOutOfQuestionInputField: () => {
|
102
|
+
highlightPage.questionInputField()
|
103
|
+
.blur();
|
104
|
+
},
|
105
|
+
|
106
|
+
verifyErroredStateOfQuestionInputField: () => {
|
107
|
+
utilities.verifyCSS(highlightPage.questionInputField(), {
|
108
|
+
'border-color': css.color.errorFieldBorder,
|
109
|
+
'background-color': css.color.errorFieldBg
|
110
|
+
});
|
111
|
+
},
|
112
|
+
|
113
|
+
verifyErroredStateOfHighlightOptionsSection: () => {
|
114
|
+
utilities.verifyCSS(highlightPage.highlightOptionsTextFieldWrapper(), {
|
115
|
+
'border-color': css.color.errorFieldBorder,
|
116
|
+
'background-color': css.color.errorFieldBg
|
117
|
+
});
|
118
|
+
},
|
119
|
+
|
120
|
+
/**
|
121
|
+
* @param {number} highlightCounterValue Value of highlight counter
|
122
|
+
* @description Verify highlight counter text and value
|
123
|
+
*/
|
124
|
+
verifyHighlightCounterTextAndValue: (highlightCounterValue) => {
|
125
|
+
utilities.verifyInnerText(highlightPage.highlightOptionsHighlightCounter(), `Highlight count: ${highlightCounterValue}`);
|
126
|
+
},
|
127
|
+
|
128
|
+
/**
|
129
|
+
* @param {number} paragraphIndex Index of the paragraph in highlight options section
|
130
|
+
* @param {number} numberOfOptions Number of options inside the paragraph in highlight options section
|
131
|
+
* @description Verify number of options inside a paragraph in highlight options section
|
132
|
+
*/
|
133
|
+
verifyNumberOfOptionsInsideAParagraphInHighlightOptionsSection: (paragraphIndex, numberOfOptions) => {
|
134
|
+
highlightPage.highlightOptionsParagraphs()
|
135
|
+
.eq(paragraphIndex)
|
136
|
+
.within(() => {
|
137
|
+
utilities.verifyElementCount(highlightPage.optionSpan(), numberOfOptions)
|
138
|
+
});
|
139
|
+
},
|
140
|
+
|
141
|
+
/**
|
142
|
+
* @param {number} paragraphIndex Index of the paragraph in set correct answer section
|
143
|
+
* @param {number} numberOfOptions Number of options inside the paragraph in set correct answer section
|
144
|
+
* @description Verify number of options inside a paragraph in set correct answer section
|
145
|
+
*/
|
146
|
+
verifyNumberOfOptionsInsideAParagraphInSetCorrectAnswerSection: (paragraphIndex, numberOfOptions) => {
|
147
|
+
highlightPage.setCorrectAnswerParagraphs()
|
148
|
+
.eq(paragraphIndex)
|
149
|
+
.within(() => {
|
150
|
+
utilities.verifyElementCount(highlightPage.option(), numberOfOptions)
|
151
|
+
});
|
152
|
+
},
|
153
|
+
|
154
|
+
clickOnColorLibraryButton: () => {
|
155
|
+
highlightPage.colorLibraryButton()
|
156
|
+
.click();
|
157
|
+
},
|
158
|
+
|
159
|
+
clickingAwayFromColorLibraryPopup: () => {
|
160
|
+
cy.get('body')
|
161
|
+
.click('left');
|
162
|
+
},
|
163
|
+
|
164
|
+
verifyColorLibraryButton: () => {
|
165
|
+
utilities.verifyInnerText(highlightPage.colorLibraryButton(), 'Color library');
|
166
|
+
utilities.verifyElementVisibilityState(highlightPage.colorLibraryButton(), 'visible');
|
167
|
+
utilities.verifyElementVisibilityState(highlightPage.colorLibraryButton().find('.color-library-icon'), 'exist');
|
168
|
+
},
|
169
|
+
|
170
|
+
verifyClearHighlightButton: () => {
|
171
|
+
utilities.verifyInnerText(highlightPage.clearHighlightButton(), 'Clear')
|
172
|
+
utilities.verifyElementVisibilityState(highlightPage.clearHighlightButton(), 'visible');
|
173
|
+
utilities.verifyElementVisibilityState(highlightPage.clearHighlightButton().find('.X-mark-icon'), 'exist');
|
174
|
+
},
|
175
|
+
|
176
|
+
switchColorInColorLibraryPopup: (colorIndex) => {
|
177
|
+
highlightPage.colorLibraryColorOptionButton()
|
178
|
+
.eq(colorIndex)
|
179
|
+
.click();
|
180
|
+
utilities.verifyElementVisibilityState(highlightPage.dialogBox(), 'notExist');
|
181
|
+
},
|
182
|
+
|
183
|
+
verifyColorLibraryPopupColors: () => {
|
184
|
+
utilities.verifyElementVisibilityState(highlightPage.colorLibraryColorOptionButton(), 'visible');
|
185
|
+
utilities.verifyElementCount(highlightPage.colorLibraryColorOptionButton(), '6');
|
186
|
+
colorLibrary.forEach((color, index) => {
|
187
|
+
utilities.verifyCSS(highlightPage.colorLibraryColorOptionButton().eq(index), {
|
188
|
+
'background-color': color.background,
|
189
|
+
'border': `1px solid ${color.border}`
|
190
|
+
});
|
191
|
+
});
|
192
|
+
},
|
193
|
+
|
194
|
+
verifyColorLibraryPopupColorSelected: (colorIndex) => {
|
195
|
+
highlightPage.colorLibraryColorOptionButton()
|
196
|
+
.eq(colorIndex)
|
197
|
+
.should('have.attr', 'aria-pressed', 'true')
|
198
|
+
.within(() => {
|
199
|
+
utilities.verifyElementVisibilityState(highlightPage.colorLibrarySelectedColorIcon(), 'visible');
|
200
|
+
})
|
201
|
+
},
|
202
|
+
|
203
|
+
expandTextSelectionDropdown: () => {
|
204
|
+
highlightPage.textSelectionDropdown()
|
205
|
+
.scrollIntoView({ offset: { top: 200, left: 0 } })
|
206
|
+
.click();
|
207
|
+
utilities.verifyElementVisibilityState(highlightPage.textSelectionDropdownList(), 'visible');
|
208
|
+
},
|
209
|
+
|
210
|
+
closeTextSelectionDropdown: () => {
|
211
|
+
highlightPage.textSelectionDropdown()
|
212
|
+
.scrollIntoView({ offset: { top: 200, left: 0 } })
|
213
|
+
.click();
|
214
|
+
utilities.verifyElementVisibilityState(highlightPage.textSelectionDropdownList(), 'notExist');
|
215
|
+
},
|
216
|
+
|
217
|
+
verifyTextSelectionDropdownList: () => {
|
218
|
+
for (let index = 0; index < dropdownOptions.length; index++) {
|
219
|
+
highlightPage.textSelectionDropdownListOptions()
|
220
|
+
.eq(index)
|
221
|
+
.verifyInnerText(dropdownOptions[index]);
|
222
|
+
}
|
223
|
+
},
|
224
|
+
|
225
|
+
/**
|
226
|
+
* @param {string} textSelectionType Type of text selection in text selection dropdown
|
227
|
+
* @description Select the dropdown option in the text selection dropdown
|
228
|
+
*/
|
229
|
+
selectDropdownOptionInTextSelectionDropdown: (textSelectionType) => {
|
230
|
+
highlightPage.textSelectionDropdownListOptions()
|
231
|
+
.contains(textSelectionType)
|
232
|
+
.click();
|
233
|
+
},
|
234
|
+
|
235
|
+
verifyResetPopupForClearingOptionSelection: () => {
|
236
|
+
utilities.verifyElementVisibilityState(highlightPage.dialogBox(), 'visible');
|
237
|
+
utilities.verifyInnerText(highlightPage.dialogBoxTitle(), 'Reset');
|
238
|
+
utilities.verifyInnerText(highlightPage.dialogBoxContent(), 'Are you sure you want to clear all highlights? This action will not delete template content but clear all highlights.');
|
239
|
+
utilities.verifyInnerText(highlightPage.buttonReject(), 'Cancel');
|
240
|
+
utilities.verifyInnerText(highlightPage.buttonAccept(), 'Confirm');
|
241
|
+
},
|
242
|
+
|
243
|
+
/**
|
244
|
+
* @param {string} textSelectionType Type of text selection for which reset confirmation popup is displayed
|
245
|
+
* @description Verify reset confirmation popup for switch text selection type
|
246
|
+
*/
|
247
|
+
verifyResetPopupForSwitchingTextSelectionType: (textSelectionType) => {
|
248
|
+
utilities.verifyElementVisibilityState(highlightPage.dialogBox(), 'visible');
|
249
|
+
utilities.verifyInnerText(highlightPage.dialogBoxTitle(), 'Reset');
|
250
|
+
utilities.verifyInnerText(highlightPage.dialogBoxContent(), `Applying ${textSelectionType} text selection will reset any existing highlight options, including valid responses and alternate response values.`);
|
251
|
+
utilities.verifyInnerText(highlightPage.buttonReject(), 'Cancel');
|
252
|
+
utilities.verifyInnerText(highlightPage.buttonAccept(), 'Confirm');
|
253
|
+
},
|
254
|
+
|
255
|
+
/**
|
256
|
+
* @param {string} textSelectionType Type of text selection for which reset confirmation popup is displayed
|
257
|
+
* @description Switch text selection type in text selection dropdown
|
258
|
+
*/
|
259
|
+
switchTextSelectionTypeInTextSelectionDropdown: (textSelectionType) => {
|
260
|
+
highlightPage.steps.expandTextSelectionDropdown();
|
261
|
+
highlightPage.steps.selectDropdownOptionInTextSelectionDropdown(textSelectionType);
|
262
|
+
utilities.verifyInnerText(highlightPage.dialogBoxContent(), `Applying ${textSelectionType} text selection will reset any existing highlight options, including valid responses and alternate response values.`);
|
263
|
+
highlightPage.steps.clickOnAcceptButtonInDialogBox();
|
264
|
+
utilities.verifyInnerText(highlightPage.textSelectionDropdown(), textSelectionType);
|
265
|
+
},
|
266
|
+
|
267
|
+
clearSelectedOptionsInHighlightOptionsSection: () => {
|
268
|
+
highlightPage.steps.clickOnClearHighlightButtonInHighlightOptionsSection();
|
269
|
+
highlightPage.steps.clickOnAcceptButtonInDialogBox();
|
270
|
+
},
|
271
|
+
|
272
|
+
/**
|
273
|
+
* @param {string} optionText Text of the option in highlight options section
|
274
|
+
* @description Verify that option is in selected state in highlight options section
|
275
|
+
*/
|
276
|
+
verifyOptionIsSelectedInHighlightOptionsSection: (optionText) => {
|
277
|
+
highlightPage.highlightOptionsSpans()
|
278
|
+
.contains(optionText)
|
279
|
+
.should('have.class', 'highlighted')
|
280
|
+
.and('have.attr', 'aria-checked', 'true');
|
281
|
+
},
|
282
|
+
|
283
|
+
/**
|
284
|
+
* @param {string} optionText Text of the option in set correct answer section
|
285
|
+
* @description Verify that option is not in selected state in set correct answer section
|
286
|
+
*/
|
287
|
+
verifyOptionIsNotSelectedInSetCorrectAnswerSection: (optionText) => {
|
288
|
+
highlightPage.setCorrectAnswerOption()
|
289
|
+
.contains(optionText)
|
290
|
+
.should('not.have.class', 'correct_answer')
|
291
|
+
.and('have.attr', 'aria-checked', 'false');
|
292
|
+
},
|
293
|
+
|
294
|
+
/**
|
295
|
+
* @param {string} optionText Text of the option in set correct answer section
|
296
|
+
* @description Verify that option is in selected state in set correct answer section
|
297
|
+
*/
|
298
|
+
verifyOptionIsSelectedInSetCorrectAnswerSection: (optionText) => {
|
299
|
+
highlightPage.setCorrectAnswerOption()
|
300
|
+
.contains(optionText)
|
301
|
+
.should('have.class', 'correct_answer')
|
302
|
+
.and('have.attr', 'aria-checked', 'true');
|
303
|
+
},
|
304
|
+
|
305
|
+
/**
|
306
|
+
* @param {string} optionText Text of the option in highlight options section
|
307
|
+
* @description Verify that option is not in selected state in highlight options section
|
308
|
+
*/
|
309
|
+
verifyOptionIsNotSelectedInHighlightOptionsSection: (optionText) => {
|
310
|
+
highlightPage.highlightOptionsSpans()
|
311
|
+
.contains(optionText)
|
312
|
+
.should('not.have.class', 'highlighted')
|
313
|
+
.and('have.attr', 'aria-checked', 'false');
|
314
|
+
},
|
315
|
+
|
316
|
+
/**
|
317
|
+
* @param {string} optionText Text of the option in preview tab
|
318
|
+
* @description Verify that option is in selected state in preview tab
|
319
|
+
*/
|
320
|
+
verifyOptionIsSelectedInPreviewTab: (optionText) => {
|
321
|
+
highlightPage.previewTabOption()
|
322
|
+
.contains(optionText)
|
323
|
+
.should('have.class', 'correct_answer')
|
324
|
+
.and('have.attr', 'aria-checked', 'true');
|
325
|
+
},
|
326
|
+
|
327
|
+
/**
|
328
|
+
* @param {string} optionText Text of the option in preview tab
|
329
|
+
* @description Verify that option is not in selected state in preview tab
|
330
|
+
*/
|
331
|
+
verifyOptionIsNotSelectedInPreviewTab: (optionText) => {
|
332
|
+
highlightPage.previewTabOption()
|
333
|
+
.contains(optionText)
|
334
|
+
.should('not.have.class', 'correct_answer')
|
335
|
+
.and('have.attr', 'aria-checked', 'false');
|
336
|
+
},
|
337
|
+
|
338
|
+
verifyNoOptionIsSelectedInPreviewTab: () => {
|
339
|
+
highlightPage.previewTabOption()
|
340
|
+
.should('not.have.class', 'correct_answer')
|
341
|
+
.and('have.attr', 'aria-checked', 'false');
|
342
|
+
},
|
343
|
+
|
344
|
+
/**
|
345
|
+
* @param {string} optionText Text of the option in highlight options section
|
346
|
+
* @description Verify that option does not exist in highlight options section
|
347
|
+
*/
|
348
|
+
verifyOptionDoesNotExistInHighlightOptionsSection: (optionText) => {
|
349
|
+
utilities.verifyElementVisibilityState(highlightPage.highlightOptionsSpans().contains(optionText), 'notExist');
|
350
|
+
},
|
351
|
+
|
352
|
+
/**
|
353
|
+
* @param {string} optionText Text of the option in highlight options section
|
354
|
+
* @description Click on option in highlight options section
|
355
|
+
*/
|
356
|
+
clickOnOptionInHighlightOptionsSection: (optionText) => {
|
357
|
+
highlightPage.highlightOptionsSpans()
|
358
|
+
.contains(optionText)
|
359
|
+
.click();
|
360
|
+
},
|
361
|
+
|
362
|
+
/**
|
363
|
+
* @param {string} optionText Text of the option in set correct answer section
|
364
|
+
* @description Click on option in set correct answer section
|
365
|
+
*/
|
366
|
+
clickOnOptionInSetCorrectAnswerSection: (optionText) => {
|
367
|
+
highlightPage.setCorrectAnswerOption()
|
368
|
+
.contains(optionText)
|
369
|
+
.click();
|
370
|
+
},
|
371
|
+
|
372
|
+
/**
|
373
|
+
* @param {string} optionText Text of the option in preview tab
|
374
|
+
* @description Click on option in preview tab
|
375
|
+
*/
|
376
|
+
clickOnOptionInPreviewTab: (optionText) => {
|
377
|
+
highlightPage.previewTabOption()
|
378
|
+
.contains(optionText)
|
379
|
+
.click();
|
380
|
+
},
|
381
|
+
|
382
|
+
/**
|
383
|
+
* @param {string} textSelectionType Type of text selection
|
384
|
+
* @param {*} optionText Text of the option in highlight options section
|
385
|
+
* @description Select an option in highlight options section
|
386
|
+
*/
|
387
|
+
selectOptionInHighlightOptionsSection: (textSelectionType, optionText) => {
|
388
|
+
if (textSelectionType === 'Any') {
|
389
|
+
highlightPage.highlightOptionsSectionTextWrapper()
|
390
|
+
.selectText(optionText);
|
391
|
+
highlightPage.steps.verifyOptionIsSelectedInHighlightOptionsSection(optionText);
|
392
|
+
} else {
|
393
|
+
highlightPage.steps.clickOnOptionInHighlightOptionsSection(optionText);
|
394
|
+
highlightPage.steps.verifyOptionIsSelectedInHighlightOptionsSection(optionText);
|
395
|
+
}
|
396
|
+
},
|
397
|
+
|
398
|
+
/**
|
399
|
+
* @param {string} textSelectionType Type of text selection
|
400
|
+
* @param {*} optionText Text of the option in highlight options section
|
401
|
+
* @description Deselect an option in highlight options section
|
402
|
+
*/
|
403
|
+
deselectOptionInHighlightOptionsSection: (textSelectionType, optionText) => {
|
404
|
+
if (textSelectionType === 'Any') {
|
405
|
+
highlightPage.steps.clickOnOptionInHighlightOptionsSection(optionText);
|
406
|
+
highlightPage.steps.verifyOptionDoesNotExistInHighlightOptionsSection(optionText);
|
407
|
+
} else {
|
408
|
+
highlightPage.steps.clickOnOptionInHighlightOptionsSection(optionText);
|
409
|
+
highlightPage.steps.verifyOptionIsNotSelectedInHighlightOptionsSection(optionText);
|
410
|
+
}
|
411
|
+
},
|
412
|
+
|
413
|
+
/**
|
414
|
+
* @param {*} optionText Text of the option in set correct answer section
|
415
|
+
* @description Select an option in set correct answer section
|
416
|
+
*/
|
417
|
+
selectOptionInSetCorrectAnswerSection: (optionText) => {
|
418
|
+
highlightPage.steps.clickOnOptionInSetCorrectAnswerSection(optionText);
|
419
|
+
highlightPage.steps.verifyOptionIsSelectedInSetCorrectAnswerSection(optionText);
|
420
|
+
},
|
421
|
+
|
422
|
+
/**
|
423
|
+
* @param {*} optionText Text of the option in set correct answer section
|
424
|
+
* @description Deselect an option in set correct answer section
|
425
|
+
*/
|
426
|
+
deselectOptionInSetCorrectAnswerSection: (optionText) => {
|
427
|
+
highlightPage.steps.clickOnOptionInSetCorrectAnswerSection(optionText);
|
428
|
+
highlightPage.steps.verifyOptionIsNotSelectedInSetCorrectAnswerSection(optionText);
|
429
|
+
},
|
430
|
+
|
431
|
+
/**
|
432
|
+
* @param {*} optionText Text of the option in preview tab
|
433
|
+
* @description Select an option in preview tab
|
434
|
+
*/
|
435
|
+
selectOptionInPreviewTab: (optionText) => {
|
436
|
+
highlightPage.steps.clickOnOptionInPreviewTab(optionText);
|
437
|
+
highlightPage.steps.verifyOptionIsSelectedInPreviewTab(optionText);
|
438
|
+
},
|
439
|
+
|
440
|
+
/**
|
441
|
+
* @param {*} optionText Text of the option in preview tab
|
442
|
+
* @description Deselect an option in preview tab
|
443
|
+
*/
|
444
|
+
deselectOptionInPreviewTab: (optionText) => {
|
445
|
+
highlightPage.steps.clickOnOptionInPreviewTab(optionText);
|
446
|
+
highlightPage.steps.verifyOptionIsNotSelectedInPreviewTab(optionText);
|
447
|
+
},
|
448
|
+
|
449
|
+
/**
|
450
|
+
* @param {string[]} optionArray Array of text of options in highlight options section
|
451
|
+
* @description Verify the options displayed in highlight options section
|
452
|
+
*/
|
453
|
+
verifyOptionsInHighlightOptionsSection: (optionArray) => {
|
454
|
+
optionArray.forEach((optionText, optionIndex) => {
|
455
|
+
utilities.verifyInnerText(highlightPage.highlightOptionsSpans().eq(optionIndex), optionText)
|
456
|
+
});
|
457
|
+
utilities.verifyElementCount(highlightPage.highlightOptionsSpans(), optionArray.length);
|
458
|
+
},
|
459
|
+
|
460
|
+
/**
|
461
|
+
* @param {string[]} optionArray Array of text of options in highlight options section
|
462
|
+
* @description Verify the options displayed in highlight options section
|
463
|
+
*/
|
464
|
+
verifyOptionsInSetCorrectAnswerSection: (optionArray) => {
|
465
|
+
optionArray.forEach((optionText, optionIndex) => {
|
466
|
+
utilities.verifyInnerText(highlightPage.setCorrectAnswerOption().eq(optionIndex), optionText)
|
467
|
+
});
|
468
|
+
utilities.verifyElementCount(highlightPage.setCorrectAnswerOption(), optionArray.length);
|
469
|
+
},
|
470
|
+
|
471
|
+
/**
|
472
|
+
* @param {string[]} optionArray Array of text of options in preview tab
|
473
|
+
* @description Verify the options displayed in preview tab
|
474
|
+
*/
|
475
|
+
verifyOptionInPreviewTab: (optionArray) => {
|
476
|
+
optionArray.forEach((optionText, optionIndex) => {
|
477
|
+
utilities.verifyInnerText(highlightPage.previewTabOption().eq(optionIndex), optionText)
|
478
|
+
});
|
479
|
+
utilities.verifyElementCount(highlightPage.previewTabOption(), optionArray.length);
|
480
|
+
},
|
481
|
+
|
482
|
+
|
483
|
+
/**
|
484
|
+
* @param {string} optionText Text of the option in highlight options section
|
485
|
+
* @description Hover on deselected option in highlight options section
|
486
|
+
*/
|
487
|
+
hoverOnDeselectedOptionInHighlightOptionsSection: (optionText) => {
|
488
|
+
highlightPage.highlightOptionsSpans()
|
489
|
+
.contains(optionText)
|
490
|
+
.realHover();
|
491
|
+
},
|
492
|
+
|
493
|
+
/**
|
494
|
+
* @param {string} optionText Text of the option in highlight options section
|
495
|
+
* @description Verify hover state of the deselected option in highlight options section
|
496
|
+
*/
|
497
|
+
verifyHoverStateOfDeselectedOptionInHighlightOptionsSection: (optionText) => {
|
498
|
+
highlightPage.steps.hoverOnDeselectedOptionInHighlightOptionsSection(optionText);
|
499
|
+
utilities.verifyCSS(highlightPage.highlightOptionsSpans().contains(optionText), {
|
500
|
+
'color': css.color.text,
|
501
|
+
'font-size': css.fontSize.default,
|
502
|
+
'font-weight': css.fontWeight.regular,
|
503
|
+
'background-color': colorLibrary[0].hoverBackground,
|
504
|
+
'border': `1px solid ${colorLibrary[0].hoverBorder}`
|
505
|
+
});
|
506
|
+
},
|
507
|
+
|
508
|
+
/**
|
509
|
+
* @param {string} optionText Text of the option in set correct answer section
|
510
|
+
* @description Hover on deselected option in set correct answer section
|
511
|
+
*/
|
512
|
+
hoverOnDeselectedOptionInSetCorrectAnswerSection: (optionText) => {
|
513
|
+
highlightPage.setCorrectAnswerOption()
|
514
|
+
.contains(optionText)
|
515
|
+
.realHover();
|
516
|
+
},
|
517
|
+
|
518
|
+
/**
|
519
|
+
* @param {string} optionText Text of the option in preview tab
|
520
|
+
* @description Hover on deselected option in preview tab
|
521
|
+
*/
|
522
|
+
hoverOnDeselectedOptionInPreviewTab: (optionText) => {
|
523
|
+
highlightPage.previewTabOption()
|
524
|
+
.contains(optionText)
|
525
|
+
.realHover();
|
526
|
+
},
|
527
|
+
|
528
|
+
/**
|
529
|
+
* @param {string} optionText Text of the option in set correct answer section
|
530
|
+
* @description Verify hover state of the deselected option in set correct answer section
|
531
|
+
*/
|
532
|
+
verifyHoverStateOfDeselectedOptionInSetCorrectAnswerSection: (optionText) => {
|
533
|
+
highlightPage.steps.hoverOnDeselectedOptionInSetCorrectAnswerSection(optionText);
|
534
|
+
utilities.verifyCSS(highlightPage.setCorrectAnswerOption().contains(optionText), {
|
535
|
+
'color': css.color.text,
|
536
|
+
'font-size': css.fontSize.default,
|
537
|
+
'font-weight': css.fontWeight.regular,
|
538
|
+
'background-color': colorLibrary[0].hoverBackground,
|
539
|
+
'border': `1px solid ${colorLibrary[0].hoverBorder}`
|
540
|
+
});
|
541
|
+
},
|
542
|
+
|
543
|
+
/**
|
544
|
+
* @param {string} optionText Text of the option in preview tab
|
545
|
+
* @description Verify hover state of the deselected option in preview tab
|
546
|
+
*/
|
547
|
+
verifyHoverStateOfOptionInPreviewTab: (optionText) => {
|
548
|
+
highlightPage.steps.hoverOnDeselectedOptionInPreviewTab(optionText);
|
549
|
+
utilities.verifyCSS(highlightPage.previewTabOption().contains(optionText), {
|
550
|
+
'color': css.color.text,
|
551
|
+
'font-size': css.fontSize.default,
|
552
|
+
'font-weight': css.fontWeight.regular,
|
553
|
+
'background-color': colorLibrary[0].hoverBackground,
|
554
|
+
'border': `1px solid ${colorLibrary[0].hoverBorder}`
|
555
|
+
});
|
556
|
+
},
|
557
|
+
|
558
|
+
/**
|
559
|
+
* @param {string} optionText Text of the option in preview tab
|
560
|
+
* @description Verify check-mark icon is displayed for option
|
561
|
+
*/
|
562
|
+
verifyCorrectAnswerCheckmarkIconForOption: (optionText) => {
|
563
|
+
highlightPage.previewTabOption()
|
564
|
+
.contains(optionText)
|
565
|
+
.should('have.class', 'correct_answer')
|
566
|
+
.within(() => {
|
567
|
+
autoScoredPreviewBase.correctIcon()
|
568
|
+
.should('be.visible');
|
569
|
+
});
|
570
|
+
},
|
571
|
+
|
572
|
+
/**
|
573
|
+
* @param {string} optionText Text of the option in preview tab
|
574
|
+
* @description Verify cross-mark icon is displayed for option
|
575
|
+
*/
|
576
|
+
verifyIncorrectAnswerCrossmarkIconForOption: (optionText) => {
|
577
|
+
highlightPage.previewTabOption()
|
578
|
+
.contains(optionText)
|
579
|
+
.should('have.class', 'correct_answer')
|
580
|
+
.within(() => {
|
581
|
+
autoScoredPreviewBase.incorrectIcon()
|
582
|
+
.should('be.visible');
|
583
|
+
});
|
584
|
+
},
|
585
|
+
|
586
|
+
/**
|
587
|
+
* @param {number[]} pointsArray Array of partial different points for options
|
588
|
+
* @description Add points to options in set points popup
|
589
|
+
*/
|
590
|
+
addPartialDifferentWeightsPointsInSetPointsPopup: (pointsArray) => {
|
591
|
+
highlightPage.setPointsButton()
|
592
|
+
.click();
|
593
|
+
setPointsPopupBase.steps.allotPointsToSetPointsPopupPointsInputField(pointsArray);
|
594
|
+
highlightPage.setPointsPopupSaveButton()
|
595
|
+
.click();
|
596
|
+
},
|
597
|
+
|
598
|
+
/**
|
599
|
+
* @param {string[]} optionsArray array of options set in options section
|
600
|
+
* @description this function resets the question preview
|
601
|
+
*/
|
602
|
+
resetQuestionPreview: () => {
|
603
|
+
highlightPage.steps.switchToEditTab();
|
604
|
+
highlightPage.steps.switchToPreviewTab();
|
605
|
+
highlightPage.steps.verifyNoOptionIsSelectedInPreviewTab();
|
606
|
+
},
|
607
|
+
|
608
|
+
/**
|
609
|
+
* @param {number} maxNumberOfAnswers maximum number of answers
|
610
|
+
* @description add input to maximum number of answers input field
|
611
|
+
*/
|
612
|
+
addInputToMaximumNumberOfAnswersInputField: (maxNumberOfAnswers) => {
|
613
|
+
highlightPage.maximumAnswersInputField()
|
614
|
+
.clear()
|
615
|
+
.type(`${maxNumberOfAnswers}`)
|
616
|
+
.should('have.value', `${maxNumberOfAnswers}`);
|
617
|
+
},
|
618
|
+
|
619
|
+
//Check after https://redmine.zeuslearning.com/issues/542344 is fixed
|
620
|
+
/**
|
621
|
+
* @param {number} points Points displayed for points per response
|
622
|
+
* @description Verify the points per response score
|
623
|
+
*/
|
624
|
+
verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
|
625
|
+
utilities.verifyInnerText(highlightPage.pointsPerResponseLabelAndScore(), `Points per response: ${points}`);
|
626
|
+
},
|
627
|
+
|
628
|
+
clickOnClearHighlightButtonInHighlightOptionsSection: () => {
|
629
|
+
highlightPage.clearHighlightButton()
|
630
|
+
.click();
|
631
|
+
},
|
632
|
+
|
633
|
+
verifyDefaultSetPointsButtonLabelAndDisabledState: () => {
|
634
|
+
utilities.verifyInnerText(highlightPage.setPointsButton(), 'Set points');
|
635
|
+
utilities.verifyElementVisibilityState(highlightPage.setPointsButton(), 'visible');
|
636
|
+
utilities.verifyElementVisibilityState(highlightPage.setPointsButton().find('svg'), 'exist');
|
637
|
+
highlightPage.setPointsButton()
|
638
|
+
.should('be.disabled');
|
639
|
+
utilities.verifyCSS(highlightPage.setPointsButton(), {
|
640
|
+
'color': css.color.secondaryBtnDisabled
|
641
|
+
});
|
642
|
+
utilities.verifyCSS(highlightPage.setPointsButton().find('svg'), {
|
643
|
+
'color': css.color.secondaryBtnDisabled
|
644
|
+
});
|
645
|
+
},
|
646
|
+
|
647
|
+
verifySetPointsButtonLabelAndEnabledState: () => {
|
648
|
+
utilities.verifyInnerText(highlightPage.setPointsButton(), 'Set points');
|
649
|
+
utilities.verifyElementVisibilityState(highlightPage.setPointsButton(), 'visible');
|
650
|
+
utilities.verifyElementVisibilityState(highlightPage.setPointsButton().find('svg'), 'exist');
|
651
|
+
highlightPage.setPointsButton()
|
652
|
+
.should('be.enabled');
|
653
|
+
},
|
654
|
+
|
655
|
+
clickOnSetPointsButton: () => {
|
656
|
+
highlightPage.setPointsButton()
|
657
|
+
.click();
|
658
|
+
},
|
659
|
+
|
660
|
+
cancelSetPointsPopup: () => {
|
661
|
+
highlightPage.setPointsPopupCancelButton()
|
662
|
+
.click();
|
663
|
+
highlightPage.dialogBox()
|
664
|
+
.should('not.exist');
|
665
|
+
},
|
666
|
+
|
667
|
+
savePointsAllotedInSetPointsPopup: () => {
|
668
|
+
highlightPage.setPointsPopupSaveButton()
|
669
|
+
.click();
|
670
|
+
highlightPage.dialogBox()
|
671
|
+
.should('not.exist');
|
672
|
+
},
|
673
|
+
|
674
|
+
/**
|
675
|
+
* @param {string[]} optionTextArray Array of options displayed in set points popup
|
676
|
+
* @description Verify the options displayed in set points popup
|
677
|
+
*/
|
678
|
+
verifySetPointsPopupOptions: (optionTextArray) => {
|
679
|
+
optionTextArray.forEach((optionText, index) => {
|
680
|
+
utilities.verifyInnerText(highlightPage.setPointsPopupOptions().eq(index), `${optionText}`);
|
681
|
+
});
|
682
|
+
utilities.verifyElementCount(highlightPage.setPointsPopupOptions(), optionTextArray.length);
|
683
|
+
},
|
684
|
+
|
685
|
+
/**
|
686
|
+
* @param {number} index points field option index
|
687
|
+
* @description this function verifies points field error message
|
688
|
+
*/
|
689
|
+
verifyPointsErrorMessageInSetPointsPopup: (index) => {
|
690
|
+
setPointsPopupBase.dialogBox()
|
691
|
+
.within(() => {
|
692
|
+
scoringSectionBase.pointsInputField()
|
693
|
+
.eq(index)
|
694
|
+
.parents('[class*="SetPointsPopupstyle__PointsErrorWrapper"]')
|
695
|
+
.within(() => {
|
696
|
+
commonComponents.errorMessage()
|
697
|
+
.should('have.text', 'Error: Please enter points.');
|
698
|
+
});
|
699
|
+
});
|
700
|
+
},
|
701
|
+
|
702
|
+
verifyImageAndAltTextInQuestionInputField: () => {
|
703
|
+
highlightPage.questionInputField()
|
704
|
+
.find('img')
|
705
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
706
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
707
|
+
},
|
708
|
+
|
709
|
+
verifyEquationInQuestionInputField: () => {
|
710
|
+
highlightPage.questionInputField()
|
711
|
+
.find('[data-widget="ngie_equation"]')
|
712
|
+
.should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
|
713
|
+
.contains(constants.CKEditorInputFieldEnteredEquationText);
|
714
|
+
},
|
715
|
+
|
716
|
+
verifyLinkInQuestionInputField: () => {
|
717
|
+
highlightPage.questionInputField()
|
718
|
+
.find('a')
|
719
|
+
.should('have.text', 'lorem')
|
720
|
+
.and('have.attr', 'href', `${Cypress.config().baseUrl}`);
|
721
|
+
},
|
722
|
+
|
723
|
+
verifyBoldTextInQuestionInputField: () => {
|
724
|
+
highlightPage.questionInputField()
|
725
|
+
.find('strong')
|
726
|
+
.should('exist')
|
727
|
+
.should('have.text', 'This is Bold text input.');
|
728
|
+
},
|
729
|
+
|
730
|
+
verifyImageAndAltTextInHighlightOptionsSection: () => {
|
731
|
+
highlightPage.highlightOptionsTextFieldWrapper()
|
732
|
+
.find('img')
|
733
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
734
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
735
|
+
},
|
736
|
+
|
737
|
+
verifyEquationInHighlightOptionsSection: () => {
|
738
|
+
highlightPage.highlightOptionsTextFieldWrapper()
|
739
|
+
.find('span[role="math"]')
|
740
|
+
.should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
|
741
|
+
.contains(constants.CKEditorInputFieldEnteredEquationText);
|
742
|
+
},
|
743
|
+
|
744
|
+
verifyLinkInHighlightOptionsSection: () => {
|
745
|
+
highlightPage.highlightOptionsTextFieldWrapper()
|
746
|
+
.find('a')
|
747
|
+
.should('have.text', 'lorem')
|
748
|
+
.and('have.attr', 'href', `${Cypress.config().baseUrl}`);
|
749
|
+
},
|
750
|
+
|
751
|
+
verifyBoldTextInHighlightOptionsSection: () => {
|
752
|
+
highlightPage.highlightOptionsTextFieldWrapper()
|
753
|
+
.find('strong')
|
754
|
+
.should('exist')
|
755
|
+
.should('have.text', 'This is Bold text input.lorem');
|
756
|
+
},
|
757
|
+
|
758
|
+
verifyImageAndAltTextInSetCorrectAnswerSection: () => {
|
759
|
+
highlightPage.setCorrectAnswerTextWrapper()
|
760
|
+
.find('img')
|
761
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
762
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
763
|
+
},
|
764
|
+
|
765
|
+
verifyEquationInSetCorrectAnswerSection: () => {
|
766
|
+
highlightPage.setCorrectAnswerTextWrapper()
|
767
|
+
.find('span[role="math"]')
|
768
|
+
.should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
|
769
|
+
.contains(constants.CKEditorInputFieldEnteredEquationText);
|
770
|
+
},
|
771
|
+
|
772
|
+
verifyLinkInSetCorrectAnswerSection: () => {
|
773
|
+
highlightPage.setCorrectAnswerTextWrapper()
|
774
|
+
.find('a')
|
775
|
+
.should('have.text', 'lorem')
|
776
|
+
.and('have.attr', 'href', `${Cypress.config().baseUrl}`);
|
777
|
+
},
|
778
|
+
|
779
|
+
verifyBoldTextInSetCorrectAnswerSection: () => {
|
780
|
+
highlightPage.setCorrectAnswerTextWrapper()
|
781
|
+
.find('strong')
|
782
|
+
.should('exist')
|
783
|
+
.should('have.text', 'This is Bold text input.lorem');
|
784
|
+
},
|
785
|
+
|
786
|
+
verifyImageAndAltTextInPreviewTab: () => {
|
787
|
+
highlightPage.previewTabQuestionContainer()
|
788
|
+
.find('img')
|
789
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
790
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
791
|
+
},
|
792
|
+
|
793
|
+
verifyEquationInPreviewTab: () => {
|
794
|
+
highlightPage.previewTabQuestionContainer()
|
795
|
+
.find('span[role="math"]')
|
796
|
+
.should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
|
797
|
+
.contains(constants.CKEditorInputFieldEnteredEquationText);
|
798
|
+
},
|
799
|
+
|
800
|
+
verifyLinkInPreviewTab: () => {
|
801
|
+
highlightPage.previewTabQuestionContainer()
|
802
|
+
.find('a')
|
803
|
+
.should('have.text', 'lorem')
|
804
|
+
.and('have.attr', 'href', `${Cypress.config().baseUrl}`);
|
805
|
+
},
|
806
|
+
|
807
|
+
verifyBoldTextInPreviewTab: () => {
|
808
|
+
highlightPage.previewTabQuestionContainer()
|
809
|
+
.find('strong')
|
810
|
+
.should('exist')
|
811
|
+
.should('have.text', 'This is Bold text input.lorem');
|
812
|
+
},
|
813
|
+
}
|
814
|
+
|
815
|
+
const tests = {
|
816
|
+
...questionInstructionsComponent.tests,
|
817
|
+
...commonComponents.tests,
|
818
|
+
...autoScoredScoringSection.tests,
|
819
|
+
...autoScoredScoringSectionMultipleResponsesType.tests,
|
820
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
821
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
822
|
+
...scoringSectionBase.tests,
|
823
|
+
...additionalSettingsPanel.tests,
|
824
|
+
...studentResponseAndLayoutComponent.tests,
|
825
|
+
...autoScoredAdditionalSettings.tests,
|
826
|
+
|
827
|
+
/**
|
828
|
+
* @param {number} totalPoints Maximum total points set for the question
|
829
|
+
* @description Verify the options displayed in set correct answer section
|
830
|
+
*/
|
831
|
+
verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (totalPoints) => {
|
832
|
+
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', () => {
|
833
|
+
cy.log('Switch to edit tab and set minimum score if attempted points')
|
834
|
+
highlightPage.steps.switchToEditTab();
|
835
|
+
highlightPage.steps.allotMinimumScoreAwardedIfAttempted(1);
|
836
|
+
highlightPage.steps.switchToPreviewTab()
|
837
|
+
highlightPage.steps.selectOptionInPreviewTab(paragraphTextArray[3]);
|
838
|
+
highlightPage.steps.verifyPreviewTabScoreText(1, `${totalPoints}`);
|
839
|
+
});
|
840
|
+
|
841
|
+
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', () => {
|
842
|
+
cy.log('Switch to edit tab and remove minimum score if attempted points')
|
843
|
+
highlightPage.steps.switchToEditTab();
|
844
|
+
highlightPage.steps.clearMinimumScoreIfAttemptedPointsField();
|
845
|
+
highlightPage.steps.switchToPreviewTab()
|
846
|
+
highlightPage.steps.selectOptionInPreviewTab(paragraphTextArray[3]);
|
847
|
+
highlightPage.steps.verifyPreviewTabScoreText(0, `${totalPoints}`);
|
848
|
+
});
|
849
|
+
},
|
850
|
+
|
851
|
+
/**
|
852
|
+
* @param {string} scoringType Type of scoring set in scoring section
|
853
|
+
* @param {string[]} optionsArray Array of the options displayed in set correct answer
|
854
|
+
* @description Verify the options displayed in set correct answer section
|
855
|
+
*/
|
856
|
+
verifyContentsOfSetCorrectAnswerSectionForScoringType: (scoringType, optionsArray) => {
|
857
|
+
it(`When user has selected ${scoringType} scoring type then the added options should be displayed in the set correct answer section and they should be in deselected state`, () => {
|
858
|
+
highlightPage.steps.verifyOptionsInSetCorrectAnswerSection(optionsArray);
|
859
|
+
optionsArray.forEach((optionText) => {
|
860
|
+
highlightPage.steps.verifyOptionIsNotSelectedInSetCorrectAnswerSection(optionText);
|
861
|
+
});
|
862
|
+
});
|
863
|
+
}
|
864
|
+
}
|
865
|
+
|
866
|
+
export const highlightPage = {
|
867
|
+
...selectors,
|
868
|
+
steps,
|
869
|
+
tests
|
870
|
+
}
|