itemengine-cypress-automation 1.0.553-IEI-7000-main-8cb7c78.0 → 1.0.554-IEI-5835-LIVE-30c8e27.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,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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.553-IEI-7000-main-8cb7c78.0",
3
+ "version": "1.0.554-IEI-5835-LIVE-30c8e27.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -214,8 +214,29 @@ export async function runSorryCypressSpinnakerSmoke() {
214
214
  startTime = process.env.START_TIME;
215
215
  ciBuildId = setCiBuildId("spinnaker", startTime);
216
216
  const envArgs = setCommandLineEnvArgs()
217
- let command = `cy2 run --parallel --browser chrome --record --key imaginelearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs} --spec "cypress/e2e/ILC/**/*.smoke.js"`;
217
+
218
+ // Define specific folders to run smoke tests from (subset of tests - approximately 60%)
219
+ const testFolders = [
220
+ "cypress/e2e/ILC/EssayResponse/**/*.smoke.js",
221
+ "cypress/e2e/ILC/MultipleSelection/**/*.smoke.js",
222
+ "cypress/e2e/ILC/DragAndDropIntoCategoriesNew/**/*.smoke.js",
223
+ "cypress/e2e/ILC/FillInTheGapsTextNew/**/*.smoke.js",
224
+ "cypress/e2e/ILC/FillInTheGapsDropdownNew/**/*.smoke.js",
225
+ "cypress/e2e/ILC/FillInTheGapsDragAndDropNew/**/*.smoke.js",
226
+ "cypress/e2e/ILC/UploadResponse/**/*.smoke.js",
227
+ "cypress/e2e/ILC/Matching/**/*.smoke.js",
228
+ "cypress/e2e/ILC/ShortTextResponseNew/**/*.smoke.js",
229
+ "cypress/e2e/ILC/ListOrderingNew/**/*.smoke.js",
230
+ "cypress/e2e/ILC/AudioResponseNew/**/*.smoke.js",
231
+ "cypress/e2e/ILC/SingleSelection/**/*.smoke.js",
232
+ "cypress/e2e/ILC/ThinkSphere/**/*.smoke.js",
233
+ "cypress/e2e/ILC/DrawingResponse/**/*.smoke.js",
234
+ "cypress/e2e/ILC/ContentBlocks/**/*.smoke.js"
235
+ ].join(",");
236
+
237
+ let command = `cy2 run --parallel --browser chrome --record --key imaginelearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs} --spec "${testFolders}"`;
218
238
  console.log(`command: ${command}`);
239
+ console.log(`Running smoke tests from selected folders (subset)`);
219
240
  const isOtkv2 = process.env.OTK_VERSION === '2';
220
241
  try {
221
242
  execSync(command, { stdio: "inherit" });