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,78 @@
|
|
1
|
+
import { autoScoredPreviewBase } from "./autoScoredPreviewBase";
|
2
|
+
import { commonComponents } from "./commonComponents";
|
3
|
+
import { mcqOptionsComponent } from "./mcqOptionsComponent";
|
4
|
+
|
5
|
+
const steps = {
|
6
|
+
verifyCorrectOptionCheckmarkIcon: (option) => {
|
7
|
+
mcqOptionsComponent.previewTabOptionsWrapper(option)
|
8
|
+
.within(() => {
|
9
|
+
autoScoredPreviewBase.correctIcon()
|
10
|
+
.should('be.visible');
|
11
|
+
});
|
12
|
+
},
|
13
|
+
|
14
|
+
verifyIncorrectOptionCrossmarkIcon: (option) => {
|
15
|
+
mcqOptionsComponent.previewTabOptionsWrapper(option)
|
16
|
+
.within(() => {
|
17
|
+
autoScoredPreviewBase.incorrectIcon()
|
18
|
+
.should('be.visible');
|
19
|
+
});
|
20
|
+
},
|
21
|
+
|
22
|
+
verifyCorrectOption: (option) => {
|
23
|
+
commonComponents.previewTabQuestionWrapper()
|
24
|
+
.within(() => {
|
25
|
+
mcqOptionsComponent.previewTabOptionsText()
|
26
|
+
.contains(option)
|
27
|
+
.parents('.mcq-option-wrapper')
|
28
|
+
.within(() => {
|
29
|
+
autoScoredPreviewBase.correctIcon()
|
30
|
+
.should('be.visible');
|
31
|
+
});
|
32
|
+
});
|
33
|
+
},
|
34
|
+
|
35
|
+
verifyIncorrectOption: (option) => {
|
36
|
+
commonComponents.previewTabQuestionWrapper()
|
37
|
+
.within(() => {
|
38
|
+
mcqOptionsComponent.previewTabOptionsText()
|
39
|
+
.contains(option)
|
40
|
+
.parents('.mcq-option-wrapper')
|
41
|
+
.within(() => {
|
42
|
+
autoScoredPreviewBase.incorrectIcon()
|
43
|
+
.should('be.visible');
|
44
|
+
});
|
45
|
+
});
|
46
|
+
},
|
47
|
+
|
48
|
+
verifyPreviewTabOptionsText: (optionsArray) => {
|
49
|
+
optionsArray.forEach((optionText, count) => {
|
50
|
+
mcqOptionsComponent.previewTabOptionsWrapper(count)
|
51
|
+
.within(() => {
|
52
|
+
mcqOptionsComponent.previewTabOptionsText()
|
53
|
+
.verifyInnerText(optionText);
|
54
|
+
});
|
55
|
+
});
|
56
|
+
},
|
57
|
+
|
58
|
+
verifyPreviewTabOptionsNumeration: (optionNumerationArray, inputType) => {
|
59
|
+
optionNumerationArray.forEach((optionNumeration, count) => {
|
60
|
+
mcqOptionsComponent.previewTabOptionsWrapper(count)
|
61
|
+
.within(() => {
|
62
|
+
mcqOptionsComponent.optionNumeration()
|
63
|
+
.should('have.text', optionNumeration);
|
64
|
+
if (inputType === 'radio') {
|
65
|
+
mcqOptionsComponent.optionsRadioButton()
|
66
|
+
.should('not.be.visible');
|
67
|
+
} else if (inputType === 'checkbox') {
|
68
|
+
mcqOptionsComponent.previewTabOptionsCheckbox()
|
69
|
+
.should('not.be.visible');
|
70
|
+
};
|
71
|
+
});
|
72
|
+
});
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
export const mcqPreviewComponents = {
|
77
|
+
steps
|
78
|
+
}
|
@@ -0,0 +1,265 @@
|
|
1
|
+
import { additionalSettingsPanel } from "./additionalSettingsPanel";
|
2
|
+
import { autoScoredSetCorrectAnswerSection } from "./autoScoredSetCorrectAnswerSection";
|
3
|
+
import { commonComponents } from "./commonComponents";
|
4
|
+
import { createQuestionBasePage } from "./createQuestionBasePage";
|
5
|
+
import { mcqOptionsComponent } from "./mcqOptionsComponent";
|
6
|
+
import { mcqSetCorrectAnswerSection } from "./mcqSetCorrectAnswerSection";
|
7
|
+
import { questionInstructionsComponent } from "./questionInstructionsComponent";
|
8
|
+
import { scoringSectionBase } from "./scoringSectionBase";
|
9
|
+
const css = Cypress.env('css');
|
10
|
+
|
11
|
+
const selectors = {
|
12
|
+
shuffleOptionCheckbox: () => cy.get('[data-ngie-testid="shuffle-option-order-checkbox"] input'),
|
13
|
+
shuffleOptionLabel: () => cy.get('[data-ngie-testid="shuffle-option-order-checkbox"] .MuiFormControlLabel-label')
|
14
|
+
}
|
15
|
+
|
16
|
+
const steps = {
|
17
|
+
verifyShuffleOptionOrder: (optionArray, numberOfOptions) => {
|
18
|
+
let currentOptions = [...optionArray]
|
19
|
+
let optionsString = currentOptions.join('');
|
20
|
+
for (let index = 0; index < numberOfOptions; index++) {
|
21
|
+
mcqOptionsComponent.previewTabOptionsWrapper(index)
|
22
|
+
.within(() => {
|
23
|
+
mcqOptionsComponent.previewTabOptionsText()
|
24
|
+
.then(($element) => {
|
25
|
+
expect($element.text()).to.be.oneOf(currentOptions);
|
26
|
+
currentOptions = currentOptions.filter((value) => value !== $element.text())
|
27
|
+
});
|
28
|
+
});
|
29
|
+
};
|
30
|
+
commonComponents.previewTabQuestionWrapper()
|
31
|
+
.within(() => {
|
32
|
+
mcqOptionsComponent.previewTabOptionsText()
|
33
|
+
.should('not.have.text', optionsString);
|
34
|
+
});
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
const tests = {
|
39
|
+
verifyCompulsoryFieldsErrorMessages: () => {
|
40
|
+
it('Validation error messages should be displayed below required input fields', () => {
|
41
|
+
questionInstructionsComponent.questionInstructionsLabelEditTab()
|
42
|
+
.parents('.edit-question-instruction-wrapper')
|
43
|
+
.within(() => {
|
44
|
+
commonComponents.errorMessage()
|
45
|
+
.should('be.visible')
|
46
|
+
.verifyInnerText('Error: Question instructions are required.');
|
47
|
+
});
|
48
|
+
for (let index = 0; index < 4; index++) {
|
49
|
+
mcqOptionsComponent.editTabOptionsWrapper(index)
|
50
|
+
.within(() => {
|
51
|
+
commonComponents.errorMessage()
|
52
|
+
.verifyInnerText('Error: Option is required.');
|
53
|
+
});
|
54
|
+
};
|
55
|
+
scoringSectionBase.pointsLabel()
|
56
|
+
.parents('.points-wrapper')
|
57
|
+
.within(() => {
|
58
|
+
commonComponents.errorMessage()
|
59
|
+
.verifyInnerText('Error: Please enter points.');
|
60
|
+
});
|
61
|
+
autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
|
62
|
+
.should('have.text', 'Error-Icon');
|
63
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
64
|
+
.parents('.edit-set-correct-answer-mcq-control')
|
65
|
+
.within(() => {
|
66
|
+
commonComponents.errorMessage()
|
67
|
+
.verifyInnerText('Error: Please set a correct answer.');
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
it('Validation error messages should disappear when required input fields are filled', () => {
|
72
|
+
//Question instructions error message
|
73
|
+
questionInstructionsComponent.steps.addQuestionInstructions();
|
74
|
+
questionInstructionsComponent.questionInstructionsLabelEditTab()
|
75
|
+
.parents('.edit-question-instruction-wrapper')
|
76
|
+
.within(() => {
|
77
|
+
commonComponents.errorMessage()
|
78
|
+
.should('not.exist');
|
79
|
+
});
|
80
|
+
//Options error message
|
81
|
+
mcqOptionsComponent.steps.addOptionsText(4);
|
82
|
+
mcqOptionsComponent.editTabOptionsWrapper(0)
|
83
|
+
.parents('.edit-mcq-options-wrapper')
|
84
|
+
.within(() => {
|
85
|
+
commonComponents.errorMessage()
|
86
|
+
.should('not.exist');
|
87
|
+
});
|
88
|
+
//Set correct answer error messages
|
89
|
+
mcqSetCorrectAnswerSection.steps.setCorrectAnswers(2);
|
90
|
+
scoringSectionBase.steps.allotPoints(20);
|
91
|
+
scoringSectionBase.pleaseEnterPointsErrorMessage()
|
92
|
+
.should('not.exist');
|
93
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
94
|
+
.parents('.edit-set-correct-answer-mcq-control')
|
95
|
+
.within(() => {
|
96
|
+
commonComponents.errorMessage()
|
97
|
+
.should('not.exist');
|
98
|
+
});
|
99
|
+
autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
|
100
|
+
.should('not.exist');
|
101
|
+
});
|
102
|
+
|
103
|
+
commonComponents.tests.verifya11yOfCreateItemWrapperContents();
|
104
|
+
},
|
105
|
+
|
106
|
+
verifyCSSanda11yOfSelectedNumericalInCorrectAnswerSectionAndPreviewTab: () => {
|
107
|
+
it('CSS of selected state of options and numbers in the \'Set Correct Answer\' section as well as in the \'Preview\' tab', { tags: 'css' }, () => {
|
108
|
+
cy.log('Selecting an option in Preview tab to check CSS of selected option')
|
109
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
110
|
+
.click()
|
111
|
+
.within(() => {
|
112
|
+
mcqOptionsComponent.optionNumeration()
|
113
|
+
.verifyCSS(css.color.whiteText, css.fontSize.default, css.fontWeight.bold)
|
114
|
+
.should('have.css', 'background-color', css.color.optionsSelectedText);
|
115
|
+
mcqOptionsComponent.previewTabOptionsText()
|
116
|
+
.verifyCSS(css.color.optionsSelectedText, css.fontSize.default, css.fontWeight.bold)
|
117
|
+
.parents('[data-ngie-testid="response-option-checkbox"]')
|
118
|
+
.should('have.css', 'background-color', css.color.defaultBackground)
|
119
|
+
.and('have.css', 'border', `2px solid ${css.color.activeComponentBorder}`);
|
120
|
+
});
|
121
|
+
cy.log('Switching to Edit tab')
|
122
|
+
createQuestionBasePage.steps.switchToEditTab();
|
123
|
+
cy.log('Selecting an option in Correct answer section to check CSS of selected option')
|
124
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
125
|
+
.click()
|
126
|
+
.within(() => {
|
127
|
+
mcqOptionsComponent.optionNumeration()
|
128
|
+
.verifyCSS(css.color.whiteText, css.fontSize.default, css.fontWeight.bold)
|
129
|
+
.should('have.css', 'background-color', css.color.optionsSelectedText);
|
130
|
+
mcqOptionsComponent.editTabOptionsText()
|
131
|
+
.verifyCSS(css.color.optionsSelectedText, css.fontSize.default, css.fontWeight.bold)
|
132
|
+
.parents('[data-ngie-testid="response-option-checkbox"]')
|
133
|
+
.should('have.css', 'background-color', css.color.defaultBackground)
|
134
|
+
.and('have.css', 'border', `2px solid ${css.color.activeComponentBorder}`);
|
135
|
+
});
|
136
|
+
cy.log('Post step: Deselecting the options and switching to Preview tab')
|
137
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
138
|
+
.click();
|
139
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
140
|
+
});
|
141
|
+
|
142
|
+
it('Accessibility of selected state of options and numbers in the \'Set Correct Answer\' section as well as in the \'Preview\' tab', { tags: 'a11y' }, () => {
|
143
|
+
cy.log('Selecting an option in Preview tab to check accessibility of Preview tab options')
|
144
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
145
|
+
.click();
|
146
|
+
cy.checkAccessibility(commonComponents.previewTabQuestionWrapper());
|
147
|
+
cy.log('Switching to Edit tab')
|
148
|
+
createQuestionBasePage.steps.switchToEditTab();
|
149
|
+
cy.log('Selecting an option in Correct answer section to check Accessibility Correct answer section options')
|
150
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
151
|
+
.click();
|
152
|
+
cy.checkAccessibility(mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0).parents('.mcq_Group'));
|
153
|
+
cy.log('Post step:Deselecting option and switching to Preview tab')
|
154
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0)
|
155
|
+
.click();
|
156
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
157
|
+
});
|
158
|
+
},
|
159
|
+
|
160
|
+
verifyEditTabCorrectAnswerSectionAndPreviewTabFontSize: () => {
|
161
|
+
//TODO: Comment: we'll need to move to object loopings in case of 2 parameters please ask for more details
|
162
|
+
const fontsizes = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
|
163
|
+
const font = ['16px', '12px', '14px', '17px', '20px', '24px'];
|
164
|
+
fontsizes.forEach((option, count) => {
|
165
|
+
it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size of the preview (options, question instructions and check answer button) should be changed to ${option} in the \'Set Correct Answer\' section as well as in the \'Preview\' tab`, () => {
|
166
|
+
additionalSettingsPanel.fontSizeDropdown()
|
167
|
+
.click();
|
168
|
+
additionalSettingsPanel.fontSizeListOptions(count)
|
169
|
+
.click();
|
170
|
+
additionalSettingsPanel.fontSizeDropdown()
|
171
|
+
.verifyInnerText(`${option}`);
|
172
|
+
cy.log('Checking correct answer section font size')
|
173
|
+
mcqOptionsComponent.editTabOptionsText()
|
174
|
+
.each(($element) => {
|
175
|
+
expect($element).to.have.css('font-size', font[count]);
|
176
|
+
});
|
177
|
+
cy.log('Switching to Preview tab')
|
178
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
179
|
+
cy.log('Checking Preview section font size')
|
180
|
+
questionInstructionsComponent.questionInstructionsText()
|
181
|
+
.should('have.css', 'font-size', font[count]);
|
182
|
+
commonComponents.previewTabQuestionWrapper()
|
183
|
+
.within(() => {
|
184
|
+
mcqOptionsComponent.editTabOptionsText()
|
185
|
+
.each(($element) => {
|
186
|
+
expect($element).to.have.css('font-size', font[count]);
|
187
|
+
});
|
188
|
+
});
|
189
|
+
cy.log('Post step: Switch to Edit tab')
|
190
|
+
createQuestionBasePage.steps.switchToEditTab();
|
191
|
+
});
|
192
|
+
});
|
193
|
+
},
|
194
|
+
|
195
|
+
verifyShuffleOptionOrderFunctionality: () => {
|
196
|
+
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'];
|
197
|
+
let shuffledOptions = '';
|
198
|
+
it('\'Shuffle option order\' checkbox should be present and by default \'Shuffle option order\' checkbox should be unchecked', () => {
|
199
|
+
mcqQuestionCommonComponents.shuffleOptionCheckbox()
|
200
|
+
.should('not.be.checked');
|
201
|
+
});
|
202
|
+
|
203
|
+
it('User should be able to shuffle answer options for students using \'Shuffle option order\' checkbox and The options should get shuffled in the \'Preview\' tab', () => {
|
204
|
+
mcqQuestionCommonComponents.shuffleOptionCheckbox()
|
205
|
+
.click()
|
206
|
+
.should('be.checked');
|
207
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
208
|
+
mcqQuestionCommonComponents.steps.verifyShuffleOptionOrder(options, 4)
|
209
|
+
});
|
210
|
+
|
211
|
+
it('When user switches to Edit tab and makes no changes (edit/updates) and switches back to the Preview tab, the options should not get shuffled, ', () => {
|
212
|
+
commonComponents.previewTabQuestionWrapper()
|
213
|
+
.within(() => {
|
214
|
+
mcqOptionsComponent.editTabOptionsText()
|
215
|
+
.then(($element) => {
|
216
|
+
shuffledOptions = $element.text();
|
217
|
+
});
|
218
|
+
});
|
219
|
+
createQuestionBasePage.steps.switchToEditTab()
|
220
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
221
|
+
commonComponents.previewTabQuestionWrapper()
|
222
|
+
.within(() => {
|
223
|
+
mcqOptionsComponent.previewTabOptionsText()
|
224
|
+
.should('have.text', shuffledOptions);
|
225
|
+
});
|
226
|
+
});
|
227
|
+
|
228
|
+
it('When user switches to Edit tab and makes some changes (edit/updates) and switches back to the Preview tab, the options should get re-shuffled', () => {
|
229
|
+
createQuestionBasePage.steps.switchToEditTab()
|
230
|
+
scoringSectionBase.pointsInputField()
|
231
|
+
.clear()
|
232
|
+
.type('10')
|
233
|
+
.should('have.value', '10');
|
234
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
235
|
+
mcqQuestionCommonComponents.steps.verifyShuffleOptionOrder(options, 4);
|
236
|
+
commonComponents.previewTabQuestionWrapper()
|
237
|
+
.within(() => {
|
238
|
+
mcqOptionsComponent.previewTabOptionsText()
|
239
|
+
.should('not.have.text', shuffledOptions);
|
240
|
+
});
|
241
|
+
});
|
242
|
+
|
243
|
+
it('CSS of Shuffle option order', { tags: 'css' }, () => {
|
244
|
+
cy.log('Pre-step: switching back to the edit tab')
|
245
|
+
createQuestionBasePage.steps.switchToEditTab()
|
246
|
+
mcqQuestionCommonComponents.shuffleOptionCheckbox()
|
247
|
+
.parent()
|
248
|
+
.find('svg g g')
|
249
|
+
.should('have.css', 'fill', css.color.activeButtons);
|
250
|
+
mcqQuestionCommonComponents.shuffleOptionLabel()
|
251
|
+
.verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
|
252
|
+
cy.log('Post step: Deselecting Shuffle option order checkbox')
|
253
|
+
mcqQuestionCommonComponents.shuffleOptionCheckbox()
|
254
|
+
.click()
|
255
|
+
cy.log('Pre-step: switching back to the preview tab')
|
256
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
257
|
+
});
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
261
|
+
export const mcqQuestionCommonComponents = {
|
262
|
+
...selectors,
|
263
|
+
steps,
|
264
|
+
tests
|
265
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { autoScoredPreviewBase } from "./autoScoredPreviewBase";
|
2
|
+
import { createQuestionBasePage } from "./createQuestionBasePage";
|
3
|
+
import { scoringSectionBase } from "./scoringSectionBase";
|
4
|
+
import { mcqSetCorrectAnswerSection } from "./mcqSetCorrectAnswerSection";
|
5
|
+
import { mcqOptionsComponent } from "./mcqOptionsComponent";
|
6
|
+
import { mcqPreviewComponents } from "./mcqPreviewComponents";
|
7
|
+
import { previewScoringAndShowCorrectAnswerComponent } from "./previewScoringAndShowCorrectAnswerComponent";
|
8
|
+
|
9
|
+
const tests = {
|
10
|
+
verifyMCQShowCorrectAnswerFunctionality: (questionType) => {
|
11
|
+
it('When the user has set correct answer option(s) and alloted points \'Show correct answer\' checkbox should be displayed and it should be unchecked by default and points for the question should be displayed beside it', () => {
|
12
|
+
createQuestionBasePage.steps.switchToEditTab();
|
13
|
+
switch (questionType) {
|
14
|
+
case 'multiple selection':
|
15
|
+
mcqSetCorrectAnswerSection.steps.setCorrectAnswers(2);
|
16
|
+
break;
|
17
|
+
case 'single selection':
|
18
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(1)
|
19
|
+
.click();
|
20
|
+
break;
|
21
|
+
default:
|
22
|
+
throw new Error('Invalid question type');
|
23
|
+
}
|
24
|
+
scoringSectionBase.steps.allotPoints(20);
|
25
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
26
|
+
previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
|
27
|
+
.should('not.be.checked')
|
28
|
+
.parents('.MuiIconButton-label')
|
29
|
+
.should('be.visible');
|
30
|
+
previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckboxLabel()
|
31
|
+
.verifyInnerText('Show correct answer');
|
32
|
+
previewScoringAndShowCorrectAnswerComponent.previewScoreText()
|
33
|
+
.verifyInnerText('0/20');
|
34
|
+
});
|
35
|
+
|
36
|
+
it('When the user attempts question in preview tab and switches to edit tab, then on re-switching to the preview tab users response should not persist', () => {
|
37
|
+
cy.log('Attempting the question in preview tab to verify')
|
38
|
+
switch (questionType) {
|
39
|
+
case 'multiple selection':
|
40
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
41
|
+
.click()
|
42
|
+
.within(() => {
|
43
|
+
mcqOptionsComponent.previewTabOptionsCheckbox()
|
44
|
+
.should('be.checked');
|
45
|
+
});
|
46
|
+
break;
|
47
|
+
case 'single selection':
|
48
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
49
|
+
.click()
|
50
|
+
.within(() => {
|
51
|
+
mcqOptionsComponent.optionsRadioButton()
|
52
|
+
.should('be.checked');
|
53
|
+
});
|
54
|
+
break;
|
55
|
+
default:
|
56
|
+
throw new Error('Invalid question type');
|
57
|
+
}
|
58
|
+
cy.log('Re-switching to Preview tab and checking options')
|
59
|
+
createQuestionBasePage.steps.switchToEditTab();
|
60
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
61
|
+
switch (questionType) {
|
62
|
+
case 'multiple selection':
|
63
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
64
|
+
.within(() => {
|
65
|
+
mcqOptionsComponent.previewTabOptionsCheckbox()
|
66
|
+
.should('not.be.checked');
|
67
|
+
});
|
68
|
+
break;
|
69
|
+
case 'single selection':
|
70
|
+
mcqOptionsComponent.previewTabOptionsWrapper(0)
|
71
|
+
.within(() => {
|
72
|
+
mcqOptionsComponent.optionsRadioButton()
|
73
|
+
.should('not.be.checked');
|
74
|
+
});
|
75
|
+
break;
|
76
|
+
default:
|
77
|
+
throw new Error('Invalid question type');
|
78
|
+
}
|
79
|
+
});
|
80
|
+
|
81
|
+
it('When the user selects \'Show correct answer\' checkbox without attempting the question, green checkmark icon should be displayed besides correct answer option(s), no correct answer border should appear and no label should be displayed below the option(s)', () => {
|
82
|
+
previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
|
83
|
+
.click()
|
84
|
+
.should('be.checked');
|
85
|
+
switch (questionType) {
|
86
|
+
case 'multiple selection':
|
87
|
+
mcqPreviewComponents.steps.verifyCorrectOptionCheckmarkIcon(0);
|
88
|
+
mcqPreviewComponents.steps.verifyCorrectOptionCheckmarkIcon(1);
|
89
|
+
autoScoredPreviewBase.steps.verifyCorrectIncorrectBorderNotExists();
|
90
|
+
break;
|
91
|
+
case 'single selection':
|
92
|
+
mcqPreviewComponents.steps.verifyCorrectOptionCheckmarkIcon(1);
|
93
|
+
break;
|
94
|
+
default:
|
95
|
+
throw new Error('Invalid question type');
|
96
|
+
}
|
97
|
+
autoScoredPreviewBase.correctIncorectAnswerLabel()
|
98
|
+
.should('not.exist');
|
99
|
+
});
|
100
|
+
},
|
101
|
+
|
102
|
+
verifyMinimumScoreAwardedForIncorrectAnswer: (totalPoints) => {
|
103
|
+
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', () => {
|
104
|
+
cy.log('Switch to edit tab and set minimum score if attempted points')
|
105
|
+
createQuestionBasePage.steps.switchToEditTab();
|
106
|
+
scoringSectionBase.minimumScoreIfAttemptedInputField()
|
107
|
+
.type('1')
|
108
|
+
.should('have.value', '1');
|
109
|
+
createQuestionBasePage.steps.switchToPreviewTab()
|
110
|
+
mcqOptionsComponent.previewTabOptionsWrapper(3)
|
111
|
+
.click();
|
112
|
+
previewScoringAndShowCorrectAnswerComponent.previewScoreText()
|
113
|
+
.verifyInnerText(`1/${totalPoints}`);
|
114
|
+
});
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
export const mcqScoringComponent = {
|
119
|
+
tests
|
120
|
+
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
import { commonComponents } from "./commonComponents";
|
2
|
+
import { mcqOptionsComponent } from "./mcqOptionsComponent";
|
3
|
+
import { questionInstructionsComponent } from "./questionInstructionsComponent";
|
4
|
+
import { autoScoredSetCorrectAnswerSection } from "./autoScoredSetCorrectAnswerSection";
|
5
|
+
const css = Cypress.env('css');
|
6
|
+
|
7
|
+
const selectors = {
|
8
|
+
correctAnswerOptionsWrapper: (optionNumber) => cy.get('.edit-question-edit-tab-wrapper [class*="edit-set-correct-answer"] div[class*="option-wrapper"]').eq(optionNumber),
|
9
|
+
optionsRadioButton: () => cy.get('input[type="radio"]')
|
10
|
+
}
|
11
|
+
|
12
|
+
const steps = {
|
13
|
+
setCorrectAnswers: (CorrectAnswers) => {
|
14
|
+
for (let index = 0; index < CorrectAnswers; index++) {
|
15
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(index)
|
16
|
+
.click();
|
17
|
+
}
|
18
|
+
},
|
19
|
+
|
20
|
+
checkUncheckCorrectAnswer: (option, checkedUnchecked) => {
|
21
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(option)
|
22
|
+
.click()
|
23
|
+
.within(() => {
|
24
|
+
mcqOptionsComponent.editTabOptionsCheckbox()
|
25
|
+
.should(checkedUnchecked);
|
26
|
+
});
|
27
|
+
},
|
28
|
+
|
29
|
+
checkCorrectAnswerRadioButton: (option) => {
|
30
|
+
//TODO: Move to Single selection POM
|
31
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(option)
|
32
|
+
.click()
|
33
|
+
.within(() => {
|
34
|
+
mcqOptionsComponent.optionsRadioButton()
|
35
|
+
.should('be.checked');
|
36
|
+
});
|
37
|
+
},
|
38
|
+
|
39
|
+
verifyEditTabCorrectAnswerSectionOptionsText: (optionsArray) => {
|
40
|
+
optionsArray.forEach((optionText, count) => {
|
41
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(count)
|
42
|
+
.within(() => {
|
43
|
+
mcqOptionsComponent.editTabOptionsText()
|
44
|
+
.verifyInnerText(optionText);
|
45
|
+
});
|
46
|
+
});
|
47
|
+
},
|
48
|
+
|
49
|
+
verifyEditTabCorrectAnswerSectionOptionsNumeration: (optionNumerationArray, inputType) => {
|
50
|
+
optionNumerationArray.forEach((optionNumeration, count) => {
|
51
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(count)
|
52
|
+
.within(() => {
|
53
|
+
mcqOptionsComponent.optionNumeration()
|
54
|
+
.should('have.text', optionNumeration);
|
55
|
+
if (inputType === 'radio') {
|
56
|
+
mcqOptionsComponent.optionsRadioButton()
|
57
|
+
.should('not.be.visible');
|
58
|
+
} else if (inputType === 'checkbox') {
|
59
|
+
mcqOptionsComponent.editTabOptionsCheckbox()
|
60
|
+
.should('not.be.visible');
|
61
|
+
};
|
62
|
+
});
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
const tests = {
|
68
|
+
verifyCorrectAnswerSection: (inputType) => {
|
69
|
+
it(`In the Set Correct Answer section, all the 4 empty options with ${inputType} should be displayed`, () => {
|
70
|
+
for (let index = 0; index < 4; index++) {
|
71
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(index)
|
72
|
+
.within(() => {
|
73
|
+
if (inputType === 'radio') {
|
74
|
+
mcqOptionsComponent.optionsRadioButton()
|
75
|
+
.should('not.be.checked');
|
76
|
+
} else if (inputType === 'checkbox') {
|
77
|
+
mcqOptionsComponent.editTabOptionsCheckbox()
|
78
|
+
.should('not.be.checked');
|
79
|
+
};
|
80
|
+
mcqOptionsComponent.editTabOptionsText()
|
81
|
+
.verifyInnerText('');
|
82
|
+
});
|
83
|
+
};
|
84
|
+
});
|
85
|
+
|
86
|
+
it('Pre-step: Adding question instructions and options', () => {
|
87
|
+
questionInstructionsComponent.steps.addQuestionInstructions()
|
88
|
+
mcqOptionsComponent.steps.addOptionsText(4)
|
89
|
+
});
|
90
|
+
|
91
|
+
it(`User should be able to set correct answer by checking the ${inputType} besides the options`, () => {
|
92
|
+
if (inputType === 'radio') {
|
93
|
+
mcqSetCorrectAnswerSection.steps.checkCorrectAnswerRadioButton(1);
|
94
|
+
} else if (inputType === 'checkbox') {
|
95
|
+
mcqSetCorrectAnswerSection.steps.setCorrectAnswers(2);
|
96
|
+
};
|
97
|
+
});
|
98
|
+
|
99
|
+
it('CSS of Set answer in the Correct answer tab', { tags: 'css' }, () => {
|
100
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(1)
|
101
|
+
.find('label')
|
102
|
+
.verifyCSS(css.color.optionsSelectedText, css.fontSize.default, css.fontWeight.bold)
|
103
|
+
.should('have.css', 'background-color', css.color.defaultBackground);
|
104
|
+
});
|
105
|
+
|
106
|
+
it('Accessibility of Set answer in the Correct answer tab', { tags: 'a11y' }, () => {
|
107
|
+
cy.checkAccessibility(mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(0).parents('.mcq_Group'));
|
108
|
+
});
|
109
|
+
},
|
110
|
+
|
111
|
+
verifyCorrectAnswerSectionErrorMessages: () => {
|
112
|
+
autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty('Correct tab');
|
113
|
+
|
114
|
+
it('On deleting correct answer option(s), \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'Correct\' tab', () => {
|
115
|
+
mcqOptionsComponent.editTabOptionsWrapper(0)
|
116
|
+
.within(() => {
|
117
|
+
commonComponents.deleteButton()
|
118
|
+
.click();
|
119
|
+
commonComponents.deleteButton()
|
120
|
+
.click();
|
121
|
+
});
|
122
|
+
commonComponents.errorMessage()
|
123
|
+
.should('be.visible');
|
124
|
+
autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
|
125
|
+
.should('be.visible');
|
126
|
+
});
|
127
|
+
|
128
|
+
autoScoredSetCorrectAnswerSection.tests.verifyCSSAndA11yOfAutoScoredSetCorrectAnswerErrorMessage();
|
129
|
+
|
130
|
+
it('On reselecting correct answer option(s), \'Error: Please set a correct answer.\' validation error message should disappear', () => {
|
131
|
+
mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(1)
|
132
|
+
.click();
|
133
|
+
commonComponents.errorMessage()
|
134
|
+
.should('not.exist');
|
135
|
+
});
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
export const mcqSetCorrectAnswerSection = {
|
140
|
+
...selectors,
|
141
|
+
steps,
|
142
|
+
tests
|
143
|
+
}
|