itemengine-cypress-automation 1.0.550-task-IEI-6999-a623bd8.0 → 1.0.551-IEI-6981-b0785e0.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.
@@ -36,7 +36,6 @@ describe('Fill In the gaps with text - Additional settings', () => {
36
36
  cy.barsPreLoaderWait();
37
37
  fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
38
38
  fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }]);
39
- fillInTheGapsTextPage.steps.allotPoints(5);
40
39
  fillInTheGapsTextPage.steps.expandAdditionalSettings();
41
40
  });
42
41
 
@@ -66,33 +65,7 @@ describe('Fill In the gaps with text - Additional settings', () => {
66
65
  'font-size': fontSizes[option]
67
66
  });
68
67
  fillInTheGapsTextPage.steps.switchToStudentView();
69
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
70
- fillInTheGapsTextPage.steps.switchToPreviewTab();
71
- // fillInTheGapsTextPage.steps.switchToGradingView();
72
- // fillInTheGapsTextPage.steps.switchToPreviewTab();
73
- fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }]);
74
- utilities.verifyCSS(fillInTheGapsTextPage.questionInstructionsText(), {
75
- 'font-size': fontSizes[option]
76
- });
77
- utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab(), {
78
- 'font-size': fontSizes[option]
79
- });
80
- fillInTheGapsTextPage.steps.switchToGradingView();
81
- utilities.verifyCSS(fillInTheGapsTextPage.correctAnswersLabel(), {
82
- 'font-size': fontSizes[option]
83
- });
84
- utilities.verifyCSS(fillInTheGapsTextPage.correctAnswerResponseNumeration().find('.response-input-adornment'), {
85
- 'font-size': fontSizes[option]
86
- });
87
- utilities.verifyCSS(fillInTheGapsTextPage.correctAnswerResponse(), {
88
- 'font-size': fontSizes[option]
89
- });
90
- utilities.verifyCSS(fillInTheGapsTextPage.correctIncorrectStatusMessageText(), {
91
- 'font-size': fontSizes[option]
92
- });
93
68
  fillInTheGapsTextPage.steps.switchToEditTab();
94
- fillInTheGapsTextPage.steps.clickOnEditQuestionButton();
95
- fillInTheGapsTextPage.steps.expandAdditionalSettings();
96
69
  });
97
70
  });
98
71
  });
@@ -90,7 +90,6 @@ describe('Fill In the gaps with text - Additional settings : Placeholder text, G
90
90
  cy.barsPreLoaderWait();
91
91
  fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }]);
92
92
  //fillInTheGapsTextPage.steps.checkAllowStudentToCheckAnswerCheckbox();
93
- fillInTheGapsTextPage.steps.allotPoints(5);
94
93
  fillInTheGapsTextPage.steps.expandAdditionalSettings();
95
94
  });
96
95
 
@@ -107,18 +106,11 @@ describe('Fill In the gaps with text - Additional settings : Placeholder text, G
107
106
  });*/
108
107
 
109
108
  it(`When the user switches to the "Grading view", then the "${option}" numeration should be displayed in the answer input fields as well as correct answer options in the correct answer section`, () => {
110
- fillInTheGapsTextPage.steps.switchToGradingView();
111
- fillInTheGapsTextPage.steps.verifyAnswerInputFieldEnumeration(enumerationOptions[option]);
112
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesEnumeration(enumerationOptions[option]);
113
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
114
- fillInTheGapsTextPage.steps.switchToPreviewTab();
115
109
  fillInTheGapsTextPage.steps.switchToGradingView();
116
110
  fillInTheGapsTextPage.steps.verifyAnswerInputFieldEnumeration(enumerationOptions[option]);
117
111
  fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesEnumeration(enumerationOptions[option]);
118
112
  cy.log('Post step: Switch to Edit tab')
119
113
  fillInTheGapsTextPage.steps.switchToEditTab();
120
- fillInTheGapsTextPage.steps.clickOnEditQuestionButton();
121
- fillInTheGapsTextPage.steps.expandAdditionalSettings();
122
114
  });
123
115
  });
124
116
 
@@ -1,10 +1,6 @@
1
- import { fillInTheGapsTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
1
+ import { fillInTheGapsTextPage } from "../../../pages";
2
2
  import abortEarlySetup from "../../../support/helpers/abortEarly";
3
- import utilities from "../../../support/helpers/utilities";
4
3
  const css = Cypress.env('css');
5
- let correctAnswerViews = ['Question preview', 'Item preview', 'Student view'];
6
- const views = utilities.getViews(correctAnswerViews);
7
- var itemReferenceID = "";
8
4
 
9
5
  describe('Create item page - Fill in the gaps with text: Set limit section', () => {
10
6
  before(() => {
@@ -45,7 +41,7 @@ describe('Create item page - Fill in the gaps with text: Set limit section', ()
45
41
  it('User should able to enter characters in the answer input field', () => {
46
42
  fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }]);
47
43
  });
48
-
44
+
49
45
  //Uncomment below code once https://redmine.zeuslearning.com/issues/571588 is resolved
50
46
  // fillInTheGapsTextPage.tests.verifyMaximumCharacterLimitWarningConditionsSpecifyCorrectAnswerSection();
51
47
 
@@ -80,56 +76,4 @@ describe('Create item page - Fill in the gaps with text: Set limit section', ()
80
76
 
81
77
  // fillInTheGapsTextPage.tests.verifyMinimumCharacterLimitWarningConditionsPreviewTab();
82
78
  });
83
-
84
- views.forEach((view) => {
85
- describe(`${view}: Maximum character limit functionality`, () => {
86
- abortEarlySetup();
87
- before(() => {
88
- switch (view) {
89
- case 'Question preview':
90
- fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
91
- cy.barsPreLoaderWait();
92
- fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
93
- fillInTheGapsTextPage.steps.setMaximumLimit(15);
94
- fillInTheGapsTextPage.steps.switchToPreviewTab();
95
- break;
96
- case 'Item preview':
97
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
98
- itemPreviewPage.steps.switchToPreviewTab();
99
- break;
100
- case 'Grading view':
101
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
102
- break;
103
- };
104
- });
105
-
106
- beforeEach(() => {
107
- switch (view) {
108
- case 'Question preview':
109
- break;
110
- case 'Item preview':
111
- fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
112
- itemPreviewPage.steps.resetQuestionPreview();
113
- break;
114
- case 'Student view':
115
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
116
- break;
117
- }
118
- });
119
-
120
- if (view === 'Question preview') {
121
- after(() => {
122
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
123
- fillInTheGapsTextPage.steps.clickOnConfirmButton();
124
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
125
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
126
- });
127
- };
128
-
129
- it('When the user reaches the character limit, then the warning message \'Maximum 15 characters have been entered\' should be displayed', () => {
130
- fillInTheGapsTextPage.steps.addTextInAnswerInputFieldsAllView(0, 'NewFlowerpotsingarden');
131
- fillInTheGapsTextPage.steps.verifyLimitReachedWarningMessageExist('Maximum 15 characters have been entered.');
132
- });
133
- });
134
- });
135
79
  });
