itemengine-cypress-automation 1.0.205 → 1.0.206

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.
Files changed (42) hide show
  1. package/cypress/e2e/ILC/ChartsBar/Scoring/addAndDeleteBarAllOrNothingScoring.js +1 -1
  2. package/cypress/e2e/ILC/ChartsBar/gridSettings.js +3 -3
  3. package/cypress/e2e/ILC/ChartsBar/labelOptionsSection.js +2 -0
  4. package/cypress/e2e/ILC/ChartsBar/previewContentsForAllViews.smoke.js +17 -17
  5. package/cypress/e2e/ILC/ChartsBar/selectChartTypeSection.js +747 -0
  6. package/cypress/e2e/ILC/ChartsBar/specifyCorrectAnswerSection.js +1 -1
  7. package/cypress/e2e/ILC/ChartsLine/previewContentsForAllViews.smoke.js +7 -7
  8. package/cypress/e2e/ILC/EssayResponse/additionalSettings.js +257 -0
  9. package/cypress/e2e/ILC/EssayResponse/toolSettings.js +73 -0
  10. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/manuallyAndNonScored.js +1 -1
  11. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/additionalSettingsBasic.js +2 -2
  12. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/additionalSettingsForDropdowns.js +1 -1
  13. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/editTabBasicSection.js +3 -3
  14. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/previewContentsForAllViews.smoke.js +1 -1
  15. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/specifyCorrectAnswerSection.js +2 -2
  16. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/backgroundImageAndCanvasProperties.js +1 -0
  17. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/studentViewSettings.js +2 -2
  18. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +1 -1
  19. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/specifyCorrectAnswerSection.js +3 -2
  20. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/styleAndLayoutCutomization.js +2 -2
  21. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +1 -1
  22. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/allOrNothingForAllViews.smoke.js +1 -1
  23. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/backgroundImageAndCanvasProperties.js +4 -3
  24. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/styleAndLayoutCustomization.js +29 -26
  25. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/manuallyAndNonScored.js +1 -1
  26. package/cypress/e2e/ILC/FillInTheGapsTextNew/additionalSettingsForAnswerInputFields.js +1 -1
  27. package/cypress/e2e/ILC/FillInTheGapsTextNew/allOrNothingForAllViews.smoke.js +1 -1
  28. package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabBasicSection.js +3 -3
  29. package/cypress/e2e/ILC/FillInTheGapsTextNew/previewContentsForAllViews.smoke.js +1 -1
  30. package/cypress/e2e/ILC/ImageHighlight/customiseHighlightStyle.js +707 -0
  31. package/cypress/e2e/ILC/ImageHighlight/imageHighlightStyle.js +4 -3
  32. package/cypress/pages/chartsBarPage.js +212 -35
  33. package/cypress/pages/chartsDotPlotPage.js +10 -25
  34. package/cypress/pages/components/barAndLineChartComponent.js +54 -5
  35. package/cypress/pages/components/chartsCommonComponent.js +16 -1
  36. package/cypress/pages/components/createQuestionBasePage.js +1 -1
  37. package/cypress/pages/components/figCommonStyleAndLayoutComponent.js +1 -1
  38. package/cypress/pages/components/imageCanvasComponent.js +3 -3
  39. package/cypress/pages/essayResponsePage.js +152 -2
  40. package/cypress/pages/imageHighlightPage.js +398 -15
  41. package/cypress/pages/matchingPage.js +1 -0
  42. package/package.json +1 -1
@@ -62,7 +62,23 @@ const selectors = {
62
62
  } else {
63
63
  return cy.get('[class*="ControlsWrapper"] .icon-button-custom-format')
64
64
  }
65
- }
65
+ },
66
+ //additional settings
67
+ clipboardFunctionLabel: () => cy.get('.essay-clipboard-functions .ngie-toggle-button-title'),
68
+ clipboardFunctionButton: (index) => cy.get('.ngie-toggle-button-group button').eq(index),
69
+ clipboardFunctionButtonIcon: (index) => cy.get('.ngie-toggle-button-icon').eq(index),
70
+ clipboardFunctionButtonTickIcon: (index) => cy.get('.ngie-toggle-button-tick-icon').eq(index),
71
+ setInputFieldheightLabel: () => cy.get('.set-input-height'),
72
+ setInputFieldheightToggleButton: (ariaLabel = null) => {
73
+ if (ariaLabel) {
74
+ return cy.get(`.input-field-height button[aria-label*="${ariaLabel}"]`)
75
+ } else {
76
+ return cy.get('.input-field-height button')
77
+ }
78
+ },
79
+ minimumHeightInputField: () => cy.get('.max-min-input-field input').eq(0),
80
+ maximumHeightInputField: () => cy.get('.max-min-input-field input').eq(1),
81
+ studentResponseAreaAndLayoutLabel: () => cy.get('[class*="StudentResponseAreaLayoutstyles__LayoutText"]'),
66
82
  }
