itemengine-cypress-automation 1.0.122-updateILCRepo28Feb-2c3e0e3.0 → 1.0.123

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. package/cypress/e2e/ILC/AudioResponseNew/compactRecorderStyle.smoke.js +1 -1
  2. package/cypress/e2e/ILC/DrawingResponse/drawingResponseBackground.js +1 -1
  3. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +1 -1
  4. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions1.smoke.js +4 -2
  5. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/previewContentsForAllViews.smoke.js +1 -1
  6. package/cypress/e2e/ILC/TextEntryMath/allOrNothingBasicForAllViews.smoke.js +11 -12
  7. package/cypress/e2e/ILC/TextEntryMathWithImage/previewTabContentsForAllViews.smoke.js +1 -1
  8. package/cypress/e2e/ILC/UploadResponse/previewContentsForAllViews.smoke.js +4 -3
  9. package/cypress/e2e/migration/migration.js +32 -19
  10. package/cypress/e2e/migration/migration10.js +160 -0
  11. package/cypress/e2e/migration/migration2.js +34 -19
  12. package/cypress/e2e/migration/migration3.js +34 -19
  13. package/cypress/e2e/migration/migration4.js +34 -19
  14. package/cypress/e2e/migration/migration5.js +34 -19
  15. package/cypress/e2e/migration/migration6.js +160 -0
  16. package/cypress/e2e/migration/migration7.js +160 -0
  17. package/cypress/e2e/migration/migration8.js +160 -0
  18. package/cypress/e2e/migration/migration9.js +160 -0
  19. package/cypress/fixtures/drawingToolbarOptionsAdditionalOptionsAndSpecialAndMathCharacters.js +1 -1
  20. package/cypress/pages/drawingResponsePage.js +6 -5
  21. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +1 -1
  22. package/cypress/pages/textEntryMathPage.js +15 -7
  23. package/cypress/pages/uploadResponsePage.js +10 -1
  24. package/cypress/support/migrationHelpers/essayResponseToolbarOptionsENUM.js +30 -0
  25. package/cypress/support/migrationHelpers/extractLrnQuestionData.js +24 -2
  26. package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +1 -1
  27. package/cypress/support/migrationHelpers/verifyIeQuestionData.js +21 -5
  28. package/deploy/migration/deploy.yaml +2 -2
  29. package/package.json +2 -2