@@ -1,15 +1,11 @@
1
1
  import { specialCharacters } from "../../../fixtures/drawingToolbarOptionsAdditionalOptionsAndSpecialAndMathCharacters";
2
- import { dialogBoxBase, fillInTheGapsTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
+ import { dialogBoxBase, fillInTheGapsTextPage } from "../../../pages";
3
3
  import abortEarlySetup from "../../../support/helpers/abortEarly";
4
4
  import utilities from "../../../support/helpers/utilities";
5
5
  const css = Cypress.env('css');
6
6
 
7
7
  const specialCharactersCategories = Object.values(specialCharacters.map((icon) => icon.categoryName));
8
8
  const customSpecialCharacters = ['A', '1', '#'];
9
- const specialCharactersLanguageLabel = ['French', 'Portuguese', 'Italian'];
10
- let correctAnswerViews = ['Question preview', 'Item preview', 'Student view'];
11
- const views = utilities.getViews(correctAnswerViews);
12
- var itemReferenceID = "";
13
9
 
14
10
  describe('Create item page - Fill in the gaps with text - Special characters section', () => {
15
11
  before(() => {
@@ -239,114 +235,4 @@ describe('Create item page - Fill in the gaps with text - Special characters sec
239
235
  });
240
236
  });
241
237
  });
242
-
243
- views.forEach((view) => {
244
- describe(`${view}: Special characters section `, () => {
245
- abortEarlySetup();
246
- before(() => {
247
- switch (view) {
248
- case 'Question preview':
249
- fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
250
- cy.barsPreLoaderWait();
251
- fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
252
- fillInTheGapsTextPage.steps.checkEnableSpecialCharactersCheckbox();
253
- fillInTheGapsTextPage.steps.clickOnSpecialCharactersCategoryTile(specialCharacters[0].categoryName);
254
- fillInTheGapsTextPage.steps.clickOnSpecialCharactersCategoryTile(specialCharacters[2].categoryName);
255
- fillInTheGapsTextPage.steps.clickOnSpecialCharactersCategoryTile(specialCharacters[4].categoryName);
256
- fillInTheGapsTextPage.steps.clickOnSpecialCharactersCategoryTile(specialCharacters[6].categoryName);
257
- fillInTheGapsTextPage.steps.switchToPreviewTab();
258
- break;
259
- case 'Item preview':
260
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
261
- itemPreviewPage.steps.switchToPreviewTab();
262
- break;
263
- case 'Grading view':
264
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
265
- break;
266
- };
267
- });
268
-
269
- beforeEach(() => {
270
- switch (view) {
271
- case 'Question preview':
272
- break;
273
- case 'Item preview':
274
- fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
275
- break;
276
- case 'Student view':
277
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
278
- break;
279
- }
280
- });
281
-
282
- if (view === 'Question preview') {
283
- after(() => {
284
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
285
- fillInTheGapsTextPage.steps.clickOnConfirmButton();
286
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
287
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
288
- });
289
- };
290
-
291
- it(`should display the ${specialCharactersLanguageLabel} special characters language labels in the popup`, () => {
292
- fillInTheGapsTextPage.steps.focusInResponseInputFieldPreviewTab(0);
293
- fillInTheGapsTextPage.steps.openSpecialCharactersPopupPreviewTab();
294
- fillInTheGapsTextPage.steps.verifySpecialCharactersLanguageLabelsInSpecialCharactersPopupPreviewTab(specialCharactersLanguageLabel);
295
- });
296
- });
297
- });
298
-
299
- views.forEach((view) => {
300
- describe(`${view}: Custom special characters section`, () => {
301
- abortEarlySetup();
302
- before(() => {
303
- switch (view) {
304
- case 'Question preview':
305
- fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
306
- cy.barsPreLoaderWait();
307
- fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
308
- fillInTheGapsTextPage.steps.checkEnableSpecialCharactersCheckbox();
309
- fillInTheGapsTextPage.steps.selectShowOnlyCustomSpecialCharactersRadioButton();
310
- fillInTheGapsTextPage.steps.addInputToCustomSpecialCharactersInputField(`${customSpecialCharacters.join('')}`);
311
- fillInTheGapsTextPage.steps.switchToPreviewTab();
312
- break;
313
- case 'Item preview':
314
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
315
- itemPreviewPage.steps.switchToPreviewTab();
316
- break;
317
- case 'Grading view':
318
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
319
- break;
320
- };
321
- });
322
-
323
- beforeEach(() => {
324
- switch (view) {
325
- case 'Question preview':
326
- break;
327
- case 'Item preview':
328
- fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
329
- break;
330
- case 'Student view':
331
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
332
- break;
333
- }
334
- });
335
-
336
- if (view === 'Question preview') {
337
- after(() => {
338
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
339
- fillInTheGapsTextPage.steps.clickOnConfirmButton();
340
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
341
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
342
- });
343
- };
344
-
345
- it(`should display the ${customSpecialCharacters} custom special characters in the popup`, () => {
346
- fillInTheGapsTextPage.steps.focusInResponseInputFieldPreviewTab(0);
347
- fillInTheGapsTextPage.steps.openSpecialCharactersPopupPreviewTab();
348
- fillInTheGapsTextPage.steps.verifyCustomSpecialCharactersInSpecialCharactersPopupPreviewTab(customSpecialCharacters);
349
- });
350
- });
351
- });
352
238
  });
@@ -1,8 +1,8 @@
1
- import { fillInTheGapsTextPage, gradingViewPage, itemPreviewPage, studentViewPage, dialogBoxBase } from "../../../pages";
1
+ import { fillInTheGapsTextPage, gradingViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
2
  import abortEarlySetup from "../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
  const css = Cypress.env('css');
5
- let correctAnswerViews = ['Question preview', 'Item preview', 'Student view', 'Grading view'];
5
+ let correctAnswerViews = ['Question preview', 'Item preview', 'Student view'];
6
6
  const views = utilities.getViews(correctAnswerViews);
7
7
  var itemReferenceID = "";
8
8
 
@@ -59,7 +59,7 @@ describe('Create Item page - Fill in the gaps with text: Student view settings',
59
59
  });