67
83
 
68
84
  const tableDialogBox = {
@@ -954,7 +970,141 @@ const steps = {
954
970
  dblClickHyperlinkText: () => {
955
971
  essayResponsePage.previewInputFieldHyperlinkText()
956
972
  .dblclick();
957
- }
973
+ },
974
+
975
+ verifyPlaceholderInputFieldIsEmpty: () => {
976
+ essayResponseCommonComponents.placeholderTextInputField()
977
+ .should('have.value', '');
978
+ },
979
+
980
+ /**
981
+ * @description type a text in placeholder input field and verify it.
982
+ * @param {string} inputText - the text to be typed in placeholder.
983
+ */
984
+ typeAndVerifyPlaceholderInputText: (inputText) => {
985
+ essayResponseCommonComponents.placeholderTextInputField()
986
+ .type(inputText);
987
+ },
988
+
989
+ /**
990
+ * @description verify placeholder text in preview tab.
991
+ * @param {string} text - the text to be verified .
992
+ */
993
+ verifyPlaceholderTextPreviewTab: (text) => {
994
+ essayResponsePage.responseField()
995
+ .should('have.attr', 'data-cke-editorplaceholder', text);
996
+ },
997
+
998
+ verifyPlaceholderTextNotPresentInPreviewTab: () => {
999
+ essayResponsePage.responseField()
1000
+ .should('not.have.attr', 'data-cke-editorplaceholder');
1001
+ },
1002
+
1003
+ /**
1004
+ * @param {number} index index of the clipboard function button
1005
+ * @description function verifies content of clipboard function buttons
1006
+ */
1007
+ verifyClipBoardButton: (index) => {
1008
+ utilities.verifyElementVisibilityState(essayResponsePage.clipboardFunctionButton(index), 'visible');
1009
+ utilities.verifyElementVisibilityState(essayResponsePage.clipboardFunctionButtonIcon(index), 'visible');
1010
+ utilities.verifyElementVisibilityState(essayResponsePage.clipboardFunctionButtonTickIcon(index), 'visible');
1011
+ steps.verifyClipboardFunctionButtonSelectedState(index);
1012
+ },
1013
+
1014
+ /**
1015
+ * @param {number} index index of the clipboard function button
1016
+ * @description function verifies clipboard function button is in selected state
1017
+ */
1018
+ verifyClipboardFunctionButtonSelectedState: (index) => {
1019
+ essayResponsePage.clipboardFunctionButton(index)
1020
+ .should('have.attr', 'aria-pressed', 'true');
1021
+ },
1022
+
1023
+ /**
1024
+ * @param {number} index index of the clipboard function button
1025
+ * @description function unselects the clipboard function button
1026
+ */
1027
+ unselectClipboardFunctionButton: (index) => {
1028
+ essayResponsePage.clipboardFunctionButton(index)
1029
+ .click();
1030
+ steps.verifyClipboardFunctionButtonUnselectedState(index);
1031
+ },
1032
+
1033
+ /**
1034
+ * @param {number} index index of the clipboard function button
1035
+ * @description function verifies clipboard function button is in unselected state
1036
+ */
1037
+ verifyClipboardFunctionButtonUnselectedState: (index) => {
1038
+ essayResponsePage.clipboardFunctionButton(index)
1039
+ .should('have.attr', 'aria-pressed', 'false');
1040
+ },
1041
+
1042
+ /**
1043
+ * @param {"Set height"|"No scrolling"} ariaLabel aria label of toggle button
1044
+ * @description selects a toggle button
1045
+ */
1046
+ selectSetHeightNoScrollingToggleButton: (ariaLabel) => {
1047
+ essayResponsePage.setInputFieldheightToggleButton(ariaLabel)
1048
+ .click()
1049
+ .should('have.attr', 'aria-pressed', 'true');
1050
+ },
1051
+
1052
+ /**
1053
+ * @param {string} minHeight height in px to be checked
1054
+ * @description verifies the input field value od minimum height
1055
+ */
1056
+ verifyMinHeightInputFieldValue: (minHeight) => {
1057
+ essayResponsePage.minimumHeightInputField()
1058
+ .should('have.value', `${minHeight}`)
1059
+ },
1060
+
1061
+ /**
1062
+ * @param {string} maxHeight height in px to be checked
1063
+ * @description verifies the input field value od maximum height
1064
+ */
1065
+ verifyMaxHeightInputFieldValue: (maxHeight) => {
1066
+ essayResponsePage.maximumHeightInputField()
1067
+ .should('have.value', `${maxHeight}`)
1068
+ },
1069
+
1070
+ /**
1071
+ * @param {string} minHeight height in px to be checked
1072
+ * @description verifies the max-height attribute of response field in preview tab
1073
+ */
1074
+ verifyMinHeightResponseField: (minHeight) => {
1075
+ essayResponsePage.responseField()
1076
+ .should('have.css', 'min-height', `${minHeight}`);
1077
+ },
1078
+
1079
+ /**
1080
+ * @param {string} maxHeight height in px to be checked
1081
+ * @description verifies the max-height attribute of response field in preview tab
1082
+ */
1083
+ verifyMaxHeightResponseField: (maxHeight) => {
1084
+ essayResponsePage.responseField()
1085
+ .should('have.css', 'max-height', `${maxHeight}`);
1086
+ },
1087
+
1088
+ /**
1089
+ * @param {string} maxHeight height in px to be checked
1090
+ * @description verifies the min-height attribute of response field in preview tab
1091
+ */
1092
+ setMinHeightInput: (inputHeight) => {
1093
+ essayResponsePage.minimumHeightInputField()
1094
+ .clear()
1095
+ .type(`${inputHeight}`)
1096
+ .should('have.value', `${inputHeight}`);
1097
+ },
1098
+
1099
+ /**
1100
+ * @param {string} maxHeight height in px to be checked
1101
+ * @description verifies the max-height attribute of response field in preview tab
1102
+ */
1103
+ setMaxHeightInput: (inputHeight) => {
1104
+ essayResponsePage.maximumHeightInputField()
1105
+ .type(`${inputHeight}`)
1106
+ .should('have.value', `${inputHeight}`);
1107
+ },
958
1108
  }
