itemengine-cypress-automation 1.0.180-essayResponseLazyLoadingFix-f323e32.0 → 1.0.180-essayResponseLazyLoadingFix-63cd8a3.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
+ });
@@ -283,11 +283,16 @@ export const extractLrnQuestionData = {
283
283
  obj.textAreaPlaceholder = textAreaPlaceholder;
284
284
  });
285
285
  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);
286
+ lrnPage.essayResponseTextArea()
287
+ .then(($element) => {
288
+ if ($element[0].innerHTML.includes('type="button"')) {
289
+ lrnPage.essayResponseToolbarButton()
290
+ .each(($button) => {
291
+ let ariaLabel = $button[0].attributes["aria-label"].nodeValue;
292
+ if (!ariaLabel) ariaLabel = $button[0].attributes["title"].nodeValue;
293
+ if (ariaLabel != 'Edit table') toolbarButtons.push(ariaLabel);
294
+ });
295
+ }
291
296
  });
292
297
  obj.toolbarButtons = toolbarButtons;
293
298
  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,19 @@ 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
+ }
269
274
  if (expectedQuestionData.hasWordLimit || expectedQuestionData.hasWordCount) {
270
275
  if (expectedQuestionData.hasWordLimit) {
271
276
  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-63cd8a3.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {