itemengine-cypress-automation 1.0.553-IEI-3480-e6afc10.0 → 1.0.554-IEI-5835-LIVE-9ad00b0.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.
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
multipleSelectionPage.steps.focusInOptionsInputField(0);
|
|
33
|
+
multipleSelectionPage.steps.selectImageOptionFromCKEditorToolbar()
|
|
34
|
+
multipleSelectionPage.steps.addImageToInputField();
|
|
35
|
+
|
|
36
|
+
multipleSelectionPage.steps.focusInOptionsInputField(1);
|
|
37
|
+
multipleSelectionPage.steps.selectBoldOptionFromCKEditorToolbar();
|
|
38
|
+
multipleSelectionPage.steps.enterTextInOptionInputField(1, 'This is a bold option');
|
|
39
|
+
|
|
40
|
+
multipleSelectionPage.steps.focusInOptionsInputField(2);
|
|
41
|
+
multipleSelectionPage.steps.selectEquationEditorOptionFromCKEditorToolbar();
|
|
42
|
+
multipleSelectionPage.steps.addGenericEquationUsingEquationEditorToCKEditorInputField();
|
|
43
|
+
multipleSelectionPage.steps.enterTextInOptionInputField(3, 'option 4');
|
|
44
|
+
|
|
45
|
+
multipleSelectionPage.steps.allotPoints(10);
|
|
46
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInSpecifyCorrectAnswerSection(0);
|
|
47
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInSpecifyCorrectAnswerSection(1);
|
|
48
|
+
|
|
49
|
+
// Save the question to get itemReferenceID
|
|
50
|
+
multipleSelectionPage.steps.clickOnSaveQuestionButton();
|
|
51
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
|
52
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
|
53
|
+
|
|
54
|
+
// Navigate to live student view using page object
|
|
55
|
+
cy.then(() => {
|
|
56
|
+
liveStudentViewPage.steps.navigateToLiveStudentView(itemReferenceID);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Multiple Selection Question functionality tests - use multipleSelectionPage.tests
|
|
61
|
+
it('Question instructions should be visible in Live Student View', () => {
|
|
62
|
+
// Use multipleSelectionPage method directly since it's already in Live Student View
|
|
63
|
+
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.');
|
|
64
|
+
utilities.verifyElementVisibilityState(multipleSelectionPage.questionInstructionsText(), 'visible');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('Multiple selection - When the user has added image, bold text and equation to the options input they should be displayed', () => {
|
|
68
|
+
// Use multipleSelectionPage methods directly - they work in Live Student View
|
|
69
|
+
multipleSelectionPage.steps.verifyImageInPreviewTab(0);
|
|
70
|
+
multipleSelectionPage.steps.verifyBoldTextInPreviewTab(1);
|
|
71
|
+
multipleSelectionPage.steps.verifyEquationTextInPreviewTab(2);
|
|
72
|
+
cy.eyesCheckWindow('Multiple selection - Live Student View - Image, Bold Text, and Equation Display');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('All the options should be in unchecked state initially', () => {
|
|
76
|
+
// Use multipleSelectionPage method directly
|
|
77
|
+
for (let index = 0; index < 4; index++) {
|
|
78
|
+
multipleSelectionPage.steps.verifyOptionsCheckboxInPreviewTabUncheckedState(index);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('CSS of Multiple Selection options', { tags: 'css' }, () => {
|
|
83
|
+
utilities.verifyCSS(utilities.getNthElement(multipleSelectionPage.optionsText(), 2), {
|
|
84
|
+
'color': css.color.text,
|
|
85
|
+
'font-size': css.fontSize.default,
|
|
86
|
+
'font-weight': css.fontWeight.regular
|
|
87
|
+
});
|
|
88
|
+
utilities.verifyCSS(multipleSelectionPage.optionsCheckbox().parent().find('svg'), {
|
|
89
|
+
'fill': css.color.secondaryBtn
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Check a box to verify selected CSS
|
|
93
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInPreviewTab(1);
|
|
94
|
+
utilities.verifyCSS(utilities.getNthElement(multipleSelectionPage.optionsCheckboxWrapperPreviewTab(), 1), {
|
|
95
|
+
'background-color': css.color.defaultBackground,
|
|
96
|
+
'color': css.color.activeButtons,
|
|
97
|
+
'border': `2px solid ${css.color.activeComponentBorder}`
|
|
98
|
+
});
|
|
99
|
+
utilities.verifyCSS(utilities.getNthElement(multipleSelectionPage.optionsText(), 1).find('.question-text-wrapper'), {
|
|
100
|
+
'color': css.color.optionsSelectedText,
|
|
101
|
+
'font-size': css.fontSize.default,
|
|
102
|
+
'font-weight': css.fontWeight.regular
|
|
103
|
+
});
|
|
104
|
+
multipleSelectionPage.optionsCheckbox()
|
|
105
|
+
.eq(1)
|
|
106
|
+
.parent()
|
|
107
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('Accessibility of Multiple Selection question', { tags: 'a11y' }, () => {
|
|
111
|
+
cy.checkAccessibility(multipleSelectionPage.questionInstructionsText().parents('[class*="ContentWrapper"]'));
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Live Student View specific functionality tests - use common base tests
|
|
115
|
+
liveStudentViewPage.tests.verifyLiveStudentViewInterface();
|
|
116
|
+
|
|
117
|
+
// Multiple Selection specific Live Student View interactions - test on current page first
|
|
118
|
+
liveStudentViewPage.tests.verifyMultipleSelectionLiveStudentViewInteractions();
|
|
119
|
+
|
|
120
|
+
// Then navigate to multiple session page and test those controls
|
|
121
|
+
liveStudentViewPage.tests.verifyMultipleSessionLiveStudentView();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
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.visit(`/item-engine/demo/live-student-view/${encodedId}`);
|
|
37
|
+
cy.wait(2000); // Wait for page to load
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
navigateToMultipleSessionLiveStudentView: () => {
|
|
41
|
+
cy.visit('/item-engine/multiple-session/live-student-view');
|
|
42
|
+
cy.wait(2000); // Wait for page to load
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
navigateToMultipleSessionWithItem: (itemReferenceID = null) => {
|
|
46
|
+
if (itemReferenceID) {
|
|
47
|
+
const encodedId = utilities.base64Encoding(itemReferenceID);
|
|
48
|
+
cy.visit(`/item-engine/multiple-session/live-student-view/${encodedId}`);
|
|
49
|
+
} else {
|
|
50
|
+
liveStudentViewBase.steps.navigateToMultipleSessionLiveStudentView();
|
|
51
|
+
}
|
|
52
|
+
cy.wait(2000); // Wait for page to load
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Common verification methods - works for all question types
|
|
57
|
+
*/
|
|
58
|
+
verifyBothStudentContainersExist: () => {
|
|
59
|
+
liveStudentViewBase.student1Container().should('exist').should('be.visible');
|
|
60
|
+
liveStudentViewBase.student2Container().should('exist').should('be.visible');
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
verifyStudentHeaders: () => {
|
|
64
|
+
liveStudentViewBase.student1Header().should('be.visible');
|
|
65
|
+
liveStudentViewBase.student2Header().should('be.visible');
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Multiple Session Live Student View methods - common to all question types
|
|
70
|
+
*/
|
|
71
|
+
verifyMultipleSessionPageTitle: () => {
|
|
72
|
+
liveStudentViewBase.pageTitle().should('contain.text', 'Multiple Session Grading View');
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
checkEnableLiveClassCheckbox: () => {
|
|
76
|
+
liveStudentViewBase.enableLiveClassCheckboxInput().then(($checkbox) => {
|
|
77
|
+
if (!$checkbox.is(':checked')) {
|
|
78
|
+
liveStudentViewBase.enableLiveClassCheckbox().click();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
verifyEnableLiveClassCheckboxIsChecked: () => {
|
|
84
|
+
liveStudentViewBase.enableLiveClassCheckboxInput().should('be.checked');
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
verifyEnableLiveClassCheckboxIsUnchecked: () => {
|
|
88
|
+
liveStudentViewBase.enableLiveClassCheckboxInput().should('not.be.checked');
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
clickGetStudentViewSessionDataButton: () => {
|
|
92
|
+
liveStudentViewBase.getStudentViewSessionDataButton().should('be.visible').click();
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
clickRefreshUserResponsesButton: () => {
|
|
96
|
+
liveStudentViewBase.refreshUserResponsesButton().should('be.visible').click();
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
clickLaunchGradingButton: () => {
|
|
100
|
+
liveStudentViewBase.launchGradingButton().should('be.visible').click();
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
clickResetFieldsButton: () => {
|
|
104
|
+
liveStudentViewBase.resetFieldsButton().should('be.visible').click();
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Common tests that work for all question types
|
|
110
|
+
*/
|
|
111
|
+
const tests = {
|
|
112
|
+
/**
|
|
113
|
+
* Verifies Live Student View interface - common to all question types
|
|
114
|
+
*/
|
|
115
|
+
verifyLiveStudentViewInterface: () => {
|
|
116
|
+
it('Both student containers should exist and be visible', () => {
|
|
117
|
+
liveStudentViewBase.steps.verifyBothStudentContainersExist();
|
|
118
|
+
liveStudentViewBase.steps.verifyStudentHeaders();
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Verifies Multiple Session Live Student View functionality - common to all question types
|
|
124
|
+
*/
|
|
125
|
+
verifyMultipleSessionLiveStudentView: () => {
|
|
126
|
+
it('Navigate to Multiple Session Live Student View and interact with Live Class controls', () => {
|
|
127
|
+
liveStudentViewBase.steps.navigateToMultipleSessionLiveStudentView();
|
|
128
|
+
liveStudentViewBase.steps.verifyMultipleSessionPageTitle();
|
|
129
|
+
liveStudentViewBase.steps.checkEnableLiveClassCheckbox();
|
|
130
|
+
liveStudentViewBase.steps.verifyEnableLiveClassCheckboxIsChecked();
|
|
131
|
+
liveStudentViewBase.steps.clickGetStudentViewSessionDataButton();
|
|
132
|
+
liveStudentViewBase.steps.clickLaunchGradingButton();
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Common accessibility test for Live Student View - works with any question type
|
|
138
|
+
*/
|
|
139
|
+
verifyLiveStudentViewAccessibility: () => {
|
|
140
|
+
it('Accessibility of Live Student View containers', { tags: 'a11y' }, () => {
|
|
141
|
+
cy.checkAccessibility(liveStudentViewBase.studentsWrapper());
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Common navigation test - works with any question type
|
|
147
|
+
*/
|
|
148
|
+
verifyLiveStudentViewNavigation: (itemReferenceID) => {
|
|
149
|
+
it('Should successfully navigate to Live Student View', () => {
|
|
150
|
+
liveStudentViewBase.steps.navigateToLiveStudentView(itemReferenceID);
|
|
151
|
+
liveStudentViewBase.steps.verifyBothStudentContainersExist();
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Helper function to get student-specific selectors for any question type
|
|
158
|
+
* @param {number} studentNum - Student number (1 or 2)
|
|
159
|
+
* @param {string} selector - The selector string to find within student container
|
|
160
|
+
* @returns {Cypress.Chainable} - Cypress element within specific student container
|
|
161
|
+
*/
|
|
162
|
+
const getStudentSpecificElement = (studentNum, selector) => {
|
|
163
|
+
const container = studentNum === 1 ? liveStudentViewBase.student1Container() : liveStudentViewBase.student2Container();
|
|
164
|
+
return container.find(selector);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Helper function to perform actions within a specific student container
|
|
169
|
+
* @param {number} studentNum - Student number (1 or 2)
|
|
170
|
+
* @param {function} callback - Callback function to execute within student container
|
|
171
|
+
*/
|
|
172
|
+
const withinStudentContainer = (studentNum, callback) => {
|
|
173
|
+
const container = studentNum === 1 ? liveStudentViewBase.student1Container() : liveStudentViewBase.student2Container();
|
|
174
|
+
container.within(callback);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const liveStudentViewBase = {
|
|
178
|
+
...selectors,
|
|
179
|
+
steps,
|
|
180
|
+
tests,
|
|
181
|
+
getStudentSpecificElement,
|
|
182
|
+
withinStudentContainer
|
|
183
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
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 liveStudentViewBase.student1Container().find('[data-testid="question-instruction-element"]');
|
|
16
|
+
} else if (studentNum === 2) {
|
|
17
|
+
return liveStudentViewBase.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 liveStudentViewBase.student1Container().find('[data-ngie-testid="response-option-checkbox"]');
|
|
26
|
+
} else if (studentNum === 2) {
|
|
27
|
+
return liveStudentViewBase.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 liveStudentViewBase.student1Container().find('[data-ngie-testid="response-option-checkbox"] [type="checkbox"]');
|
|
35
|
+
} else if (studentNum === 2) {
|
|
36
|
+
return liveStudentViewBase.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
|
+
liveStudentViewBase.withinStudentContainer(studentNum, () => {
|
|
62
|
+
// Use multipleSelectionPage method for consistent checkbox clicking
|
|
63
|
+
multipleSelectionPage.optionsCheckboxWrapperPreviewTab().eq(optionIndex).click();
|
|
64
|
+
});
|
|
65
|
+
cy.wait(2000); // Wait for API response
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
selectMultipleOptionsForStudent: function(studentNum, optionIndexes) {
|
|
69
|
+
optionIndexes.forEach(optionIndex => {
|
|
70
|
+
this.selectOptionForStudent(studentNum, optionIndex);
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// Multiple Selection specific verification methods
|
|
75
|
+
verifyOptionCheckedForStudent: (studentNum, optionIndex) => {
|
|
76
|
+
liveStudentViewBase.withinStudentContainer(studentNum, () => {
|
|
77
|
+
// Use multipleSelectionPage method for consistent checkbox verification
|
|
78
|
+
multipleSelectionPage.optionsCheckboxPreviewTab().eq(optionIndex).should('be.checked');
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
verifyOptionUncheckedForStudent: (studentNum, optionIndex) => {
|
|
83
|
+
liveStudentViewBase.withinStudentContainer(studentNum, () => {
|
|
84
|
+
// Use multipleSelectionPage method for consistent checkbox verification
|
|
85
|
+
multipleSelectionPage.optionsCheckboxPreviewTab().eq(optionIndex).should('not.be.checked');
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
verifyStudentSelections: function(studentNum, checkedOptions = [], uncheckedOptions = []) {
|
|
90
|
+
// Verify checked options
|
|
91
|
+
checkedOptions.forEach(optionIndex => {
|
|
92
|
+
this.verifyOptionCheckedForStudent(studentNum, optionIndex);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Verify unchecked options
|
|
96
|
+
uncheckedOptions.forEach(optionIndex => {
|
|
97
|
+
this.verifyOptionUncheckedForStudent(studentNum, optionIndex);
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// Method to use multipleSelectionPage's existing unchecked state verification
|
|
102
|
+
verifyAllOptionsUncheckedInitially: () => {
|
|
103
|
+
// Use multipleSelectionPage method for initial unchecked state verification
|
|
104
|
+
for (let index = 0; index < 4; index++) {
|
|
105
|
+
multipleSelectionPage.steps.verifyOptionsCheckboxInPreviewTabUncheckedState(index);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
// Method to use multipleSelectionPage's checkbox clicking
|
|
110
|
+
clickOptionUsingMultipleSelectionMethod: (optionIndex) => {
|
|
111
|
+
multipleSelectionPage.steps.checkOptionsCheckboxInPreviewTab(optionIndex);
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
// Content verification methods - reusing multipleSelectionPage methods
|
|
115
|
+
verifyQuestionInstructionsVisible: (expectedText, studentNum = null) => {
|
|
116
|
+
if (studentNum) {
|
|
117
|
+
const questionElement = selectors.questionInstructions(studentNum);
|
|
118
|
+
questionElement.should('be.visible');
|
|
119
|
+
if (expectedText) {
|
|
120
|
+
questionElement.should('contain.text', expectedText);
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
// Use multipleSelectionPage method for question instructions verification
|
|
124
|
+
utilities.verifyInnerText(multipleSelectionPage.questionInstructionsText(), expectedText);
|
|
125
|
+
utilities.verifyElementVisibilityState(multipleSelectionPage.questionInstructionsText(), 'visible');
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// Content verification methods - using multipleSelectionPage methods
|
|
130
|
+
verifyImageOptionVisible: (studentNum, optionIndex = 0) => {
|
|
131
|
+
if (studentNum) {
|
|
132
|
+
selectors.imageOption(studentNum, optionIndex).should('exist').should('be.visible');
|
|
133
|
+
} else {
|
|
134
|
+
// Use multipleSelectionPage method
|
|
135
|
+
multipleSelectionPage.steps.verifyImageInPreviewTab(optionIndex);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
verifyBoldTextOptionVisible: (studentNum, optionIndex = 1, expectedText = null) => {
|
|
140
|
+
if (studentNum) {
|
|
141
|
+
const boldElement = selectors.boldTextOption(studentNum, optionIndex);
|
|
142
|
+
boldElement.should('exist').should('be.visible');
|
|
143
|
+
if (expectedText) {
|
|
144
|
+
boldElement.should('contain.text', expectedText);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
// Use multipleSelectionPage method
|
|
148
|
+
multipleSelectionPage.steps.verifyBoldTextInPreviewTab(optionIndex);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
verifyEquationOptionVisible: (studentNum, optionIndex = 2) => {
|
|
153
|
+
if (studentNum) {
|
|
154
|
+
selectors.equationOption(studentNum, optionIndex).should('exist').should('be.visible');
|
|
155
|
+
} else {
|
|
156
|
+
// Use multipleSelectionPage method
|
|
157
|
+
multipleSelectionPage.steps.verifyEquationTextInPreviewTab(optionIndex);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
// Combined test scenarios
|
|
162
|
+
testIndependentStudentInteractions: function() {
|
|
163
|
+
// Student-1 selects options 0 and 1
|
|
164
|
+
this.selectMultipleOptionsForStudent(1, [0, 1]);
|
|
165
|
+
|
|
166
|
+
// Student-2 selects options 2 and 3
|
|
167
|
+
this.selectMultipleOptionsForStudent(2, [2, 3]);
|
|
168
|
+
|
|
169
|
+
// Verify Student-1's selections
|
|
170
|
+
this.verifyStudentSelections(1, [0, 1], [2, 3]);
|
|
171
|
+
|
|
172
|
+
// Verify Student-2's selections
|
|
173
|
+
this.verifyStudentSelections(2, [2, 3], [0, 1]);
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Verifies that the image in both student containers has the correct source and alt text.
|
|
180
|
+
* @param {number} index - The index of the option in both student containers.
|
|
181
|
+
*/
|
|
182
|
+
verifyImageInBothStudentContainers: function(index) {
|
|
183
|
+
this.verifyImageOptionVisible(1, index);
|
|
184
|
+
this.verifyImageOptionVisible(2, index);
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Verifies that the bold text in both student containers is correct.
|
|
189
|
+
* @param {number} index - The index of the option in both student containers.
|
|
190
|
+
*/
|
|
191
|
+
verifyBoldTextInBothStudentContainers: function(index) {
|
|
192
|
+
this.verifyBoldTextOptionVisible(1, index);
|
|
193
|
+
this.verifyBoldTextOptionVisible(2, index);
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Verifies that the equation text in both student containers is correct.
|
|
198
|
+
* @param {number} index - The index of the option in both student containers.
|
|
199
|
+
*/
|
|
200
|
+
verifyEquationInBothStudentContainers: function(index) {
|
|
201
|
+
this.verifyEquationOptionVisible(1, index);
|
|
202
|
+
this.verifyEquationOptionVisible(2, index);
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const tests = {
|
|
208
|
+
// Import common Live Student View tests from base
|
|
209
|
+
...liveStudentViewBase.tests,
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Multiple Selection specific Live Student View tests
|
|
213
|
+
*/
|
|
214
|
+
verifyMultipleSelectionLiveStudentViewInteractions: () => {
|
|
215
|
+
it('Live Student View should allow real-time interaction with both students for Multiple Selection', () => {
|
|
216
|
+
liveStudentViewBase.steps.verifyBothStudentContainersExist();
|
|
217
|
+
liveStudentViewBase.steps.verifyStudentHeaders();
|
|
218
|
+
steps.testIndependentStudentInteractions();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export const liveStudentViewPage = {
|
|
224
|
+
...selectors,
|
|
225
|
+
steps,
|
|
226
|
+
tests
|
|
227
|
+
}
|