itemengine-cypress-automation 1.0.562 → 1.0.564-IEI-7011-cf323ce.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/config-files/ilprod.json +2 -1
- package/cypress/config-files/ilqa.json +2 -1
- package/cypress/config-files/ilstage.json +2 -1
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingBasicForAllViews.smoke.js +168 -1
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +86 -0
- package/cypress/e2e/ILC/MultipleSelection/partialDifferentWeightsWithAlternativeAnswer.js +91 -0
- package/cypress/e2e/ILC/MultipleSelection/partialEqualWeightsWithAlternativeAnswer.js +79 -0
- package/cypress/e2e/ILC/SingleSelection/allOrNothingBasicForAllViews.smoke.js +130 -0
- package/cypress/e2e/ILC/SingleSelection/allOrNothingWithAlternativeAnswer.js +16 -0
- package/cypress/pages/components/index.js +1 -0
- package/cypress/pages/components/showAlternativeAnswersComponent.js +169 -0
- package/cypress/pages/multipleSelectionPage.js +3 -1
- package/cypress/pages/singleSelectionPage.js +5 -1
- package/package.json +1 -1
- package/service.yaml +9 -1
|
@@ -3,6 +3,7 @@ import abortEarlySetup from "../../../support/helpers/abortEarly";
|
|
|
3
3
|
import { dialogBoxBase, gradingViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
|
|
4
4
|
import utilities from "../../../support/helpers/utilities";
|
|
5
5
|
const grepTags = Cypress.env('grepTags');
|
|
6
|
+
const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
|
|
6
7
|
let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
|
|
7
8
|
const views = utilities.getViews(correctAnswerViews);
|
|
8
9
|
var itemReferenceID = "";
|
|
@@ -168,6 +169,135 @@ describe('Create Item page - Single Selection: Scoring cases', () => {
|
|
|
168
169
|
});
|
|
169
170
|
});
|
|
170
171
|
|
|
172
|
+
views.forEach((view) => {
|
|
173
|
+
describe(`Single selection: all or nothing with alternative answer - ${view}`, { tags: 'smoke' }, () => {
|
|
174
|
+
abortEarlySetup();
|
|
175
|
+
before(() => {
|
|
176
|
+
switch (view) {
|
|
177
|
+
case 'Question preview':
|
|
178
|
+
singleSelectionPage.steps.navigateToCreateQuestion('single selection');
|
|
179
|
+
cy.barsPreLoaderWait();
|
|
180
|
+
singleSelectionPage.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
|
181
|
+
singleSelectionPage.steps.allotPoints(20);
|
|
182
|
+
singleSelectionPage.steps.addInputToOptionsInputField(options);
|
|
183
|
+
singleSelectionPage.steps.checkOptionInSpecifyCorrectAnswerSection(1);
|
|
184
|
+
singleSelectionPage.steps.clickOnAddAlternativeAnswerButton();
|
|
185
|
+
singleSelectionPage.steps.allotPoints(10);
|
|
186
|
+
singleSelectionPage.steps.checkOptionInSpecifyCorrectAnswerSection(0);
|
|
187
|
+
singleSelectionPage.steps.switchToPreviewTab();
|
|
188
|
+
break;
|
|
189
|
+
case 'Item preview':
|
|
190
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
|
191
|
+
itemPreviewPage.steps.switchToPreviewTab();
|
|
192
|
+
break;
|
|
193
|
+
case 'Grading view':
|
|
194
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
beforeEach(() => {
|
|
200
|
+
switch (view) {
|
|
201
|
+
case 'Question preview':
|
|
202
|
+
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
203
|
+
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
204
|
+
singleSelectionPage.steps.resetQuestionPreview();
|
|
205
|
+
break;
|
|
206
|
+
case 'Item preview':
|
|
207
|
+
itemPreviewPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
208
|
+
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
209
|
+
itemPreviewPage.steps.resetQuestionPreview();
|
|
210
|
+
break;
|
|
211
|
+
case 'Grading view':
|
|
212
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (view === 'Question preview') {
|
|
218
|
+
after(() => {
|
|
219
|
+
singleSelectionPage.steps.clickOnSaveQuestionButton();
|
|
220
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
|
221
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
it('When the user selects \'Grading\' view without attempting the question, no icons should be displayed besides responses, correct answer label and border should not be displayed and correct answer should be displayed in correct answer section', () => {
|
|
226
|
+
if (view === 'Grading view') {
|
|
227
|
+
studentViewPage.steps.submitResponse();
|
|
228
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
|
229
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
|
230
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 20);
|
|
231
|
+
}
|
|
232
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
|
233
|
+
singleSelectionPage.steps.switchToGradingView();
|
|
234
|
+
singleSelectionPage.steps.verifyPreviewScore(0, 20);
|
|
235
|
+
}
|
|
236
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(0);
|
|
237
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(1);
|
|
238
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(2);
|
|
239
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
|
|
240
|
+
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabelNotExist();
|
|
241
|
+
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
242
|
+
//correct answer section
|
|
243
|
+
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
244
|
+
if (alternativeAnswerCheck === 'true') {
|
|
245
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides incorrect responses, no icons should be displayed besides unattempted responses, incorrect answer border and label should not be displayed below the question preview and correct answer should be displayed in correct answer section', () => {
|
|
250
|
+
singleSelectionPage.steps.checkOptionInPreviewTab(2);
|
|
251
|
+
if (view === 'Grading view') {
|
|
252
|
+
studentViewPage.steps.submitResponse();
|
|
253
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
|
254
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
|
255
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 20);
|
|
256
|
+
}
|
|
257
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
|
258
|
+
singleSelectionPage.steps.switchToGradingView();
|
|
259
|
+
singleSelectionPage.steps.verifyPreviewScore(0, 20);
|
|
260
|
+
}
|
|
261
|
+
singleSelectionPage.steps.verifyIncorrectOptionIconStudentView(2);
|
|
262
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(0);
|
|
263
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(1);
|
|
264
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
|
|
265
|
+
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
|
266
|
+
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
267
|
+
//correct answer section
|
|
268
|
+
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
269
|
+
if (alternativeAnswerCheck === 'true') {
|
|
270
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it(`Single selection ${view} - When user attempts the question correctly, the user should be awarded full points and on switching to 'Grading' view, then correct icons should be displayed beside all the correct responses, correct answer border and a label should not be displayed below the question preview and correct answer section should not be displayed`, () => {
|
|
275
|
+
singleSelectionPage.steps.checkOptionInPreviewTab(1);
|
|
276
|
+
if (view === 'Grading view') {
|
|
277
|
+
studentViewPage.steps.submitResponse();
|
|
278
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
|
279
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
|
280
|
+
gradingViewPage.steps.verifyGradingViewScore(20, 20);
|
|
281
|
+
}
|
|
282
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
|
283
|
+
singleSelectionPage.steps.verifyPreviewScore(20, 20);
|
|
284
|
+
singleSelectionPage.steps.switchToGradingView();
|
|
285
|
+
}
|
|
286
|
+
singleSelectionPage.steps.verifyCorrectOptionIconStudentView(1);
|
|
287
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(0);
|
|
288
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(2);
|
|
289
|
+
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
|
|
290
|
+
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
291
|
+
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
292
|
+
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
293
|
+
if (alternativeAnswerCheck === 'true') {
|
|
294
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
295
|
+
}
|
|
296
|
+
cy.eyesCheckWindow(`Single selection ${view} - Correct attempt`);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
171
301
|
views.forEach((view) => {
|
|
172
302
|
describe(`Single selection - Manually scored: ${view}`, { tags: 'smoke' }, () => {
|
|
173
303
|
abortEarlySetup();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { singleSelectionPage } from "../../../pages/singleSelectionPage";
|
|
2
2
|
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
|
3
3
|
const css = Cypress.env('css');
|
|
4
|
+
const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
|
|
4
5
|
|
|
5
6
|
const options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
|
|
6
7
|
|
|
@@ -49,6 +50,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
49
50
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
50
51
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
51
52
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
53
|
+
if (alternativeAnswerCheck === 'true') {
|
|
54
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
55
|
+
}
|
|
52
56
|
//singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
53
57
|
/*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, correct answer border and a label should not be displayed below the question preview')
|
|
54
58
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -96,6 +100,10 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
96
100
|
singleSelectionPage.steps.verifyIncorrectOptionIconStudentView(3);
|
|
97
101
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
|
98
102
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
103
|
+
//show alternative answers
|
|
104
|
+
if (alternativeAnswerCheck === 'true') {
|
|
105
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
106
|
+
}
|
|
99
107
|
//correct answer section
|
|
100
108
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
101
109
|
//singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
@@ -215,6 +223,10 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
215
223
|
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
|
|
216
224
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
|
217
225
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
226
|
+
//show alternative answers
|
|
227
|
+
if (alternativeAnswerCheck === 'true') {
|
|
228
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
229
|
+
}
|
|
218
230
|
//correct answer section
|
|
219
231
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(2);
|
|
220
232
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
@@ -314,6 +326,10 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
314
326
|
singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
|
|
315
327
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
|
316
328
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
329
|
+
//show alternative answers
|
|
330
|
+
if (alternativeAnswerCheck === 'true') {
|
|
331
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
|
|
332
|
+
}
|
|
317
333
|
//correct answer section
|
|
318
334
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
319
335
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
@@ -3,6 +3,7 @@ export * from './commonComponents';
|
|
|
3
3
|
export * from './additionalSettingsPanel';
|
|
4
4
|
export * from './mcqAdditionalSettingsBase';
|
|
5
5
|
export * from './questionInstructionsComponent';
|
|
6
|
+
export * from './showAlternativeAnswersComponent';
|
|
6
7
|
export * from './ckEditorToolbar';
|
|
7
8
|
export * from './essayResponseCommonComponents';
|
|
8
9
|
export * from './optionsWrapperComponent';
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show Alternative Answers Component
|
|
3
|
+
* Common functionality for managing and verifying alternative answers toggle and content
|
|
4
|
+
* across different question types (Single Selection, Multiple Selection, etc.)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const showAlternativeAnswersComponent = {
|
|
8
|
+
// Selectors for the alternative answers toggle
|
|
9
|
+
showAlternativeAnswersToggleWrapper: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"]'),
|
|
10
|
+
showAlternativeAnswersToggleInput: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] input[type="checkbox"]'),
|
|
11
|
+
showAlternativeAnswersToggleLabel: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] [class*="SwitchLabelWrapper"]'),
|
|
12
|
+
showAlternativeAnswersToggleButton: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] .MuiButtonBase-root'),
|
|
13
|
+
|
|
14
|
+
// Selectors for the alternative answers content section
|
|
15
|
+
alternativeAnswersSection: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').contains('Alternative answer'),
|
|
16
|
+
alternativeAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]:contains("Alternative answer")'),
|
|
17
|
+
alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
|
|
18
|
+
alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
|
|
19
|
+
|
|
20
|
+
steps: {
|
|
21
|
+
/**
|
|
22
|
+
* Verifies that the "Show alternative answers" toggle is present and visible
|
|
23
|
+
*/
|
|
24
|
+
verifyShowAlternativeAnswersToggleExists: () => {
|
|
25
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
26
|
+
.should('be.visible');
|
|
27
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
|
|
28
|
+
.should('contain.text', 'Show alternative answers');
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Verifies that the "Show alternative answers" toggle does not exist
|
|
33
|
+
*/
|
|
34
|
+
verifyShowAlternativeAnswersToggleNotExists: () => {
|
|
35
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
36
|
+
.should('not.exist');
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
|
|
41
|
+
*/
|
|
42
|
+
verifyShowAlternativeAnswersToggleChecked: () => {
|
|
43
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
44
|
+
.should('be.checked')
|
|
45
|
+
.and('have.attr', 'aria-pressed', 'true');
|
|
46
|
+
// Verify the checked state visual indicator (tick icon)
|
|
47
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
48
|
+
.find('.icon-ILC-tick-icon')
|
|
49
|
+
.should('be.visible');
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
|
|
54
|
+
*/
|
|
55
|
+
verifyShowAlternativeAnswersToggleUnchecked: () => {
|
|
56
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
57
|
+
.should('not.be.checked')
|
|
58
|
+
.and('have.attr', 'aria-pressed', 'false');
|
|
59
|
+
// Verify the unchecked state visual indicator (x-circle icon)
|
|
60
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
61
|
+
.find('.icon-x-circle')
|
|
62
|
+
.should('be.visible');
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Clicks the "Show alternative answers" toggle to change its state
|
|
67
|
+
*/
|
|
68
|
+
clickShowAlternativeAnswersToggle: () => {
|
|
69
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleButton()
|
|
70
|
+
.click();
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
|
|
75
|
+
*/
|
|
76
|
+
enableShowAlternativeAnswersToggle: () => {
|
|
77
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
78
|
+
.then(($input) => {
|
|
79
|
+
if (!$input.prop('checked')) {
|
|
80
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
|
|
87
|
+
*/
|
|
88
|
+
disableShowAlternativeAnswersToggle: () => {
|
|
89
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
90
|
+
.then(($input) => {
|
|
91
|
+
if ($input.prop('checked')) {
|
|
92
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Verifies that the alternative answers section is visible
|
|
99
|
+
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
100
|
+
* @param {number} points - The expected points for the alternative answer
|
|
101
|
+
*/
|
|
102
|
+
verifyAlternativeAnswersSectionVisible: (index, points) => {
|
|
103
|
+
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
104
|
+
.contains(`Alternative answer ${index}`)
|
|
105
|
+
.should('be.visible');
|
|
106
|
+
|
|
107
|
+
if (points) {
|
|
108
|
+
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
109
|
+
.contains(`Alternative answer ${index}`)
|
|
110
|
+
.parent()
|
|
111
|
+
.find('p')
|
|
112
|
+
.should('contain.text', `(${points} points)`);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Verifies that the alternative answers section does not exist
|
|
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")
|
|
128
|
+
* @param {number} points - The expected points for the alternative answer
|
|
129
|
+
*/
|
|
130
|
+
verifyAlternativeAnswersSectionComplete: (index = 1, points) => {
|
|
131
|
+
// Verify the alternative answer label is visible
|
|
132
|
+
showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionVisible(index, points);
|
|
133
|
+
|
|
134
|
+
// Verify the selection grid is visible
|
|
135
|
+
showAlternativeAnswersComponent.alternativeAnswerSelectionGrid()
|
|
136
|
+
.should('be.visible');
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Comprehensive test that verifies the complete toggle functionality
|
|
141
|
+
* @param {number} index - The index of the alternative answer to verify
|
|
142
|
+
* @param {number} points - The expected points for the alternative answer
|
|
143
|
+
*/
|
|
144
|
+
verifyShowAlternativeAnswersToggleFunctionality: (index, points) => {
|
|
145
|
+
// Start with ensuring toggle exists
|
|
146
|
+
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
|
|
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
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export { showAlternativeAnswersComponent };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import constants from "../fixtures/constants";
|
|
2
2
|
import utilities from "../support/helpers/utilities"
|
|
3
|
-
import { autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, additionalSettingsPanel, ckEditorToolbar, equationEditorFlyout, mcqAdditionalSettingsBase, randomizeOptionsComponent, lockUnlockOptionComponent, additionalSettingsAccessibilitySectionComponent } from "./components"
|
|
3
|
+
import { autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, additionalSettingsPanel, ckEditorToolbar, equationEditorFlyout, mcqAdditionalSettingsBase, randomizeOptionsComponent, lockUnlockOptionComponent, additionalSettingsAccessibilitySectionComponent, showAlternativeAnswersComponent } from "./components"
|
|
4
4
|
import { ckEditorAudioPlayerComponent } from "../pages/components/ckEditorAudioPlayerComponent"
|
|
5
5
|
import { ckEditorEquationEditorComponent } from "../pages/components/ckEditorEquationEditorComponent"
|
|
6
6
|
import { ckEditorInsertTableComponent } from "../pages/components/ckEditorInsertTableComponent"
|
|
@@ -35,6 +35,7 @@ const selectors = {
|
|
|
35
35
|
...ckEditorLinkComponent,
|
|
36
36
|
...createItemPage,
|
|
37
37
|
...audioPlayerPage,
|
|
38
|
+
...showAlternativeAnswersComponent,
|
|
38
39
|
//Specify correct answer section
|
|
39
40
|
optionWrapperSpecifyCorrectAnswerSection: () => cy.get('.mcq-option-wrapper'),
|
|
40
41
|
optionsText: () => cy.get('.mcq-label'),
|
|
@@ -111,6 +112,7 @@ const steps = {
|
|
|
111
112
|
...ckEditorAudioPlayerComponent.steps,
|
|
112
113
|
...ckEditorEquationEditorComponent.steps,
|
|
113
114
|
...ckEditorInsertTableComponent.steps,
|
|
115
|
+
...showAlternativeAnswersComponent.steps,
|
|
114
116
|
...ckEditorInsertImageComponent.steps,
|
|
115
117
|
...ckEditorLinkComponent.steps,
|
|
116
118
|
...createItemPage.steps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import constants from "../fixtures/constants";
|
|
2
2
|
import utilities from "../support/helpers/utilities";
|
|
3
|
-
import { additionalSettingsPanel, createQuestionBasePage, mcqAdditionalSettingsBase, scoringSectionBaseEditTab, autoScoredSpecifyCorrectAnswerSection, optionsWrapperComponent, commonComponents, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, ckEditorToolbar, equationEditorFlyout, randomizeOptionsComponent, lockUnlockOptionComponent, questionInstructionsComponent, additionalSettingsAccessibilitySectionComponent } from "./components";
|
|
3
|
+
import { additionalSettingsPanel, createQuestionBasePage, mcqAdditionalSettingsBase, scoringSectionBaseEditTab, autoScoredSpecifyCorrectAnswerSection, optionsWrapperComponent, commonComponents, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, ckEditorToolbar, equationEditorFlyout, randomizeOptionsComponent, lockUnlockOptionComponent, questionInstructionsComponent, additionalSettingsAccessibilitySectionComponent, showAlternativeAnswersComponent } from "./components";
|
|
4
4
|
import { createItemPage } from "./createItemPage";
|
|
5
5
|
import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
|
|
6
6
|
const css = Cypress.env('css');
|
|
@@ -21,6 +21,7 @@ const selectors = {
|
|
|
21
21
|
...randomizeOptionsComponent,
|
|
22
22
|
...lockUnlockOptionComponent,
|
|
23
23
|
...createItemPage,
|
|
24
|
+
...showAlternativeAnswersComponent,
|
|
24
25
|
optionsRadioButton: () => cy.get('input[type="radio"]'),
|
|
25
26
|
optionsRadioButtonForSpecifyCorrectAnswer: () => cy.get('.radio-option-wrapper:visible input[type="radio"]'),
|
|
26
27
|
editTabOptionsWrapper: () => cy.get('.edit-mcq-option-wrapper'),
|
|
@@ -61,6 +62,7 @@ const steps = {
|
|
|
61
62
|
...lockUnlockOptionComponent.steps,
|
|
62
63
|
...createItemPage.steps,
|
|
63
64
|
...selectQuestionResourceToolPage.steps,
|
|
65
|
+
...showAlternativeAnswersComponent.steps,
|
|
64
66
|
/**
|
|
65
67
|
* Verifies the contents of an option wrapper in the 'Specify correct answer' section for single selection questions.
|
|
66
68
|
* @param {number} optionIndex - The index of the option wrapper to be verified.
|
|
@@ -728,6 +730,8 @@ const steps = {
|
|
|
728
730
|
singleSelectionPage.steps.setCorrectAnswer(correctAnswer);
|
|
729
731
|
singleSelectionPage.saveQuestionButton().click();
|
|
730
732
|
},
|
|
733
|
+
|
|
734
|
+
|
|
731
735
|
};
|
|
732
736
|
|
|
733
737
|
const tests = {
|
package/package.json
CHANGED
package/service.yaml
CHANGED
|
@@ -102,21 +102,29 @@ namespaces:
|
|
|
102
102
|
value: "dev"
|
|
103
103
|
- name: FILE_CONFIG
|
|
104
104
|
value: "dev"
|
|
105
|
+
- name: ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT
|
|
106
|
+
value: "false"
|
|
105
107
|
qa:
|
|
106
108
|
env:
|
|
107
109
|
- name: STAGE
|
|
108
110
|
value: "qa"
|
|
109
111
|
- name: FILE_CONFIG
|
|
110
112
|
value: "qa"
|
|
113
|
+
- name: ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT
|
|
114
|
+
value: "true"
|
|
111
115
|
staging:
|
|
112
116
|
env:
|
|
113
117
|
- name: STAGE
|
|
114
118
|
value: "stage"
|
|
115
119
|
- name: FILE_CONFIG
|
|
116
120
|
value: "stage"
|
|
121
|
+
- name: ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT
|
|
122
|
+
value: "false"
|
|
117
123
|
prod:
|
|
118
124
|
env:
|
|
119
125
|
- name: STAGE
|
|
120
126
|
value: "prod"
|
|
121
127
|
- name: FILE_CONFIG
|
|
122
|
-
value: "prod"
|
|
128
|
+
value: "prod"
|
|
129
|
+
- name: ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT
|
|
130
|
+
value: "false"
|