@@ -346,7 +346,7 @@ describe('Preview of Audio response for compact audio recorder style', () => {
346
346
  audioResponsePage.steps.startPlaybackCompactPreview();
347
347
  audioResponsePage.steps.waitForPlaybackToBeginCompactPreview();
348
348
  audioResponsePage.steps.verifyPlaybackTimeCompactPreview('00:05', '00:10');
349
- audioResponsePage.steps.pauseAndVerifyProgressBarSliderPosition();
349
+ audioResponsePage.steps.pauseAndVerifyProgressBarSliderPositionCompactPreview();
350
350
  audioResponsePage.steps.verifyPlaybackTimeCompactPreview('00:05', '00:10');
351
351
  utilities.verifyElementVisibilityState(audioResponsePage.compactPreviewPlayPlaybackButton(), 'visible');
352
352
  utilities.verifyElementVisibilityState(audioResponsePage.compactPreviewPausePlaybackButton(), 'notExist');
@@ -3,7 +3,7 @@ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
 
5
5
  const css = Cypress.env('css');
6
- const defaultToolbarAndControlOptions = ['Select', 'Scribble', 'Line', 'Curved line', 'Capture image', 'Insert image', 'Text', 'Point eraser', 'Bring to front', 'Sent to back', 'Duplicate', 'Undo', 'Redo', 'Full screen', 'Clear all'];
6
+ const defaultToolbarAndControlOptions = ['Select', 'Scribble', 'Line', 'Curved line', 'Capture image', 'Insert image', 'Text', 'Point eraser', 'Bring to front', 'Send to back', 'Duplicate', 'Undo', 'Redo', 'Full screen', 'Clear all'];
7
7
  const patterns = ['Grid', 'Lines', 'Dots', 'Circular', 'Graph', 'Quadrant'];
8
8
  const orientationOptions = ['Portrait', 'Landscape', 'Square'];
9
9
  const imageAlternativeText = ['Grid pattern of evenly spaced horizontal and vertical lines', 'Line pattern of evenly spaced horizontal lines', 'Dot pattern of evenly spaced horizontal and vertical dots', 'Circular pattern of evenly spaced concentric circles', 'Graph pattern of evenly spaced horizontal and vertical lines', 'Quadrant pattern of evenly spaced horizontal and vertical lines'];
@@ -6,7 +6,7 @@ let gradingAndCorrectAnsView = ['Grading view', 'Correct answer view']
6
6
  const views = utilities.getViews(gradingAndCorrectAnsView);
7
7
  var itemReferenceID = "";
8
8
 
9
- const defaultToolbarAndControlOptions = ['Select', 'Scribble', 'Line', 'Curved line', 'Capture image', 'Insert image', 'Text', 'Point eraser', 'Bring to front', 'Sent to back', 'Duplicate', 'Undo', 'Redo', 'Full screen', 'Clear all'];
9
+ const defaultToolbarAndControlOptions = ['Select', 'Scribble', 'Line', 'Curved line', 'Capture image', 'Insert image', 'Text', 'Point eraser', 'Bring to front', 'Send to back', 'Duplicate', 'Undo', 'Redo', 'Full screen', 'Clear all'];
10
10
 
11
11
  describe('Create item page - Drawing response: Grading view, Correct answer view contents', () => {
12
12
  before(() => {
@@ -7,8 +7,10 @@ const grepTags = Cypress.env('grepTags');
7
7
 
8
8
  const formattingOptions = ['Bold', 'Italic', 'Underline', 'Bulleted List', 'Numbered List', 'Insert Table', 'Increase Indent', 'Decrease Indent', 'Equation Editor', 'Insert Image', 'Strikethrough', 'Subscript', 'Superscript', 'Special Characters', 'Math Characters', 'Insert Hyperlink', 'Block Quote', 'Remove Format', 'Code Inline', 'Code Editor', 'Align Left', 'Align Center', 'Align Right', 'Align Justify', 'Text direction left to right', 'Text direction right to left', 'Insert Horizontal Line', 'Font size', 'Font Color', 'Highlight Text'];
9
9
  const defaultSelectedFormattingOptions = ['Bold', 'Italic', 'Underline', 'Bulleted List', 'Numbered List', 'Insert Table', 'Increase Indent', 'Decrease Indent'];
10
+ const unselectedOptions = formattingOptions.filter(option => !defaultSelectedFormattingOptions.includes(option));
10
11
  const defaultFormattingOptionsPreviewTab = ['Bold (Ctrl+B)', 'Italic (Ctrl+I)', 'Underline (Ctrl+U)', 'Insert/Remove Bulleted List', 'Insert/Remove Numbered List', 'Insert Table', 'Increase Indent', 'Decrease Indent'];
11
12
  const formattingOptionsPreviewTab = ['Bold (Ctrl+B)', 'Italic (Ctrl+I)', 'Underline (Ctrl+U)', 'Insert/Remove Bulleted List', 'Insert/Remove Numbered List', 'Insert Table', 'Increase Indent', 'Decrease Indent', 'Equation Editor', 'Insert Image', 'Strikethrough', 'Subscript', 'Superscript', 'Special characters', 'Math characters', 'Insert Hyperlink', 'Block Quote', 'Remove Format', 'Code Inline', 'Code Editor', 'Align Left', 'Align Center', 'Align Right', 'Align Justify', 'Text direction left to right', 'Text direction right to left', 'Insert Horizontal Line', 'Font Size', 'Text Color', 'Highlight Text', 'Undo (Ctrl+Z)', 'Redo (Ctrl+Y)'];
13
+ const unselectedOptionsPreviewTab = formattingOptionsPreviewTab.filter(option => !defaultFormattingOptionsPreviewTab.includes(option));
12
14
 
13
15
  describe('Create question page - Essay Response: Customize formatting options (for student player) accordion contents, toolbar options', () => {
14
16
  before(() => {
@@ -84,7 +86,7 @@ describe('Create question page - Essay Response: Customize formatting options (f
84
86
  defaultSelectedFormattingOptions.forEach((option) => {
85
87
  essayResponsePage.steps.verifyCustomizeFormattingOptionIsSelected(option);
86
88
  });
87
- formattingOptions.splice(8, formattingOptions.length).forEach((option) => {
89
+ unselectedOptions.forEach((option) => {
88
90
  essayResponsePage.steps.verifyCustomizeFormattingOptionNotSelected(option);
89
91
  });
90
92
  });
@@ -125,7 +127,7 @@ describe('Create question page - Essay Response: Customize formatting options (f
125
127
  it('When the user selects all formatting options from the \'Customize formatting options\' accordion, all formatting options should appear in the preview tab', () => {
126
128
  essayResponsePage.steps.switchToEditTab();
127
129
  essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
128
- essayResponsePage.steps.selectCustomizedFormattingOption(formattingOptions.splice(8, formattingOptions.length));
130
+ essayResponsePage.steps.selectCustomizedFormattingOption(unselectedOptions);
129
131
  formattingOptions.forEach((option) => {
130
132
  essayResponsePage.steps.verifyCustomizeFormattingOptionIsSelected(option);
131
133
  });
@@ -88,7 +88,7 @@ describe('Preview tab contents for all views', () => {
88
88
  });
89
89
 
90
90
  it('The image uploaded in the \'Background image\' section should be displayed', () => {
91
- utilities.verifyElementVisibilityState(fillInTheGapsOverImageDragAndDropPage.canvasImage(), 'visible');
91
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDragAndDropPage.canvasImage(), 'exist');
92
92
  });
93
93
 
94
94
  if (view !== 'Grading view' && view !== 'Correct answer view') {
@@ -29,7 +29,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
29
29
  it('When the user sets correct answer responses and allots points, then the alloted points should be displayed in the preview tab', () => {
30
30
  textEntryMathPage.steps.switchToEditTab();
31
31
  textEntryMathPage.steps.expandResponseAccordionSpecifyCorrectAnswer(0);
32
- textEntryMathPage.steps.addInputToResponseAnswerInputFieldSpecifyCorrectAnswer(0, 'Correct answer 1');
32
+ textEntryMathPage.steps.addInputToResponseAnswerInputFieldSpecifyCorrectAnswer(0, 'Correctanswer1');
33
33
  textEntryMathPage.steps.expandResponseAccordionSpecifyCorrectAnswer(1);
34
34
  textEntryMathPage.steps.focusInResponseAnswerInputFieldSpecifyCorrectAnswerSection(1);
35
35
  textEntryMathPage.steps.selectEquationEditorOptionFromCKEditorToolbar();
@@ -41,7 +41,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
41
41
 
42
42
  it('When the user attempts question in preview tab and switches to edit tab, then on re-switching to the preview tab, users response should not persist', () => {
43
43
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(0);
44
- equationEditorFlyout.steps.enterTextInPreviewInputField(0, 'Correct answer 1');
44
+ equationEditorFlyout.steps.enterTextInPreviewInputField(0, 'Correctanswer1');
45
45
  equationEditorFlyout.steps.clickOnOkButton();
46
46
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(1);
47
47
  equationEditorFlyout.steps.enterQuadraticEquation();
@@ -66,7 +66,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
66
66
  textEntryMathPage.steps.addResponseToken();
67
67
  textEntryMathPage.steps.addResponseToken();
68
68
  textEntryMathPage.steps.expandResponseAccordionSpecifyCorrectAnswer(0);
69
- textEntryMathPage.steps.addInputToResponseAnswerInputFieldSpecifyCorrectAnswer(0, 'Correct answer 1');
69
+ textEntryMathPage.steps.addInputToResponseAnswerInputFieldSpecifyCorrectAnswer(0, 'Correctanswer1');
70
70
  textEntryMathPage.steps.expandResponseAccordionSpecifyCorrectAnswer(1);
71
71
  textEntryMathPage.steps.focusInResponseAnswerInputFieldSpecifyCorrectAnswerSection(1);
72
72
  textEntryMathPage.steps.selectEquationEditorOptionFromCKEditorToolbar();
@@ -123,9 +123,8 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
123
123
  textEntryMathPage.steps.switchToGradingView();
124
124
  textEntryMathPage.steps.verifyPreviewScore(0, 20);
125
125
  }
126
- utilities.verifyElementVisibilityState(textEntryMathPage.tickIcon(), 'notExist');
127
126
  textEntryMathPage.steps.verifyResponseFieldNumerationPreviewTab();
128
- textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correct answer 1', '2x2y2+4xy+4', '6×π']);
127
+ textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correctanswer1', '2x2y2+4xy+4', '6×π']);
129
128
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(1, '2 x squared y squared plus 4 x y plus 4');
130
129
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(2, '6 times pi');
131
130
  textEntryMathPage.steps.verifyCorrectIncorrectIconNotExist(0);
@@ -158,7 +157,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
158
157
  textEntryMathPage.steps.verifyIncorrectResponseIcon(1);
159
158
  textEntryMathPage.steps.verifyIncorrectResponseIcon(2);
160
159
  textEntryMathPage.steps.verifyResponseFieldNumerationPreviewTab();
161
- textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correct answer 1', '2x2y2+4xy+4', '6×π']);
160
+ textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correctanswer1', '2x2y2+4xy+4', '6×π']);
162
161
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(1, '2 x squared y squared plus 4 x y plus 4');
163
162
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(2, '6 times pi');
164
163
  textEntryMathPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
@@ -169,7 +168,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
169
168
  studentViewPage.steps.clearResponses();
170
169
  }
171
170
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(0);
172
- equationEditorFlyout.steps.enterTextInPreviewInputField('Correct answer 1');
171
+ equationEditorFlyout.steps.enterTextInPreviewInputField('Correctanswer1');
173
172
  equationEditorFlyout.steps.clickOnOkButton();
174
173
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(1);
175
174
  equationEditorFlyout.steps.enterQuadraticEquation();
@@ -190,7 +189,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
190
189
  textEntryMathPage.steps.verifyCorrectResponseIcon(1);
191
190
  textEntryMathPage.steps.verifyIncorrectResponseIcon(2);
192
191
  textEntryMathPage.steps.verifyResponseFieldNumerationPreviewTab();
193
- textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correct answer 1', '2x2y2+4xy+4', '6×π']);
192
+ textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correctanswer1', '2x2y2+4xy+4', '6×π']);
194
193
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(1, '2 x squared y squared plus 4 x y plus 4');
195
194
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(2, '6 times pi');
196
195
  textEntryMathPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
@@ -201,7 +200,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
201
200
  studentViewPage.steps.clearResponses();
202
201
  }
203
202
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(0);
204
- equationEditorFlyout.steps.enterTextInPreviewInputField('Correct answer 1');
203
+ equationEditorFlyout.steps.enterTextInPreviewInputField('Correctanswer1');
205
204
  equationEditorFlyout.steps.clickOnOkButton();
206
205
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(1);
207
206
  equationEditorFlyout.steps.enterQuadraticEquation();
@@ -219,7 +218,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
219
218
  textEntryMathPage.steps.verifyCorrectResponseIcon(1);
220
219
  textEntryMathPage.steps.verifyCorrectIncorrectIconNotExist(2);
221
220
  textEntryMathPage.steps.verifyResponseFieldNumerationPreviewTab();
222
- textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correct answer 1', '2x2y2+4xy+4', '6×π']);
221
+ textEntryMathPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Correctanswer1', '2x2y2+4xy+4', '6×π']);
223
222
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(1, '2 x squared y squared plus 4 x y plus 4');
224
223
  textEntryMathPage.steps.verifyCorrectAnswerResponsesAriaLabel(2, '6 times pi');
225
224
  textEntryMathPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
@@ -230,7 +229,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
230
229
  studentViewPage.steps.clearResponses();
231
230
  }
232
231
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(0);
233
- equationEditorFlyout.steps.enterTextInPreviewInputField('Correct answer 1');
232
+ equationEditorFlyout.steps.enterTextInPreviewInputField('Correctanswer1');
234
233
  equationEditorFlyout.steps.clickOnOkButton();
235
234
  textEntryMathPage.steps.focusInResponseAnswerInputFieldPreviewTab(1);
236
235
  equationEditorFlyout.steps.enterQuadraticEquation();
@@ -266,7 +265,7 @@ describe('Create Item page - Text entry math: All or nothing ', () => {
266
265
  textEntryMathPage.steps.addResponseToken();
267
266
  textEntryMathPage.steps.addResponseToken();
268
267
  textEntryMathPage.steps.expandResponseAccordionSpecifyCorrectAnswer(0);
269
- textEntryMathPage.steps.addInputToResponseAnswerInputFieldSpecifyCorrectAnswer(0, 'Correct answer 1');
268
+ textEntryMathPage.steps.addInputToResponseAnswerInputFieldSpecifyCorrectAnswer(0, 'Correctanswer1');
270
269
  textEntryMathPage.steps.expandResponseAccordionSpecifyCorrectAnswer(1);
271
270
  textEntryMathPage.steps.focusInResponseAnswerInputFieldSpecifyCorrectAnswerSection(1);
272
271
  textEntryMathPage.steps.selectEquationEditorOptionFromCKEditorToolbar();
@@ -80,7 +80,7 @@ describe('Create item page - Text entry math: Preview contents', () => {
80
80
  });
81
81
 
82
82
  it('The image uploaded in the \'Background image\' section should be displayed', () => {
83
- utilities.verifyElementVisibilityState(textEntryMathWithImagePage.canvasImage(), 'visible');
83
+ utilities.verifyElementVisibilityState(textEntryMathWithImagePage.canvasImage(), 'exist');
84
84
  });
85
85
 
86
86
  if (view !== 'Grading view' && view !== 'Correct answer view') {
@@ -70,8 +70,8 @@ describe('Create item page - Upload response : Preview contents', () => {
70
70
 
71
71
  it('When user uploads multiple files, then uploaded files should be visible in the uploaded file section and file limit should be updated accordingly', () => {
72
72
  uploadResponsePage.steps.uploadFile(['uploads/sample.pdf', 'uploads/sample.jpg']);
73
- uploadResponsePage.steps.uploadedFileContentsPreviewTab(0, 'sample.pdf');
74
- uploadResponsePage.steps.uploadedFileContentsPreviewTab(1, 'sample.jpg');
73
+ uploadResponsePage.steps.verifyUploadedFileNameVisible('sample.pdf');
74
+ uploadResponsePage.steps.verifyUploadedFileNameVisible('sample.jpg');
75
75
  uploadResponsePage.steps.verifyUploadedFileLimitCount(2, 3);
76
76
  utilities.verifyElementCount(uploadResponsePage.fileName(), 2);
77
77
  });
@@ -132,6 +132,7 @@ describe('Create item page - Upload response : Preview contents', () => {
132
132
  cy.checkAccessibility(uploadResponsePage.questionWrapperPreviewTab());
133
133
  });
134
134
 
135
+ //Failed due to https://redmine.zeuslearning.com/issues/563182
135
136
  it('When user uploads file type which is not selected from the \'Supported file types\' accordion menu, then file upload error message - \'The file type is not supported. Please upload files with the following supported formats: *file format separated by commas*\' should be displayed', () => {
136
137
  uploadResponsePage.steps.uploadFile('uploads/sample.heif');
137
138
  uploadResponsePage.steps.verifyWarningMessage('The file type is not supported. Please upload files with the following supported formats: CSV, Excel, GIF, JPG, Open Office, PDF, PNG, Powerpoint, Publisher, RTF, TXT, Word, XPS, ZIP.');
@@ -145,7 +146,7 @@ describe('Create item page - Upload response : Preview contents', () => {
145
146
 
146
147
  if (view != 'Question preview') {
147
148
  it('On clicking on the file name, user should be able to download the file', () => {
148
- cy.verifyUploadFilePreviewDownload('sample.pdf');
149
+ cy.verifyUploadFilePreviewDownload('sample.jpg');
149
150
  cy.log('Added wait here to pause till the file download is complete');
150
151
  cy.wait(5000);
151
152
  });
@@ -18,7 +18,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
18
  iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
- throw new Error('Element did not load in time')
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
22
  };
23
23
  if (elements.length < count) {
24
24
  iePage.questionWrapper()
@@ -27,21 +27,23 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
27
27
  .wait(1000);
28
28
  cy.lazyLoadPreviewQuestions(count, retries - 1)
29
29
  };
30
- cy.log('All question parts loaded')
30
+ cy.log('All question parts loaded');
31
31
  });
32
32
  iePage.barsPreloader()
33
33
  .should('not.exist');
34
34
  cy.learnosityLoaderWait();
35
35
  })
36
36
 
37
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["textEntryMathImage"]
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
39
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
40
42
 
41
43
  let lrnQuestionDataArr = [];
42
44
  let lrnGradingDataArr = [];
43
45
 
44
- let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 100);//["d526a378-de9e-4086-90ba-405057c48c3d", "9ee38abc-9c1c-4c10-9467-85f5823b7b17", "6521f6a7-4a9f-441f-8fc6-314ba7bf2386"]
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 100);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
45
47
 
46
48
  if (referenceIds.length > 0) {
47
49
  describe('Migration item check for MCQ questions', () => {
@@ -74,13 +76,18 @@ if (referenceIds.length > 0) {
74
76
  .each(($el, index) => {
75
77
  let currQuestionType = $el[0].innerText
76
78
  if (lrnMcqTypesRegex.test(currQuestionType)) {
77
- currQuestionType = lrnQuestionTypesENUM.mcq
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
78
84
  }
79
85
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
86
  switch (currQuestionType) {
81
87
  case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
88
  case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
83
89
  case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
84
91
  default: throw new Error('Invalid lrn question type');
85
92
  }
86
93
  }
@@ -97,6 +104,7 @@ if (referenceIds.length > 0) {
97
104
  case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
98
105
  case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
99
106
  case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
100
108
  default: throw new Error('Invalid ngie question type');
101
109
  }
102
110
  });
@@ -104,20 +112,25 @@ if (referenceIds.length > 0) {
104
112
  });
105
113
 
106
114
  it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
107
- lrnPage.steps.checkShowAnswersToggle();
108
- lrnPage.questionTypeDiv()
109
- .each(($el, index) => {
110
- let currQuestionType = $el[0].innerText
111
- if (lrnMcqTypesRegex.test(currQuestionType)) {
112
- currQuestionType = lrnQuestionTypesENUM.mcq
113
- }
114
- if (migrationQuestionTypesLrn.includes(currQuestionType)) {
115
- switch (currQuestionType) {
116
- case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
118
- case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
119
- default: throw new Error('Invalid lrn question type');
120
- }
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
121
134
  }
122
135
  });
123
136
  });
@@ -0,0 +1,160 @@
1
+ import { autoScoredScoringPreviewTab } from "../../pages/components";
2
+ import utilities from "../../support/helpers/utilities";
3
+ import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
4
+ import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
5
+ import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
+
7
+ Cypress.Commands.add('learnosityLoaderWait', () => {
8
+ // cy.get('.lrn-spinner')
9
+ // .should('be.visible');
10
+ lrnPage.questionsLoader()
11
+ .should('not.be.visible');
12
+ lrnPage.questionWrapper()
13
+ .eq(0)
14
+ .should('be.visible');
15
+ });
16
+
17
+ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
+ iePage.questionWrapper()
19
+ .then((elements) => {
20
+ if (retries <= 0) {
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
+ };
23
+ if (elements.length < count) {
24
+ iePage.questionWrapper()
25
+ .last()
26
+ .scrollIntoView()
27
+ .wait(1000);
28
+ cy.lazyLoadPreviewQuestions(count, retries - 1)
29
+ };
30
+ cy.log('All question parts loaded');
31
+ });
32
+ iePage.barsPreloader()
33
+ .should('not.exist');
34
+ cy.learnosityLoaderWait();
35
+ })
36
+
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
+ const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
+ let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
42
+
43
+ let lrnQuestionDataArr = [];
44
+ let lrnGradingDataArr = [];
45
+
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(900, 1000);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
47
+
48
+ if (referenceIds.length > 0) {
49
+ describe('Migration item check for MCQ questions', () => {
50
+ before(() => {
51
+ cy.loginAs('technicalTester');
52
+ });
53
+
54
+ referenceIds.forEach((referenceId) => {
55
+ describe(`Migration item check for item "${referenceId}"`, () => {
56
+ before(() => {
57
+ cy.interceptGraphql('getItemPreview');
58
+ cy.setGraphqlWait();
59
+ cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
60
+ cy.pageLoadWait('getItemPreview');
61
+ cy.get('@getItemPreview').then((req) => {
62
+ let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
63
+ cy.lazyLoadPreviewQuestions(questionCount);
64
+ });
65
+ });
66
+
67
+ after(() => {
68
+ console.log(lrnQuestionDataArr)
69
+ console.log(lrnGradingDataArr)
70
+ lrnQuestionDataArr = [];
71
+ lrnGradingDataArr = [];
72
+ });
73
+
74
+ it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
75
+ lrnPage.questionTypeDiv()
76
+ .each(($el, index) => {
77
+ let currQuestionType = $el[0].innerText
78
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
84
+ }
85
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
86
+ switch (currQuestionType) {
87
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
88
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
89
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
91
+ default: throw new Error('Invalid lrn question type');
92
+ }
93
+ }
94
+ });
95
+ });
96
+
97
+ it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
98
+ migrationQuestionTypes.forEach((questionType) => {
99
+ cy.log(`Verifying data for all ${questionType} question type`);
100
+ let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
101
+ currQuestionTypeArr.forEach((questionData, index) => {
102
+ cy.log(`Verifying data for ${questionType} ${index}`);
103
+ switch (questionType) {
104
+ case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
105
+ case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
106
+ case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
108
+ default: throw new Error('Invalid ngie question type');
109
+ }
110
+ });
111
+ });
112
+ });
113
+
114
+ it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
134
+ }
135
+ });
136
+ });
137
+
138
+ it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
139
+ autoScoredScoringPreviewTab.steps.switchToGradingView();
140
+ cy.wait(500);
141
+ migrationQuestionTypes.forEach((questionType) => {
142
+ cy.log(`Verifying grading data for all ${questionType} question type`);
143
+ let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
144
+ currQuestionTypeArr.forEach((questionData, index) => {
145
+ cy.log(`Verifying grading data for ${questionType} ${index}`);
146
+ switch (questionType) {
147
+ case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
148
+ case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
149
+ case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
150
+ default: throw new Error('Invalid ngie question type');
151
+ }
152
+ });
153
+ });
154
+ });
155
+ });
156
+ });
157
+ });
158
+ }
159
+
160
+ //https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
@@ -18,7 +18,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
18
18
  iePage.questionWrapper()
19
19
  .then((elements) => {
20
20
  if (retries <= 0) {
21
- throw new Error('Element did not load in time')
21
+ throw new Error('Itemengine questions did not lazy load in time');
22
22
  };
23
23
  if (elements.length < count) {
24
24
  iePage.questionWrapper()
@@ -27,21 +27,23 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
27
27
  .wait(1000);
28
28
  cy.lazyLoadPreviewQuestions(count, retries - 1)
29
29
  };
30
- cy.log('All question parts loaded')
30
+ cy.log('All question parts loaded');
31
31
  });
32
32
  iePage.barsPreloader()
33
33
  .should('not.exist');
34
34
  cy.learnosityLoaderWait();
35
35
  })