60
60
 
61
61
  views.forEach((view) => {
62
- describe(`${view}: student view settings: Spell check and auto-resize default state`, () => {
62
+ describe(`${view}: student view settings`, () => {
63
63
  abortEarlySetup();
64
64
  before(() => {
65
65
  switch (view) {
@@ -101,93 +101,13 @@ describe('Create Item page - Fill in the gaps with text: Student view settings',
101
101
  });
102
102
  };
103
103
 
104
- it(`When the \'Auto-resize response field\' and spell check functionality is unchecked, the response field should have \'resizetype\' attribute set as \'vertical\' and \'spellcheck\' attribute set as \'false\' in ${view}`, () => {
104
+ it(` 'Auto-resize response field' functionality in ${view}`, () => {
105
105
  if (view === 'Student view') {
106
- fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabDisabled(0);
107
- fillInTheGapsTextPage.steps.verifySpellCheckOfResponseFieldPreviewTabDisabled(0);
108
- studentViewPage.steps.submitResponse();
109
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
110
- studentViewPage.steps.clickOnGoToGradingViewButton();
111
- };
112
-
113
- if (view === 'Grading view') {
114
- fillInTheGapsTextPage.steps.verifySpellCheckOfResponseFieldPreviewTabDisabled(0);
115
- fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabDisabled(0);
116
- };
117
-
118
- if (view === 'Question preview' || view === 'Item preview') {
119
- fillInTheGapsTextPage.steps.switchToPreviewTab();
120
- fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabDisabled(0);
121
- fillInTheGapsTextPage.steps.verifySpellCheckOfResponseFieldPreviewTabDisabled(0);
122
- };
123
- });
124
-
125
- });
126
- });
127
-
128
- views.forEach((view) => {
129
- describe(`${view}: student view settings: Spell check and auto-resize checked`, () => {
130
- abortEarlySetup();
131
- before(() => {
132
- switch (view) {
133
- case 'Question preview':
134
- fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
135
- cy.barsPreLoaderWait();
136
- fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('fill in the gaps');
137
- fillInTheGapsTextPage.steps.addResponseAreaInQuestionField();
138
- fillInTheGapsTextPage.steps.checkSpellCheckCheckbox();
139
- fillInTheGapsTextPage.steps.checkAutoResizeCheckbox();
140
- fillInTheGapsTextPage.steps.switchToPreviewTab();
141
- break;
142
- case 'Item preview':
143
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
144
- itemPreviewPage.steps.switchToPreviewTab();
145
- break;
146
- case 'Student view':
147
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
148
- break;
149
- };
150
- });
151
-
152
- beforeEach(() => {
153
- switch (view) {
154
- case 'Question preview':
155
- break;
156
- case 'Item preview':
157
- break;
158
- case 'Student view':
159
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
160
- break;
161
- }
162
- });
163
-
164
- if (view === 'Question preview') {
165
- after(() => {
166
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
167
- fillInTheGapsTextPage.steps.clickOnConfirmButton();
168
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
169
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
170
- });
171
- };
172
-
173
- it(`When the \'Spell check\' and \'Auto-resize response field\' functionality is enabled, the response field should have \'resizetype\' attribute set as \'vertical\' and \'spellcheck\' attribute set as \'true\' in the ${view}`, () => {
174
- if (view === 'Student view') {
175
- fillInTheGapsTextPage.steps.verifySpellCheckOfResponseFieldAllViewEnabled(0);
176
- fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabEnabled(0);
177
- studentViewPage.steps.submitResponse();
178
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
179
- studentViewPage.steps.clickOnGoToGradingViewButton();
180
- };
181
-
182
- if (view === 'Grading view') {
183
- fillInTheGapsTextPage.steps.verifySpellCheckOfResponseFieldAllViewEnabled(0);
184
- fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabEnabled(0);
106
+ fillInTheGapsTextPage.tests.verifyAutoResizeResponseFieldFunctionalityPreviewTab();
185
107
  };
186
108
 
187
109
  if (view === 'Question preview' || view === 'Item preview') {
188
- fillInTheGapsTextPage.steps.switchToPreviewTab();
189
- fillInTheGapsTextPage.steps.verifySpellCheckOfResponseFieldAllViewEnabled(0);
190
- fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabEnabled(0);
110
+ fillInTheGapsTextPage.tests.verifyAutoResizeResponseFieldFunctionalityPreviewTab();
191
111
  };
192
112
  });
193
113
  });
@@ -1,13 +1,9 @@
1
- import { dialogBoxBase, fillInTheGapsTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
1
+ import { dialogBoxBase, fillInTheGapsTextPage } from "../../../pages";
2
2
  import { colorPopupComponent } from "../../../pages/components";
3
3
  import abortEarlySetup from "../../../support/helpers/abortEarly";
4
4
  import utilities from "../../../support/helpers/utilities";
5
5
  const css = Cypress.env('css');
6
- const borderStyles = ["Dashed", "Dotted", "Solid", "None"];
7
- let correctAnswerViews = ['Question preview', 'Item preview', 'Student view'];
8
- const views = utilities.getViews(correctAnswerViews);
9
- var itemReferenceID = "";
10
-
6
+ const borderStyles = ["Dashed", "Dotted", "Solid", "None"]
11
7
  describe('Create Item page - Fill in the gaps with text: Style and layout customization', () => {
12
8
  before(() => {
13
9
  cy.loginAs('admin');
@@ -44,7 +40,7 @@ describe('Create Item page - Fill in the gaps with text: Style and layout custom
44
40
  fillInTheGapsTextPage.tests.verifyFillColorTooltips();
45
41
 
46
42
  fillInTheGapsTextPage.tests.verifyBorderColorTooltips();
47
-
43
+
48
44
  fillInTheGapsTextPage.tests.verifyStyleAndLayoutCustomizationAccordionContentsCSSAndA11y('Solid');
49
45
  });
50
46
 
@@ -337,55 +333,4 @@ describe('Create Item page - Fill in the gaps with text: Style and layout custom
337
333
  });
338
334
  })
339
335
  });
340
-
341
- views.forEach((view) => {
342
- describe(`${view}: Default border style and default border color`, () => {
343
- abortEarlySetup();
344
- before(() => {
345
- switch (view) {
346
- case 'Question preview':
347
- fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
348
- cy.barsPreLoaderWait();
349
- fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
350
- fillInTheGapsTextPage.steps.expandStyleAndLayoutCustomizationAccordion();
351
- fillInTheGapsTextPage.steps.allotPoints(5);
352
- fillInTheGapsTextPage.steps.switchToPreviewTab();
353
- break;
354
- case 'Item preview':
355
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
356
- itemPreviewPage.steps.switchToPreviewTab();
357
- break;
358
- case 'Grading view':
359
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
360
- break;
361
- };
362
- });
363
-
364
- beforeEach(() => {
365
- switch (view) {
366
- case 'Question preview':
367
- break;
368
- case 'Item preview':
369
- fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
370
- break;
371
- case 'Student view':
372
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
373
- break;
374
- }
375
- });
376
-
377
- if (view === 'Question preview') {
378
- after(() => {
379
- fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
380
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
381
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
382
- });
383
- };
384
-
385
- it(`when the user switches to ${view} default border style and color should be displayed`, () => {
386
- fillInTheGapsTextPage.steps.verifyAnswerInputFieldBorderColor(0, `1px solid ${css.color.activeComponentBorder}`);
387
- fillInTheGapsTextPage.steps.verifyAnswerInputFieldFillColor(0, css.color.optionsBg);
388
- });
389
- });
390
- });
391
336
  });
@@ -796,17 +796,11 @@ const steps = {
796
796
  },
797
797
 
798
798
  verifyImageAndAltTextInAudioOverviewInputField: () => {
799
- audioPlayerPage.audioOverviewInputField()
800
- .find('img')
801
- .should('have.attr', 'src', constants.foxImageLink)
802
- .and('have.attr', 'alt', constants.foxImageAltText);
799
+ utilities.verifyImage(audioPlayerPage.audioOverviewInputField(), constants.foxImageLink, constants.foxImageAltText);
803
800
  },
804
801
 
805
802
  verifyImageAndAltTextInAudioOverviewPreviewTab: () => {
806
- audioPlayerPage.audioOverviewPreviewTab()
807
- .find('img')
808
- .should('have.attr', 'src', constants.foxImageLink)
809
- .and('have.attr', 'alt', constants.foxImageAltText);
803
+ utilities.verifyImage(audioPlayerPage.audioOverviewPreviewTab(), constants.foxImageLink, constants.foxImageAltText);
810
804
  },
811
805
 
812
806
  verifyEquationInAudioOverviewInputField: () => {
@@ -904,17 +898,11 @@ const steps = {
904
898
  },
905
899
 
906
900
  verifyImageAndAltTextInTranscriptInputField: () => {
907
- audioPlayerPage.transcriptInputField()
908
- .find('img')
909
- .should('have.attr', 'src', constants.foxImageLink)
910
- .and('have.attr', 'alt', constants.foxImageAltText);
901
+ utilities.verifyImage(audioPlayerPage.transcriptInputField(), constants.foxImageLink, constants.foxImageAltText);
911
902
  },
912
903
 
913
904
  verifyImageAndAltTextInTranscriptPreviewTab: () => {
914
- audioPlayerPage.transcriptContentPreviewTab()
915
- .find('img')
916
- .should('have.attr', 'src', constants.foxImageLink)
917
- .and('have.attr', 'alt', constants.foxImageAltText);
905
+ utilities.verifyImage(audioPlayerPage.transcriptContentPreviewTab(), constants.foxImageLink, constants.foxImageAltText);
918
906
  },
919
907
 
920
908
  verifyEquationInTranscriptInputField: () => {
@@ -90,8 +90,6 @@ const selectors = {
90
90
  spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input[type="checkbox"]'),
91
91
  correctAnswerResponseForCorrectResponse: () => cy.get('[class*="ClozeWithTextResponsestyles__AnswerWrapperForLabelImg"]').eq(0),
92
92
  correctIncorrectAnswerLabelNew: () => cy.get('[class*="ClozeWithTextPreviewstyle__AnswerStatusWrapper"]'),
93
- answerInputFieldAllView: () => cy.get('[class*="question-preview-wrapper"] [aria-label*="Add answer for response"]'),
94
- customSpecialCharactersButtonPreviewTab: () => cy.get('.special-character-popup-container .MuiButton-text'),
95
93
  }
96
94
 
97
95
  const steps = {
@@ -696,16 +694,6 @@ const steps = {
696
694
  .should('have.attr', 'spellcheck', 'true');
697
695
  },
698
696
 
699
- /**
700
- * Verify that the spell check for a response field in the Preview Tab is enabled.
701
- * @param {number} responseFieldIndex - The index of the response field to verify.
702
- */
703
- verifySpellCheckOfResponseFieldAllViewEnabled: (responseFieldIndex) => {
704
- fillInTheGapsTextCommonComponent.answerInputFieldAllView()
705
- .eq(responseFieldIndex)
706
- .should('have.attr', 'spellcheck', 'true');
707
- },
708
-
709
697
  /**
710
698
  *@description Verify numeration text for the answer input fields of the specify correct answer section.
711
699
  * @param responseAccordionIndex denotes response accordion index
@@ -918,38 +906,7 @@ const steps = {
918
906
  utilities.verifyCSS(utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab().parent('.response-input-field'), responseAreaIndex), {
919
907
  'border-style': styleName
920
908
  });
921
- },
922
-
923
- /**
924
- * @param {number} responseIndex index number of text container
925
- * @param {string} responseText text to be added in text container
926
- * @description function enters text in the answer input fields of the preview tab
927
- */
928
- addTextInAnswerInputFieldsAllView: (responseIndex, responseText) => {
929
- utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
930
- .type(responseText)
931
- },
932
-
933
- /**
934
- * @description Verify special characters language labels in the special characters popup
935
- * @param {string[]} specialCharactersLanguageLabel Array of the language labels for the category
936
- */
937
- verifySpecialCharactersLanguageLabelsInSpecialCharactersPopupPreviewTab: (specialCharactersLanguageLabel) => {
938
- specialCharactersLanguageLabel.forEach((label, index) => {
939
- utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.specialCharactersPopupCategoryAccordionLabelPreviewTab(), index), label);
940
- });
941
- },
942
-
943
- /**
944
- * @description Verify =custom special characters displayed in special characters popup in preview tab
945
- * @param {string[]} customSpecialCharacters Array of the custom special characters
946
- */
947
- verifyCustomSpecialCharactersInSpecialCharactersPopupPreviewTab: (customSpecialCharacters) => {
948
- customSpecialCharacters.forEach((character, index) => {
949
- utilities.verifyElementVisibilityState(utilities.getNthElement(fillInTheGapsTextCommonComponent.customSpecialCharactersButtonPreviewTab(), index), 'visible');
950
- utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.customSpecialCharactersButtonPreviewTab(), index), character);
951
- });
952
- },
909
+ }
953
910
  }
954
911
 
955
912
  const tests = {
@@ -1099,11 +1056,6 @@ const tests = {
1099
1056
  fillInTheGapsTextCommonComponent.steps.setMinimumLimit(10);
1100
1057
  fillInTheGapsTextCommonComponent.steps.setMaximumLimit(40);
1101
1058
  });
1102
-
1103
- it('When the user insert 100002 in maximum character limit input field, then the value should be reset to 100000', () => {
1104
- fillInTheGapsTextCommonComponent.steps.setMaximumLimit(100002);
1105
- fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInputField(100000);
1106
- });
1107
1059
  },
