itemengine-cypress-automation 1.0.564-IEI-7011-cf323ce.0 → 1.0.564-IEI-7011-3998a1c.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingBasicForAllViews.smoke.js +1 -167
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +284 -17
- package/cypress/e2e/ILC/MultipleSelection/partialDifferentWeightsWithAlternativeAnswer.js +397 -25
- package/cypress/e2e/ILC/MultipleSelection/partialEqualWeightsWithAlternativeAnswer.js +320 -20
- package/cypress/pages/components/showAlternativeAnswersComponent.js +40 -64
- package/cypress/pages/multipleSelectionPage.js +32 -0
- package/package.json +1 -1
|
@@ -10,20 +10,19 @@ const showAlternativeAnswersComponent = {
|
|
|
10
10
|
showAlternativeAnswersToggleInput: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] input[type="checkbox"]'),
|
|
11
11
|
showAlternativeAnswersToggleLabel: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] [class*="SwitchLabelWrapper"]'),
|
|
12
12
|
showAlternativeAnswersToggleButton: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] .MuiButtonBase-root'),
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
// Selectors for the alternative answers content section
|
|
15
|
-
alternativeAnswersSection: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').
|
|
16
|
-
alternativeAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]:contains("Alternative answer")'),
|
|
15
|
+
alternativeAnswersSection: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(1), // Alternative answer is typically the second wrapper
|
|
17
16
|
alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
|
|
18
17
|
alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
|
|
18
|
+
correctAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(0), // Correct answer is typically the first wrapper
|
|
19
19
|
|
|
20
20
|
steps: {
|
|
21
21
|
/**
|
|
22
22
|
* Verifies that the "Show alternative answers" toggle is present and visible
|
|
23
23
|
*/
|
|
24
24
|
verifyShowAlternativeAnswersToggleExists: () => {
|
|
25
|
-
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
26
|
-
.should('be.visible');
|
|
25
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper().should('be.visible');
|
|
27
26
|
showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
|
|
28
27
|
.should('contain.text', 'Show alternative answers');
|
|
29
28
|
},
|
|
@@ -76,10 +75,10 @@ const showAlternativeAnswersComponent = {
|
|
|
76
75
|
enableShowAlternativeAnswersToggle: () => {
|
|
77
76
|
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
78
77
|
.then(($input) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
if (!$input.prop('checked')) {
|
|
79
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
83
82
|
},
|
|
84
83
|
|
|
85
84
|
/**
|
|
@@ -88,81 +87,58 @@ const showAlternativeAnswersComponent = {
|
|
|
88
87
|
disableShowAlternativeAnswersToggle: () => {
|
|
89
88
|
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
90
89
|
.then(($input) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
if ($input.prop('checked')) {
|
|
91
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
95
94
|
},
|
|
96
95
|
|
|
97
96
|
/**
|
|
98
97
|
* Verifies that the alternative answers section is visible
|
|
99
98
|
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
100
|
-
* @param {
|
|
99
|
+
* @param {string} points - The expected points for the alternative answer
|
|
101
100
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
|
|
102
|
+
verifyAlternativeAnswersLabelAndPointVisible: (index, points) => {
|
|
103
|
+
showAlternativeAnswersComponent.alternativeAnswersSection().should('be.visible');
|
|
104
|
+
|
|
107
105
|
if (points) {
|
|
108
|
-
|
|
109
|
-
.contains(`Alternative answer ${index}`)
|
|
106
|
+
showAlternativeAnswersComponent.alternativeAnswersSection()
|
|
110
107
|
.parent()
|
|
111
108
|
.find('p')
|
|
112
|
-
.
|
|
109
|
+
.invoke('text')
|
|
110
|
+
.then((text) => {
|
|
111
|
+
expect(text.trim()).to.equal(points);
|
|
112
|
+
});
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* Verifies that the
|
|
118
|
-
*/
|
|
119
|
-
verifyAlternativeAnswersSectionNotExist: () => {
|
|
120
|
-
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
121
|
-
.contains('Alternative answer')
|
|
122
|
-
.should('not.exist');
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Verifies the complete alternative answers section including content and grid
|
|
127
|
-
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
117
|
+
* Verifies that the correct answers section is visible
|
|
128
118
|
* @param {number} points - The expected points for the alternative answer
|
|
129
119
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
showAlternativeAnswersComponent.
|
|
133
|
-
|
|
134
|
-
// Verify the selection grid is visible
|
|
135
|
-
showAlternativeAnswersComponent.alternativeAnswerSelectionGrid()
|
|
120
|
+
|
|
121
|
+
verifyCorrectAnswersLabelAndPointVisible: (points) => {
|
|
122
|
+
showAlternativeAnswersComponent.correctAnswerLabelWrapper()
|
|
136
123
|
.should('be.visible');
|
|
124
|
+
|
|
125
|
+
if (points) {
|
|
126
|
+
showAlternativeAnswersComponent.correctAnswerLabelWrapper()
|
|
127
|
+
.parent()
|
|
128
|
+
.find('p')
|
|
129
|
+
.invoke('text')
|
|
130
|
+
.then((text) => {
|
|
131
|
+
expect(text.trim()).to.equal(points);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
137
134
|
},
|
|
138
135
|
|
|
139
136
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @param {number} index - The index of the alternative answer to verify
|
|
142
|
-
* @param {number} points - The expected points for the alternative answer
|
|
137
|
+
* Verifies that the alternative answers section does not exist
|
|
143
138
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
// Test unchecked state
|
|
149
|
-
showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
|
|
150
|
-
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
151
|
-
|
|
152
|
-
// Verify the alternative answers section does not exist
|
|
153
|
-
showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionNotExist();
|
|
154
|
-
|
|
155
|
-
// Test checked state
|
|
156
|
-
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
157
|
-
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
158
|
-
|
|
159
|
-
// Verify the alternative answers section is visible
|
|
160
|
-
showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionVisible(index, points);
|
|
161
|
-
|
|
162
|
-
// Test toggle back to unchecked
|
|
163
|
-
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
164
|
-
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
165
|
-
}
|
|
139
|
+
verifyAlternativeAnswersSectionNotExist: () => {
|
|
140
|
+
showAlternativeAnswersComponent.alternativeAnswersSection().should('not.exist');
|
|
141
|
+
},
|
|
166
142
|
},
|
|
167
143
|
};
|
|
168
144
|
|
|
@@ -79,6 +79,8 @@ const selectors = {
|
|
|
79
79
|
correctAnswersLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="CorrectAnswerLabel"]'),
|
|
80
80
|
correctAnswerSectionWrapper: () => cy.get('[class*="question-preview-wrapper"] .mcq-checkbox-control.mcq-answer-checked').eq(1),
|
|
81
81
|
optionWrapperCorrectAnswerSection: () => cy.get('.mcq-option-wrapper'),
|
|
82
|
+
alternativeAnswerSectionWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(1).next(),
|
|
83
|
+
optionWrapperAlternativeAnswerSection: () => cy.get('.mcq-option-wrapper'),
|
|
82
84
|
answerStatusBanner: () => cy.get('[class*="StatusContainer"]'),
|
|
83
85
|
cancelButton: () => cy.get('.save-action-btn-wrapper .MuiButtonBase-root').eq(1),
|
|
84
86
|
optionsInputFieldInQuestionPreviewTab: () => cy.get('.mcq-option-wrapper [data-testid="question-instruction-element"]'),
|
|
@@ -861,6 +863,36 @@ const steps = {
|
|
|
861
863
|
.should('exist');
|
|
862
864
|
},
|
|
863
865
|
|
|
866
|
+
/**
|
|
867
|
+
* Verifies correct option icon in alternative answer section
|
|
868
|
+
* @param {number} optionIndex - The index of the option to verify
|
|
869
|
+
*/
|
|
870
|
+
verifyCorrectOptionIconAlternativeAnswerSection: (optionIndex) => {
|
|
871
|
+
multipleSelectionPage.alternativeAnswerSectionWrapper()
|
|
872
|
+
.within(() => {
|
|
873
|
+
multipleSelectionPage.optionWrapperAlternativeAnswerSection()
|
|
874
|
+
.eq(optionIndex)
|
|
875
|
+
.within(() => {
|
|
876
|
+
utilities.verifyElementVisibilityState(autoScoredScoringPreviewTab.correctIcon(), 'visible');
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
},
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Verifies that correct/incorrect icon is not visible in alternative answer section
|
|
883
|
+
* @param {number} optionIndex - The index of the option to verify
|
|
884
|
+
*/
|
|
885
|
+
verifyCorrectIncorrectIconNotVisibleAlternativeAnswerSection: (optionIndex) => {
|
|
886
|
+
multipleSelectionPage.alternativeAnswerSectionWrapper()
|
|
887
|
+
.within(() => {
|
|
888
|
+
multipleSelectionPage.optionWrapperAlternativeAnswerSection()
|
|
889
|
+
.eq(optionIndex)
|
|
890
|
+
.within(() => {
|
|
891
|
+
autoScoredScoringPreviewTab.steps.verifyCorrectIncorrectIconsNotExist();
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
},
|
|
895
|
+
|
|
864
896
|
verifyAnswerBannerNotExist: () => {
|
|
865
897
|
multipleSelectionPage.answerStatusBanner()
|
|
866
898
|
.should('not.exist');
|