959
1109
 
960
1110
  const tests = {
@@ -1,5 +1,5 @@
1
1
  import utilities from "../support/helpers/utilities";
2
- import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent } from "./components"
2
+ import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent, colorPopupComponent } from "./components"
3
3
  const css = Cypress.env('css');
4
4
  let imageWidth = 768;
5
5
  let imageHeight = 432;
@@ -39,6 +39,7 @@ const selectors = {
39
39
  cancelButton: () => cy.get('.cancel-button'),
40
40
  clearAllButton: () => cy.get('.clear-button'),
41
41
  specifyPossibleOptionsToolbar: () => cy.get('.drawing-tool__toolbar'),
42
+ toolTipText: () => cy.get('.react-tooltip'),
42
43
  //Specify correct answer section
43
44
  specifyCorrectAnswerSectionImage: () => cy.get('.ngie-accordion .highlight-svg-responseive image'),
44
45
  specifyCorrectAnswerSectionHighlight: () => cy.get('.ngie-accordion [class*="HighlightImageControlstyles__ShapeWrapper"] a'),
@@ -47,6 +48,36 @@ const selectors = {
47
48
  partialEqualWeightsPointsPerResponseScore: () => cy.get('.alternate-points-points-per-value-span'),
48
49
  specifyCorrectAnswerSectionPatternPolygon: () => cy.get('[class*="HighlightImageControlstyles__LinkWrapper"]'),
49
50
  specifyCorrectAnswerDiamondPattern: () => cy.get('[class*="HighlightImageControlstyles__DiamondPattern"]'),
51
+ fillColorButton: () => cy.get('[id*="fillColor"]'),
52
+ borderColorButton: () => cy.get('[id*="strokeColor"]'),
53
+ borderStyleButton: () => cy.get('[id*="borderSetting"]'),
54
+ colorPopupWrapper: () => cy.get('[class*="DrawingToolOptionsstyled__OptionsWrapper"]'),
55
+ colorPopupMenuLabel: () => cy.get('.drawing-tool-options__options__label'),
56
+ defaultStateColorLabel: () => cy.get('.drawing-tool-options__options__options-list__state-text').eq(0),
57
+ activeStateColorLabel: () => cy.get('.drawing-tool-options__options__options-list__state-text').eq(1),
58
+ defaultColorButton: () => cy.get('.drawing-tool-options__options__options-list__button').eq(0),
59
+ activeColorButton: () => cy.get('.drawing-tool-options__options__options-list__button').eq(1),
60
+ defaultStateEditButton: () => cy.get('.drawing-tool-options__options__options-list__edit-color-button').eq(0),
61
+ activeStateEditButton: () => cy.get('.drawing-tool-options__options__options-list__edit-color-button').eq(1),
62
+ defaultEditButtonText: () => cy.get('.drawing-tool-options__options__options-list__edit-text').eq(0),
63
+ activeEditButtonText: () => cy.get('.drawing-tool-options__options__options-list__edit-text').eq(1),
64
+ applyToAllOptionsCheckbox: () => cy.get('.drawing-tool-options__options__options-list__checkbox-input'),
65
+ applyToAllOptionsCheckboxLabel: () => cy.get('.drawing-tool-options__options__options-list__checkbox-text'),
66
+ menuLabelColorPallete: () => cy.get('.drawing-tool-options__options__label'),
67
+ colorPickerLabel: () => cy.get('.drawing-tool-color-picker__label'),
68
+ selectedColorBlockLabelColorPallete: () => cy.get('.drawing-tool-color-picker__selected-color-label'),
69
+ selectedColorBlock: () => cy.get('[class*="ColorPickerstyled__SelectedColorBlock"]'),
70
+ cancelButtonColorPopup: () => cy.get('.drawing-tool-color-picker__footer__cancel-btn'),
71
+ okButtonColorPopup: () => cy.get('.drawing-tool-color-picker__footer__ok-btn'),
72
+ specifyCorrectAnswerSectionCustomizedPolygon: () => cy.get('[class*="HighlightImageControlstyles__LinkWrapper"]'),
73
+ activeDefaultToggleButton: (optionAriaLabel = null) => {
74
+ if (optionAriaLabel) {
75
+ return cy.get(`.drawing-tool-options__options__options-list__toggle-button-group button[aria-label*="${optionAriaLabel}"]`)
76
+ } else {
77
+ return cy.get('.drawing-tool-options__options__options-list__toggle-button-group button')
78
+ }
79
+ },
80
+ popupBorderStyleButtons: () => cy.get('.drawing-tool-options__options__options-list__button'),
50
81
  //preview tab
51
82
  imagePreviewTab: () => cy.get('[class*="question-preview-wrapper"] .highlight-svg-responseive image'),
52
83
  imagePreviewTabWrapper: () => cy.get('[class*="question-preview-wrapper"] .highlight-svg-wrapper'),
@@ -62,6 +93,7 @@ const selectors = {
62
93
  correctIncorrectAnswerTextWrapper: () => cy.get('[class*="_CorrectIncorrectWrapper"]'),
63
94
  incorrectIcon: () => cy.get('[data-icon="Incorrect"]'),
64
95
  correctIcon: () => cy.get('[data-icon="CorrectAnswer"]'),
96
+ previewSectionHighlight: () => cy.get('[class*="HighlightImageControlstyles__ShapeWrapper"] a'),
65
97
  //Additional settings
66
98
  descriptorsAccordion: () => cy.get('.descriptor-wrapper .MuiAccordionSummary-root'),
67
99
  descriptorsHeading: () => cy.get('[class*="Descriptorsstyles__AddToolsHeading"]'),
@@ -978,21 +1010,21 @@ const steps = {
978
1010
  switch (toggleButtonType) {
979
1011
  case 'Filled-in':
980
1012
  imageHighlightPage.filledInToggleButton()
981
- .should('have.attr','aria-pressed','true');
1013
+ .should('have.attr', 'aria-pressed', 'true');
982
1014
  break;
983
1015
  case 'Outline':
984
1016
  imageHighlightPage.outlineToggleButton()
985
- .should('have.attr','aria-pressed','true');
1017
+ .should('have.attr', 'aria-pressed', 'true');
986
1018
  break;
987
1019
  case 'Pattern':
988
1020
  imageHighlightPage.patternToggleButton()
989
- .should('have.attr','aria-pressed','true');
1021
+ .should('have.attr', 'aria-pressed', 'true');
990
1022
  break;
991
1023
  default:
992
- throw new Error('Invalid toggle button');
1024
+ throw new Error('Invalid toggle button');
993
1025
  }
994
1026
  },
995
-
1027
+
996
1028
  /**
997
1029
  * @param {("Filled-in"|"Outline"|"Pattern")} toggleButtonType - Type of toggle button.
998
1030
  * @description Verifies the not-selected state of toggle button.
@@ -1001,18 +1033,18 @@ const steps = {
1001
1033
  switch (toggleButtonType) {
1002
1034
  case 'Filled-in':
1003
1035
  imageHighlightPage.filledInToggleButton()
1004
- .should('have.attr','aria-pressed','false');
1036
+ .should('have.attr', 'aria-pressed', 'false');
1005
1037
  break;
1006
1038
  case 'Outline':
1007
1039
  imageHighlightPage.outlineToggleButton()
1008
- .should('have.attr','aria-pressed','false');
1040
+ .should('have.attr', 'aria-pressed', 'false');
1009
1041
  break;
1010
1042
  case 'Pattern':
1011
1043
  imageHighlightPage.patternToggleButton()
1012
- .should('have.attr','aria-pressed','false');
1044
+ .should('have.attr', 'aria-pressed', 'false');
1013
1045
  break;
1014
1046
  default:
1015
- throw new Error('Invalid toggle button');
1047
+ throw new Error('Invalid toggle button');
1016
1048
  }
1017
1049
  },
1018
1050
 
@@ -1025,7 +1057,7 @@ const steps = {
1025
1057
  imageHighlightPage.patternToggleButton()
1026
1058
  .click();
1027
1059
  },
1028
-
1060
+
1029
1061
  selectPatternToggleButton: () => {
1030
1062
  imageHighlightPage.patternToggleButton()
1031
1063
  .click();
@@ -1051,7 +1083,7 @@ const steps = {
1051
1083
  'stroke': css.color.activeHighlightBorder
1052
1084
  });
1053
1085
  },
1054
-
1086
+
1055
1087
  /**
1056
1088
  * @param {number} index of highlight region
1057
1089
  * @description this function verifies the outlineHighlight of selected highlight in specify correct answer section.
@@ -1071,7 +1103,7 @@ const steps = {
1071
1103
  imageHighlightPage.specifyCorrectAnswerSectionPatternPolygon()
1072
1104
  .eq(index)
1073
1105
  .within(() => {
1074
- utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerDiamondPattern().eq(1),'exist');
1106
+ utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerDiamondPattern().eq(1), 'exist');
1075
1107
  })
1076
1108
  },
1077
1109
 
@@ -1106,7 +1138,7 @@ const steps = {
1106
1138
  imageHighlightPage.previewSectionPatterntPolygon()
1107
1139
  .eq(index)
1108
1140
  .within(() => {
1109
- utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerDiamondPattern().eq(1),'exist');
1141
+ utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerDiamondPattern().eq(1), 'exist');
1110
1142
  });
1111
1143
  },
1112
1144
 
@@ -1158,7 +1190,299 @@ const steps = {
1158
1190
  .type(inputText)
1159
1191
  .blur();
1160
1192
  steps.verifyDescriptorsInputField(index, inputText);
1161
- }
1193
+ },
1194
+
1195
+ clickOnFillColorIcon: () => {
1196
+ imageHighlightPage.fillColorButton()
1197
+ .click()
1198
+ },
1199
+
1200
+ clickOnBorderColorIcon: () => {
1201
+ imageHighlightPage.borderColorButton()
1202
+ .click()
1203
+ },
1204
+
1205
+ clickOnBorderStyleIcon: () => {
1206
+ imageHighlightPage.borderStyleButton()
1207
+ .click()
1208
+ },
1209
+
1210
+ clickOnDefaultStateColorEditButton: () => {
1211
+ imageHighlightPage.defaultStateEditButton()
1212
+ .click()
1213
+ },
1214
+
1215
+ clickOnActiveStateColorEditButton: () => {
1216
+ imageHighlightPage.activeStateEditButton()
1217
+ .click()
1218
+ },
1219
+
1220
+ clickOnCancelButton: () => {
1221
+ imageHighlightPage.cancelButtonColorPopup()
1222
+ .click({ force: true });
1223
+ },
1224
+
1225
+ clickOnOkButton: () => {
1226
+ imageHighlightPage.okButtonColorPopup()
1227
+ .click({ force: true });
1228
+ },
1229
+
1230
+ verifyApplyToAllOptionsCheckboxChecked: () => {
1231
+ imageHighlightPage.applyToAllOptionsCheckbox()
1232
+ .should('be.checked')
1233
+ },
1234
+
1235
+ uncheckApplyToAllOptionsCheckbox: () => {
1236
+ imageHighlightPage.applyToAllOptionsCheckbox()
1237
+ .click()
1238
+ .should('not.be.checked')
1239
+ },
1240
+
1241
+ checkApplyToAllOptionsCheckbox: () => {
1242
+ imageHighlightPage.applyToAllOptionsCheckbox()
1243
+ .click()
1244
+ .should('be.checked')
1245
+ },
1246
+
1247
+ /**
1248
+ * @param {index} button index of tooltip text
1249
+ * @param {HTMLElement} button button to check the tooltip
1250
+ * @param {string} toolTipText text of tool tip
1251
+ * @description this function verifies the tooltip text
1252
+ */
1253
+ verifyToolTipText: (index, button, toolTipText) => {
1254
+ imageHighlightPage.steps.clickOnFreeformTool();
1255
+ button
1256
+ .realHover();
1257
+ utilities.verifyElementVisibilityState(imageHighlightPage.toolTipText(), 'visible');
1258
+ utilities.verifyInnerText(imageHighlightPage.toolTipText().eq(index), toolTipText);
1259
+ },
1260
+
1261
+ /**
1262
+ * @param {"default"|"active"} optionButton type of toggle button
1263
+ * @description this function selects the active/defult toggle button
1264
+ */
1265
+ verifyActiveDefaultToggleButtonSelected: (optionButton) => {
1266
+ imageHighlightPage.activeDefaultToggleButton(optionButton)
1267
+ .should('have.attr', 'aria-pressed', 'true')
1268
+ },
1269
+
1270
+ /**
1271
+ * @param {"default"|"active"} optionButton type of toggle button
1272
+ * @description this function is used to verify in the selected toggle button
1273
+ */
1274
+ selectActiveDefaultToggleButton: (optionButton) => {
1275
+ imageHighlightPage.activeDefaultToggleButton(optionButton)
1276
+ .click()
1277
+ imageHighlightPage.steps.verifyActiveDefaultToggleButtonSelected(optionButton);
1278
+ },
1279
+
1280
+ /**
1281
+ * @param {string} color in the selected color block in rgb/rgba format
1282
+ * @description this function is used to verify in the selected color block of the color popup
1283
+ */
1284
+ verifySelectedColorBlock: (color) => {
1285
+ utilities.verifyCSS(imageHighlightPage.selectedColorBlock(), {
1286
+ 'background-color': color
1287
+ });
1288
+ },
1289
+
1290
+ /**
1291
+ * @param {number} index index of highlight region
1292
+ * @param {string} color color to be checked in rgb/rgba format
1293
+ * @description this function verifiies the fill color of highlight regions in specify correct answer section.
1294
+ */
1295
+ verifyEditedFillColorInSpecifyCorrectAnswerSection: (index, color) => {
1296
+ imageHighlightPage.specifyCorrectAnswerSectionCustomizedPolygon()
1297
+ .eq(index)
1298
+ .within(() => {
1299
+ utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerDiamondPattern(), {
1300
+ 'fill': color
1301
+ });
1302
+ });
1303
+ },
1304
+
1305
+ /**
1306
+ * @param {number} index index of highlight region
1307
+ * @param {string} color color to be checked in rgb/rgba format
1308
+ * @description this function verifiies the fill color of highlight regions in preview tab.
1309
+ */
1310
+ verifyEditedFillColorInPreviewtabSection: (index, color) => {
1311
+ imageHighlightPage.specifyCorrectAnswerSectionCustomizedPolygon()
1312
+ .eq(index)
1313
+ .within(() => {
1314
+ utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerDiamondPattern(), {
1315
+ 'fill': color
1316
+ });
1317
+ });
1318
+ },
1319
+
1320
+ /**
1321
+ * @param {number} index index of highlight region
1322
+ * @param {string} color color to be checked in rgb/rgba format
1323
+ * @description this function verifiies the border color of highlight regions in specify correct answer section.
1324
+ */
1325
+ verifyEditedBorderColorInSpecifyCorrectAnswerSection: (index, color) => {
1326
+ imageHighlightPage.specifyCorrectAnswerSectionHighlight()
1327
+ .eq(index)
1328
+ .within(() => {
1329
+ utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerSectionHighlightPolygon(), {
1330
+ 'stroke': color
1331
+ });
1332
+ });
1333
+ },
1334
+
1335
+ /**
1336
+ * @param {number} index index of highlight region
1337
+ * @param {string} color color to be checked in rgb/rgba format
1338
+ * @description this function verifiies the border color of highlight regions in preview tab.
1339
+ */
1340
+ verifyEditedBorderColorInPreviewtabSection: (index, color) => {
1341
+ imageHighlightPage.previewSectionHighlight()
1342
+ .eq(index)
1343
+ .within(() => {
1344
+ utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerSectionHighlightPolygon(), {
1345
+ 'stroke': color
1346
+ });
1347
+ });
1348
+ },
1349
+
1350
+ verifyBorderStyleButtonsVisible: () => {
1351
+ utilities.verifyElementVisibilityState(imageHighlightPage.popupBorderStyleButtons().eq(0), 'visible');
1352
+ utilities.verifyElementVisibilityState(imageHighlightPage.popupBorderStyleButtons().eq(1), 'visible');
1353
+ utilities.verifyElementVisibilityState(imageHighlightPage.popupBorderStyleButtons().eq(2), 'visible');
1354
+ utilities.verifyElementVisibilityState(imageHighlightPage.popupBorderStyleButtons().eq(3), 'visible');
1355
+ },
1356
+
1357
+ /**
1358
+ * @param {number} index index of highlight region
1359
+ * @param {string} strokeDasharray stroke-dasharray style attribute
1360
+ * @param {string} strokWidth stroke-width style attribute
1361
+ * @description this function verifiies the border style of highlight regions in specify correct answer section.
1362
+ */
1363
+ verifyEditedBorderStyleInSpecifyCorrectAnswerSection: (index, strokeDasharray, strokWidth) => {
1364
+ imageHighlightPage.specifyCorrectAnswerSectionHighlight()
1365
+ .eq(index)
1366
+ .within(() => {
1367
+ utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerSectionHighlightPolygon(), {
1368
+ 'stroke-dasharray': strokeDasharray,
1369
+ 'stroke-width': strokWidth
1370
+ });
1371
+ });
1372
+ },
1373
+
1374
+ /**
1375
+ * @param {number} index index of highlight region
1376
+ * @param {string} strokeDasharray stroke-dasharray style attribute
1377
+ * @param {string} strokWidth stroke-width style attribute
1378
+ * @description this function verifiies the border style of highlight regions in preview tab.
1379
+ */
1380
+ verifyEditedBorderStyleInPreviewTabSection: (index, strokeDasharray, strokWidth) => {
1381
+ imageHighlightPage.previewSectionHighlight()
1382
+ .eq(index)
1383
+ .within(() => {
1384
+ utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerSectionHighlightPolygon(), {
1385
+ 'stroke-dasharray': strokeDasharray,
1386
+ 'stroke-width': strokWidth
1387
+ });
1388
+ });
1389
+ },
1390
+
1391
+ /**
1392
+ * @param {number[]} region co-ordinates of the region to be selected
1393
+ * @description this function selects a region in specify possible options section.
1394
+ */
1395
+ selectARegionInSpecifyPossibleOptions: (region) => {
1396
+ imageHighlightPage.steps.clickOnFreeformTool();
1397
+ imageHighlightPage.specifyPossibleOptionsImageCanvas()
1398
+ .then(($element) => {
1399
+ const clientWidth = $element[0].clientWidth;
1400
+ region.forEach((coordinates) => {
1401
+ imageHighlightPage.specifyPossibleOptionsImageCanvas()
1402
+ .click(coordinates[0] * clientWidth / 100, coordinates[1] * clientWidth / 100);
1403
+ });
1404
+ });
1405
+ },
1406
+
1407
+ /**
1408
+ * @param {("Dashed"|"Dotted"|"Default"|"None")} borderStyle - Type of border style.
1409
+ * @description Verifies the border style for the highlight regions.
1410
+ */
1411
+ selectBorderStyleForHighlightRegions: (borderStyle) => {
1412
+ switch (borderStyle) {
1413
+ case 'Dashed':
1414
+ imageHighlightPage.popupBorderStyleButtons().eq(0)
1415
+ .click()
1416
+ break;
1417
+ case 'Dotted':
1418
+ imageHighlightPage.popupBorderStyleButtons().eq(1)
1419
+ .click()
1420
+ break;
1421
+ case 'Default':
1422
+ imageHighlightPage.popupBorderStyleButtons().eq(2)
1423
+ .click()
1424
+ break;
1425
+ case 'None':
1426
+ imageHighlightPage.popupBorderStyleButtons().eq(3)
1427
+ .click()
1428
+ break;
1429
+ default:
1430
+ throw new Error('Invalid toggle button');
1431
+ }
1432
+ },
1433
+
1434
+ /**
1435
+ * @param {("Dashed"|"Dotted"|"Default"|"None")} borderStyle - Type of border style.
1436
+ * @param {number} index index for the border style.
1437
+ * @description Verifies the border style for the highlight regions in specify correct answer section.
1438
+ */
1439
+ verifyBorderStyleForHighlightRegionsSpecifyCorrectAnswer: (borderStyle, index) => {
1440
+ switch (borderStyle) {
1441
+ case 'Dashed':
1442
+ imageHighlightPage.steps.verifyEditedBorderStyleInSpecifyCorrectAnswerSection(index, '5px, 5px', '2px');
1443
+ break;
1444
+ case 'Dotted':
1445
+ imageHighlightPage.steps.verifyEditedBorderStyleInSpecifyCorrectAnswerSection(index, '2px, 2px', '2px');
1446
+ break;
1447
+ case 'Default':
1448
+ imageHighlightPage.steps.verifyEditedBorderStyleInSpecifyCorrectAnswerSection(index, 'none', '2px');
1449
+ break;
1450
+ case 'None':
1451
+ imageHighlightPage.steps.verifyEditedBorderStyleInSpecifyCorrectAnswerSection(index, 'none', '0px');
1452
+ break;
1453
+ default:
1454
+ throw new Error('Invalid border style');
1455
+ }
1456
+ },
1457
+
1458
+ /**
1459
+ * @param {("Dashed"|"Dotted"|"Default"|"None")} borderStyle - Type of border style.
1460
+ * @param {number} index index for the border style.
1461
+ * @description Verifies the border style for the highlight regions in preview tab.
1462
+ */
1463
+ verifyBorderStyleForHighlightRegionsPreviewTab: (borderStyle, index) => {
1464
+ switch (borderStyle) {
1465
+ case 'Dashed':
1466
+ imageHighlightPage.steps.verifyEditedBorderStyleInPreviewTabSection(index, '5px, 5px', '2px');
1467
+ break;
1468
+ case 'Dotted':
1469
+ imageHighlightPage.steps.verifyEditedBorderStyleInPreviewTabSection(index, '2px, 2px', '2px');
1470
+ break;
1471
+ case 'Default':
1472
+ imageHighlightPage.steps.verifyEditedBorderStyleInPreviewTabSection(index, 'none', '2px');
1473
+ break;
1474
+ case 'None':
1475
+ imageHighlightPage.steps.verifyEditedBorderStyleInPreviewTabSection(index, 'none', '0px');
1476
+ break;
1477
+ default:
1478
+ throw new Error('Invalid border style');
1479
+ }
1480
+ },
1481
+
1482
+ verifyDefaultStyleButtonSelected: () => {
1483
+ imageHighlightPage.popupBorderStyleButtons().eq(2)
1484
+ .should('have.attr', 'aria-pressed', 'true');
1485
+ },
1162
1486
  }
