itemengine-cypress-automation 1.0.551-IEI-5835-4b5c9f4.0 → 1.0.551-IEI-5835-LIVE-73e4d13.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/LiveStudentView/MultipleSelection/liveStudentView.smoke.js +131 -0
- package/cypress/pages/liveStudentViewBase.js +210 -0
- package/cypress/pages/liveStudentViewPage.js +246 -0
- package/package.json +1 -1
- package/cypress/e2e/ILC/LiveItem/liveItem.js +0 -56
- package/cypress/pages/components/liveItemPage.js +0 -58
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { multipleSelectionPage } from "../../../pages/multipleSelectionPage";
|
|
2
|
+
import { itemPreviewPage } from "../../../pages/itemPreviewPage";
|
|
3
|
+
import { liveStudentViewPage } from "../../../pages/liveStudentViewPage";
|
|
4
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
|
5
|
+
import utilities from "../../../support/helpers/utilities";
|
|
6
|
+
const css = Cypress.env('css');
|
|
7
|
+
var itemReferenceID = "";
|
|
8
|
+
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'];
|
|
9
|
+
|
|
10
|
+
describe('Live Student View - Multiple Selection', () => {
|
|
11
|
+
before(() => {
|
|
12
|
+
cy.loginAs('admin');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
cy.startApplitools();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
cy.eyesClose();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('Multiple Selection Question in Live Student View', { tags: 'smoke' }, () => {
|
|
24
|
+
abortEarlySetup();
|
|
25
|
+
|
|
26
|
+
before(() => {
|
|
27
|
+
// Create the multiple selection question first
|
|
28
|
+
multipleSelectionPage.steps.navigateToCreateQuestion('multiple selection');
|
|
29
|
+
cy.barsPreLoaderWait();
|
|
30
|
+
multipleSelectionPage.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.');
|
|
31
|
+
|
|
32
|
+
cy.log('Add image to option input field')
|
|
33
|
+
multipleSelectionPage.steps.focusInOptionsInputField(0);
|
|
34
|
+
multipleSelectionPage.steps.selectImageOptionFromCKEditorToolbar()
|
|
35
|
+
multipleSelectionPage.steps.addImageToInputField();
|
|
36
|
+
|
|
37
|
+
cy.log('Add bold text to input field')
|
|
38
|
+
multipleSelectionPage.steps.focusInOptionsInputField(1);
|
|
39
|
+
multipleSelectionPage.steps.selectBoldOptionFromCKEditorToolbar();
|
|
40
|
+
multipleSelectionPage.steps.enterTextInOptionInputField(1, 'This is a bold option');
|
|
41
|
+
|
|
42
|
+
cy.log('Add equation to option input field')
|
|
43
|
+
multipleSelectionPage.steps.focusInOptionsInputField(2);
|
|
44
|
+
multipleSelectionPage.steps.selectEquationEditorOptionFromCKEditorToolbar();
|
|
45
|
+
multipleSelectionPage.steps.addGenericEquationUsingEquationEditorToCKEditorInputField();
|
|
46
|
+
multipleSelectionPage.steps.enterTextInOptionInputField(3, 'option 4');
|
|
47
|
+
|
|
48
|
+
multipleSelectionPage.steps.allotPoints(10);
|
|
49
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInSpecifyCorrectAnswerSection(0);
|
|
50
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInSpecifyCorrectAnswerSection(1);
|
|
51
|
+
|
|
52
|
+
// Save the question to get itemReferenceID
|
|
53
|
+
multipleSelectionPage.steps.clickOnSaveQuestionButton();
|
|
54
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
|
55
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
|
56
|
+
|
|
57
|
+
// Log the itemReferenceID to debug
|
|
58
|
+
cy.log(`Item Reference ID: ${itemReferenceID}`);
|
|
59
|
+
|
|
60
|
+
// Navigate to live student view using page object
|
|
61
|
+
cy.then(() => {
|
|
62
|
+
liveStudentViewPage.steps.navigateToLiveStudentView(itemReferenceID);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Multiple Selection Question functionality tests - use multipleSelectionPage.tests
|
|
67
|
+
it('Question instructions should be visible in Live Student View', () => {
|
|
68
|
+
// Use multipleSelectionPage method directly since it's already in Live Student View
|
|
69
|
+
utilities.verifyInnerText(multipleSelectionPage.questionInstructionsText(), 'Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
|
70
|
+
utilities.verifyElementVisibilityState(multipleSelectionPage.questionInstructionsText(), 'visible');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('Multiple selection - When the user has added image, bold text and equation to the options input they should be displayed', () => {
|
|
74
|
+
// Use multipleSelectionPage methods directly - they work in Live Student View
|
|
75
|
+
multipleSelectionPage.steps.verifyImageInPreviewTab(0);
|
|
76
|
+
multipleSelectionPage.steps.verifyBoldTextInPreviewTab(1);
|
|
77
|
+
multipleSelectionPage.steps.verifyEquationTextInPreviewTab(2);
|
|
78
|
+
cy.eyesCheckWindow('Multiple selection - Live Student View - Image, Bold Text, and Equation Display');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('All the options should be in unchecked state initially', () => {
|
|
82
|
+
// Use multipleSelectionPage method directly
|
|
83
|
+
for (let index = 0; index < 4; index++) {
|
|
84
|
+
multipleSelectionPage.steps.verifyOptionsCheckboxInPreviewTabUncheckedState(index);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('CSS of Multiple Selection options', { tags: 'css' }, () => {
|
|
89
|
+
utilities.verifyCSS(utilities.getNthElement(multipleSelectionPage.optionsText(), 2), {
|
|
90
|
+
'color': css.color.text,
|
|
91
|
+
'font-size': css.fontSize.default,
|
|
92
|
+
'font-weight': css.fontWeight.regular
|
|
93
|
+
});
|
|
94
|
+
utilities.verifyCSS(multipleSelectionPage.optionsCheckbox().parent().find('svg'), {
|
|
95
|
+
'fill': css.color.secondaryBtn
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Check a box to verify selected CSS
|
|
99
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInPreviewTab(1);
|
|
100
|
+
|
|
101
|
+
cy.log('CSS of selected options')
|
|
102
|
+
utilities.verifyCSS(utilities.getNthElement(multipleSelectionPage.optionsCheckboxWrapperPreviewTab(), 1), {
|
|
103
|
+
'background-color': css.color.defaultBackground,
|
|
104
|
+
'color': css.color.activeButtons,
|
|
105
|
+
'border': `2px solid ${css.color.activeComponentBorder}`
|
|
106
|
+
});
|
|
107
|
+
utilities.verifyCSS(utilities.getNthElement(multipleSelectionPage.optionsText(), 1).find('.question-text-wrapper'), {
|
|
108
|
+
'color': css.color.optionsSelectedText,
|
|
109
|
+
'font-size': css.fontSize.default,
|
|
110
|
+
'font-weight': css.fontWeight.regular
|
|
111
|
+
});
|
|
112
|
+
multipleSelectionPage.optionsCheckbox()
|
|
113
|
+
.eq(1)
|
|
114
|
+
.parent()
|
|
115
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('Accessibility of Multiple Selection question', { tags: 'a11y' }, () => {
|
|
119
|
+
cy.checkAccessibility(multipleSelectionPage.questionInstructionsText().parents('[class*="ContentWrapper"]'));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Live Student View specific functionality tests - use common base tests
|
|
123
|
+
liveStudentViewPage.tests.verifyLiveStudentViewInterface();
|
|
124
|
+
|
|
125
|
+
// Multiple Selection specific Live Student View interactions - test on current page first
|
|
126
|
+
liveStudentViewPage.tests.verifyMultipleSelectionLiveStudentViewInteractions();
|
|
127
|
+
|
|
128
|
+
// Then navigate to multiple session page and test those controls
|
|
129
|
+
liveStudentViewPage.tests.verifyMultipleSessionLiveStudentView();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import utilities from "../support/helpers/utilities";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Live Student View Base - Common functionality for all question types
|
|
5
|
+
* This module provides reusable Live Student View functionality that works with any question type
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const css = Cypress.env('css');
|
|
9
|
+
|
|
10
|
+
const selectors = {
|
|
11
|
+
// Main Live Student View containers - common to all question types
|
|
12
|
+
student1Container: () => cy.get('#nextgen-live-student1'),
|
|
13
|
+
student2Container: () => cy.get('#nextgen-live-student2'),
|
|
14
|
+
studentsWrapper: () => cy.get('.LiveStudentViewstyles__StudentsWrapper-hx9itz-3'),
|
|
15
|
+
|
|
16
|
+
// Student headers - common to all question types
|
|
17
|
+
student1Header: () => cy.get('#nextgen-live-student1').parent().find('.LiveStudentViewstyles__LiveStudentHeader-hx9itz-2').contains('Student-1'),
|
|
18
|
+
student2Header: () => cy.get('#nextgen-live-student2').parent().find('.LiveStudentViewstyles__LiveStudentHeader-hx9itz-2').contains('Student-2'),
|
|
19
|
+
|
|
20
|
+
// Multiple Session Live Student View selectors - common to all question types
|
|
21
|
+
pageTitle: () => cy.get('[id="header-title"]'),
|
|
22
|
+
enableLiveClassCheckbox: () => cy.get('[data-ngie-testid="enable-live-class-checkbox"]'),
|
|
23
|
+
enableLiveClassCheckboxInput: () => cy.get('[data-ngie-testid="enable-live-class-checkbox"] input[type="checkbox"]'),
|
|
24
|
+
getStudentViewSessionDataButton: () => cy.contains('button', 'Get student view session data'),
|
|
25
|
+
refreshUserResponsesButton: () => cy.contains('button', 'Refresh User Responses'),
|
|
26
|
+
launchGradingButton: () => cy.get('[data-testid="launchGrading"]'),
|
|
27
|
+
resetFieldsButton: () => cy.contains('button', 'Reset Fields')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const steps = {
|
|
31
|
+
/**
|
|
32
|
+
* Common navigation methods - works for all question types
|
|
33
|
+
*/
|
|
34
|
+
navigateToLiveStudentView: (itemReferenceID) => {
|
|
35
|
+
const encodedId = utilities.base64Encoding(itemReferenceID);
|
|
36
|
+
cy.log(`Navigating to live student view with encoded ID: ${encodedId}`);
|
|
37
|
+
cy.visit(`/item-engine/demo/live-student-view/${encodedId}`);
|
|
38
|
+
cy.wait(3000); // Wait for page to load
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
navigateToMultipleSessionLiveStudentView: () => {
|
|
42
|
+
cy.log('Navigating to multiple-session live student view page');
|
|
43
|
+
cy.visit('/item-engine/multiple-session/live-student-view');
|
|
44
|
+
cy.wait(3000); // Wait for page to load
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
navigateToMultipleSessionWithItem: (itemReferenceID = null) => {
|
|
48
|
+
if (itemReferenceID) {
|
|
49
|
+
const encodedId = utilities.base64Encoding(itemReferenceID);
|
|
50
|
+
cy.log(`Navigating to multiple-session live student view with encoded ID: ${encodedId}`);
|
|
51
|
+
cy.visit(`/item-engine/multiple-session/live-student-view/${encodedId}`);
|
|
52
|
+
} else {
|
|
53
|
+
liveStudentViewBase.steps.navigateToMultipleSessionLiveStudentView();
|
|
54
|
+
}
|
|
55
|
+
cy.wait(3000); // Wait for page to load
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Common verification methods - works for all question types
|
|
60
|
+
*/
|
|
61
|
+
verifyBothStudentContainersExist: () => {
|
|
62
|
+
cy.log('Verifying both student containers exist');
|
|
63
|
+
liveStudentViewBase.student1Container().should('exist').should('be.visible');
|
|
64
|
+
liveStudentViewBase.student2Container().should('exist').should('be.visible');
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
verifyStudentHeaders: () => {
|
|
68
|
+
cy.log('Verifying student headers');
|
|
69
|
+
liveStudentViewBase.student1Header().should('be.visible');
|
|
70
|
+
liveStudentViewBase.student2Header().should('be.visible');
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Multiple Session Live Student View methods - common to all question types
|
|
75
|
+
*/
|
|
76
|
+
verifyMultipleSessionPageTitle: () => {
|
|
77
|
+
cy.log('Verifying Multiple Session Grading View page title');
|
|
78
|
+
liveStudentViewBase.pageTitle().should('contain.text', 'Multiple Session Grading View');
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
checkEnableLiveClassCheckbox: () => {
|
|
82
|
+
cy.log('Checking Enable Live Class checkbox');
|
|
83
|
+
liveStudentViewBase.enableLiveClassCheckboxInput().then(($checkbox) => {
|
|
84
|
+
if (!$checkbox.is(':checked')) {
|
|
85
|
+
liveStudentViewBase.enableLiveClassCheckbox().click();
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
verifyEnableLiveClassCheckboxIsChecked: () => {
|
|
91
|
+
cy.log('Verifying Enable Live Class checkbox is checked');
|
|
92
|
+
liveStudentViewBase.enableLiveClassCheckboxInput().should('be.checked');
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
verifyEnableLiveClassCheckboxIsUnchecked: () => {
|
|
96
|
+
cy.log('Verifying Enable Live Class checkbox is unchecked');
|
|
97
|
+
liveStudentViewBase.enableLiveClassCheckboxInput().should('not.be.checked');
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
clickGetStudentViewSessionDataButton: () => {
|
|
101
|
+
cy.log('Clicking Get student view session data button');
|
|
102
|
+
liveStudentViewBase.getStudentViewSessionDataButton().should('be.visible').click();
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
clickRefreshUserResponsesButton: () => {
|
|
106
|
+
cy.log('Clicking Refresh User Responses button');
|
|
107
|
+
liveStudentViewBase.refreshUserResponsesButton().should('be.visible').click();
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
clickLaunchGradingButton: () => {
|
|
111
|
+
cy.log('Clicking Launch Grading button');
|
|
112
|
+
liveStudentViewBase.launchGradingButton().should('be.visible').click();
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
clickResetFieldsButton: () => {
|
|
116
|
+
cy.log('Clicking Reset Fields button');
|
|
117
|
+
liveStudentViewBase.resetFieldsButton().should('be.visible').click();
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Common utility methods
|
|
122
|
+
*/
|
|
123
|
+
waitForPageLoad: () => {
|
|
124
|
+
cy.wait(3000);
|
|
125
|
+
cy.log('Live Student View page loaded');
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
waitForApiResponse: () => {
|
|
129
|
+
cy.wait(2000);
|
|
130
|
+
cy.log('Waiting for API response...');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Common tests that work for all question types
|
|
136
|
+
*/
|
|
137
|
+
const tests = {
|
|
138
|
+
/**
|
|
139
|
+
* Verifies Live Student View interface - common to all question types
|
|
140
|
+
*/
|
|
141
|
+
verifyLiveStudentViewInterface: () => {
|
|
142
|
+
it('Both student containers should exist and be visible', () => {
|
|
143
|
+
liveStudentViewBase.steps.verifyBothStudentContainersExist();
|
|
144
|
+
liveStudentViewBase.steps.verifyStudentHeaders();
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Verifies Multiple Session Live Student View functionality - common to all question types
|
|
150
|
+
*/
|
|
151
|
+
verifyMultipleSessionLiveStudentView: () => {
|
|
152
|
+
it('Navigate to Multiple Session Live Student View and interact with Live Class controls', () => {
|
|
153
|
+
liveStudentViewBase.steps.navigateToMultipleSessionLiveStudentView();
|
|
154
|
+
liveStudentViewBase.steps.verifyMultipleSessionPageTitle();
|
|
155
|
+
liveStudentViewBase.steps.checkEnableLiveClassCheckbox();
|
|
156
|
+
liveStudentViewBase.steps.verifyEnableLiveClassCheckboxIsChecked();
|
|
157
|
+
liveStudentViewBase.steps.clickGetStudentViewSessionDataButton();
|
|
158
|
+
liveStudentViewBase.steps.clickLaunchGradingButton();
|
|
159
|
+
cy.log('✅ SUCCESS: Successfully interacted with Multiple Session Live Class controls and launched grading');
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Common accessibility test for Live Student View - works with any question type
|
|
165
|
+
*/
|
|
166
|
+
verifyLiveStudentViewAccessibility: () => {
|
|
167
|
+
it('Accessibility of Live Student View containers', { tags: 'a11y' }, () => {
|
|
168
|
+
cy.checkAccessibility(liveStudentViewBase.studentsWrapper());
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Common navigation test - works with any question type
|
|
174
|
+
*/
|
|
175
|
+
verifyLiveStudentViewNavigation: (itemReferenceID) => {
|
|
176
|
+
it('Should successfully navigate to Live Student View', () => {
|
|
177
|
+
liveStudentViewBase.steps.navigateToLiveStudentView(itemReferenceID);
|
|
178
|
+
liveStudentViewBase.steps.verifyBothStudentContainersExist();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Helper function to get student-specific selectors for any question type
|
|
185
|
+
* @param {number} studentNum - Student number (1 or 2)
|
|
186
|
+
* @param {string} selector - The selector string to find within student container
|
|
187
|
+
* @returns {Cypress.Chainable} - Cypress element within specific student container
|
|
188
|
+
*/
|
|
189
|
+
const getStudentSpecificElement = (studentNum, selector) => {
|
|
190
|
+
const container = studentNum === 1 ? liveStudentViewBase.student1Container() : liveStudentViewBase.student2Container();
|
|
191
|
+
return container.find(selector);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Helper function to perform actions within a specific student container
|
|
196
|
+
* @param {number} studentNum - Student number (1 or 2)
|
|
197
|
+
* @param {function} callback - Callback function to execute within student container
|
|
198
|
+
*/
|
|
199
|
+
const withinStudentContainer = (studentNum, callback) => {
|
|
200
|
+
const container = studentNum === 1 ? liveStudentViewBase.student1Container() : liveStudentViewBase.student2Container();
|
|
201
|
+
container.within(callback);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export const liveStudentViewBase = {
|
|
205
|
+
...selectors,
|
|
206
|
+
steps,
|
|
207
|
+
tests,
|
|
208
|
+
getStudentSpecificElement,
|
|
209
|
+
withinStudentContainer
|
|
210
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import constants from "../fixtures/constants";
|
|
2
|
+
import utilities from "../support/helpers/utilities";
|
|
3
|
+
import { multipleSelectionPage } from "./multipleSelectionPage";
|
|
4
|
+
import { liveStudentViewBase } from "./liveStudentViewBase";
|
|
5
|
+
|
|
6
|
+
const css = Cypress.env('css');
|
|
7
|
+
|
|
8
|
+
const selectors = {
|
|
9
|
+
// Import common Live Student View selectors from base
|
|
10
|
+
...liveStudentViewBase,
|
|
11
|
+
|
|
12
|
+
// Question elements - reusing multipleSelectionPage selectors
|
|
13
|
+
questionInstructions: (studentNum = null) => {
|
|
14
|
+
if (studentNum === 1) {
|
|
15
|
+
return liveStudentViewPage.student1Container().find('[data-testid="question-instruction-element"]');
|
|
16
|
+
} else if (studentNum === 2) {
|
|
17
|
+
return liveStudentViewPage.student2Container().find('[data-testid="question-instruction-element"]');
|
|
18
|
+
}
|
|
19
|
+
return multipleSelectionPage.questionInstructionsText();
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
// Option elements - reusing multipleSelectionPage selectors
|
|
23
|
+
optionCheckboxes: (studentNum = null) => {
|
|
24
|
+
if (studentNum === 1) {
|
|
25
|
+
return liveStudentViewPage.student1Container().find('[data-ngie-testid="response-option-checkbox"]');
|
|
26
|
+
} else if (studentNum === 2) {
|
|
27
|
+
return liveStudentViewPage.student2Container().find('[data-ngie-testid="response-option-checkbox"]');
|
|
28
|
+
}
|
|
29
|
+
return multipleSelectionPage.optionsCheckboxWrapperPreviewTab();
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
optionInputs: (studentNum = null) => {
|
|
33
|
+
if (studentNum === 1) {
|
|
34
|
+
return liveStudentViewPage.student1Container().find('[data-ngie-testid="response-option-checkbox"] [type="checkbox"]');
|
|
35
|
+
} else if (studentNum === 2) {
|
|
36
|
+
return liveStudentViewPage.student2Container().find('[data-ngie-testid="response-option-checkbox"] [type="checkbox"]');
|
|
37
|
+
}
|
|
38
|
+
return multipleSelectionPage.optionsCheckboxPreviewTab();
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Multiple Selection specific option types - using base helper functions
|
|
42
|
+
imageOption: (studentNum, optionIndex = 0) => {
|
|
43
|
+
return liveStudentViewBase.getStudentSpecificElement(studentNum, '[data-ngie-testid="response-option-checkbox"]').eq(optionIndex).find('img');
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
boldTextOption: (studentNum, optionIndex = 1) => {
|
|
47
|
+
return liveStudentViewBase.getStudentSpecificElement(studentNum, '[data-ngie-testid="response-option-checkbox"]').eq(optionIndex).find('strong');
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
equationOption: (studentNum, optionIndex = 2) => {
|
|
51
|
+
return liveStudentViewBase.getStudentSpecificElement(studentNum, '[data-ngie-testid="response-option-checkbox"]').eq(optionIndex).find('.mathjx-rendered');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const steps = {
|
|
56
|
+
// Import common Live Student View steps from base
|
|
57
|
+
...liveStudentViewBase.steps,
|
|
58
|
+
|
|
59
|
+
// Multiple Selection specific student interactions
|
|
60
|
+
selectOptionForStudent: (studentNum, optionIndex) => {
|
|
61
|
+
cy.log(`Student-${studentNum}: Selecting option ${optionIndex}`);
|
|
62
|
+
|
|
63
|
+
liveStudentViewBase.withinStudentContainer(studentNum, () => {
|
|
64
|
+
// Use multipleSelectionPage method for consistent checkbox clicking
|
|
65
|
+
multipleSelectionPage.optionsCheckboxWrapperPreviewTab().eq(optionIndex).click();
|
|
66
|
+
});
|
|
67
|
+
cy.wait(2000); // Wait for API response
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
selectMultipleOptionsForStudent: (studentNum, optionIndexes) => {
|
|
71
|
+
cy.log(`Student-${studentNum}: Selecting multiple options: ${optionIndexes.join(', ')}`);
|
|
72
|
+
optionIndexes.forEach(optionIndex => {
|
|
73
|
+
liveStudentViewPage.steps.selectOptionForStudent(studentNum, optionIndex);
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
// Multiple Selection specific verification methods
|
|
78
|
+
verifyOptionCheckedForStudent: (studentNum, optionIndex) => {
|
|
79
|
+
cy.log(`Verifying Student-${studentNum} option ${optionIndex} is checked`);
|
|
80
|
+
|
|
81
|
+
liveStudentViewBase.withinStudentContainer(studentNum, () => {
|
|
82
|
+
// Use multipleSelectionPage method for consistent checkbox verification
|
|
83
|
+
multipleSelectionPage.optionsCheckboxPreviewTab().eq(optionIndex).should('be.checked');
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
verifyOptionUncheckedForStudent: (studentNum, optionIndex) => {
|
|
88
|
+
cy.log(`Verifying Student-${studentNum} option ${optionIndex} is unchecked`);
|
|
89
|
+
|
|
90
|
+
liveStudentViewBase.withinStudentContainer(studentNum, () => {
|
|
91
|
+
// Use multipleSelectionPage method for consistent checkbox verification
|
|
92
|
+
multipleSelectionPage.optionsCheckboxPreviewTab().eq(optionIndex).should('not.be.checked');
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
verifyStudentSelections: (studentNum, checkedOptions = [], uncheckedOptions = []) => {
|
|
97
|
+
cy.log(`Verifying Student-${studentNum} selections`);
|
|
98
|
+
|
|
99
|
+
// Verify checked options
|
|
100
|
+
checkedOptions.forEach(optionIndex => {
|
|
101
|
+
liveStudentViewPage.steps.verifyOptionCheckedForStudent(studentNum, optionIndex);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Verify unchecked options
|
|
105
|
+
uncheckedOptions.forEach(optionIndex => {
|
|
106
|
+
liveStudentViewPage.steps.verifyOptionUncheckedForStudent(studentNum, optionIndex);
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// Method to use multipleSelectionPage's existing unchecked state verification
|
|
111
|
+
verifyAllOptionsUncheckedInitially: () => {
|
|
112
|
+
cy.log('Verifying all options are unchecked initially using multipleSelectionPage methods');
|
|
113
|
+
// Use multipleSelectionPage method for initial unchecked state verification
|
|
114
|
+
for (let index = 0; index < 4; index++) {
|
|
115
|
+
multipleSelectionPage.steps.verifyOptionsCheckboxInPreviewTabUncheckedState(index);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// Method to use multipleSelectionPage's checkbox clicking
|
|
120
|
+
clickOptionUsingMultipleSelectionMethod: (optionIndex) => {
|
|
121
|
+
cy.log(`Clicking option ${optionIndex} using multipleSelectionPage method`);
|
|
122
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInPreviewTab(optionIndex);
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// Content verification methods - reusing multipleSelectionPage methods
|
|
126
|
+
verifyQuestionInstructionsVisible: (expectedText, studentNum = null) => {
|
|
127
|
+
cy.log(`Verifying question instructions are visible${studentNum ? ` for Student-${studentNum}` : ''}`);
|
|
128
|
+
if (studentNum) {
|
|
129
|
+
const questionElement = liveStudentViewPage.questionInstructions(studentNum);
|
|
130
|
+
questionElement.should('be.visible');
|
|
131
|
+
if (expectedText) {
|
|
132
|
+
questionElement.should('contain.text', expectedText);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
// Use multipleSelectionPage method for question instructions verification
|
|
136
|
+
utilities.verifyInnerText(multipleSelectionPage.questionInstructionsText(), expectedText);
|
|
137
|
+
utilities.verifyElementVisibilityState(multipleSelectionPage.questionInstructionsText(), 'visible');
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
// Content verification methods - using multipleSelectionPage methods
|
|
142
|
+
verifyImageOptionVisible: (studentNum, optionIndex = 0) => {
|
|
143
|
+
cy.log(`Verifying image option is visible for Student-${studentNum}`);
|
|
144
|
+
if (studentNum) {
|
|
145
|
+
liveStudentViewPage.imageOption(studentNum, optionIndex).should('exist').should('be.visible');
|
|
146
|
+
} else {
|
|
147
|
+
// Use multipleSelectionPage method
|
|
148
|
+
multipleSelectionPage.steps.verifyImageInPreviewTab(optionIndex);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
verifyBoldTextOptionVisible: (studentNum, optionIndex = 1, expectedText = null) => {
|
|
153
|
+
cy.log(`Verifying bold text option is visible for Student-${studentNum}`);
|
|
154
|
+
if (studentNum) {
|
|
155
|
+
const boldElement = liveStudentViewPage.boldTextOption(studentNum, optionIndex);
|
|
156
|
+
boldElement.should('exist').should('be.visible');
|
|
157
|
+
if (expectedText) {
|
|
158
|
+
boldElement.should('contain.text', expectedText);
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
// Use multipleSelectionPage method
|
|
162
|
+
multipleSelectionPage.steps.verifyBoldTextInPreviewTab(optionIndex);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
verifyEquationOptionVisible: (studentNum, optionIndex = 2) => {
|
|
167
|
+
cy.log(`Verifying equation option is visible for Student-${studentNum}`);
|
|
168
|
+
if (studentNum) {
|
|
169
|
+
liveStudentViewPage.equationOption(studentNum, optionIndex).should('exist').should('be.visible');
|
|
170
|
+
} else {
|
|
171
|
+
// Use multipleSelectionPage method
|
|
172
|
+
multipleSelectionPage.steps.verifyEquationTextInPreviewTab(optionIndex);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
// Combined test scenarios
|
|
177
|
+
testIndependentStudentInteractions: () => {
|
|
178
|
+
cy.log('=== Testing Independent Student Interactions ===');
|
|
179
|
+
|
|
180
|
+
// Student-1 selects options 0 and 1
|
|
181
|
+
liveStudentViewPage.steps.selectMultipleOptionsForStudent(1, [0, 1]);
|
|
182
|
+
|
|
183
|
+
// Student-2 selects options 2 and 3
|
|
184
|
+
liveStudentViewPage.steps.selectMultipleOptionsForStudent(2, [2, 3]);
|
|
185
|
+
|
|
186
|
+
// Verify Student-1's selections
|
|
187
|
+
liveStudentViewPage.steps.verifyStudentSelections(1, [0, 1], [2, 3]);
|
|
188
|
+
|
|
189
|
+
// Verify Student-2's selections
|
|
190
|
+
liveStudentViewPage.steps.verifyStudentSelections(2, [2, 3], [0, 1]);
|
|
191
|
+
|
|
192
|
+
cy.log('✅ SUCCESS: Both students can independently select options');
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Verifies that the image in both student containers has the correct source and alt text.
|
|
199
|
+
* @param {number} index - The index of the option in both student containers.
|
|
200
|
+
*/
|
|
201
|
+
verifyImageInBothStudentContainers: (index) => {
|
|
202
|
+
liveStudentViewPage.steps.verifyImageOptionVisible(1, index);
|
|
203
|
+
liveStudentViewPage.steps.verifyImageOptionVisible(2, index);
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Verifies that the bold text in both student containers is correct.
|
|
208
|
+
* @param {number} index - The index of the option in both student containers.
|
|
209
|
+
*/
|
|
210
|
+
verifyBoldTextInBothStudentContainers: (index) => {
|
|
211
|
+
liveStudentViewPage.steps.verifyBoldTextOptionVisible(1, index);
|
|
212
|
+
liveStudentViewPage.steps.verifyBoldTextOptionVisible(2, index);
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Verifies that the equation text in both student containers is correct.
|
|
217
|
+
* @param {number} index - The index of the option in both student containers.
|
|
218
|
+
*/
|
|
219
|
+
verifyEquationInBothStudentContainers: (index) => {
|
|
220
|
+
liveStudentViewPage.steps.verifyEquationOptionVisible(1, index);
|
|
221
|
+
liveStudentViewPage.steps.verifyEquationOptionVisible(2, index);
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const tests = {
|
|
227
|
+
// Import common Live Student View tests from base
|
|
228
|
+
...liveStudentViewBase.tests,
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Multiple Selection specific Live Student View tests
|
|
232
|
+
*/
|
|
233
|
+
verifyMultipleSelectionLiveStudentViewInteractions: () => {
|
|
234
|
+
it('Live Student View should allow real-time interaction with both students for Multiple Selection', () => {
|
|
235
|
+
liveStudentViewBase.steps.verifyBothStudentContainersExist();
|
|
236
|
+
liveStudentViewBase.steps.verifyStudentHeaders();
|
|
237
|
+
liveStudentViewPage.steps.testIndependentStudentInteractions();
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export const liveStudentViewPage = {
|
|
243
|
+
...selectors,
|
|
244
|
+
steps,
|
|
245
|
+
tests
|
|
246
|
+
}
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
|
2
|
-
import { liveItemPage } from "../../../pages/components/liveItemPage";
|
|
3
|
-
import utilities from "../../../support/helpers/utilities";
|
|
4
|
-
|
|
5
|
-
describe('Navigate to Live item page and view the page contents', () => {
|
|
6
|
-
before(() => {
|
|
7
|
-
cy.loginAs('admin');
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
describe('Live item page', () => {
|
|
11
|
-
abortEarlySetup();
|
|
12
|
-
before(() => {
|
|
13
|
-
liveItemPage.steps.navigateToLiveItemPage();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('Live item heading should be displayed', () => {
|
|
17
|
-
utilities.verifyElementVisibilityState(liveItemPage.liveItemHeaderText(), 'visible');
|
|
18
|
-
utilities.verifyInnerText(liveItemPage.liveItemHeaderText(), 'Live Item Demo');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('Item id should be displayed', () => {
|
|
22
|
-
utilities.verifyElementVisibilityState(liveItemPage.liveItemItemId(), 'visible');
|
|
23
|
-
utilities.verifyInnerText(liveItemPage.liveItemItemId(), 'Item: a61f2-1a16-eff1-421d-ba3defd3e643');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('Student preview should be displayed', () => {
|
|
27
|
-
utilities.verifyElementVisibilityState(liveItemPage.liveItemStudentPreview(), 'visible');
|
|
28
|
-
utilities.verifyInnerText(liveItemPage.liveItemStudentPreview(), 'Student Preview');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('Teacher preview should be displayed', () => {
|
|
32
|
-
utilities.verifyElementVisibilityState(liveItemPage.liveItemTeacherPreview(), 'visible');
|
|
33
|
-
utilities.verifyInnerText(liveItemPage.liveItemTeacherPreview(), 'Teacher Preview');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe.only('Student preview content', () => {
|
|
38
|
-
abortEarlySetup();
|
|
39
|
-
before(() => {
|
|
40
|
-
liveItemPage.steps.navigateToLiveItemPage();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('Student preview should be displayed', () => {
|
|
44
|
-
utilities.verifyElementVisibilityState(liveItemPage.liveItemStudentPreview(), 'visible');
|
|
45
|
-
utilities.verifyInnerText(liveItemPage.liveItemStudentPreview(), 'Student Preview');
|
|
46
|
-
cy.wait(2000);
|
|
47
|
-
liveItemPage.steps.checkOptionForQuestion(0, 1);
|
|
48
|
-
liveItemPage.steps.checkOptionForQuestion(1, 3);
|
|
49
|
-
liveItemPage.steps.checkOptionForQuestion(2, [1, 3]);
|
|
50
|
-
liveItemPage.steps.checkOptionForQuestion(3, 0);
|
|
51
|
-
liveItemPage.steps.checkOptionForQuestion(4, [0, 2]);
|
|
52
|
-
liveItemPage.steps.checkOptionForQuestion(5, 0);
|
|
53
|
-
liveItemPage.steps.checkOptionForQuestion(6, [1, 2, 3]);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import utilities from "../../support/helpers/utilities";
|
|
2
|
-
import { commonComponents } from "./commonComponents";
|
|
3
|
-
const css = Cypress.env('css');
|
|
4
|
-
|
|
5
|
-
const selectors = {
|
|
6
|
-
liveItemHeaderText: () => cy.get('[class*="HeaderTitleComponentstyles__HeaderTitleWrapper"]'),
|
|
7
|
-
liveItemItemId: () => cy.get('[class*="LiveItemDemostyles__ViewInfoWrapper"]'),
|
|
8
|
-
liveItemStudentPreview: () => cy.get('[class*="LiveItemDemostyles__LiveStudentHeader"]'),
|
|
9
|
-
liveItemTeacherPreview: () => cy.get('[class*="LiveTeacherPreviewstyles__LiveTeacherHeader"]'),
|
|
10
|
-
optionsRadioButtonForCorrectAnswer: () => cy.get('.radio-option-wrapper'),
|
|
11
|
-
optionsCheckboxForCorrectAnswer: () => cy.get('.mcq-option-wrapper'),
|
|
12
|
-
selectQuestion: ()=> cy.get('[class*="SinglePageAssessmentQuestionsstyles__QuestionPartContainer"]'),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const steps = {
|
|
16
|
-
navigateToLiveItemPage: () => {
|
|
17
|
-
cy.visit('/item-engine/demo/live-item-demo');
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @description Checks the options checkbox in the 'Specify correct answer' section for single selection questions.
|
|
22
|
-
* @param {number} optionIndex - The index of the option checkbox to be checked.
|
|
23
|
-
*/
|
|
24
|
-
checkRadioOptionInStudentPreview: (optionIndex) => {
|
|
25
|
-
liveItemPage.optionsRadioButtonForCorrectAnswer()
|
|
26
|
-
.eq(optionIndex)
|
|
27
|
-
.click()
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
checkCheckboxInStudentPreview: (optionIndex) => {
|
|
31
|
-
liveItemPage.optionsCheckboxForCorrectAnswer()
|
|
32
|
-
.eq(optionIndex)
|
|
33
|
-
.click()
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
checkOptionForQuestion: (questionNumber, optionIndex) => {
|
|
37
|
-
liveItemPage.selectQuestion()
|
|
38
|
-
.eq(questionNumber)
|
|
39
|
-
.within(() => {
|
|
40
|
-
if (Array.isArray(optionIndex)) {
|
|
41
|
-
optionIndex.forEach((index) => {
|
|
42
|
-
liveItemPage.steps.checkCheckboxInStudentPreview(index);
|
|
43
|
-
});
|
|
44
|
-
} else {
|
|
45
|
-
liveItemPage.steps.checkRadioOptionInStudentPreview(optionIndex);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const tests = {};
|
|
53
|
-
|
|
54
|
-
export const liveItemPage = {
|
|
55
|
-
...selectors,
|
|
56
|
-
steps,
|
|
57
|
-
tests,
|
|
58
|
-
};
|