1108
1060
 
1109
1061
  verifySetLimitSectionForNoneOption: () => {
@@ -496,10 +496,8 @@ const steps = {
496
496
  gridQuestionCommonComponent.gridPreviewTab()
497
497
  .within(() => {
498
498
  utilities.getNthElement(gridQuestionCommonComponent.tableRow(), row).within(() => {
499
- utilities.getNthElement(gridQuestionCommonComponent.tableCell(), column)
500
- .find('img')
501
- .should('have.attr', 'src', constants.foxImageLink)
502
- .and('have.attr', 'alt', constants.foxImageAltText);
499
+ const tableCell = utilities.getNthElement(gridQuestionCommonComponent.tableCell(), column);
500
+ utilities.verifyImage(tableCell, constants.foxImageLink, constants.foxImageAltText);
503
501
  })
504
502
  });
505
503
  },
@@ -167,11 +167,8 @@ const steps = {
167
167
  * @description this function verifies image in options input fields
168
168
  */
169
169
  verifyImageAndAltTextInOptionsInputField: (index) => {
170
- optionsWrapperComponent.optionsInputField()
171
- .eq(index)
172
- .find('img')
173
- .should('have.attr', 'src', constants.foxImageLink)
174
- .and('have.attr', 'alt', constants.foxImageAltText);
170
+ const optionsInputField = optionsWrapperComponent.optionsInputField().eq(index);
171
+ utilities.verifyImage(optionsInputField, constants.foxImageLink, constants.foxImageAltText);
175
172
  },
176
173
 
177
174
  /**
@@ -677,11 +677,8 @@ const steps = {
677
677
  verifyDraggableOptionWithImageInPreviewTab: (optionIndex) => {
678
678
  dragAndDropIntoCategoriesPage.optionsContainerPreviewTab()
679
679
  .within(() => {
680
- draggableOptionContainer.draggableOption()
681
- .eq(optionIndex)
682
- .find('img')
683
- .should('have.attr', 'src', constants.foxImageLink)
684
- .and('have.attr', 'alt', constants.foxImageAltText);
680
+ const draggableOption = draggableOptionContainer.draggableOption().eq(optionIndex);
681
+ utilities.verifyImage(draggableOption, constants.foxImageLink, constants.foxImageAltText);
685
682
  utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
686
683
  });
687
684
  },
@@ -224,11 +224,8 @@ const steps = {
224
224
  * @param {number} optionIndex - The index of the option in the Preview tab.
225
225
  */
226
226
  verifyDraggableOptionWithImageInPreviewTab: (optionIndex) => {
227
- fillInTheGapsDragAndDropPage.optionContainerOptionsPreviewTab()
228
- .eq(optionIndex)
229
- .find('img')
230
- .should('have.attr', 'src', constants.foxImageLink)
231
- .and('have.attr', 'alt', constants.foxImageAltText);
227
+ const optionElement = fillInTheGapsDragAndDropPage.optionContainerOptionsPreviewTab().eq(optionIndex);
228
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
232
229
  utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
233
230
  },
234
231
 
@@ -261,11 +258,8 @@ const steps = {
261
258
  * @param {number} optionIndex - The index of the option in the Preview tab.
262
259
  */
263
260
  verifyDropzoneWithImageInPreviewTab: (optionIndex) => {
264
- fillInTheGapsDragAndDropPage.dropzonePreviewTab()
265
- .eq(optionIndex)
266
- .find('img')
267
- .should('have.attr', 'src', constants.foxImageLink)
268
- .and('have.attr', 'alt', constants.foxImageAltText);
261
+ const dropzoneElement = fillInTheGapsDragAndDropPage.dropzonePreviewTab().eq(optionIndex);
262
+ utilities.verifyImage(dropzoneElement, constants.foxImageLink, constants.foxImageAltText);
269
263
  },
270
264
 
271
265
  /**
@@ -339,11 +339,8 @@ const steps = {
339
339
  * @param {number} optionIndex - The index of the option in the Preview tab.
340
340
  */
341
341
  verifyDraggableOptionWithImageInPreviewTab: (optionIndex) => {
342
- fillInTheGapsOverImageDragAndDropPage.optionContainerOptionsPreviewTab()
343
- .eq(optionIndex)
344
- .find('img')
345
- .should('have.attr', 'src', constants.foxImageLink)
346
- .and('have.attr', 'alt', constants.foxImageAltText);
342
+ const optionElement = fillInTheGapsOverImageDragAndDropPage.optionContainerOptionsPreviewTab().eq(optionIndex);
343
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
347
344
  utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
348
345
  },
349
346
 
@@ -376,11 +373,8 @@ const steps = {
376
373
  * @param {number} optionIndex - The index of the option in the Preview tab.
377
374
  */
378
375
  verifyDropzoneWithImageInPreviewTab: (optionIndex) => {
379
- fillInTheGapsOverImageDragAndDropPage.dropzonePreviewTab()
380
- .eq(optionIndex)
381
- .find('img')
382
- .should('have.attr', 'src', constants.foxImageLink)
383
- .and('have.attr', 'alt', constants.foxImageAltText);
376
+ const dropzoneElement = fillInTheGapsOverImageDragAndDropPage.dropzonePreviewTab().eq(optionIndex);
377
+ utilities.verifyImage(dropzoneElement, constants.foxImageLink, constants.foxImageAltText);
384
378
  },
385
379
 
386
380
  /**
@@ -300,11 +300,11 @@ const tests = {
300
300
  },
301
301
 
302
302
  verifyAutoResizeResponseFieldFunctionalityPreviewTab: () => {
303
- it('When the \'Auto-resize response field\' functionality is disabled, the response field should have \'resizetype\' attribute set as \'vertical\' in preview tab', () => {
303
+ it('When the \'Auto-resize response field\' functionality is disabled, the response field should have \'auto-resize\' attribute set as \'false\' in preview tab', () => {
304
304
  fillInTheGapsTextPage.steps.verifyAutoResizeOfResponseFieldPreviewTabDisabled(0);
305
305
  });
306
306
 
307
- it('When the \'Auto-resize response field\' functionality is enabled, the response field should have \'resizetype\' attribute set as \'none\' in the preview tab', () => {
307
+ it('When the \'Auto-resize response field\' functionality is enabled, the response field should have \'auto-resize\' attribute set as \'true\' in the preview tab', () => {
308
308
  createQuestionBasePage.steps.switchToEditTab();
309
309
  fillInTheGapsTextPage.steps.checkAutoResizeCheckbox();
310
310
  createQuestionBasePage.steps.switchToPreviewTab();
@@ -414,11 +414,8 @@ const steps = {
414
414
  * @param {number} optionIndex - The index of the option in the Preview tab.
415
415
  */
416
416
  verifyOptionWithImageInPreviewTab: (optionIndex) => {
417
- listOrderingPage.optionWrapperPreviewTab()
418
- .eq(optionIndex)
419
- .find('img')
420
- .should('have.attr', 'src', constants.foxImageLink)
421
- .and('have.attr', 'alt', constants.foxImageAltText);
417
+ const optionElement = listOrderingPage.optionWrapperPreviewTab().eq(optionIndex);
418
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
422
419
  },
423
420
 
424
421
  /**
@@ -520,11 +517,8 @@ const steps = {
520
517
  * @param {number} optionIndex - The index of the option in the Preview tab.
521
518
  */
522
519
  verifyOptionWithImageInGradingView: (optionIndex) => {
523
- listOrderingPage.optionGradingView()
524
- .eq(optionIndex)
525
- .find('img')
526
- .should('have.attr', 'src', constants.foxImageLink)
527
- .and('have.attr', 'alt', constants.foxImageAltText);
520
+ const optionElement = listOrderingPage.optionGradingView().eq(optionIndex);
521
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
528
522
  },
529
523
 
530
524
  /**
@@ -709,10 +703,8 @@ const steps = {
709
703
  * @param {number} index - The index of the option in the Specify Correct Answer section.
710
704
  */
711
705
  verifyImageInSpecifyCorrectAnswerSection: (index) => {
712
- utilities.getNthElement(listOrderingPage.optionSpecifyCorrectAnswerSection(), index)
713
- .find('img')
714
- .should('have.attr', 'src', constants.foxImageLink)
715
- .and('have.attr', 'alt', constants.foxImageAltText);
706
+ const optionElement = utilities.getNthElement(listOrderingPage.optionSpecifyCorrectAnswerSection(), index);
707
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
716
708
  },
717
709
 
718
710
  /**
@@ -896,11 +888,8 @@ const steps = {
896
888
  * @param {number} optionIndex - The index of the option in the Preview tab.
897
889
  */
898
890
  verifyOptionWithImageDropdownLayoutInGradingView: (optionIndex) => {
899
- listOrderingPage.dropdownOptionWrapperGradingView()
900
- .eq(optionIndex)
901
- .find('img')
902
- .should('have.attr', 'src', constants.foxImageLink)
903
- .and('have.attr', 'alt', constants.foxImageAltText);
891
+ const optionElement = listOrderingPage.dropdownOptionWrapperGradingView().eq(optionIndex);
892
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
904
893
  },
905
894
 
906
895
  /**
@@ -1253,11 +1242,8 @@ const steps = {
1253
1242
  * @param {number} optionIndex - The index of the option in the Preview tab.
1254
1243
  */
1255
1244
  verifyImageOptionInSetPointsPopup: (optionIndex) => {
1256
- listOrderingPage.optionWrapperSetPointsPopup()
1257
- .eq(optionIndex)
1258
- .find('img')
1259
- .should('have.attr', 'src', constants.foxImageLink)
1260
- .and('have.attr', 'alt', constants.foxImageAltText);
1245
+ const optionElement = listOrderingPage.optionWrapperSetPointsPopup().eq(optionIndex);
1246
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
1261
1247
  },
1262
1248
 
1263
1249
  /**
@@ -1297,11 +1283,8 @@ const steps = {
1297
1283
  * @param {number} optionIndex - The index of the option in the Preview tab.
1298
1284
  */
1299
1285
  verifyHorizontalOptionWithImageInPreviewTab: (optionIndex) => {
1300
- listOrderingPage.horizontalOptionPreviewTab()
1301
- .eq(optionIndex)
1302
- .find('img')
1303
- .should('have.attr', 'src', constants.foxImageLink)
1304
- .and('have.attr', 'alt', constants.foxImageAltText);
1286
+ const optionElement = listOrderingPage.horizontalOptionPreviewTab().eq(optionIndex);
1287
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
1305
1288
  },
1306
1289
 
1307
1290
  /**
@@ -1727,11 +1710,8 @@ const steps = {
1727
1710
  * @param {number} optionIndex - The index of the option in the Preview tab.
1728
1711
  */
1729
1712
  verifyOptionWithImageInDropzonePreviewTabSeperateList: (optionIndex) => {
1730
- listOrderingPage.droppedOptionSeperateList()
1731
- .eq(optionIndex)
1732
- .find('img')
1733
- .should('have.attr', 'src', constants.foxImageLink)
1734
- .and('have.attr', 'alt', constants.foxImageAltText);
1713
+ const optionElement = listOrderingPage.droppedOptionSeperateList().eq(optionIndex);
1714
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
1735
1715
  },
1736
1716
 
1737
1717
  /**
@@ -1739,11 +1719,8 @@ const steps = {
1739
1719
  * @param {number} optionIndex - The index of the option in the Preview tab.
1740
1720
  */
1741
1721
  verifyOptionWithImageInDropzoneCorrectAnswerSectionTabSeperateList: (optionIndex) => {
1742
- listOrderingPage.correctAnswerSectionIconWrapper()
1743
- .eq(optionIndex)
1744
- .find('img')
1745
- .should('have.attr', 'src', constants.foxImageLink)
1746
- .and('have.attr', 'alt', constants.foxImageAltText);
1722
+ const optionElement = listOrderingPage.correctAnswerSectionIconWrapper().eq(optionIndex);
1723
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
1747
1724
  },
1748
1725
 
1749
1726
  /**
@@ -1751,11 +1728,8 @@ const steps = {
1751
1728
  * @param {number} optionIndex - The index of the option in the Preview tab.
1752
1729
  */
1753
1730
  verifyOptionWithImageInOptionsContainerPreviewTabSeperateList: (optionIndex) => {
1754
- listOrderingPage.optionsSeperateList()
1755
- .eq(optionIndex)
1756
- .find('img')
1757
- .should('have.attr', 'src', constants.foxImageLink)
1758
- .and('have.attr', 'alt', constants.foxImageAltText);
1731
+ const optionElement = listOrderingPage.optionsSeperateList().eq(optionIndex);
1732
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
1759
1733
  },
1760
1734
 
1761
1735
  /**
@@ -760,11 +760,8 @@ const steps = {
760
760
  * @param {number} optionIndex - The index of the option in the Preview tab.
761
761
  */
762
762
  verifyDropzoneWithImageInPreviewTab: (optionIndex) => {
763
- matchingPage.dropzonePreviewTab()
764
- .eq(optionIndex)
765
- .find('img')
766
- .should('have.attr', 'src', constants.foxImageLink)
767
- .and('have.attr', 'alt', constants.foxImageAltText);
763
+ const dropzoneElement = matchingPage.dropzonePreviewTab().eq(optionIndex);
764
+ utilities.verifyImage(dropzoneElement, constants.foxImageLink, constants.foxImageAltText);
768
765
  },
769
766
 
770
767
  /**
@@ -784,11 +781,8 @@ const steps = {
784
781
  * @param {number} optionIndex - The index of the option in the Preview tab.
785
782
  */
786
783
  verifyDraggableOptionWithImageInPreviewTab: (optionIndex) => {
787
- matchingPage.correctAnswersOptionContainer()
788
- .eq(optionIndex)
789
- .find('img')
790
- .should('have.attr', 'src', constants.foxImageLink)
791
- .and('have.attr', 'alt', constants.foxImageAltText);
784
+ const optionElement = matchingPage.correctAnswersOptionContainer().eq(optionIndex);
785
+ utilities.verifyImage(optionElement, constants.foxImageLink, constants.foxImageAltText);
792
786
  utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
793
787
  },
794
788
 
@@ -822,11 +816,8 @@ const steps = {
822
816
  * @param {number} optionIndex - The index of the option in the Preview tab.
823
817
  */
824
818
  verifyPromptWithImageInPreviewTab: (optionIndex) => {
825
- matchingPage.promptContainerPreviewTab()
826
- .eq(optionIndex)
827
- .find('img')
828
- .should('have.attr', 'src', constants.foxImageLink)
829
- .and('have.attr', 'alt', constants.foxImageAltText);
819
+ const promptElement = matchingPage.promptContainerPreviewTab().eq(optionIndex);
820
+ utilities.verifyImage(promptElement, constants.foxImageLink, constants.foxImageAltText);
830
821
  },
831
822
 
832
823
  /**
@@ -347,11 +347,8 @@ const steps = {
347
347
  * @param {number} index - The index of the option in the Specify Correct Answer section.
348
348
  */
349
349
  verifyImageInSpecifyCorrectAnswerSection: (index) => {
350
- multipleSelectionPage.optionWrapperSpecifyCorrectAnswerSection()
351
- .eq(index)
352
- .find('img')
353
- .should('have.attr', 'src', constants.foxImageLink)
354
- .and('have.attr', 'alt', constants.foxImageAltText);
350
+ const optionWrapper = multipleSelectionPage.optionWrapperSpecifyCorrectAnswerSection().eq(index);
351
+ utilities.verifyImage(optionWrapper, constants.foxImageLink, constants.foxImageAltText);
355
352
  },
356
353
 
357
354
  /**
@@ -394,11 +391,8 @@ const steps = {
394
391
  * @param {number} index - The index of the option in the Preview tab.
395
392
  */
396
393
  verifyImageInPreviewTab: (index) => {
397
- multipleSelectionPage.optionWrapperPreviewTab()
398
- .eq(index)
399
- .find('img')
400
- .should('have.attr', 'src', constants.foxImageLink)
401
- .and('have.attr', 'alt', constants.foxImageAltText);
394
+ const optionWrapper = multipleSelectionPage.optionWrapperPreviewTab().eq(index);
395
+ utilities.verifyImage(optionWrapper, constants.foxImageLink, constants.foxImageAltText);
402
396
  },
403
397
 
404
398
  /**
@@ -182,11 +182,8 @@ const steps = {
182
182
  * @param {number} index - The index of the option in the Preview tab.
183
183
  */
184
184
  verifyImageInLabelInputField: (index) => {
185
- numberLineLabelPage.labelInputField()
186
- .eq(index)
187
- .find('img')
188
- .should('have.attr', 'src', constants.foxImageLink)
189
- .and('have.attr', 'alt', constants.foxImageAltText);
185
+ const labelInputField = numberLineLabelPage.labelInputField().eq(index);
186
+ utilities.verifyImage(labelInputField, constants.foxImageLink, constants.foxImageAltText);
190
187
  },
191
188
 
192
189
  /**
@@ -351,11 +348,8 @@ const steps = {
351
348
  * @param {number} index - The index of the option in the Preview tab.
352
349
  */
353
350
  verifyImageInPreviewTab: (index) => {
354
- numberLineLabelPage.draggableLabelsPreviewTab()
355
- .eq(index)
356
- .find('img')
357
- .should('have.attr', 'src', constants.foxImageLink)
358
- .and('have.attr', 'alt', constants.foxImageAltText);
351
+ const draggableLabel = numberLineLabelPage.draggableLabelsPreviewTab().eq(index);
352
+ utilities.verifyImage(draggableLabel, constants.foxImageLink, constants.foxImageAltText);
359
353
  },
360
354
 
361
355
  /**
@@ -406,11 +400,8 @@ const steps = {
406
400
  * @param {number} index - The index of the option in the Preview tab.
407
401
  */
408
402
  verifyImageInLabelSpecifyCorrectAnswerSection: (index) => {
409
- numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer()
410
- .eq(index)
411
- .find('img')
412
- .should('have.attr', 'src', constants.foxImageLink)
413
- .and('have.attr', 'alt', constants.foxImageAltText);
403
+ const labelElement = numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer().eq(index);
404
+ utilities.verifyImage(labelElement, constants.foxImageLink, constants.foxImageAltText);
414
405
  },
415
406
 
416
407
  /**
@@ -325,11 +325,8 @@ const steps = {
325
325
  * @param {number} index - The index of the option in the Specify Correct Answer section.
326
326
  */
327
327
  verifyImageInSpecifyCorrectAnswerSection: (index) => {
328
- singleSelectionPage.optionWrapperSpecifyCorrectAnswerSection()
329
- .eq(index)
330
- .find('img')
331
- .should('have.attr', 'src', constants.foxImageLink)
332
- .and('have.attr', 'alt', constants.foxImageAltText);
328
+ const optionWrapper = singleSelectionPage.optionWrapperSpecifyCorrectAnswerSection().eq(index);
329
+ utilities.verifyImage(optionWrapper, constants.foxImageLink, constants.foxImageAltText);
333
330
  },
334
331
 
335
332
  /**
@@ -372,11 +369,8 @@ const steps = {
372
369
  * @param {number} index - The index of the option in the Preview tab.
373
370
  */
374
371
  verifyImageInPreviewTab: (index) => {
375
- singleSelectionPage.optionWrapperPreviewTab()
376
- .eq(index)
377
- .find('img')
378
- .should('have.attr', 'src', constants.foxImageLink)
379
- .and('have.attr', 'alt', constants.foxImageAltText);
372
+ const optionWrapper = singleSelectionPage.optionWrapperPreviewTab().eq(index);
373
+ utilities.verifyImage(optionWrapper, constants.foxImageLink, constants.foxImageAltText);
380
374
  },
381
375
 
382
376
  /**
@@ -162,10 +162,8 @@ const steps = {
162
162
  },
163
163
 
164
164
  verifyImageAndAltTextInQuestionInputField: () => {
165
- textSelectionPage.questionInputField()
166
- .find('img')
167
- .should('have.attr', 'src', constants.foxImageLink)
168
- .and('have.attr', 'alt', constants.foxImageAltText);
165
+ const questionInputField = textSelectionPage.questionInputField();
166
+ utilities.verifyImage(questionInputField, constants.foxImageLink, constants.foxImageAltText);
169
167
  },
170
168
 
171
169
  verifyEquationInQuestionInputField: () => {
@@ -232,10 +230,8 @@ const steps = {
232
230
  },
233
231
 
234
232
  verifyImageAndAltTextInSpecifyPossibleOptionsSection: () => {
235
- textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
236
- .find('img')
237
- .should('have.attr', 'src', constants.foxImageLink)
238
- .and('have.attr', 'alt', constants.foxImageAltText);
233
+ const specifyPossibleOptionsTextFieldWrapper = textSelectionPage.specifyPossibleOptionsTextFieldWrapper();
234
+ utilities.verifyImage(specifyPossibleOptionsTextFieldWrapper, constants.foxImageLink, constants.foxImageAltText);
239
235
  },
240
236
 
241
237
  verifyEquationInSpecifyPossibleOptionsSection: () => {
@@ -281,10 +277,8 @@ const steps = {
281
277
  },
282
278
 
283
279
  verifyImageAndAltTextInSpecifyCorrectAnswerSection: () => {
284
- textSelectionPage.specifyCorrectAnswerTextWrapper()
285
- .find('img')
286
- .should('have.attr', 'src', constants.foxImageLink)
287
- .and('have.attr', 'alt', constants.foxImageAltText);
280
+ const specifyCorrectAnswerTextWrapper = textSelectionPage.specifyCorrectAnswerTextWrapper();
281
+ utilities.verifyImage(specifyCorrectAnswerTextWrapper, constants.foxImageLink, constants.foxImageAltText);
288
282
  },
289
283
 
290
284
  verifyEquationInSpecifyCorrectAnswerSection: () => {
@@ -330,10 +324,8 @@ const steps = {
330
324
  },
331
325
 
332
326
  verifyImageAndAltTextInPreviewTab: () => {
333
- textSelectionPage.questionTextWrapperPreviewTab()
334
- .find('img')
335
- .should('have.attr', 'src', constants.foxImageLink)
336
- .and('have.attr', 'alt', constants.foxImageAltText);
327
+ const questionTextWrapperPreviewTab = textSelectionPage.questionTextWrapperPreviewTab();
328
+ utilities.verifyImage(questionTextWrapperPreviewTab, constants.foxImageLink, constants.foxImageAltText);
337
329
  },
338
330
 
339
331
  verifyEquationInPreviewTab: () => {
@@ -260,7 +260,7 @@ const utilities = {
260
260
  cy.get('body')
261
261
  .click();
262
262
  },
263
-
263
+
264
264
  /**
265
265
  * Simulates pressing the Escape key.
266
266
  * @returns {null} - Returns null after the action is performed.
@@ -268,6 +268,33 @@ const utilities = {
268
268
  pressEscapeKey: () => {
269
269
  cy.get('body').type('{esc}');
270
270
  },
271
+
272
+ /**
273
+ * Verifies that an image source is either a fixed URL or a blob/data URL
274
+ * @param {Cypress.Chainable} element - The element containing the image
275
+ * @param {string} expectedUrl - The expected fixed URL (optional)
276
+ * @param {string} expectedAlt - The expected alt text (optional)
277
+ */
278
+ verifyImage: (element, expectedUrl = null, expectedAlt = null) => {
279
+ element.find('img').should(($img) => {
280
+ const src = $img.attr('src');
281
+
282
+ // Check if src is either the fixed URL or a blob/data URL
283
+ const isValidSrc = (expectedUrl && src === expectedUrl) ||
284
+ src.startsWith('blob:') ||
285
+ src.startsWith('data:image/');
286
+
287
+ expect(isValidSrc,
288
+ `Image src should be ${expectedUrl ? `either ${expectedUrl} or ` : ''}a blob/data URL, but got: ${src}`
289
+ ).to.be.true;
290
+
291
+ // Verify alt text if provided
292
+ if (expectedAlt) {
293
+ const alt = $img.attr('alt');
294
+ expect(alt).to.equal(expectedAlt);
295
+ }
296
+ });
297
+ },
271
298
  }
272
299
 
273
300
  export default utilities
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.550-task-IEI-6999-a623bd8.0",
3
+ "version": "1.0.551-IEI-6981-b0785e0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {