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,390 @@
|
|
1
|
+
import { autoScoredAdditionalSettings } from "./autoScoredAdditionalSettings";
|
2
|
+
import { commonComponents } from "./commonComponents";
|
3
|
+
import { createQuestionBasePage } from "./createQuestionBasePage";
|
4
|
+
import { mcqOptionsComponent } from "./mcqOptionsComponent";
|
5
|
+
import { mcqPreviewComponents } from "./mcqPreviewComponents";
|
6
|
+
import { mcqQuestionCommonComponents } from "./mcqQuestionCommonComponents";
|
7
|
+
import { mcqSetCorrectAnswerSection } from "./mcqSetCorrectAnswerSection";
|
8
|
+
const css = Cypress.env('css');
|
9
|
+
|
10
|
+
const selectors = {
|
11
|
+
//Options style dropdown
|
12
|
+
optionsAndLayoutLabel: () => cy.get('.additional-settings-heading-label').eq(0),
|
13
|
+
optionsStyleLabel: () => cy.get('#Option-Style-dropdown-label'),
|
14
|
+
optionsStyleDropdown: () => cy.get('#Option-Style-select'),
|
15
|
+
optionsStyleDropdownListOptions: (ariaLabel = null) => {
|
16
|
+
if (ariaLabel) {
|
17
|
+
return cy.get(`[aria-labelledby*="Option-Style-dropdown-label"] li[role="option"][aria-label*="${ariaLabel}"]`)
|
18
|
+
} else {
|
19
|
+
return cy.get('[aria-labelledby*="Option-Style-dropdown-label"] li[role="option"]')
|
20
|
+
}
|
21
|
+
},
|
22
|
+
//Option numeration dropdown
|
23
|
+
optionNumerationLabel: () => cy.get('#Option-Numeration-dropdown-label'),
|
24
|
+
optionNumerationDropdown: () => cy.get('#Option-Numeration-select'),
|
25
|
+
optionNumerationDropdownListOptions: (ariaLabel = null) => {
|
26
|
+
if (ariaLabel) {
|
27
|
+
return cy.get(`[aria-labelledby*="Option-Numeration-dropdown-label"] li[role="option"][aria-label*="${ariaLabel}"]`)
|
28
|
+
} else {
|
29
|
+
return cy.get('[aria-labelledby*="Option-Numeration-dropdown-label"] li[role="option"]')
|
30
|
+
}
|
31
|
+
},
|
32
|
+
//Number of option columns
|
33
|
+
numberOfOptionColumnsLabel: () => cy.get('#Number-of-Option-Columns-dropdown-label'),
|
34
|
+
numberOfOptionColumnsDropdown: () => cy.get('#Number-of-Option-Columns-select'),
|
35
|
+
numberOfOptionColumnsListOptions: (optionNumber) => cy.get('[aria-labelledby="Number-of-Option-Columns-dropdown-label Number-of-Option-Columns-placeholder"] li[role="option"]').eq(optionNumber),
|
36
|
+
//Option orientation dropdown
|
37
|
+
optionOrientationLabel: () => cy.get('#Option-Orientation-dropdown-label'),
|
38
|
+
optionOrientationDropdown: () => cy.get('#Option-Orientation-select'),
|
39
|
+
optionOrientationListOptions: (optionIndex) => cy.get('[aria-labelledby="Option-Orientation-dropdown-label Option-Orientation-placeholder"] li[role="option"]').eq(optionIndex)
|
40
|
+
}
|
41
|
+
|
42
|
+
const tests = {
|
43
|
+
verifyNumberOfOptionsColumns: (orientation) => {
|
44
|
+
let option = [2, 3, 4, 5, 6];
|
45
|
+
option.forEach((option) => {
|
46
|
+
it(`When the user selects option \'${option}\' from the Number of Option Columns dropdown and \'${orientation}\' option is selected in \'Option Orientation\' dropdown, then the answer options should be divided and displayed vertically in ${option} columns in \'Set Correct Answer\' section and in \'Preview\' tab`, () => {
|
47
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsDropdown()
|
48
|
+
.click();
|
49
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(`${option - 1}`)
|
50
|
+
.click();
|
51
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
52
|
+
.verifyInnerText(orientation);
|
53
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
54
|
+
.parents('.edit-set-correct-answer-mcq-control')
|
55
|
+
.should('have.attr', 'columns')
|
56
|
+
.and('eq', `${option}`);
|
57
|
+
createQuestionBasePage.previewTab()
|
58
|
+
.click();
|
59
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
60
|
+
.parents()
|
61
|
+
.eq(2)
|
62
|
+
.should('have.attr', 'columns')
|
63
|
+
.and('eq', `${option}`);
|
64
|
+
createQuestionBasePage.editTab()
|
65
|
+
.click();
|
66
|
+
});
|
67
|
+
});
|
68
|
+
},
|
69
|
+
|
70
|
+
verifyOptionsStyleLayoutAndDropdown: (inputType) => {
|
71
|
+
//inputType : 'radio' | 'checkbox'
|
72
|
+
let dropdownOptions
|
73
|
+
if (inputType === 'radio') {
|
74
|
+
dropdownOptions = ['Default', 'Block without radio button', 'Radio button below option'];
|
75
|
+
} else if (inputType === 'checkbox') {
|
76
|
+
dropdownOptions = ['Default', 'Block without check box', 'Check box below option'];
|
77
|
+
}
|
78
|
+
it('CSS of Option Style and Layout section', { tags: 'css' }, () => {
|
79
|
+
mcqAdditionalSettingsBase.optionsAndLayoutLabel()
|
80
|
+
.verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.semibold);
|
81
|
+
mcqAdditionalSettingsBase.optionsStyleLabel()
|
82
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
83
|
+
mcqAdditionalSettingsBase.optionsStyleDropdown()
|
84
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
85
|
+
});
|
86
|
+
|
87
|
+
//Note: a11y is covered for the entire additional settings section
|
88
|
+
|
89
|
+
it('\'Option Style and Layout\' label, \'Option Style\' label and dropdown should be displayed and in \'Option Style\' dropdown \'Default\' option should be selected by default and option numeration dropdown should not be present', () => {
|
90
|
+
mcqAdditionalSettingsBase.optionsAndLayoutLabel()
|
91
|
+
.verifyInnerText('Option style and layout');
|
92
|
+
mcqAdditionalSettingsBase.optionsStyleLabel()
|
93
|
+
.should('be.visible')
|
94
|
+
.verifyInnerText('Option style');
|
95
|
+
mcqAdditionalSettingsBase.optionsStyleDropdown()
|
96
|
+
.should('be.visible')
|
97
|
+
.verifyInnerText('Default');
|
98
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
99
|
+
.should('not.exist');
|
100
|
+
});
|
101
|
+
|
102
|
+
it(`Clicking on Option Style dropdown should open a list of 3 options - ${dropdownOptions.toString()}`, () => {
|
103
|
+
mcqAdditionalSettingsBase.optionsStyleDropdown()
|
104
|
+
.click();
|
105
|
+
mcqAdditionalSettingsBase.optionsStyleDropdownListOptions()
|
106
|
+
.should('be.visible');
|
107
|
+
dropdownOptions.forEach((option, count) => {
|
108
|
+
mcqAdditionalSettingsBase.optionsStyleDropdownListOptions()
|
109
|
+
.eq(count)
|
110
|
+
.verifyInnerText(option);
|
111
|
+
});
|
112
|
+
});
|
113
|
+
|
114
|
+
it('CSS of Options style dropdown in active state', { tags: 'css' }, () => {
|
115
|
+
mcqAdditionalSettingsBase.optionsStyleDropdownListOptions()
|
116
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
|
117
|
+
.should('have.css', 'background-color', css.color.liTextSelectedBg);
|
118
|
+
mcqAdditionalSettingsBase.optionsStyleDropdownListOptions(`${dropdownOptions[1]}`)
|
119
|
+
.should('have.css', 'background-color', css.color.transparent);
|
120
|
+
});
|
121
|
+
|
122
|
+
it('Accessibility of Options Style dropdown in active state', { tags: 'a11y' }, () => {
|
123
|
+
cy.checkAccessibility(commonComponents.dropdownList())
|
124
|
+
});
|
125
|
+
|
126
|
+
it(`When the user selects ${dropdownOptions[1]} option from the Option Style dropdown, then \'Option Numeration\' label and dropdown should be displayed and in \'Option Numeration\' dropdown and by default, Numerical should be selected in the dropdown`, () => {
|
127
|
+
mcqAdditionalSettingsBase.optionsStyleDropdownListOptions(`${dropdownOptions[1]}`)
|
128
|
+
.verifyInnerText(`${dropdownOptions[1]}`)
|
129
|
+
.and('be.visible')
|
130
|
+
.click();
|
131
|
+
mcqAdditionalSettingsBase.optionsStyleDropdown()
|
132
|
+
.verifyInnerText(`${dropdownOptions[1]}`);
|
133
|
+
mcqAdditionalSettingsBase.optionNumerationLabel()
|
134
|
+
.verifyInnerText('Option numeration');
|
135
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
136
|
+
.verifyInnerText('Numerical')
|
137
|
+
.and('be.visible');
|
138
|
+
});
|
139
|
+
},
|
140
|
+
|
141
|
+
verifyOptionNumerationDropdownContents: (inputType) => {
|
142
|
+
//inputType : 'radio' | 'checkbox'
|
143
|
+
let optionName
|
144
|
+
if (inputType === 'radio') {
|
145
|
+
optionName = 'Radio button below option'
|
146
|
+
} else if (inputType === 'checkbox') {
|
147
|
+
optionName = 'Check box below option'
|
148
|
+
}
|
149
|
+
it('CSS of Option Numeration dropdown', { tags: 'css' }, () => {
|
150
|
+
mcqAdditionalSettingsBase.optionNumerationLabel()
|
151
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
152
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
153
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
154
|
+
});
|
155
|
+
|
156
|
+
it('Accessibility of Option numeration dropdown', () => {
|
157
|
+
cy.checkAccessibility(mcqAdditionalSettingsBase.optionNumerationDropdown().parents('.Option-Numeration'))
|
158
|
+
});
|
159
|
+
|
160
|
+
it('Clicking on Option Numeration dropdown should open a list of 3 options - Numerical, Uppercase alphabet, Lowercase alphabet', () => {
|
161
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
162
|
+
.click();
|
163
|
+
mcqAdditionalSettingsBase.optionNumerationDropdownListOptions()
|
164
|
+
.should('be.visible');
|
165
|
+
let dropdownOptions = ['Numerical', 'Uppercase alphabet', 'Lowercase alphabet'];
|
166
|
+
dropdownOptions.forEach((option, count) => {
|
167
|
+
mcqAdditionalSettingsBase.optionNumerationDropdownListOptions()
|
168
|
+
.eq(count)
|
169
|
+
.verifyInnerText(option);
|
170
|
+
});
|
171
|
+
cy.get('body')
|
172
|
+
.click();
|
173
|
+
});
|
174
|
+
|
175
|
+
it('CSS of Option Numeration dropdown in active state', { tags: 'css' }, () => {
|
176
|
+
cy.log('Post step: Clicking on the dropdown')
|
177
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
178
|
+
.click()
|
179
|
+
mcqAdditionalSettingsBase.optionNumerationDropdownListOptions()
|
180
|
+
.eq(0)
|
181
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
|
182
|
+
.should('have.css', 'background-color', css.color.liTextSelectedBg);
|
183
|
+
mcqAdditionalSettingsBase.optionNumerationDropdownListOptions()
|
184
|
+
.eq(1)
|
185
|
+
.should('have.css', 'background-color', css.color.transparent);
|
186
|
+
cy.log('Post step: Collapsing the response dropdown')
|
187
|
+
cy.get('body')
|
188
|
+
.click();
|
189
|
+
});
|
190
|
+
|
191
|
+
it('Accessibility of Options Numeration dropdown in active state', { tags: 'a11y' }, () => {
|
192
|
+
cy.log('Pre step: Clicking on Option Numeration dropdown')
|
193
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
194
|
+
.click();
|
195
|
+
cy.checkAccessibility(commonComponents.dropdownList())
|
196
|
+
cy.log('Post step: Closing the Option Numeration dropdown')
|
197
|
+
cy.get('body')
|
198
|
+
.click();
|
199
|
+
});
|
200
|
+
|
201
|
+
it(`When the user selects ${optionName} option from the Option Style dropdown, then \'Option Numeration\' dropdown should not be displayed`, () => {
|
202
|
+
mcqAdditionalSettingsBase.optionsStyleDropdown()
|
203
|
+
.click();
|
204
|
+
mcqAdditionalSettingsBase.optionsStyleDropdownListOptions(`${optionName}`)
|
205
|
+
.click();
|
206
|
+
mcqAdditionalSettingsBase.optionsStyleDropdown()
|
207
|
+
.verifyInnerText(`${optionName}`);
|
208
|
+
mcqAdditionalSettingsBase.optionNumerationDropdown()
|
209
|
+
.should('not.exist');
|
210
|
+
});
|
211
|
+
},
|
212
|
+
|
213
|
+
verifyNumberOfOptionColumnsAndOptionOrientationContent: () => {
|
214
|
+
it('CSS of \'Number of Option Columns\' dropdown', { tags: 'css' }, () => {
|
215
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsLabel()
|
216
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
217
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsDropdown()
|
218
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
219
|
+
});
|
220
|
+
|
221
|
+
it('\'Number of Option Columns\' label and dropdown should be displayed and in \'Number of Option Columns\' dropdown option \'1\' should be selected by default and Option orientation dropdown should not be present', () => {
|
222
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsLabel()
|
223
|
+
.should('be.visible')
|
224
|
+
.verifyInnerText('Number of option columns');
|
225
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsDropdown()
|
226
|
+
.verifyInnerText('1');
|
227
|
+
mcqAdditionalSettingsBase.optionOrientationLabel()
|
228
|
+
.should('not.exist');
|
229
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
230
|
+
.should('not.exist');
|
231
|
+
});
|
232
|
+
|
233
|
+
it('Clicking on Number of Option Columns dropdown should open a list of options from 1 to 6', () => {
|
234
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsDropdown()
|
235
|
+
.click();
|
236
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(0)
|
237
|
+
.should('be.visible');
|
238
|
+
for (let index = 0; index < 6; index++) {
|
239
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(index)
|
240
|
+
.should('have.text', index + 1);
|
241
|
+
};
|
242
|
+
});
|
243
|
+
|
244
|
+
it('CSS of Number of options column dropdown in active state', { tags: 'css' }, () => {
|
245
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(0)
|
246
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
|
247
|
+
.should('have.css', 'background-color', css.color.liTextSelectedBg);
|
248
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(1)
|
249
|
+
.should('have.css', 'background-color', css.color.transparent);
|
250
|
+
});
|
251
|
+
|
252
|
+
it('Accessibility of Number of Option Columns dropdown in active state', { tags: 'a11y' }, () => {
|
253
|
+
cy.checkAccessibility(commonComponents.dropdownList())
|
254
|
+
});
|
255
|
+
|
256
|
+
it('When the user selects any option except 1 from the Number of Option Columns dropdown, then \'Option Orientation\' label and dropdown should be displayed and in \'Option Orientation\' dropdown \'Vertical\' option should be selected by default', () => {
|
257
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(2)
|
258
|
+
.click();
|
259
|
+
mcqAdditionalSettingsBase.optionOrientationLabel()
|
260
|
+
.verifyInnerText('Option orientation');
|
261
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
262
|
+
.verifyInnerText('Vertical');
|
263
|
+
});
|
264
|
+
|
265
|
+
it('CSS of \'Option Orientation\' dropdown', { tags: 'css' }, () => {
|
266
|
+
mcqAdditionalSettingsBase.optionOrientationLabel()
|
267
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
268
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
269
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
270
|
+
});
|
271
|
+
|
272
|
+
it('Clicking on Option Orientation dropdown should open a list of 2 options - Vertical, Horizontal', () => {
|
273
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
274
|
+
.click();
|
275
|
+
mcqAdditionalSettingsBase.optionOrientationListOptions(0)
|
276
|
+
.should('be.visible');
|
277
|
+
let dropdownOptions = ['Vertical', 'Horizontal']
|
278
|
+
dropdownOptions.forEach((option, count) => {
|
279
|
+
mcqAdditionalSettingsBase.optionOrientationListOptions(count)
|
280
|
+
.verifyInnerText(option);
|
281
|
+
});
|
282
|
+
cy.log('Post step: Collapsing the response dropdown')
|
283
|
+
cy.get('body')
|
284
|
+
.click();
|
285
|
+
});
|
286
|
+
|
287
|
+
it('CSS of Option Orientation dropdown in active state', { tags: 'css' }, () => {
|
288
|
+
cy.log('Post step: Clicking on the dropdown')
|
289
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
290
|
+
.click();
|
291
|
+
mcqAdditionalSettingsBase.optionOrientationListOptions(0)
|
292
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
|
293
|
+
.should('have.css', 'background-color', css.color.liTextSelectedBg);
|
294
|
+
mcqAdditionalSettingsBase.optionOrientationListOptions(1)
|
295
|
+
.should('have.css', 'background-color', css.color.transparent);
|
296
|
+
cy.log('Post step: Collapsing the response dropdown')
|
297
|
+
cy.get('body')
|
298
|
+
.click();
|
299
|
+
});
|
300
|
+
|
301
|
+
it('Accessibility of Option Orientation dropdown in active state', { tags: 'a11y' }, () => {
|
302
|
+
cy.log('Pre step: Clicking on the dropdown')
|
303
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
304
|
+
.click();
|
305
|
+
cy.checkAccessibility(commonComponents.dropdownList())
|
306
|
+
cy.log('Post step: Collapsing the response dropdown')
|
307
|
+
cy.get('body')
|
308
|
+
.click();
|
309
|
+
});
|
310
|
+
|
311
|
+
it('When the user selects option \'1\' from the Number of Option Columns dropdown, then \'Option Orientation\' dropdown should not be displayed and answer options should be displayed in a single column in \'Set Correct Answer\' section as well as \'Preview\' tab', () => {
|
312
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsDropdown()
|
313
|
+
.click();
|
314
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(0)
|
315
|
+
.click();
|
316
|
+
mcqAdditionalSettingsBase.optionOrientationLabel()
|
317
|
+
.should('not.exist');
|
318
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
319
|
+
.should('not.exist');
|
320
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
321
|
+
.parents('.edit-set-correct-answer-mcq-control')
|
322
|
+
.should('have.attr', 'columns')
|
323
|
+
.and('eq', '1');
|
324
|
+
cy.log('Switching to Preview tab')
|
325
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
326
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
327
|
+
.parents()
|
328
|
+
.eq(2)
|
329
|
+
.should('have.attr', 'columns')
|
330
|
+
.and('eq', '1');
|
331
|
+
});
|
332
|
+
},
|
333
|
+
|
334
|
+
verifyOptionOrientation: (inputType) => {
|
335
|
+
let options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production', 'Pollution caused by electronic waste', 'Pollution caused by nuclear waste'];
|
336
|
+
let numbers = [1, 2, 3, 4, 5, 6];
|
337
|
+
it('When the user selects \'Vertical\' option from the \'Option Orientation\' dropdown, the numbers besides answer options should be listed vertically in columns in the \'Set Correct Answer\' section as well as in the \'Preview\' tab', () => {
|
338
|
+
//Failing due to https://redmine.zeuslearning.com/issues/519970
|
339
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsDropdown()
|
340
|
+
.click();
|
341
|
+
mcqAdditionalSettingsBase.numberOfOptionColumnsListOptions(2)
|
342
|
+
.click();
|
343
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
344
|
+
.verifyInnerText('Vertical');
|
345
|
+
mcqSetCorrectAnswerSection.steps.verifyEditTabCorrectAnswerSectionOptionsNumeration(numbers, inputType)
|
346
|
+
cy.log('Switching to Preview tab')
|
347
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
348
|
+
mcqPreviewComponents.steps.verifyPreviewTabOptionsNumeration(numbers, inputType)
|
349
|
+
mcqQuestionCommonComponents.steps.verifyShuffleOptionOrder(options, 6);
|
350
|
+
cy.log('Post step: Switching to Edit tab')
|
351
|
+
createQuestionBasePage.steps.switchToEditTab();
|
352
|
+
});
|
353
|
+
|
354
|
+
it('When the user selects \'Horizontal\' option from the \'Option Orientation\' dropdown, the numbers besides answer options should be listed horizontally in columns in the \'Set Correct Answer\' section as well as in the \'Preview\' tab', () => {
|
355
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
356
|
+
.click();
|
357
|
+
mcqAdditionalSettingsBase.optionOrientationListOptions(1)
|
358
|
+
.click();
|
359
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
360
|
+
.verifyInnerText('Horizontal');
|
361
|
+
mcqSetCorrectAnswerSection.steps.verifyEditTabCorrectAnswerSectionOptionsNumeration(numbers, inputType)
|
362
|
+
cy.log('Switching to Preview tab')
|
363
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
364
|
+
mcqPreviewComponents.steps.verifyPreviewTabOptionsNumeration(numbers, inputType)
|
365
|
+
mcqQuestionCommonComponents.steps.verifyShuffleOptionOrder(options, 6);
|
366
|
+
cy.log('Post-step: Switching to Edit tab and changing back to Vertical option orientation');
|
367
|
+
createQuestionBasePage.steps.switchToEditTab();
|
368
|
+
mcqAdditionalSettingsBase.optionOrientationDropdown()
|
369
|
+
.click();
|
370
|
+
mcqAdditionalSettingsBase.optionOrientationListOptions(0)
|
371
|
+
.click();
|
372
|
+
});
|
373
|
+
|
374
|
+
it('In Preview tab, options should be displayed in shuffled order in 3 columns', () => {
|
375
|
+
cy.log('Pre step: Switching to Preview tab')
|
376
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
377
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
378
|
+
.parents()
|
379
|
+
.eq(2)
|
380
|
+
.should('have.attr', 'columns')
|
381
|
+
.and('eq', '3');
|
382
|
+
mcqQuestionCommonComponents.steps.verifyShuffleOptionOrder(options, 6);
|
383
|
+
});
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
export const mcqAdditionalSettingsBase = {
|
388
|
+
...selectors,
|
389
|
+
tests
|
390
|
+
}
|
@@ -0,0 +1,263 @@
|
|
1
|
+
import { commonComponents } from "./commonComponents";
|
2
|
+
import { createQuestionBasePage } from "./createQuestionBasePage";
|
3
|
+
import { mcqSetCorrectAnswerSection } from "./mcqSetCorrectAnswerSection";
|
4
|
+
import { ckEditorToolbar } from "./ckEditorToolbar";
|
5
|
+
const css = Cypress.env('css');
|
6
|
+
import { optionsWrapperComponent } from "./optionsWrapperComponent";
|
7
|
+
import { mcqPreviewComponents } from "./mcqPreviewComponents";
|
8
|
+
import constants from "../../fixtures/constants";
|
9
|
+
|
10
|
+
const selectors = {
|
11
|
+
optionsInputField: () => cy.get('.option-component [title*="Enter option"]'),
|
12
|
+
previewTabOptionsWrapper: (optionNumber) => cy.get('[class*="PreviewTabstyles__PreviewSubContainer"] div[class*="option-wrapper"]').eq(optionNumber),
|
13
|
+
previewTabOptionsText: () => cy.get('label .mcq-label'),
|
14
|
+
previewTabOptionsCheckbox: () => cy.get('[data-ngie-testid="response-option-checkbox"] input'),
|
15
|
+
editTabOptionsWrapper: (optionIndex) => cy.get('.edit-mcq-option-wrapper').eq(optionIndex),
|
16
|
+
editTabOptionsText: () => cy.get('label .mcq-label'),
|
17
|
+
optionsRadioButton: () => cy.get('input[type="radio"]'),
|
18
|
+
editTabOptionsCheckbox: () => cy.get('[data-ngie-testid="response-option-checkbox"] input'),
|
19
|
+
optionNumeration: () => cy.get('.mcq-option-numeration'),
|
20
|
+
optionForBlockWithoutCheckbox: () => cy.get('.mcq-without-checkbox'),
|
21
|
+
optionForBlockWithoutRadioButton: () => cy.get('.numerical-option-wrapper')
|
22
|
+
};
|
23
|
+
|
24
|
+
const steps = {
|
25
|
+
addOptionsText: (numberOfOptions) => {
|
26
|
+
let options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production', 'Pollution caused by electronic waste', 'Pollution caused by nuclear waste'];
|
27
|
+
for (let index = 0; index < numberOfOptions; index++) {
|
28
|
+
mcqOptionsComponent.optionsInputField()
|
29
|
+
.eq(index)
|
30
|
+
.type(options[index], { delay: 0 })
|
31
|
+
.blur()
|
32
|
+
.focus()
|
33
|
+
.should('have.text', options[index]);
|
34
|
+
};
|
35
|
+
},
|
36
|
+
|
37
|
+
verifyBlockWithoutCheckboxOptionsAndNumerationInEditAndPreviewTab: (inputType) => {
|
38
|
+
const numbers = ['1', '2', '3', '4'];
|
39
|
+
for (let index = 0; index < 4; index++) {
|
40
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(index)
|
41
|
+
.within(() => {
|
42
|
+
if (inputType === 'radio') {
|
43
|
+
mcqOptionsComponent.optionForBlockWithoutRadioButton()
|
44
|
+
.should('exist');
|
45
|
+
mcqOptionsComponent.optionsRadioButton()
|
46
|
+
.should('not.be.visible');
|
47
|
+
} else if (inputType === 'checkbox') {
|
48
|
+
mcqOptionsComponent.optionForBlockWithoutCheckbox()
|
49
|
+
.should('exist');
|
50
|
+
mcqOptionsComponent.editTabOptionsCheckbox()
|
51
|
+
.should('not.be.visible');
|
52
|
+
};
|
53
|
+
});
|
54
|
+
};
|
55
|
+
mcqSetCorrectAnswerSection.steps.verifyEditTabCorrectAnswerSectionOptionsNumeration(numbers, inputType)
|
56
|
+
cy.log('Switching to Preview tab')
|
57
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
58
|
+
for (let index = 0; index < 4; index++) {
|
59
|
+
mcqOptionsComponent.previewTabOptionsWrapper(index)
|
60
|
+
.within(() => {
|
61
|
+
if (inputType === 'radio') {
|
62
|
+
mcqOptionsComponent.optionsRadioButton()
|
63
|
+
.should('not.be.visible');
|
64
|
+
mcqOptionsComponent.optionForBlockWithoutRadioButton()
|
65
|
+
.should('exist');
|
66
|
+
} else if (inputType === 'checkbox') {
|
67
|
+
mcqOptionsComponent.previewTabOptionsCheckbox()
|
68
|
+
.should('not.be.visible');
|
69
|
+
mcqOptionsComponent.optionForBlockWithoutCheckbox()
|
70
|
+
.should('exist');
|
71
|
+
};
|
72
|
+
});
|
73
|
+
};
|
74
|
+
mcqPreviewComponents.steps.verifyPreviewTabOptionsNumeration(numbers, inputType);
|
75
|
+
}
|
76
|
+
};
|
77
|
+
|
78
|
+
const tests = {
|
79
|
+
verifyDefaultOptionsFieldAndErrorMessage: () => {
|
80
|
+
it('\'Options\' label should be displayed', () => {
|
81
|
+
optionsWrapperComponent.optionsLabel()
|
82
|
+
.should('have.text', 'Options');
|
83
|
+
});
|
84
|
+
|
85
|
+
it('By default 4 \'Options\' input fields should be displayed with placeholder text and Drag handle and Delete option icon buttons should be displayed besides each input field', () => {
|
86
|
+
let options = ['Enter option 1', 'Enter option 2', 'Enter option 3', 'Enter option 4'];
|
87
|
+
options.forEach((option, count) => {
|
88
|
+
mcqOptionsComponent.editTabOptionsWrapper(count)
|
89
|
+
.within(() => {
|
90
|
+
optionsWrapperComponent.optionsInputField()
|
91
|
+
.should('have.attr', 'data-cke-editorplaceholder', option);
|
92
|
+
commonComponents.dragHandleButton()
|
93
|
+
.should('exist');
|
94
|
+
commonComponents.deleteButton()
|
95
|
+
.should('be.visible');
|
96
|
+
});
|
97
|
+
});
|
98
|
+
});
|
99
|
+
|
100
|
+
it('On hovering over the drag handle of the options, \'Drag to reorder\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the drag handle', () => {
|
101
|
+
mcqOptionsComponent.editTabOptionsWrapper(0)
|
102
|
+
.within(() => {
|
103
|
+
commonComponents.dragHandleButton()
|
104
|
+
.trigger('mouseover');
|
105
|
+
});
|
106
|
+
commonComponents.tooltipText()
|
107
|
+
.should('have.text', 'Drag to reorder');
|
108
|
+
mcqOptionsComponent.editTabOptionsWrapper(0)
|
109
|
+
.within(() => {
|
110
|
+
commonComponents.dragHandleButton()
|
111
|
+
.trigger('mouseout');
|
112
|
+
});
|
113
|
+
commonComponents.tooltipText()
|
114
|
+
.should('not.exist');
|
115
|
+
});
|
116
|
+
|
117
|
+
it('\'Add Option\' button should be present', () => {
|
118
|
+
optionsWrapperComponent.addOptionButton()
|
119
|
+
.should('be.visible');
|
120
|
+
});
|
121
|
+
|
122
|
+
it('CSS of Options section', { tags: 'css' }, () => {
|
123
|
+
optionsWrapperComponent.optionsLabel()
|
124
|
+
.verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
|
125
|
+
mcqOptionsComponent.editTabOptionsWrapper(0)
|
126
|
+
.within(() => {
|
127
|
+
commonComponents.dragHandleButton()
|
128
|
+
.verifyCSS(css.color.secondaryBtnActive, css.fontSize.normal, css.fontWeight.regular);
|
129
|
+
commonComponents.deleteButton()
|
130
|
+
.verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
|
131
|
+
mcqOptionsComponent.optionsInputField()
|
132
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
|
133
|
+
});
|
134
|
+
optionsWrapperComponent.addOptionButton()
|
135
|
+
.verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.medium);
|
136
|
+
});
|
137
|
+
|
138
|
+
//Note: a11y covered in header section
|
139
|
+
|
140
|
+
it('When user focus in and out of any of the \'Options\' input field without typing anything, an error message should be thrown', () => {
|
141
|
+
mcqOptionsComponent.editTabOptionsWrapper(0)
|
142
|
+
.within(() => {
|
143
|
+
mcqOptionsComponent.optionsInputField()
|
144
|
+
.click()
|
145
|
+
.blur();
|
146
|
+
commonComponents.errorMessage()
|
147
|
+
.should('have.text', 'Error: Option is required.');
|
148
|
+
});
|
149
|
+
});
|
150
|
+
|
151
|
+
it('User should be able to enter text in options input field and \'Error: Option is required.\' error message should disappear', () => {
|
152
|
+
mcqOptionsComponent.steps.addOptionsText(3)
|
153
|
+
mcqOptionsComponent.editTabOptionsWrapper(3)
|
154
|
+
.within(() => {
|
155
|
+
commonComponents.errorMessage()
|
156
|
+
.should('not.exist');
|
157
|
+
});
|
158
|
+
});
|
159
|
+
},
|
160
|
+
|
161
|
+
verifyAddAndDeleteOptions: () => {
|
162
|
+
it('User should be able to delete an option and the deleted option should not be displayed in the \'Set Correct Answer\' section as well as on the \'Preview\' tab', () => {
|
163
|
+
mcqOptionsComponent.editTabOptionsWrapper(3)
|
164
|
+
.within(() => {
|
165
|
+
commonComponents.deleteButton()
|
166
|
+
.click();
|
167
|
+
commonComponents.deleteButton()
|
168
|
+
.should('not.exist');
|
169
|
+
});
|
170
|
+
cy.log('Switching to Preview tab to check deleted option doesn\'t exist')
|
171
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
172
|
+
mcqOptionsComponent.previewTabOptionsWrapper(3)
|
173
|
+
.should('not.exist');
|
174
|
+
});
|
175
|
+
|
176
|
+
it('User should be able to add an option using \'ADD OPTION\' button and the added option should be displayed in the \'Set Correct Answer\' section as well as on the \'Preview\' tab', () => {
|
177
|
+
cy.log('Switching back to edit tab to add option')
|
178
|
+
createQuestionBasePage.steps.switchToEditTab()
|
179
|
+
optionsWrapperComponent.addOptionButton()
|
180
|
+
.click();
|
181
|
+
mcqOptionsComponent.editTabOptionsWrapper(3)
|
182
|
+
.should('be.visible');
|
183
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(3)
|
184
|
+
.should('be.visible');
|
185
|
+
cy.log('Switching to Preview tab to check the added option')
|
186
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
187
|
+
mcqOptionsComponent.previewTabOptionsWrapper(3)
|
188
|
+
.should('be.visible');
|
189
|
+
});
|
190
|
+
},
|
191
|
+
|
192
|
+
verifyOptionsImageUpload: () => {
|
193
|
+
it('User should be able to upload images in options input field', () => {
|
194
|
+
mcqOptionsComponent.editTabOptionsWrapper(3)
|
195
|
+
.within(() => {
|
196
|
+
mcqOptionsComponent.optionsInputField()
|
197
|
+
.click();
|
198
|
+
});
|
199
|
+
ckEditorToolbar.imageIcon()
|
200
|
+
.scrollIntoView()
|
201
|
+
.click();
|
202
|
+
ckEditorToolbar.imageUrlInputField()
|
203
|
+
.type(constants.foxImageLink);
|
204
|
+
ckEditorToolbar.alternativeTextInputField()
|
205
|
+
.type(constants.foxImageAltText);
|
206
|
+
ckEditorToolbar.ckeOkButton()
|
207
|
+
.click();
|
208
|
+
mcqOptionsComponent.editTabOptionsWrapper(3)
|
209
|
+
.within(() => {
|
210
|
+
mcqOptionsComponent.optionsInputField()
|
211
|
+
.find('img')
|
212
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
213
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
214
|
+
});
|
215
|
+
});
|
216
|
+
|
217
|
+
it('The added text and image options should be displayed in the \'Set Correct Answer\' section as well as in the \'Preview\' tab', () => {
|
218
|
+
let options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production'];
|
219
|
+
options.forEach((option, count) => {
|
220
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(count)
|
221
|
+
.within(() => {
|
222
|
+
mcqOptionsComponent.editTabOptionsText()
|
223
|
+
.should('have.text', option);
|
224
|
+
});
|
225
|
+
});
|
226
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(3)
|
227
|
+
.find('img')
|
228
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
229
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
230
|
+
cy.log('Switching to Preview tab')
|
231
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
232
|
+
options.forEach((option, count) => {
|
233
|
+
mcqOptionsComponent.previewTabOptionsWrapper(count)
|
234
|
+
.within(() => {
|
235
|
+
mcqOptionsComponent.previewTabOptionsText()
|
236
|
+
.should('have.text', option);
|
237
|
+
});
|
238
|
+
});
|
239
|
+
mcqOptionsComponent.previewTabOptionsWrapper(3)
|
240
|
+
.find('img')
|
241
|
+
.should('have.attr', 'src', constants.foxImageLink)
|
242
|
+
.and('have.attr', 'alt', constants.foxImageAltText);
|
243
|
+
cy.log('Post-step: Switching back to the Edit tab')
|
244
|
+
createQuestionBasePage.steps.switchToEditTab();
|
245
|
+
});
|
246
|
+
|
247
|
+
//https://redmine.zeuslearning.com/issues/528466
|
248
|
+
it('Accessibility of options field with images', { tags: 'a11y' }, () => {
|
249
|
+
cy.checkAccessibility(mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(3).parents('.mcq_Group'))
|
250
|
+
cy.log('Switching to Preview tab')
|
251
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
252
|
+
cy.checkAccessibility(mcqOptionsComponent.previewTabOptionsWrapper(3).parents('.mcq-options-wrapper'));
|
253
|
+
cy.log('Post step: Switching to Edit tab')
|
254
|
+
createQuestionBasePage.steps.switchToEditTab();
|
255
|
+
});
|
256
|
+
}
|
257
|
+
};
|
258
|
+
|
259
|
+
export const mcqOptionsComponent = {
|
260
|
+
...selectors,
|
261
|
+
steps,
|
262
|
+
tests
|
263
|
+
};
|