36
36
 
37
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
37
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
38
38
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
39
39
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
40
+ let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
41
+
40
42
 
41
43
  let lrnQuestionDataArr = [];
42
44
  let lrnGradingDataArr = [];
43
45
 
44
- let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(100, 200);
46
+ let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(100, 200);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
45
47
 
46
48
  if (referenceIds.length > 0) {
47
49
  describe('Migration item check for MCQ questions', () => {
@@ -74,13 +76,18 @@ if (referenceIds.length > 0) {
74
76
  .each(($el, index) => {
75
77
  let currQuestionType = $el[0].innerText
76
78
  if (lrnMcqTypesRegex.test(currQuestionType)) {
77
- currQuestionType = lrnQuestionTypesENUM.mcq
79
+ currQuestionType = lrnQuestionTypesENUM.mcq;
80
+ }
81
+ if (lrnEssayResponseRegex.test(currQuestionType)) {
82
+ ;
83
+ currQuestionType = lrnQuestionTypesENUM.essayResponse;
78
84
  }
79
85
  if (migrationQuestionTypesLrn.includes(currQuestionType)) {
80
86
  switch (currQuestionType) {
81
87
  case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
82
88
  case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
83
89
  case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
90
+ case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
84
91
  default: throw new Error('Invalid lrn question type');
85
92
  }
86
93
  }
@@ -97,6 +104,7 @@ if (referenceIds.length > 0) {
97
104
  case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
98
105
  case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
99
106
  case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
107
+ case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
100
108
  default: throw new Error('Invalid ngie question type');
101
109
  }
102
110
  });
@@ -104,20 +112,25 @@ if (referenceIds.length > 0) {
104
112
  });
105
113
 
106
114
  it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
107
- lrnPage.steps.checkShowAnswersToggle();
108
- lrnPage.questionTypeDiv()
109
- .each(($el, index) => {
110
- let currQuestionType = $el[0].innerText
111
- if (lrnMcqTypesRegex.test(currQuestionType)) {
112
- currQuestionType = lrnQuestionTypesENUM.mcq
113
- }
114
- if (migrationQuestionTypesLrn.includes(currQuestionType)) {
115
- switch (currQuestionType) {
116
- case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
117
- case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
118
- case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
119
- default: throw new Error('Invalid lrn question type');
120
- }
115
+ lrnPage.authorItemToolbarControlsWrapper()
116
+ .then(($element) => {
117
+ if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
118
+ lrnPage.steps.checkShowAnswersToggle();
119
+ lrnPage.questionTypeDiv()
120
+ .each(($el, index) => {
121
+ let currQuestionType = $el[0].innerText
122
+ if (lrnMcqTypesRegex.test(currQuestionType)) {
123
+ currQuestionType = lrnQuestionTypesENUM.mcq
124
+ }
125
+ if (migrationQuestionTypesLrn.includes(currQuestionType)) {
126
+ switch (currQuestionType) {
127
+ case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
128
+ case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
129
+ case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
130
+ default: throw new Error('Invalid lrn question type');
131
+ }
132
+ }
133
+ });
121
134
  }
122
135
  });
123
136
  });
@@ -143,3 +156,5 @@ if (referenceIds.length > 0) {
143
156
  });
144
157
  });
145
158
  }
159
+
160
+ //https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json