itemengine-cypress-automation 1.0.564-IEI-6998-Add-coverage-for-image-hightlight-question-type-f372002.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/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/ImageHighlight/additionalSettings.js +0 -86
- package/cypress/e2e/ILC/ImageHighlight/backgroundImageAndCanvasProperties.js +9 -60
- package/cypress/e2e/ILC/ImageHighlight/customiseHighlightStyle.js +12 -14
- package/cypress/e2e/ILC/ImageHighlight/imageHighlightStyle.js +3 -12
- package/cypress/e2e/ILC/ImageHighlight/minimumScoringPenaltyPointsAndRoundingDropdown.js +2 -65
- package/cypress/e2e/ILC/ImageHighlight/studentViewSettings.js +1 -15
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingBasicForAllViews.smoke.js +1 -0
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +353 -0
- package/cypress/e2e/ILC/MultipleSelection/partialDifferentWeightsWithAlternativeAnswer.js +464 -1
- package/cypress/e2e/ILC/MultipleSelection/partialEqualWeightsWithAlternativeAnswer.js +379 -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 +145 -0
- package/cypress/pages/imageHighlightPage.js +7 -184
- package/cypress/pages/itemPreviewPage.js +0 -1
- package/cypress/pages/multipleSelectionPage.js +35 -1
- package/cypress/pages/singleSelectionPage.js +5 -1
- package/cypress/support/helpers/utilities.js +0 -16
- 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,145 @@
|
|
|
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"]').eq(1), // Alternative answer is typically the second wrapper
|
|
16
|
+
alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
|
|
17
|
+
alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
|
|
18
|
+
correctAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(0), // Correct answer is typically the first wrapper
|
|
19
|
+
|
|
20
|
+
steps: {
|
|
21
|
+
/**
|
|
22
|
+
* Verifies that the "Show alternative answers" toggle is present and visible
|
|
23
|
+
*/
|
|
24
|
+
verifyShowAlternativeAnswersToggleExists: () => {
|
|
25
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper().should('be.visible');
|
|
26
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
|
|
27
|
+
.should('contain.text', 'Show alternative answers');
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Verifies that the "Show alternative answers" toggle does not exist
|
|
32
|
+
*/
|
|
33
|
+
verifyShowAlternativeAnswersToggleNotExists: () => {
|
|
34
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
35
|
+
.should('not.exist');
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
|
|
40
|
+
*/
|
|
41
|
+
verifyShowAlternativeAnswersToggleChecked: () => {
|
|
42
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
43
|
+
.should('be.checked')
|
|
44
|
+
.and('have.attr', 'aria-pressed', 'true');
|
|
45
|
+
// Verify the checked state visual indicator (tick icon)
|
|
46
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
47
|
+
.find('.icon-ILC-tick-icon')
|
|
48
|
+
.should('be.visible');
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
|
|
53
|
+
*/
|
|
54
|
+
verifyShowAlternativeAnswersToggleUnchecked: () => {
|
|
55
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
56
|
+
.should('not.be.checked')
|
|
57
|
+
.and('have.attr', 'aria-pressed', 'false');
|
|
58
|
+
// Verify the unchecked state visual indicator (x-circle icon)
|
|
59
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
60
|
+
.find('.icon-x-circle')
|
|
61
|
+
.should('be.visible');
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Clicks the "Show alternative answers" toggle to change its state
|
|
66
|
+
*/
|
|
67
|
+
clickShowAlternativeAnswersToggle: () => {
|
|
68
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleButton()
|
|
69
|
+
.click();
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
|
|
74
|
+
*/
|
|
75
|
+
enableShowAlternativeAnswersToggle: () => {
|
|
76
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
77
|
+
.then(($input) => {
|
|
78
|
+
if (!$input.prop('checked')) {
|
|
79
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
|
|
86
|
+
*/
|
|
87
|
+
disableShowAlternativeAnswersToggle: () => {
|
|
88
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
89
|
+
.then(($input) => {
|
|
90
|
+
if ($input.prop('checked')) {
|
|
91
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Verifies that the alternative answers section is visible
|
|
98
|
+
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
99
|
+
* @param {string} points - The expected points for the alternative answer
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
verifyAlternativeAnswersLabelAndPointVisible: (index, points) => {
|
|
103
|
+
showAlternativeAnswersComponent.alternativeAnswersSection().should('be.visible');
|
|
104
|
+
|
|
105
|
+
if (points) {
|
|
106
|
+
showAlternativeAnswersComponent.alternativeAnswersSection()
|
|
107
|
+
.parent()
|
|
108
|
+
.find('p')
|
|
109
|
+
.invoke('text')
|
|
110
|
+
.then((text) => {
|
|
111
|
+
expect(text.trim()).to.equal(points);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Verifies that the correct answers section is visible
|
|
118
|
+
* @param {number} points - The expected points for the alternative answer
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
verifyCorrectAnswersLabelAndPointVisible: (points) => {
|
|
122
|
+
showAlternativeAnswersComponent.correctAnswerLabelWrapper()
|
|
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
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Verifies that the alternative answers section does not exist
|
|
138
|
+
*/
|
|
139
|
+
verifyAlternativeAnswersSectionNotExist: () => {
|
|
140
|
+
showAlternativeAnswersComponent.alternativeAnswersSection().should('not.exist');
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export { showAlternativeAnswersComponent };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import utilities from "../support/helpers/utilities";
|
|
2
2
|
import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent, colorPopupComponent } from "./components";
|
|
3
3
|
import { createItemPage } from "./createItemPage";
|
|
4
|
-
import { itemPreviewPage } from "./itemPreviewPage";
|
|
5
4
|
const css = Cypress.env('css');
|
|
6
5
|
let imageWidth = 768;
|
|
7
6
|
let imageHeight = 432;
|
|
@@ -19,7 +18,6 @@ const selectors = {
|
|
|
19
18
|
...imageActionsComponent,
|
|
20
19
|
...additionalSettingsPanel,
|
|
21
20
|
...gradingViewEnumerationComponent,
|
|
22
|
-
...itemPreviewPage,
|
|
23
21
|
|
|
24
22
|
//Image selection style section.
|
|
25
23
|
imageSelectionStyleLabel: () => cy.get('.options-label'),
|
|
@@ -112,12 +110,6 @@ const selectors = {
|
|
|
112
110
|
saturationPointer: () => cy.get('.react-colorful__pointer.react-colorful__saturation-pointer'),
|
|
113
111
|
huePointer: () => cy.get('.react-colorful__pointer.react-colorful__hue-pointer'),
|
|
114
112
|
alphaPointer: () => cy.get('.react-colorful__pointer.react-colorful__alpha-pointer'),
|
|
115
|
-
enumerationPlacementLabel: () => cy.get('[class*="options-container-cls dropzone-identifiers-wrapper"] .options-label').eq(1),
|
|
116
|
-
enumerationToggleButtonContainer: () => cy.get('[aria-label="Enumeration placement"]'),
|
|
117
|
-
enumerationPlacementTopToggleButton: () => cy.get('[data-ngie-testid="top-toggle-button"]'),
|
|
118
|
-
enumerationPlacementCenterToggleButton: () => cy.get('[data-ngie-testid="center-toggle-button"]').eq(1),
|
|
119
|
-
enumerationPlacementBottomToggleButton: () => cy.get('[data-ngie-testid="bottom-toggle-button"]'),
|
|
120
|
-
enumerationForHighlightsPreviewTab: () => cy.get('[class*="highlight-svg-responseive"] circle'),
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
const steps = {
|
|
@@ -320,7 +312,7 @@ const steps = {
|
|
|
320
312
|
* @description this function verifies height of canvas
|
|
321
313
|
*/
|
|
322
314
|
verifyCanvasHeight: (height) => {
|
|
323
|
-
const tolerance =
|
|
315
|
+
const tolerance = 2
|
|
324
316
|
imageHighlightPage.specifyPossibleOptionsImageCanvas()
|
|
325
317
|
.should('have.css', 'height')
|
|
326
318
|
.then(($cssHeight) => {
|
|
@@ -667,20 +659,20 @@ const steps = {
|
|
|
667
659
|
|
|
668
660
|
verifyCanvasImageTopLeftAlignedInPreviewTab: () => {
|
|
669
661
|
imageHighlightPage.imagePreviewTab()
|
|
670
|
-
.should('have.
|
|
671
|
-
.and('have.
|
|
662
|
+
.should('have.css', 'top', '0px')
|
|
663
|
+
.and('have.css', 'left', '0px');
|
|
672
664
|
},
|
|
673
665
|
|
|
674
666
|
verifyCanvasImageCenterAlignedInPreviewTab: () => {
|
|
675
667
|
imageHighlightPage.imagePreviewTab()
|
|
676
|
-
.should('have.
|
|
677
|
-
.and('have.
|
|
668
|
+
.should('not.have.css', 'top', '0px')
|
|
669
|
+
.and('not.have.css', 'left', '0px');
|
|
678
670
|
},
|
|
679
671
|
|
|
680
672
|
verifyCanvasImageTopRightAlignedInPreviewTab: () => {
|
|
681
673
|
imageHighlightPage.imagePreviewTab()
|
|
682
|
-
.should('have.
|
|
683
|
-
.and('not.have.
|
|
674
|
+
.should('have.css', 'top', '0px')
|
|
675
|
+
.and('not.have.css', 'left', '0px');
|
|
684
676
|
},
|
|
685
677
|
|
|
686
678
|
/**
|
|
@@ -1152,20 +1144,6 @@ const steps = {
|
|
|
1152
1144
|
});
|
|
1153
1145
|
},
|
|
1154
1146
|
|
|
1155
|
-
/**
|
|
1156
|
-
* @param {number} index of highlight region
|
|
1157
|
-
* @description this function verifies the outLineHighlight of selected highlight in item preview tab.
|
|
1158
|
-
*/
|
|
1159
|
-
verifyOutlineHighlightRegionItemPreviewTabSection: (index) => {
|
|
1160
|
-
imageHighlightPage.itemPreviewPageWrapper()
|
|
1161
|
-
.within(() => {
|
|
1162
|
-
utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerSectionHighlightPolygon().eq(index), {
|
|
1163
|
-
'stroke-width': '2px',
|
|
1164
|
-
'stroke': css.color.activeHighlightBorder
|
|
1165
|
-
});
|
|
1166
|
-
});
|
|
1167
|
-
},
|
|
1168
|
-
|
|
1169
1147
|
/**
|
|
1170
1148
|
* @param {number} index of highlight region
|
|
1171
1149
|
* @description this function verifies the patternHighlight of selected highlight in preview tab.
|
|
@@ -1727,161 +1705,6 @@ const steps = {
|
|
|
1727
1705
|
Math.abs(ag - eg) <= tolerance &&
|
|
1728
1706
|
Math.abs(ab - eb) <= tolerance
|
|
1729
1707
|
);
|
|
1730
|
-
},
|
|
1731
|
-
|
|
1732
|
-
/**
|
|
1733
|
-
* @param {number} width index for the border style.
|
|
1734
|
-
* @param {number} height index for the border style.
|
|
1735
|
-
* @description Verifies the height and width of image in preview tab.
|
|
1736
|
-
*/
|
|
1737
|
-
verifyImageDimensionsPreviewTab: (width, height) => {
|
|
1738
|
-
imageHighlightPage.imagePreviewTab()
|
|
1739
|
-
.should('have.css', 'width', `${width}px`)
|
|
1740
|
-
.and('have.css', 'height', `${height}px`);
|
|
1741
|
-
},
|
|
1742
|
-
|
|
1743
|
-
/**
|
|
1744
|
-
* @description Clicks on the bottom enumeration placement button.
|
|
1745
|
-
*/
|
|
1746
|
-
selectBottomEnumerationPlacementToggle: () => {
|
|
1747
|
-
imageHighlightPage.enumerationPlacementBottomToggleButton()
|
|
1748
|
-
.click();
|
|
1749
|
-
},
|
|
1750
|
-
|
|
1751
|
-
/**
|
|
1752
|
-
* @description Clicks on the center enumeration placement button.
|
|
1753
|
-
*/
|
|
1754
|
-
selectCenterEnumerationPlacementToggle: () => {
|
|
1755
|
-
imageHighlightPage.enumerationPlacementCenterToggleButton()
|
|
1756
|
-
.click();
|
|
1757
|
-
},
|
|
1758
|
-
|
|
1759
|
-
/**
|
|
1760
|
-
* @param {string} enumerationPlacement placement of the enumeration.
|
|
1761
|
-
* @param {number} index index of highlight region
|
|
1762
|
-
* @description Verifies the enumeration placement for highlight regions in the preview tab.
|
|
1763
|
-
*/
|
|
1764
|
-
verifyNumerationPlacementForHighlightRegionInPreviewTab: (enumerationPlacement, index) => {
|
|
1765
|
-
const tolerance = 1
|
|
1766
|
-
switch (enumerationPlacement) {
|
|
1767
|
-
case 'Top':
|
|
1768
|
-
switch (index) {
|
|
1769
|
-
case 0:
|
|
1770
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1771
|
-
.invoke('attr', 'cx')
|
|
1772
|
-
.then(actualCx => {
|
|
1773
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1774
|
-
expect(roundedCx).to.equal('307.80');
|
|
1775
|
-
});
|
|
1776
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1777
|
-
.invoke('attr', 'cy')
|
|
1778
|
-
.then(actualCx => {
|
|
1779
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1780
|
-
expect(roundedCx).to.equal('59.03');
|
|
1781
|
-
});
|
|
1782
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1783
|
-
.should('have.attr', 'r', '12');
|
|
1784
|
-
break;
|
|
1785
|
-
case 1:
|
|
1786
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1787
|
-
.invoke('attr', 'cx')
|
|
1788
|
-
.then(actualCx => {
|
|
1789
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1790
|
-
expect(roundedCx).to.equal('200.52');
|
|
1791
|
-
});
|
|
1792
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1793
|
-
.invoke('attr', 'cy')
|
|
1794
|
-
.then(actualCx => {
|
|
1795
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1796
|
-
expect(roundedCx).to.equal('213.11');
|
|
1797
|
-
});
|
|
1798
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1799
|
-
.should('have.attr', 'r', '12');
|
|
1800
|
-
break;
|
|
1801
|
-
default:
|
|
1802
|
-
throw new Error(`Unsupported index ${index} for placement 'Top'`);
|
|
1803
|
-
}
|
|
1804
|
-
break;
|
|
1805
|
-
case 'Center':
|
|
1806
|
-
switch (index) {
|
|
1807
|
-
case 0:
|
|
1808
|
-
// Match cx only up to 2 decimal places to allow minor rendering variance.
|
|
1809
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1810
|
-
.invoke('attr', 'cx')
|
|
1811
|
-
.then(actualCx => {
|
|
1812
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1813
|
-
expect(roundedCx).to.equal('365.45');
|
|
1814
|
-
});
|
|
1815
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1816
|
-
.invoke('attr', 'cy')
|
|
1817
|
-
.then(actualCy => {
|
|
1818
|
-
const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
|
|
1819
|
-
expect(roundedCy).to.equal('100.06');
|
|
1820
|
-
});
|
|
1821
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1822
|
-
.should('have.attr', 'r', '12');
|
|
1823
|
-
break;
|
|
1824
|
-
case 1:
|
|
1825
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1826
|
-
.invoke('attr', 'cx')
|
|
1827
|
-
.then(actualCx => {
|
|
1828
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1829
|
-
expect(roundedCx).to.equal('284.74');
|
|
1830
|
-
});
|
|
1831
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1832
|
-
.invoke('attr', 'cy')
|
|
1833
|
-
.then(actualCy => {
|
|
1834
|
-
const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
|
|
1835
|
-
expect(roundedCy).to.equal('238.14');
|
|
1836
|
-
});
|
|
1837
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1838
|
-
.should('have.attr', 'r', '12');
|
|
1839
|
-
break;
|
|
1840
|
-
default:
|
|
1841
|
-
throw new Error(`Unsupported index ${index} for placement 'Center'`);
|
|
1842
|
-
}
|
|
1843
|
-
break;
|
|
1844
|
-
case 'Bottom':
|
|
1845
|
-
switch (index) {
|
|
1846
|
-
case 0:
|
|
1847
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1848
|
-
.invoke('attr', 'cx')
|
|
1849
|
-
.then(actualCx => {
|
|
1850
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1851
|
-
expect(roundedCx).to.equal('307.80');
|
|
1852
|
-
});
|
|
1853
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1854
|
-
.invoke('attr', 'cy')
|
|
1855
|
-
.then(actualCy => {
|
|
1856
|
-
const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
|
|
1857
|
-
expect(roundedCy).to.equal('167.09');
|
|
1858
|
-
});
|
|
1859
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1860
|
-
.should('have.attr', 'r', '12');
|
|
1861
|
-
break;
|
|
1862
|
-
case 1:
|
|
1863
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1864
|
-
.invoke('attr', 'cx')
|
|
1865
|
-
.then(actualCx => {
|
|
1866
|
-
const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
|
|
1867
|
-
expect(roundedCx).to.equal('200.52');
|
|
1868
|
-
});
|
|
1869
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1870
|
-
.invoke('attr', 'cy')
|
|
1871
|
-
.then(actualCy => {
|
|
1872
|
-
const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
|
|
1873
|
-
expect(roundedCy).to.equal('289.16');
|
|
1874
|
-
});
|
|
1875
|
-
imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
|
|
1876
|
-
.should('have.attr', 'r', '12');
|
|
1877
|
-
break;
|
|
1878
|
-
default:
|
|
1879
|
-
throw new Error(`Unsupported index ${index} for placement 'Bottom'`);
|
|
1880
|
-
}
|
|
1881
|
-
break;
|
|
1882
|
-
default:
|
|
1883
|
-
throw new Error(`Invalid enumeration placement '${enumerationPlacement}'`);
|
|
1884
|
-
}
|
|
1885
1708
|
}
|
|
1886
1709
|
}
|
|
1887
1710
|
|
|
@@ -2,7 +2,6 @@ import { createQuestionBasePage, autoScoredScoringPreviewTab } from "./component
|
|
|
2
2
|
|
|
3
3
|
const selectors = {
|
|
4
4
|
referenceID: () => cy.get('.edit-item-reference-id'),
|
|
5
|
-
itemPreviewPageWrapper: () => cy.get('.item-layout-columns-wrapper-without-scroll'),
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
const steps = {
|