1163
1487
 
1164
1488
  const tests = {
@@ -1251,6 +1575,65 @@ const tests = {
1251
1575
  it('Accessibility of \'Correct\' accordion contents', { tags: 'a11y' }, () => {
1252
1576
  cy.checkAccessibility(imageHighlightPage.specifyCorrectAnswerSectionImage());
1253
1577
  });
1578
+ },
1579
+
1580
+ /**
1581
+ * Verifies the contents, CSS and functionality of the 'color popup' menu for fill color and border color customization.
1582
+ * @param {{'Fill color' | 'Border color'}} customizationOption - The name of option.
1583
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
1584
+ */
1585
+ verifyColorPopupContentCSSandAccessibility: (customizationOption) => {
1586
+ it(`When the user clicks the \'Edit color\' button the label ${customizationOption} should be visible, a \'Select color\' label along with color selector component should be visible. A \'Selected color\' label along with selected color box should be visible. Also \'Cancel\' and \'OK\' button should be visible`, () => {
1587
+ imageHighlightPage.steps.clickOnDefaultStateColorEditButton();
1588
+ utilities.verifyElementVisibilityState(imageHighlightPage.colorPopupMenuLabel(), 'visible');
1589
+ utilities.verifyInnerText(imageHighlightPage.colorPopupMenuLabel(), `${customizationOption}`);
1590
+ utilities.verifyElementVisibilityState(imageHighlightPage.colorPickerLabel(), 'visible');
1591
+ utilities.verifyInnerText(imageHighlightPage.colorPickerLabel(), 'Select color');
1592
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorSaturationPalette(), 'visible');
1593
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorHuePalette(), 'visible');
1594
+ utilities.verifyElementVisibilityState(colorPopupComponent.opacityGradientHue(), 'visible');
1595
+ utilities.verifyElementVisibilityState(imageHighlightPage.selectedColorBlockLabelColorPallete(), 'visible');
1596
+ utilities.verifyInnerText(imageHighlightPage.selectedColorBlockLabelColorPallete(), 'Selected color');
1597
+ utilities.verifyElementVisibilityState(imageHighlightPage.selectedColorBlock(), 'visible');
1598
+ utilities.verifyElementVisibilityState(imageHighlightPage.okButtonColorPopup(), 'exist');
1599
+ utilities.verifyInnerText(imageHighlightPage.okButtonColorPopup(), 'OK');
1600
+ utilities.verifyElementVisibilityState(imageHighlightPage.cancelButtonColorPopup(), 'exist');
1601
+ utilities.verifyInnerText(imageHighlightPage.cancelButtonColorPopup(), 'Cancel');
1602
+ });
1603
+
1604
+ it('CSS of \'Edit color\' popup', { tags: 'css' }, () => {
1605
+ utilities.verifyCSS(imageHighlightPage.menuLabelColorPallete(), {
1606
+ 'color': css.color.labels,
1607
+ 'font-size': css.fontSize.default,
1608
+ 'font-weight': css.fontWeight.semibold
1609
+ });
1610
+ utilities.verifyCSS(imageHighlightPage.colorPickerLabel(), {
1611
+ 'color': css.color.labels,
1612
+ 'font-size': css.fontSize.normal,
1613
+ 'font-weight': css.fontWeight.semibold
1614
+ });
1615
+ utilities.verifyCSS(imageHighlightPage.selectedColorBlockLabelColorPallete(), {
1616
+ 'color': css.color.labels,
1617
+ 'font-size': css.fontSize.normal,
1618
+ 'font-weight': css.fontWeight.semibold
1619
+ });
1620
+ utilities.verifyCSS(imageHighlightPage.cancelButtonColorPopup(), {
1621
+ 'background-color': css.color.primaryBtn,
1622
+ 'font-size': css.fontSize.default,
1623
+ 'font-weight': css.fontWeight.regular,
1624
+ 'border': `1px solid ${css.color.manipulativeOptionContainerBorder}`
1625
+ });
1626
+ utilities.verifyCSS(imageHighlightPage.okButtonColorPopup(), {
1627
+ 'background-color': css.color.activeButtons,
1628
+ 'font-size': css.fontSize.default,
1629
+ 'font-weight': css.fontWeight.regular,
1630
+ 'border': `1px solid ${css.color.gridBorder}`
1631
+ });
1632
+ });
1633
+
1634
+ it('Accessibility of \'Edit color\' popup', { tags: 'a11y' }, () => {
1635
+ cy.checkAccessibility(imageHighlightPage.colorPopupWrapper());
1636
+ });
1254
1637
  }
1255
1638
  }
1256
1639