itemengine-cypress-automation 1.0.550-IEI-6999-main-846015d.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.
- package/cypress/pages/audioPlayerPage.js +4 -16
- package/cypress/pages/components/gridQuestionCommonComponent.js +2 -4
- package/cypress/pages/components/optionsWrapperComponent.js +2 -5
- package/cypress/pages/dragAndDropIntoCategoriesPage.js +2 -5
- package/cypress/pages/fillInTheGapsDragAndDropPage.js +4 -10
- package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +4 -10
- package/cypress/pages/listOrderingPage.js +18 -44
- package/cypress/pages/matchingPage.js +6 -15
- package/cypress/pages/multipleSelectionPage.js +4 -10
- package/cypress/pages/numberLineLabelPage.js +6 -15
- package/cypress/pages/singleSelectionPage.js +4 -10
- package/cypress/pages/textSelectionPage.js +8 -16
- package/cypress/support/helpers/utilities.js +28 -1
- package/package.json +1 -1
|
@@ -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: () => {
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
/**
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|