itemengine-cypress-automation 1.0.180-essayResponseLazyLoadingFix-f323e32.0 → 1.0.180-essayResponseLazyLoadingFix-3170a00.0

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()
@@ -168,28 +169,8 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
168
169
  cy.lazyLoadPreviewQuestions(count, retries - 1)
169
170
  };
170
171
  cy.log('All question parts loaded');
171
- iePage.questionAndResourceWrapper()
172
- .each(($question, index) => {
173
- if ($question[0].innerHTML.includes('InlineLoaderstyles__LoaderDiv')) {
174
- iePage.essayResponseLoader()
175
- .parents('[class*="InlineLoaderstyles__LoaderDiv"]')
176
- .then(($element) => {
177
- const domElement = $element.get(0);
178
- const computedStyle = window.getComputedStyle(domElement);
179
- const displayPropertyValue = computedStyle.getPropertyValue('display');
180
- if (displayPropertyValue === 'block') {
181
- iePage.questionAndResourceWrapper()
182
- .eq(index)
183
- .scrollIntoView();
184
- iePage.essayResponseLoader()
185
- .should('not.be.visible');
186
- cy.log('Essay response loaders found')
187
- }
188
- });
189
- }
190
- });
191
172
  });
192
173
  iePage.barsPreloader()
193
174
  .should('not.exist');
194
175
  cy.learnosityLoaderWait();
195
- })
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()
@@ -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.180-essayResponseLazyLoadingFix-f323e32.0",
3
+ "version": "1.0.180-essayResponseLazyLoadingFix-3170a00.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {