itemengine-cypress-automation 1.0.178 → 1.0.179

Sign up to get free protection for your applications and to get access to all the features.
@@ -161,6 +161,7 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
161
161
  throw new Error('Itemengine questions did not lazy load in time');
162
162
  };
163
163
  if (elements.length < count) {
164
+ cy.wait(500);
164
165
  iePage.questionAndResourceWrapper()
165
166
  .last()
166
167
  .scrollIntoView()
@@ -172,4 +173,4 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
172
173
  iePage.barsPreloader()
173
174
  .should('not.exist');
174
175
  cy.learnosityLoaderWait();
175
- })
176
+ });
@@ -13,6 +13,7 @@ export const lrnPage = {
13
13
  correctAnswersResponseText: () => cy.get('.lrn_correctAnswerList li'),
14
14
  backgroundCanvasImage: () => cy.get('.lrn_imagecloze_image'),
15
15
  essayResponseTextArea: () => cy.get('.lrn_texteditor_editable'),
16
+ essayResponseResponseWrapper: () => cy.get('.lrn_response_wrapper'),
16
17
  essayResponseToolbarButton: () => cy.get('[aria-label="Text controls"] button.lrn_btn'),
17
18
  essayResponseFooter: () => cy.get('.lrn-toolbar-footer'),
18
19
  essayResponseToolbarWordCountWrapper: () => cy.get('.lrn_toolbar_right'),
@@ -283,11 +284,16 @@ export const extractLrnQuestionData = {
283
284
  obj.textAreaPlaceholder = textAreaPlaceholder;
284
285
  });
285
286
  let toolbarButtons = [];
286
- lrnPage.essayResponseToolbarButton()
287
- .each(($button) => {
288
- let ariaLabel = $button[0].attributes["aria-label"].nodeValue;
289
- if (!ariaLabel) ariaLabel = $button[0].attributes["title"].nodeValue;
290
- if (ariaLabel != 'Edit table') toolbarButtons.push(ariaLabel);
287
+ lrnPage.essayResponseResponseWrapper()
288
+ .then(($element) => {
289
+ if ($element[0].innerHTML.includes('type="button"')) {
290
+ lrnPage.essayResponseToolbarButton()
291
+ .each(($button) => {
292
+ let ariaLabel = $button[0].attributes["aria-label"].nodeValue;
293
+ if (!ariaLabel) ariaLabel = $button[0].attributes["title"].nodeValue;
294
+ if (ariaLabel != 'Edit table') toolbarButtons.push(ariaLabel);
295
+ });
296
+ }
291
297
  });
292
298
  obj.toolbarButtons = toolbarButtons;
293
299
  lrnPage.essayResponseFooter()
@@ -60,6 +60,8 @@ const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
60
60
  case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponseGrading(lrnGradingDataArr, index);
61
61
  case lrnQuestionTypesENUM.uploadResponse: return cy.log('Manually Graded Question Type');
62
62
  case lrnQuestionTypesENUM.figDragAndDrop: return extractLrnQuestionData.figDragAndDropGrading(lrnGradingDataArr, index);
63
+ case lrnQuestionTypesENUM.essayResponse: return cy.log('Manually Graded Question Type');
64
+ case lrnQuestionTypesENUM.essayResponseBasic: return cy.log('Manually Graded Question Type');
63
65
  case lrnQuestionTypesENUM.contentBlocks: return cy.log('Resource and tool');
64
66
  default: throw new Error('Invalid lrn question type');
65
67
  }
@@ -76,6 +78,8 @@ const verifyIeGradingData = (questionType, questionData, index) => {
76
78
  case 'uploadResponse': return cy.log('Manually Graded Question Type');
77
79
  case 'figDragAndDrop': return verifyIeQuestionData.figDragAndDropGrading(questionData, index);
78
80
  case 'contentBlocks': return cy.log('Resource and tool');
81
+ case 'essayResponse': return cy.log('Manually Graded Question Type');
82
+ case 'essayResponseBasic': return cy.log('Manually Graded Question Type');
79
83
  default: throw new Error('Invalid ngie question type');
80
84
  }
81
85
  }
@@ -45,8 +45,11 @@ export const iePage = {
45
45
  questionInstructions = questionInstructions.replace(/00:00\n\/\n00:00\n/g, '');
46
46
  expect(questionInstructions).to.be.eq(expectedQuestionData.previewQuestionInstructions)
47
47
  });
48
- } else {
48
+ } else if (expectedQuestionData.previewQuestionInstructions === '') {
49
49
  utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), '');
50
+ } else {
51
+ singleSelectionPage.questionInstructionsText()
52
+ .should('not.exist');
50
53
  }
51
54
  }
52
55
  }
@@ -255,17 +258,22 @@ export const verifyIeQuestionData = {
255
258
  let textAreaPlaceholder = $element[0].attributes["data-cke-editorplaceholder"]?.nodeValue;
256
259
  expect(textAreaPlaceholder).to.be.eq(expectedQuestionData.textAreaPlaceholder);
257
260
  });
258
- let ieButtonsTitle = [];
259
- let ieButtonsExpected = expectedQuestionData.toolbarButtons.map((button) => {
260
- return essayResponseToolbarOptionsENUM[button];
261
- });
262
- essayResponsePage.previewTabToolbarOption()
263
- .each(($button) => {
264
- let title = $button[0].attributes["title"].nodeValue;
265
- ieButtonsTitle.push(title);
266
- }).then(() => {
267
- expect(ieButtonsTitle).to.have.deep.members(ieButtonsExpected);
261
+ if (expectedQuestionData.toolbarButtons.length !== 0) {
262
+ let ieButtonsTitle = [];
263
+ let ieButtonsExpected = expectedQuestionData.toolbarButtons.map((button) => {
264
+ return essayResponseToolbarOptionsENUM[button];
268
265
  });
266
+ essayResponsePage.previewTabToolbarOption()
267
+ .each(($button) => {
268
+ let title = $button[0].attributes["title"].nodeValue;
269
+ ieButtonsTitle.push(title);
270
+ }).then(() => {
271
+ expect(ieButtonsTitle).to.have.deep.members(ieButtonsExpected);
272
+ });
273
+ } else {
274
+ essayResponsePage.previewTabToolbarOption()
275
+ .should('not.exist');
276
+ }
269
277
  if (expectedQuestionData.hasWordLimit || expectedQuestionData.hasWordCount) {
270
278
  if (expectedQuestionData.hasWordLimit) {
271
279
  iePage.essayResponseWordLimit()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.178",
3
+ "version": "1.0.179",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {