itemengine-cypress-automation 1.0.202 → 1.0.203

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/cypress/config-files/ilqa.json +1 -1
  2. package/cypress/e2e/ILC/ChartsBar/Scoring/allOrNothingAlternatePointsGreaterThanCorrectPoints.js +2 -2
  3. package/cypress/e2e/ILC/ChartsBar/Scoring/allOrNothingCorrectPointsEqualToAlternatePoints.js +3 -3
  4. package/cypress/e2e/ILC/ChartsBar/Scoring/allOrNothingCorrectPointsGreaterThanAlternatePoints.js +14 -2
  5. package/cypress/e2e/ILC/ChartsBar/Scoring/partialDifferentWeightBasic.js +1 -1
  6. package/cypress/e2e/ILC/ChartsBar/Scoring/partialEqualWeightBasic.js +1 -1
  7. package/cypress/e2e/ILC/ChartsBar/Scoring/partialEqualWeightsAlternativePointsGreaterThanCorrectPoints.js +356 -0
  8. package/cypress/e2e/ILC/ChartsBar/Scoring/partialEqualWeightsCorrectPointsEqualToAlternativePoints.js +320 -0
  9. package/cypress/e2e/ILC/ChartsBar/Scoring/partialEqualWeightsCorrectPointsGreaterThanAlternativePoints.js +355 -0
  10. package/cypress/e2e/ILC/ChartsBar/Scoring/toleranceThresholdScoring.js +141 -0
  11. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/pagination.js +170 -0
  12. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/additionalSettingsForDropzones.js +170 -0
  13. package/cypress/e2e/ILC/ImageHighlight/Scoring/singleSelectionPreviewScoring.js +250 -0
  14. package/cypress/e2e/ILC/ImageHighlight/singleMultipleSelection.js +99 -0
  15. package/cypress/e2e/ILC/MultipleSelectionGridNew/additionalSettings.js +89 -0
  16. package/cypress/e2e/ILC/MultipleSelectionGridNew/styleAndLayoutCustomizationBorderProperties.js +53 -0
  17. package/cypress/e2e/ILC/MultipleSelectionGridNew/styleAndLayoutCustomizationGridProperties.js +98 -0
  18. package/cypress/e2e/ILC/MultipleSelectionGridNew/styleAndLayoutCustomizationLayoutProperties.js +89 -0
  19. package/cypress/e2e/ILC/SingleSelectionGridNew/styleAndLayoutCustomizationBorderProperties.js +54 -0
  20. package/cypress/e2e/ILC/SingleSelectionGridNew/styleAndLayoutCustomizationLayoutProperties.js +90 -0
  21. package/cypress/e2e/ILC/SingleSelectionGridNew/styleAndLayoutCutomizationGridProperties.js +99 -0
  22. package/cypress/e2e/ILC/chartsDotsPlot/scoring/allOrNothingPenaltyScoring.js +61 -0
  23. package/cypress/e2e/ILC/chartsDotsPlot/scoring/partialDifferentWeightsBasic.js +227 -0
  24. package/cypress/e2e/ILC/chartsDotsPlot/scoring/partialDifferentWeightsWithAlternativePointsGreaterThanCorrectPoints.js +380 -0
  25. package/cypress/e2e/ILC/chartsDotsPlot/scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +294 -0
  26. package/cypress/e2e/ILC/chartsDotsPlot/scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +383 -0
  27. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +7 -7
  28. package/cypress/pages/chartsBarPage.js +1 -4
  29. package/cypress/pages/chartsDotPlotPage.js +0 -13
  30. package/cypress/pages/components/additionalSettingsPanel.js +1 -0
  31. package/cypress/pages/components/ariaLabelSectionComponent.js +1 -1
  32. package/cypress/pages/components/chartsCommonComponent.js +19 -0
  33. package/cypress/pages/components/fillInTheGapsDragAndDropCommonComponents.js +1 -0
  34. package/cypress/pages/components/gridQuestionCommonComponent.js +1836 -134
  35. package/cypress/pages/components/singleMultipleSelectionModeComponent.js +74 -1
  36. package/cypress/pages/dragAndDropIntoCategoriesPage.js +25 -2
  37. package/cypress/pages/essayResponsePage.js +9 -1
  38. package/cypress/pages/feedbackScalePage.js +1 -1
  39. package/cypress/pages/fillInTheGapsDragAndDropPage.js +111 -30
  40. package/cypress/pages/matchingPage.js +2 -1
  41. package/cypress/pages/multipleSelectionGridPage.js +4 -2
  42. package/cypress/pages/shortTextResponsePage.js +2 -2
  43. package/cypress/pages/singleSelectionGridPage.js +4 -2
  44. package/cypress/pages/textEntryMathPage.js +1 -0
  45. package/cypress/pages/textEntryMathWithImagePage.js +1 -1
  46. package/cypress/pages/uploadResponsePage.js +1 -3
  47. package/package.json +1 -1
@@ -1,11 +1,30 @@
1
1
  import constants from "../../fixtures/constants";
2
2
  import utilities from "../../support/helpers/utilities";
3
+ import { dialogBoxBase } from "../dialogBoxBase";
4
+ import { ariaLabelSectionComponent } from "./ariaLabelSectionComponent";
3
5
  import { autoScoredScoringPreviewTab } from "./autoScoredScoringPreviewTab";
4
6
  import { autoScoredScoringSectionMultiResponseType } from "./autoScoredScoringSectionMultiResponseType";
5
7
  import { autoScoredSpecifyCorrectAnswerSection } from "./autoScoredSpecifyCorrectAnswerSection";
8
+ import { colorPopupComponent } from "./colorPopupComponent";
6
9
  import { commonComponents } from "./commonComponents";
10
+ import { createQuestionBasePage } from "./createQuestionBasePage";
11
+ import { specifyRowsAndColumnsComponent } from "./specifyRowsAndColumnsComponent";
7
12
  const css = Cypress.env('css');
8
13
 
14
+ const enumerationOptions = {
15
+ 'Numerical': ['1', '2', '3', '4'],
16
+ 'Uppercase alphabet': ['A', 'B', 'C', 'D'],
17
+ 'Lowercase alphabet': ['a', 'b', 'c', 'd'],
18
+ 'uppercase roman numeral': ['I', 'II', 'III', 'IV'],
19
+ 'lowercase roman numeral': ['i', 'ii', 'iii', 'iv'],
20
+ };
21
+ const optionAlignmentOptions = ['left', 'center', 'right'];
22
+ const rowColumnOptions = ['No spacing', 'Small', 'Wide'];
23
+ const columnDimensions = ['Auto', 'Custom'];
24
+ const outerBorder = ['Outer', 'None'];
25
+ const innerBorder = ['Inner', 'Horizontal', 'Vertical', 'None'];
26
+ const modifiedColor = 'rgb(121, 61, 61)'
27
+
9
28
  const selectors = {
10
29
  editCellPropertyButton: () => cy.get('button[aria-label="More Action"]'),
11
30
  editCellPropertyList: () => cy.get('.ngie-action-cell-container [role="menu"]'),
@@ -18,11 +37,18 @@ const selectors = {
18
37
  optionCellPropertyInputField: () => cy.get('[title="Option text or image..."]'),
19
38
  tableRowSpecifyCorrectAnswerSection: () => cy.get('.correct-answer-accordion [class*="wrapper-row"]'),
20
39
  tableRowPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [class*="wrapper-row"]'),
40
+ tableRowHeadersSpecifyCorrectAnswerSection: () => cy.get('.set-correct-ans-selection-grid .cell-content-text'),
41
+ tableRowHeadersPreviewTab: () => cy.get('.preview-selection-grid .cell-content-text'),
21
42
  questionsColumnPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [class*="TableCellWrapper"][class*="col-0"]'),
22
43
  optionsButton: () => cy.get('[class*="PreviewSelectionButton"]'),
44
+ optionsButtonPreviewTab: () => cy.get('.preview-selection-grid [class*="PreviewSelectionButton"]'),
23
45
  gridPreviewTab: () => cy.get('.single-selection-grid-wrapper:visible'),
24
46
  gridSpecifyCorrectAnswerSection: () => cy.get('.set-correct-ans-selection-grid'),
25
47
  tableCell: () => cy.get('[class*="CellContainer"]'),
48
+ tableCellWrapperSpecifyCorrectAnswerSection: () => cy.get('.set-correct-ans-selection-grid [class*="TableCellWrapper"]'),
49
+ tableCellWrapperPreviewTab: () => cy.get('.preview-selection-grid [class*="TableCellWrapper"]'),
50
+ tableCellSpecifyCorrectAnswerSection: () => cy.get('.set-correct-ans-selection-grid [class*="CellContainer"]'),
51
+ tableCellPreviewTab: () => cy.get('.preview-selection-grid [class*="CellContainer"]'),
26
52
  correctAnswerGrid: () => cy.get('.correct-ans-selection-grid'),
27
53
  tableRow: () => cy.get('[class*="wrapper-row"]'),
28
54
  correctAnswersSectionLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="CorrectAnswerHeader"]'),
@@ -52,7 +78,83 @@ const selectors = {
52
78
  return cy.get('[aria-labelledby*="Default-text-dropdown-label"] [role="option"]')
53
79
  }
54
80
  },
55
- specifyRowsAndColumnsTableHelpText: () => cy.get('[class*="GridPropertiesstyles__HelperTextWrapper"]')
81
+ specifyRowsAndColumnsTableHelpText: () => cy.get('[class*="GridPropertiesstyles__HelperTextWrapper"]'),
82
+ //Additional settings
83
+ rowStyleAndLayoutTitle: () => cy.get('.row-style-additional-settings .additional-settings-heading-label'),
84
+ rowNumerationLabel: () => cy.get('.row-style-additional-settings #row-numeration-dropdown-label'),
85
+ rowNumerationDropdown: () => cy.get('.row-style-additional-settings #row-numeration-select'),
86
+ rowNumerationDropdownOptions: (ariaLabel = null) => {
87
+ if (ariaLabel) {
88
+ return cy.get(`[aria-labelledby*="row-numeration-dropdown-label"] .dropdown-menu-item[aria-label*="${ariaLabel}"]`)
89
+ } else {
90
+ return cy.get(`[aria-labelledby*="row-numeration-dropdown-label"] .dropdown-menu-item`)
91
+ }
92
+ },
93
+ numerationStyleLabel: () => cy.get('.row-style-additional-settings .additional-settings-label'),
94
+ numerationStyleOptions: () => cy.get('[class*="NumerationStyleWrapper"] button'),
95
+ rowNumerationSpecifyCorrectAnswerSection: () => cy.get('.selection-grid-wrapper [class*="__NumerationWrapper"]'),
96
+ rowNumerationPreviewTab: () => cy.get('.preview-selection-grid [class*="SelectionGridstyles__NumerationWrapper"]'),
97
+ optionAlignmentInCellLabel: () => cy.get('.option-alignment .options-label'),
98
+ optionAlignmentInCellButton: (ariaLabel = null) => {
99
+ if (ariaLabel) {
100
+ return cy.get(`.option-alignment button[aria-label*="${ariaLabel}"]`)
101
+ } else {
102
+ return cy.get(`.option-alignment button`)
103
+ }
104
+ },
105
+ //Style and layout customization
106
+ layoutLabel: () => cy.get('[class*="Layoutstyles__SectionWrapper"]'),
107
+ rowSpacingDropdownLabel: () => cy.get('#Row-spacing-dropdown-label'),
108
+ rowSpacingDropdown: () => cy.get('[aria-labelledby*="Row-spacing-dropdown-label"]'),
109
+ rowSpacingDropdownOptions: (ariaLabel = null) => {
110
+ if (ariaLabel) {
111
+ return cy.get(`[aria-labelledby*="Row-spacing-dropdown-label"] .dropdown-menu-item[aria-label*="${ariaLabel}"]`)
112
+ } else {
113
+ return cy.get(`[aria-labelledby*="Row-spacing-dropdown-label"] .dropdown-menu-item`)
114
+ }
115
+ },
116
+ columnSpacingDropdownLabel: () => cy.get('#Column-spacing-dropdown-label'),
117
+ columnSpacingDropdown: () => cy.get('[aria-labelledby*="Column-spacing-dropdown-label"]'),
118
+ columnSpacingDropdownOptions: (ariaLabel = null) => {
119
+ if (ariaLabel) {
120
+ return cy.get(`[aria-labelledby*="Column-spacing-dropdown-label"] .dropdown-menu-item[aria-label*="${ariaLabel}"]`)
121
+ } else {
122
+ return cy.get(`[aria-labelledby*="Column-spacing-dropdown-label"] .dropdown-menu-item`)
123
+ }
124
+ },
125
+ cellMinimumHeightLabel: () => cy.get('[for="cell minimum height"]'),
126
+ cellMinimumHeightInputField: () => cy.get('[id="cell minimum height"]'),
127
+ columnDimensionsLabel: () => cy.get('#column-dimensions-dropdown-label'),
128
+ columnDimensionsDropdown: () => cy.get('#column-dimensions-select'),
129
+ columnDimensionsDropdownOptions: (ariaLabel = null) => {
130
+ if (ariaLabel) {
131
+ return cy.get(`[aria-labelledby*="column-dimensions-dropdown-label"] .dropdown-menu-item[aria-label*="${ariaLabel}"]`)
132
+ } else {
133
+ return cy.get(`[aria-labelledby*="column-dimensions-dropdown-label"] .dropdown-menu-item`)
134
+ }
135
+ },
136
+ specifyForAllColumnsLabel: () => cy.get('.ngie-radio-label[aria-label="Specify for all columns"]'),
137
+ specifyForAllColumnsRadioButton: () => cy.get('[type="radio"][aria-label="Specify for all columns"]'),
138
+ specifyForFirstColumnOnlyLabel: () => cy.get('.ngie-radio-label[aria-label="Specify for first column only"]'),
139
+ specifyForFirstColumnOnlyRadioButton: () => cy.get('[type="radio"][aria-label="Specify for first column only"]'),
140
+ specifyForIndividualColumnsLabel: () => cy.get('.ngie-radio-label[aria-label="Specify for individual columns"]'),
141
+ specifyForIndividualColumnsRadioButton: () => cy.get('[type="radio"][aria-label="Specify for individual columns"]'),
142
+ columnWidthLabel: () => cy.get('.additional-settings-label[for*="width"]'),
143
+ columnWidthInputField: () => cy.get('input[id*="width"]'),
144
+ enableOuterBorderForQuestionLabel: () => cy.get('.grid-style-layout-wrapper .options-label').eq(0),
145
+ enableOuterBorderForQuestionOptions: (outerBorderOption) => cy.get(`.options-border-style button[aria-label*="Enable outer border"][value="${outerBorderOption}"]`),
146
+ innerBorderLabel: () => cy.get('.grid-style-layout-wrapper .options-label').eq(1),
147
+ innerBorderOptions: (innerBorderOption) => cy.get(`.options-border-style button[aria-label*="inner border"][value="${innerBorderOption}"]`),
148
+ applyToAllColumnsLabel: () => cy.get('label[aria-label="apply to all columns"]'),
149
+ applyToAllColumnsRadioButton: () => cy.get('input[value="applyToAll"]'),
150
+ applyToFirstColumnLabel: () => cy.get('label[aria-label="apply to first column only"]'),
151
+ applyToFirstColumnRadioButton: () => cy.get('input[value="applyToFirstColumnOnly"]'),
152
+ gridLabel: () => cy.get('[class*="Gridstyles__SectionWrapper"]'),
153
+ fillColorLabel: () => cy.get('.sub-section-label').eq(0),
154
+ borderColorLabel: () => cy.get('.sub-section-label').eq(1),
155
+ colorBlock: () => cy.get('.color-picker-block'),
156
+ editColorButton: () => cy.get('button[aria-label="edit color"]'),
157
+ colorBlockSelectedIcon: () => cy.get('[class*="BtnSelectionWrapper"] svg'),
56
158
  }
57
159
 
58
160
  const steps = {
@@ -853,7 +955,7 @@ const steps = {
853
955
  gridQuestionCommonComponent.editCellPropertyRow()
854
956
  .eq(0)
855
957
  .within(() => {
856
- utilities.verifyElementVisibilityState(gridQuestionCommonComponent.tableCell().eq(columnIndex), 'visible');
958
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.tableCell().eq(columnIndex), 'exist');
857
959
  });
858
960
  },
859
961
 
@@ -999,172 +1101,1063 @@ const steps = {
999
1101
  utilities.verifyElementVisibilityState(commonComponents.errorIcon(), 'notExist');
1000
1102
  });
1001
1103
  });
1002
- }
1003
- }
1104
+ },
1004
1105
 
1005
- const tests = {
1006
- verifyContentsOfSpecifyCorrectAnswerSection: () => {
1007
- it(`When the user selects any scoring type except for manual scored, then the question grid should be displayed in the specify correct answer section`, () => {
1008
- gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 0, column: 0 }, 'None');
1009
- gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 0, column: 1 }, 'Heading');
1010
- gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 0, column: 1 }, 'True');
1011
- gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 0, column: 2 }, 'Heading');
1012
- gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 0, column: 2 }, 'False');
1013
- gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 1, column: 0 }, 'Heading');
1014
- gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 1, column: 0 }, 'Elephants are the only mammals that can\'t jump');
1015
- gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 1, column: 1 }, 'Radio button');
1016
- gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 2, column: 0 }, 'Subheading');
1017
- gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 2, column: 0 }, 'Bats are blind and navigate by using echolocation');
1018
- gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 3, column: 0 }, 'Whale are mammals');
1019
- gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 4, column: 0 }, 'Tigers can jump upto 3 metres');
1106
+ //Additional settings
1107
+ expandRowNumerationDropdown: () => {
1108
+ gridQuestionCommonComponent.rowNumerationDropdown()
1109
+ .click();
1110
+ },
1020
1111
 
1021
- });
1112
+ /**
1113
+ * This function selects an option from the row numeration dropdown
1114
+ * @param {string} dropdownAriaLabel Aria-label of the dropdown option
1115
+ */
1116
+ selectOptionFromRowNumerationDropdown: (dropdownAriaLabel) => {
1117
+ gridQuestionCommonComponent.rowNumerationDropdownOptions(dropdownAriaLabel)
1118
+ .click();
1022
1119
  },
1023
1120
 
1024
1121
  /**
1025
- * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
1026
- * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
1027
- * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
1122
+ * This function verifies selected state of an option from the row numeration dropdown
1123
+ * @param {string} dropdownAriaLabel Aria-label of the dropdown option
1124
+ */
1125
+ verifyRowNumerationOptionSelected: (dropdownAriaLabel) => {
1126
+ gridQuestionCommonComponent.rowNumerationDropdownOptions(dropdownAriaLabel)
1127
+ .should('have.attr', 'aria-selected', 'true')
1128
+ },
1129
+
1130
+ /**
1131
+ * This function selects numeration style option
1132
+ * @param {number} index of the numeration style option
1028
1133
  */
1029
- verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
1030
- it(`The user should be able to check an option in the ${accordionName} accordion`, () => {
1031
- gridQuestionCommonComponent.steps.setAnswerInSpecifyCorrectAnswerSection({ row: 1, column: 0 });
1134
+ selectNumerationStyleOption: (index) => {
1135
+ gridQuestionCommonComponent.numerationStyleOptions()
1136
+ .eq(index)
1137
+ .click();
1138
+ },
1139
+
1140
+ /**
1141
+ * This function verified the selected state of numeration style option
1142
+ * @param {number} index of the numeration style
1143
+ */
1144
+ verifyNumerationStyleOptionSelected: (index) => {
1145
+ gridQuestionCommonComponent.numerationStyleOptions()
1146
+ .eq(index)
1147
+ .should('have.attr', 'aria-selected', 'true')
1148
+ },
1149
+
1150
+ /**
1151
+ * This function verified the numeration on grid row
1152
+ * @param {string[]} numerationArray array of numeration expected
1153
+ */
1154
+ verifyRowNumerationSpecifyCorrectAnswer: (numerationArray) => {
1155
+ numerationArray.forEach((option, index) => {
1156
+ gridQuestionCommonComponent.rowNumerationSpecifyCorrectAnswerSection()
1157
+ .eq(index)
1158
+ .should('have.text', option)
1032
1159
  });
1160
+ },
1033
1161
 
1034
- it(`When the user has unchecked all the options in the ${accordionName} accordion, \'Error: Please set a correct answer.\' error message should be thrown along with an error icon on the \'${accordionName}\' accordion`, () => {
1035
- gridQuestionCommonComponent.steps.uncheckOptionInSpecifyCorrectAnswerSection({ row: 1, column: 0 });
1036
- utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible')
1037
- utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.');
1038
- if (accordionName == 'Correct') {
1039
- autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
1040
- .within(() => {
1041
- utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'visible');
1162
+ /**
1163
+ * Verifies the border-radius CSS property of the row numeration section based on the given index.
1164
+ *
1165
+ * @param {number} index - The index representing the numeration style to verify.
1166
+ */
1167
+ verifyNumerationStyleSpecifyCorrectAnswer: (index) => {
1168
+ switch (index) {
1169
+ case 0:
1170
+ gridQuestionCommonComponent.rowNumerationSpecifyCorrectAnswerSection()
1171
+ .each(($el) => {
1172
+ cy.wrap($el)
1173
+ .should('have.css', 'border-radius', '7px');
1042
1174
  });
1043
- } else {
1044
- autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
1045
- .within(() => {
1046
- utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'visible');
1175
+ break;
1176
+ case 1:
1177
+ gridQuestionCommonComponent.rowNumerationSpecifyCorrectAnswerSection()
1178
+ .each(($el) => {
1179
+ cy.wrap($el)
1180
+ .should('have.css', 'border-radius', '0px');
1047
1181
  });
1048
- };
1049
- });
1050
-
1051
- autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredCorrectAnswerErrorMessageCSSAndA11y();
1182
+ break;
1183
+ case 2:
1184
+ gridQuestionCommonComponent.rowNumerationSpecifyCorrectAnswerSection()
1185
+ .each(($el) => {
1186
+ cy.wrap($el)
1187
+ .should('have.css', 'border-radius', '50%');
1188
+ });
1189
+ break;
1190
+ default:
1191
+ throw new Error(`Unsupported index: ${index}`);
1192
+ }
1193
+ },
1052
1194
 
1053
- it('When the user checks an option in the question grid, the error message should disappear', () => {
1054
- gridQuestionCommonComponent.steps.setAnswersForAllQuestionStemsInSpecifyCorrectAnswerSection([{ row: 1, column: 0 }, { row: 2, column: 1 }, { row: 3, column: 0 }, { row: 4, column: 1 }]);
1055
- commonComponents.steps.verifyErrorMessageIsNotDisplayed();
1195
+ /**
1196
+ * This function verified the numeration on grid row
1197
+ * @param {string[]} numerationArray array of numeration expected
1198
+ */
1199
+ verifyRowNumerationPreviewTab: (numerationArray) => {
1200
+ numerationArray.forEach((option, index) => {
1201
+ gridQuestionCommonComponent.rowNumerationPreviewTab()
1202
+ .eq(index)
1203
+ .should('have.text', option)
1056
1204
  });
1205
+ },
1057
1206
 
1058
- autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
1059
-
1060
- it('CSS of \'Correct\' accordion contents', { tags: 'css' }, () => {
1061
- gridQuestionCommonComponent.gridSpecifyCorrectAnswerSection()
1062
- .within(() => {
1063
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell().parent(), 1), {
1064
- 'background-color': css.color.matrixHeadingCellBg,
1065
- 'border-color': `${css.color.matrixCellBorder}`
1207
+ /**
1208
+ * Verifies the border-radius CSS property of the row numeration section based on the given index.
1209
+ * @param {number} index - The index representing the numeration style to verify.
1210
+ */
1211
+ verifyNumerationStylePreviewTab: (index) => {
1212
+ switch (index) {
1213
+ case 0:
1214
+ gridQuestionCommonComponent.rowNumerationPreviewTab()
1215
+ .each(($el) => {
1216
+ cy.wrap($el)
1217
+ .should('have.css', 'border-radius', '7px');
1066
1218
  });
1067
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell().parent(), 6), {
1068
- 'background-color': css.color.matrixSubheadingCellBg,
1069
- 'border-color': `${css.color.matrixCellBorder}`
1219
+ break;
1220
+ case 1:
1221
+ gridQuestionCommonComponent.rowNumerationPreviewTab()
1222
+ .each(($el) => {
1223
+ cy.wrap($el)
1224
+ .should('have.css', 'border-radius', '0px');
1070
1225
  });
1071
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell().parent(), 9), {
1072
- 'background-color': css.color.defaultBackground,
1073
- 'border-color': `${css.color.matrixCellBorder}`
1226
+ break;
1227
+ case 2:
1228
+ gridQuestionCommonComponent.rowNumerationPreviewTab()
1229
+ .each(($el) => {
1230
+ cy.wrap($el)
1231
+ .should('have.css', 'border-radius', '50%');
1074
1232
  });
1075
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.optionsButton, 0), {
1076
- 'background-color': css.color.matrixHeadingCellBg,
1077
- 'color': `${css.color.matrixCellBorder}`
1233
+ break;
1234
+ default:
1235
+ throw new Error(`Unsupported index: ${index}`);
1236
+ }
1237
+ },
1238
+
1239
+ /**
1240
+ * This function selects alignment option
1241
+ * @param {string} option alignment option to be selected
1242
+ */
1243
+ selectAlignmentOption: (option) => {
1244
+ gridQuestionCommonComponent.optionAlignmentInCellButton(option)
1245
+ .click();
1246
+ },
1247
+
1248
+ /**
1249
+ * This function verifies alignment option selected state
1250
+ * @param {string} option alignment option to be selected
1251
+ */
1252
+ verifyOptionAlignmentInCellButtonSelected: (option) => {
1253
+ gridQuestionCommonComponent.optionAlignmentInCellButton(option)
1254
+ .should('have.attr', 'aria-selected', 'true');
1255
+ },
1256
+
1257
+ /**
1258
+ * This function verifies the alignment of the options
1259
+ * @param {("left"|"right"|"center")} alignmentType of the options
1260
+ */
1261
+ verifyOptionAlignmentInCellSpecifyCorrectAnswerSection: (alignmentType) => {
1262
+ switch (alignmentType) {
1263
+ case 'left':
1264
+ gridQuestionCommonComponent.optionsButton()
1265
+ .each(($el) => {
1266
+ cy.wrap($el)
1267
+ .should('have.css', 'justify-content', 'flex-start')
1078
1268
  });
1079
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.optionsButton, 0).find('svg'), {
1080
- 'color': css.color.activeButtons
1269
+ break;
1270
+ case 'center':
1271
+ gridQuestionCommonComponent.optionsButton()
1272
+ .each(($el) => {
1273
+ cy.wrap($el)
1274
+ .should('have.css', 'justify-content', 'center')
1081
1275
  });
1082
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell(), 1).find('.question-text-wrapper'), {
1083
- 'color': css.color.text,
1084
- 'font-size': css.fontSize.heading,
1085
- 'font-weight': css.fontWeight.bold
1276
+ break;
1277
+ case 'right':
1278
+ gridQuestionCommonComponent.optionsButton()
1279
+ .each(($el) => {
1280
+ cy.wrap($el)
1281
+ .should('have.css', 'justify-content', 'flex-end')
1086
1282
  });
1087
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell(), 6).find('.question-text-wrapper'), {
1088
- 'color': css.color.text,
1089
- 'font-size': css.fontSize.default,
1090
- 'font-weight': css.fontWeight.bold
1283
+ break;
1284
+ default:
1285
+ throw new Error(`Unsupported alignment option: ${alignmentType}`);
1286
+ }
1287
+ },
1288
+
1289
+ /**
1290
+ * This function verifies the alignment of the options
1291
+ * @param {("left"|"right"|"center")} alignmentType of the options
1292
+ */
1293
+ verifyOptionAlignmentInCellPreviewTab: (alignmentType) => {
1294
+ switch (alignmentType) {
1295
+ case 'left':
1296
+ gridQuestionCommonComponent.optionsButtonPreviewTab()
1297
+ .each(($el) => {
1298
+ cy.wrap($el)
1299
+ .should('have.css', 'justify-content', 'flex-start')
1091
1300
  });
1092
- utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell(), 9).find('.question-text-wrapper'), {
1093
- 'color': css.color.text,
1094
- 'font-size': css.fontSize.default,
1095
- 'font-weight': css.fontWeight.regular
1301
+ break;
1302
+ case 'center':
1303
+ gridQuestionCommonComponent.optionsButtonPreviewTab()
1304
+ .each(($el) => {
1305
+ cy.wrap($el)
1306
+ .should('have.css', 'justify-content', 'center')
1096
1307
  });
1097
- });
1098
- });
1308
+ break;
1309
+ case 'right':
1310
+ gridQuestionCommonComponent.optionsButtonPreviewTab()
1311
+ .each(($el) => {
1312
+ cy.wrap($el)
1313
+ .should('have.css', 'justify-content', 'flex-end')
1314
+ });
1315
+ break;
1316
+ default:
1317
+ throw new Error(`Unsupported alignment option: ${alignmentType}`);
1318
+ }
1319
+ },
1099
1320
 
1100
- it('Accessibility of \'Correct\' accordion contents', { tags: 'a11y' }, () => {
1101
- cy.checkAccessibility(gridQuestionCommonComponent.tableCell().parents('.correct-answer-accordion'));
1102
- });
1321
+ /**
1322
+ * This function verifies aria-label of the table row
1323
+ * @param {string} ariaLabel of the table row
1324
+ */
1325
+ verifyRowHeaderAriaLabelSpecifyCorrectAnswerSection: (ariaLabel) => {
1326
+ gridQuestionCommonComponent.tableRowHeadersSpecifyCorrectAnswerSection()
1327
+ .should('have.attr', 'aria-label', ariaLabel)
1103
1328
  },
1104
1329
 
1105
1330
  /**
1106
- * Verifies the contents of the 'Default options' dropdown
1107
- * @param {{'Multiple selection grid' | 'Single selection grid'}} questionType - The name of the question type to be used for validation.
1108
- * @example - verifyDefaultOptionLabelAndDropdown('Multiple selection grid');
1331
+ * This function verifies aria-label of the table row
1332
+ * @param {string} ariaLabel of the table row
1109
1333
  */
1110
- verifyDefaultOptionLabelAndDropdown: (questionType) => {
1111
- const cellPropertyArray = (questionType === 'Multiple selection grid') ?
1112
- ['Checkboxes', 'Checkboxes with text', 'No checkboxes'] :
1113
- ['Radio buttons', 'Radio buttons with text', 'No radio buttons'];
1334
+ verifyRowHeaderAriaLabelPreviewTab: (ariaLabel) => {
1335
+ gridQuestionCommonComponent.tableRowHeadersPreviewTab()
1336
+ .should('have.attr', 'aria-label', ariaLabel)
1337
+ },
1114
1338
 
1115
- it(`'Default option' label and dropdown should be displayed and in 'Default option' dropdown '${cellPropertyArray[0]}' option should be selected by default`, () => {
1116
- utilities.verifyInnerText(gridQuestionCommonComponent.defaultOptionLabel(), 'Default option');
1117
- utilities.verifyInnerText(gridQuestionCommonComponent.defaultOptionDropdown(), cellPropertyArray[0]);
1118
- utilities.verifyElementVisibilityState(gridQuestionCommonComponent.defaultOptionDropdown(), 'visible');
1119
- });
1339
+ expandRowSpacingDropdown: () => {
1340
+ gridQuestionCommonComponent.rowSpacingDropdown()
1341
+ .click();
1342
+ },
1120
1343
 
1121
- it(`Clicking on default option dropdown should open a list of default option types - ${cellPropertyArray}`, () => {
1122
- gridQuestionCommonComponent.steps.expandDefaultOptionDropdown()
1123
- utilities.verifyElementVisibilityState(gridQuestionCommonComponent.defaultOptionDropdownListOptions().eq(0), 'visible')
1124
- cellPropertyArray.forEach((option, count) => {
1125
- utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.defaultOptionDropdownListOptions(), count), option);
1126
- });
1127
- });
1344
+ /**
1345
+ * This function selects row spacing option
1346
+ * @param {string} rowSpacingOption of the row spacing
1347
+ */
1348
+ selectRowSpacingDropdownOption: (rowSpacingOption) => {
1349
+ gridQuestionCommonComponent.rowSpacingDropdownOptions(rowSpacingOption)
1350
+ .click();
1351
+ },
1128
1352
 
1129
- it('CSS of default option type dropdown in active state', { tags: 'css' }, () => {
1130
- utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionDropdownListOptions().eq(0), {
1131
- 'color': css.color.liText,
1132
- 'font-size': css.fontSize.default,
1133
- 'font-weight': css.fontWeight.regular,
1134
- 'background-color': css.color.liTextSelectedBg
1135
- })
1136
- utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionDropdownListOptions().eq(1), {
1137
- 'background-color': css.color.transparent
1138
- });
1139
- });
1353
+ /**
1354
+ * This function verified the selected state of row spacing option
1355
+ * @param {string} rowSpacingOption of the row spacing
1356
+ */
1357
+ verifyRowSpacingOptionSelected: (rowSpacingOption) => {
1358
+ gridQuestionCommonComponent.rowSpacingDropdownOptions(rowSpacingOption)
1359
+ .should('have.attr', 'aria-selected', 'true');
1360
+ },
1140
1361
 
1141
- it('Accessibility of default option type dropdown in active state', { tags: 'a11y' }, () => {
1142
- cy.checkAccessibility(commonComponents.dropdownList())
1143
- });
1362
+ /**
1363
+ * This function verifies the row spacing
1364
+ * @param {("No spacing"|"Small"|"Wide")} spacing of the rows
1365
+ */
1366
+ verifyTableRowSpacingSpecifyCorrectAnswerSection: (spacing) => {
1367
+ switch (spacing) {
1368
+ case 'No spacing':
1369
+ gridQuestionCommonComponent.tableRowSpecifyCorrectAnswerSection()
1370
+ .each(($el) => {
1371
+ cy.wrap($el)
1372
+ .should('have.css', 'margin-bottom', '0px');
1373
+ });
1374
+ break;
1375
+ case 'Small':
1376
+ gridQuestionCommonComponent.tableRowSpecifyCorrectAnswerSection()
1377
+ .each(($el) => {
1378
+ cy.wrap($el)
1379
+ .should('have.css', 'margin-bottom', '8px');
1380
+ });
1381
+ break;
1382
+ case 'Wide':
1383
+ gridQuestionCommonComponent.tableRowSpecifyCorrectAnswerSection()
1384
+ .each(($el) => {
1385
+ cy.wrap($el)
1386
+ .should('have.css', 'margin-bottom', '24px');
1387
+ });
1388
+ break;
1389
+ default:
1390
+ throw new Error(`Unsupported spacing option: ${spacing}`);
1391
+ }
1392
+ },
1144
1393
 
1145
- it('On selecting an option from the default option dropdown, the dropdown should close', () => {
1146
- gridQuestionCommonComponent.steps.selectOptionFromDefaultOptionDropdown(cellPropertyArray[1]);
1147
- utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist');
1148
- });
1394
+ /**
1395
+ * This function verifies the row spacing
1396
+ * @param {("No spacing"|"Small"|"Wide")} spacing of the rows
1397
+ */
1398
+ verifyTableRowSpacingPreviewTab: (spacing) => {
1399
+ switch (spacing) {
1400
+ case 'No spacing':
1401
+ gridQuestionCommonComponent.tableRowPreviewTab()
1402
+ .each(($el) => {
1403
+ cy.wrap($el)
1404
+ .should('have.css', 'margin-bottom', '0px');
1405
+ });
1406
+ break;
1407
+ case 'Small':
1408
+ gridQuestionCommonComponent.tableRowPreviewTab()
1409
+ .each(($el) => {
1410
+ cy.wrap($el)
1411
+ .should('have.css', 'margin-bottom', '8px');
1412
+ });
1413
+ break;
1414
+ case 'Wide':
1415
+ gridQuestionCommonComponent.tableRowPreviewTab()
1416
+ .each(($el) => {
1417
+ cy.wrap($el)
1418
+ .should('have.css', 'margin-bottom', '24px');
1419
+ });
1420
+ break;
1421
+ default:
1422
+ throw new Error(`Unsupported spacing option: ${spacing}`);
1423
+ }
1424
+ },
1149
1425
 
1150
- it('CSS of default option section', { tags: 'css' }, () => {
1151
- utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionLabel(), {
1152
- 'color': css.color.labels,
1153
- 'font-size': css.fontSize.normal,
1154
- 'font-weight': css.fontWeight.semibold
1155
- });
1156
- utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionDropdown().find('.dropdown-label-text'), {
1157
- 'color': css.color.liText,
1158
- 'font-size': css.fontSize.default,
1159
- 'font-weight': css.fontWeight.regular
1160
- });
1161
- });
1426
+ expandColumnSpacingDropdown: () => {
1427
+ gridQuestionCommonComponent.columnSpacingDropdown()
1428
+ .click();
1162
1429
  },
1163
1430
 
1164
- verifyDefaultTextLabelAndDropdown: () => {
1165
- const defaultTextDropdown = ['True / false', 'Yes / no', 'Agree / disagree', 'Custom'];
1166
- it(`\'Default text\' label and dropdown should be displayed and in \'Default text\' dropdown \'${defaultTextDropdown[0]}\' option should be selected by default`, () => {
1167
- utilities.verifyInnerText(gridQuestionCommonComponent.defaultTextLabel(), 'Default text');
1431
+ /**
1432
+ * This function selects row spacing option
1433
+ * @param {string} rowSpacingOption of the row spacing
1434
+ */
1435
+ selectColumnSpacingDropdownOption: (rowSpacingOption) => {
1436
+ gridQuestionCommonComponent.columnSpacingDropdownOptions(rowSpacingOption)
1437
+ .click();
1438
+ },
1439
+
1440
+ /**
1441
+ * This function verified the selected state of row spacing option
1442
+ * @param {string} rowSpacingOption of the row spacing
1443
+ */
1444
+ verifyColumnSpacingOptionSelected: (rowSpacingOption) => {
1445
+ gridQuestionCommonComponent.columnSpacingDropdownOptions(rowSpacingOption)
1446
+ .should('have.attr', 'aria-selected', 'true');
1447
+ },
1448
+
1449
+ /**
1450
+ * This function verifies the row spacing
1451
+ * @param {("No spacing"|"Small"|"Wide")} spacing of the rows
1452
+ */
1453
+ verifyTableColumnSpacingSpecifyCorrectAnswerSection: (spacing) => {
1454
+ switch (spacing) {
1455
+ case 'No spacing':
1456
+ gridQuestionCommonComponent.tableRowSpecifyCorrectAnswerSection()
1457
+ .each(($el) => {
1458
+ cy.wrap($el)
1459
+ .should('have.css', 'column-gap', '0px');
1460
+ });
1461
+ break;
1462
+ case 'Small':
1463
+ gridQuestionCommonComponent.tableRowSpecifyCorrectAnswerSection()
1464
+ .each(($el) => {
1465
+ cy.wrap($el)
1466
+ .should('have.css', 'column-gap', '8px');
1467
+ });
1468
+ break;
1469
+ case 'Wide':
1470
+ gridQuestionCommonComponent.tableRowSpecifyCorrectAnswerSection()
1471
+ .each(($el) => {
1472
+ cy.wrap($el)
1473
+ .should('have.css', 'column-gap', '24px');
1474
+ });
1475
+ break;
1476
+ default:
1477
+ throw new Error(`Unsupported spacing option: ${spacing}`);
1478
+ }
1479
+ },
1480
+
1481
+ /**
1482
+ * This function verifies the row spacing
1483
+ * @param {("No spacing"|"Small"|"Wide")} spacing of the rows
1484
+ */
1485
+ verifyTableColumnSpacingPreviewTab: (spacing) => {
1486
+ switch (spacing) {
1487
+ case 'No spacing':
1488
+ gridQuestionCommonComponent.tableRowPreviewTab()
1489
+ .each(($el) => {
1490
+ cy.wrap($el)
1491
+ .should('have.css', 'column-gap', '0px');
1492
+ });
1493
+ break;
1494
+ case 'Small':
1495
+ gridQuestionCommonComponent.tableRowPreviewTab()
1496
+ .each(($el) => {
1497
+ cy.wrap($el)
1498
+ .should('have.css', 'column-gap', '8px');
1499
+ });
1500
+ break;
1501
+ case 'Wide':
1502
+ gridQuestionCommonComponent.tableRowPreviewTab()
1503
+ .each(($el) => {
1504
+ cy.wrap($el)
1505
+ .should('have.css', 'column-gap', '24px');
1506
+ });
1507
+ break;
1508
+ default:
1509
+ throw new Error(`Unsupported spacing option: ${spacing}`);
1510
+ }
1511
+ },
1512
+
1513
+ /**
1514
+ * This function enters text in cell height input field
1515
+ * @param {number} cellHeight of the rows
1516
+ */
1517
+ enterTextInCellMinimumHeightInputField: (cellHeight) => {
1518
+ gridQuestionCommonComponent.cellMinimumHeightInputField()
1519
+ .clear()
1520
+ .type(cellHeight)
1521
+ .should('have.value', cellHeight);
1522
+ gridQuestionCommonComponent.cellMinimumHeightInputField()
1523
+ .blur();
1524
+ },
1525
+
1526
+ /**
1527
+ * This function verifies text in cell height input field
1528
+ * @param {number} cellHeight of the rows
1529
+ */
1530
+ verifyCellMinimumHeightInputField: (cellHeight) => {
1531
+ gridQuestionCommonComponent.cellMinimumHeightInputField()
1532
+ .should('have.value', cellHeight);
1533
+ },
1534
+
1535
+ /**
1536
+ * This function verifies cell height specify correct answer section
1537
+ * @param {number} cellHeight of the rows
1538
+ */
1539
+ verifyCellMinimumHeightSpecifyCorrectAnswer: (cellHeight) => {
1540
+ gridQuestionCommonComponent.tableRowHeadersSpecifyCorrectAnswerSection()
1541
+ .each(($el) => {
1542
+ cy.wrap($el)
1543
+ .should('have.css', 'min-height', `${cellHeight}px`)
1544
+ });
1545
+ },
1546
+
1547
+ /**
1548
+ * This function verifies cell height preview tab
1549
+ * @param {number} cellHeight of the rows
1550
+ */
1551
+ verifyCellMinimumHeightPreviewTab: (cellHeight) => {
1552
+ gridQuestionCommonComponent.tableRowHeadersPreviewTab()
1553
+ .each(($el) => {
1554
+ cy.wrap($el)
1555
+ .should('have.css', 'min-height', `${cellHeight}px`)
1556
+ });
1557
+ },
1558
+
1559
+ expandColumnDimensionsDropdown: () => {
1560
+ gridQuestionCommonComponent.columnDimensionsDropdown()
1561
+ .click();
1562
+ },
1563
+
1564
+ /**
1565
+ * This function verified the selected state of column dimension dropdown
1566
+ * @param {string} columnDimensionsOption of the column dimension dropdown
1567
+ */
1568
+ selectColumnDimensionsDropdownOption: (columnDimensionsOption) => {
1569
+ gridQuestionCommonComponent.columnDimensionsDropdownOptions(columnDimensionsOption)
1570
+ .click();
1571
+ },
1572
+
1573
+ /**
1574
+ * This function verified the selected state of column dimension dropdown
1575
+ * @param {string} columnDimensionsOption of the column dimension dropdown
1576
+ */
1577
+ verifyColumnDimensionsDropdownOptionSelected: (columnDimensionsOption) => {
1578
+ gridQuestionCommonComponent.columnDimensionsDropdownOptions(columnDimensionsOption)
1579
+ .should('have.attr', 'aria-selected', 'true');
1580
+ },
1581
+
1582
+ /**
1583
+ * This function verifies the dimension of the column
1584
+ * @param {("Auto"|"Custom")} dimension of the column
1585
+ */
1586
+ verifyColumnDimensionsSpecifyCorrectAnswer: (dimension) => {
1587
+ switch (dimension) {
1588
+ case 'Auto':
1589
+ gridQuestionCommonComponent.tableRowHeadersSpecifyCorrectAnswerSection()
1590
+ .each(($el) => {
1591
+ cy.wrap($el)
1592
+ .should('not.have.css', 'width', '225px');
1593
+ });
1594
+ break;
1595
+ case 'Custom':
1596
+ gridQuestionCommonComponent.tableRowHeadersSpecifyCorrectAnswerSection()
1597
+ .each(($el) => {
1598
+ cy.wrap($el)
1599
+ .should('have.css', 'width', '225px');
1600
+ });
1601
+ break;
1602
+ default:
1603
+ throw new Error(`Unsupported spacing option: ${dimension}`);
1604
+ }
1605
+ },
1606
+
1607
+ /**
1608
+ * This function verifies the dimension of the column
1609
+ * @param {("Auto"|"Custom")} dimension of the column
1610
+ */
1611
+ verifyColumnDimensionsPreviewTab: (dimension) => {
1612
+ switch (dimension) {
1613
+ case 'Auto':
1614
+ gridQuestionCommonComponent.tableRowHeadersPreviewTab()
1615
+ .each(($el) => {
1616
+ cy.wrap($el)
1617
+ .should('not.have.css', 'width', '225px');
1618
+ });
1619
+ break;
1620
+ case 'Custom':
1621
+ gridQuestionCommonComponent.tableRowHeadersPreviewTab()
1622
+ .each(($el) => {
1623
+ cy.wrap($el)
1624
+ .should('have.css', 'width', '225px');
1625
+ });
1626
+ break;
1627
+ default:
1628
+ throw new Error(`Unsupported spacing option: ${dimension}`);
1629
+ }
1630
+ },
1631
+
1632
+ /**
1633
+ * This function verifies selected state of radio button
1634
+ * @param {("Specify for all columns"|"Specify for first column only"|"Specify for individual columns")} radioButton in custom dimensions section
1635
+ */
1636
+ verifyCustomDimensionsRadioButtonSelected: (radioButton) => {
1637
+ switch (radioButton) {
1638
+ case 'Specify for all columns':
1639
+ gridQuestionCommonComponent.specifyForAllColumnsRadioButton()
1640
+ .should('be.checked');
1641
+ break;
1642
+ case 'Specify for first column only':
1643
+ gridQuestionCommonComponent.specifyForFirstColumnOnlyRadioButton()
1644
+ .should('be.checked');
1645
+ break;
1646
+ case 'Specify for individual columns':
1647
+ gridQuestionCommonComponent.specifyForIndividualColumnsRadioButton()
1648
+ .should('be.checked');
1649
+ break;
1650
+ default:
1651
+ throw new Error(`Unsupported dimension option: ${radioButton}`);
1652
+ }
1653
+ },
1654
+
1655
+ /**
1656
+ * This function verifies selected state of radio button
1657
+ * @param {{"Specify for all columns"|"Specify for first column only"|"Specify for individual columns"}} radioButton in custom dimensions section
1658
+ */
1659
+ selectCustomDimensionsRadioButton: (radioButton) => {
1660
+ switch (radioButton) {
1661
+ case 'Specify for all columns':
1662
+ gridQuestionCommonComponent.specifyForAllColumnsRadioButton()
1663
+ .click()
1664
+ .should('be.checked');
1665
+ break;
1666
+ case 'Specify for first column only':
1667
+ gridQuestionCommonComponent.specifyForFirstColumnOnlyRadioButton()
1668
+ .click()
1669
+ .should('be.checked');
1670
+ break;
1671
+ case 'Specify for individual columns':
1672
+ gridQuestionCommonComponent.specifyForIndividualColumnsRadioButton()
1673
+ .click()
1674
+ .should('be.checked');
1675
+ break;
1676
+ default:
1677
+ throw new Error(`Unsupported dimension option: ${radioButton}`);
1678
+ }
1679
+ },
1680
+
1681
+ verifyTableColumnWidthSpecifyCorrectAnswer: (index, width) => {
1682
+ gridQuestionCommonComponent.tableCellSpecifyCorrectAnswerSection()
1683
+ .eq(index)
1684
+ .should('have.css', 'width', `${width}px`);
1685
+ },
1686
+
1687
+ verifyTableColumnDoeNotHaveSpecifiedWidthSpecifyCorrectAnswer: (index, width) => {
1688
+ gridQuestionCommonComponent.tableCellSpecifyCorrectAnswerSection()
1689
+ .eq(index)
1690
+ .should('not.have.css', 'width', `${width}px`);
1691
+ },
1692
+
1693
+ verifyColumnWidthInputField: (index, width) => {
1694
+ gridQuestionCommonComponent.columnWidthInputField()
1695
+ .eq(index)
1696
+ .should('have.value', width);
1697
+ },
1698
+
1699
+ enterTextInColumnWidthInputField: (index, width) => {
1700
+ gridQuestionCommonComponent.columnWidthInputField()
1701
+ .eq(index)
1702
+ .clear()
1703
+ .type(width);
1704
+ gridQuestionCommonComponent.columnWidthInputField()
1705
+ .eq(index)
1706
+ .blur();
1707
+ },
1708
+
1709
+ verifyTableColumnWidthPreviewTab: (index, width) => {
1710
+ gridQuestionCommonComponent.tableCellPreviewTab()
1711
+ .eq(index)
1712
+ .should('have.css', 'width', `${width}px`);
1713
+ },
1714
+
1715
+ verifyTableColumnDoeNotHaveSpecifiedWidthPreviewTab: (index, width) => {
1716
+ gridQuestionCommonComponent.tableCellPreviewTab()
1717
+ .eq(index)
1718
+ .should('not.have.css', 'width', `${width}px`);
1719
+ },
1720
+
1721
+ /**
1722
+ * This function verified the selected state of outer border option
1723
+ * @param {string} outerBorderOption
1724
+ */
1725
+ verifyOuterBorderOptionSelected: (outerBorderOption) => {
1726
+ gridQuestionCommonComponent.enableOuterBorderForQuestionOptions(outerBorderOption)
1727
+ .should('have.attr', 'aria-pressed', 'true');
1728
+ },
1729
+
1730
+ /**
1731
+ * This function verified the selected state of outer border option
1732
+ * @param {string} outerBorderOption
1733
+ */
1734
+ selectOuterBorderOption: (outerBorderOption) => {
1735
+ gridQuestionCommonComponent.enableOuterBorderForQuestionOptions(outerBorderOption)
1736
+ .click();
1737
+ },
1738
+
1739
+ verifyTableOuterBorderSpecifyCorrectAnswer: (outerBorder) => {
1740
+ switch (outerBorder) {
1741
+ case 'Outer':
1742
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1743
+ .eq(0)
1744
+ .should('have.css', 'border-bottom-width', '1px')
1745
+ .should('have.css', 'border-left-width', '1px')
1746
+ .should('have.css', 'border-top-width', '0px')
1747
+ .should('have.css', 'border-right-width', '1px');
1748
+ break;
1749
+ case 'None':
1750
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1751
+ .eq(0)
1752
+ .should('have.css', 'border-bottom-width', '0px')
1753
+ .should('have.css', 'border-left-width', '0px')
1754
+ .should('have.css', 'border-top-width', '1px')
1755
+ .should('have.css', 'border-right-width', '1px');
1756
+ break;
1757
+ default:
1758
+ throw new Error(`Unsupported outer border option: ${outerBorder}`);
1759
+ }
1760
+ },
1761
+
1762
+ verifyTableOuterBorderPreviewTab: (outerBorder) => {
1763
+ switch (outerBorder) {
1764
+ case 'Outer':
1765
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1766
+ .eq(0)
1767
+ .should('have.css', 'border-bottom-width', '1px')
1768
+ .should('have.css', 'border-left-width', '1px')
1769
+ .should('have.css', 'border-top-width', '0px')
1770
+ .should('have.css', 'border-right-width', '1px');
1771
+ break;
1772
+ case 'None':
1773
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1774
+ .eq(0)
1775
+ .should('have.css', 'border-bottom-width', '0px')
1776
+ .should('have.css', 'border-left-width', '0px')
1777
+ .should('have.css', 'border-top-width', '1px')
1778
+ .should('have.css', 'border-right-width', '1px');
1779
+ break;
1780
+ default:
1781
+ throw new Error(`Unsupported outer border option: ${outerBorder}`);
1782
+ }
1783
+ },
1784
+
1785
+ /**
1786
+ * This function verified the selected state of inner border option
1787
+ * @param {("inner"|"horizontal"|"vertical"|"none")} innerBorderOption
1788
+ */
1789
+ verifyInnerBorderOptionSelected: (innerBorderOption) => {
1790
+ gridQuestionCommonComponent.innerBorderOptions(innerBorderOption.toLowerCase())
1791
+ .should('have.attr', 'aria-pressed', 'true');
1792
+ },
1793
+
1794
+ /**
1795
+ * This function verified the selected state of inner border option
1796
+ * @param {string} innerBorderOption
1797
+ */
1798
+ selectInnerBorderOption: (innerBorderOption) => {
1799
+ gridQuestionCommonComponent.innerBorderOptions(innerBorderOption.toLowerCase())
1800
+ .click();
1801
+ },
1802
+
1803
+ verifyTableInnerBorderSpecifyCorrectAnswer: (innerBorderOption) => {
1804
+ switch (innerBorderOption) {
1805
+ case 'Inner':
1806
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1807
+ .eq(0)
1808
+ .should('have.css', 'border-bottom-width', '1px')
1809
+ .should('have.css', 'border-left-width', '1px')
1810
+ .should('have.css', 'border-top-width', '0px')
1811
+ .should('have.css', 'border-right-width', '1px');
1812
+ break;
1813
+ case 'Horizontal':
1814
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1815
+ .eq(0)
1816
+ .should('have.css', 'border-bottom-width', '0px')
1817
+ .should('have.css', 'border-left-width', '1px')
1818
+ .should('have.css', 'border-top-width', '1px')
1819
+ .should('have.css', 'border-right-width', '0px');
1820
+ break;
1821
+ case 'Vertical':
1822
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1823
+ .eq(0)
1824
+ .should('have.css', 'border-bottom-width', '0px')
1825
+ .should('have.css', 'border-left-width', '1px')
1826
+ .should('have.css', 'border-top-width', '0px')
1827
+ .should('have.css', 'border-right-width', '1px');
1828
+ break;
1829
+ case 'Vertical - apply to first column':
1830
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1831
+ .eq(0)
1832
+ .should('have.css', 'border-bottom-width', '0px')
1833
+ .should('have.css', 'border-left-width', '1px')
1834
+ .should('have.css', 'border-top-width', '0px')
1835
+ .should('have.css', 'border-right-width', '1px');
1836
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1837
+ .eq(1)
1838
+ .should('have.css', 'border-bottom-width', '0px')
1839
+ .should('have.css', 'border-left-width', '0px')
1840
+ .should('have.css', 'border-top-width', '0px')
1841
+ .should('have.css', 'border-right-width', '0px');
1842
+ break;
1843
+ case 'None':
1844
+ gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection()
1845
+ .eq(0)
1846
+ .should('have.css', 'border-bottom-width', '0px')
1847
+ .should('have.css', 'border-left-width', '1px')
1848
+ .should('have.css', 'border-top-width', '0px')
1849
+ .should('have.css', 'border-right-width', '0px');
1850
+ break;
1851
+ }
1852
+ },
1853
+
1854
+ verifyApplyToAllColumnsRadioButtonSelectedState: () => {
1855
+ gridQuestionCommonComponent.applyToAllColumnsRadioButton()
1856
+ .should('be.checked');
1857
+ },
1858
+
1859
+ checkApplyToFirstColumnRadioButton: () => {
1860
+ gridQuestionCommonComponent.applyToFirstColumnRadioButton()
1861
+ .click()
1862
+ .should('be.checked');
1863
+ },
1864
+
1865
+ verifyTableInnerBorderPreviewTab: (innerBorderOption) => {
1866
+ switch (innerBorderOption) {
1867
+ case 'Inner':
1868
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1869
+ .eq(0)
1870
+ .should('have.css', 'border-bottom-width', '1px')
1871
+ .should('have.css', 'border-left-width', '1px')
1872
+ .should('have.css', 'border-top-width', '0px')
1873
+ .should('have.css', 'border-right-width', '1px');
1874
+ break;
1875
+ case 'Horizontal':
1876
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1877
+ .eq(0)
1878
+ .should('have.css', 'border-bottom-width', '0px')
1879
+ .should('have.css', 'border-left-width', '1px')
1880
+ .should('have.css', 'border-top-width', '1px')
1881
+ .should('have.css', 'border-right-width', '0px');
1882
+ break;
1883
+ case 'Vertical':
1884
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1885
+ .eq(0)
1886
+ .should('have.css', 'border-bottom-width', '0px')
1887
+ .should('have.css', 'border-left-width', '1px')
1888
+ .should('have.css', 'border-top-width', '0px')
1889
+ .should('have.css', 'border-right-width', '1px');
1890
+ break;
1891
+ case 'Vertical - apply to first column':
1892
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1893
+ .eq(0)
1894
+ .should('have.css', 'border-bottom-width', '0px')
1895
+ .should('have.css', 'border-left-width', '1px')
1896
+ .should('have.css', 'border-top-width', '0px')
1897
+ .should('have.css', 'border-right-width', '1px');
1898
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1899
+ .eq(1)
1900
+ .should('have.css', 'border-bottom-width', '0px')
1901
+ .should('have.css', 'border-left-width', '0px')
1902
+ .should('have.css', 'border-top-width', '0px')
1903
+ .should('have.css', 'border-right-width', '0px');
1904
+ break;
1905
+ case 'None':
1906
+ gridQuestionCommonComponent.tableCellWrapperPreviewTab()
1907
+ .eq(0)
1908
+ .should('have.css', 'border-bottom-width', '0px')
1909
+ .should('have.css', 'border-left-width', '1px')
1910
+ .should('have.css', 'border-top-width', '0px')
1911
+ .should('have.css', 'border-right-width', '0px');
1912
+ break;
1913
+ }
1914
+ },
1915
+
1916
+ /**
1917
+ * Clicks on the edit color button.
1918
+ * @param {number} buttonIndex - The index of the edit color button.
1919
+ */
1920
+ editColor: (buttonIndex) => {
1921
+ utilities.getNthElement(gridQuestionCommonComponent.editColorButton(), buttonIndex)
1922
+ .click();
1923
+ },
1924
+
1925
+ /**
1926
+ * Verifies the color of a color block.
1927
+ * @param {number} blockIndex - The index of the color block.
1928
+ * @param {string} color - The expected background color of the color block.
1929
+ */
1930
+ verifyColorBlockColor: (blockIndex, color) => {
1931
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), blockIndex), {
1932
+ 'background-color': color
1933
+ });
1934
+ },
1935
+
1936
+ /**
1937
+ * @param {number} blockIndex index of the color block in the style and layout customization section
1938
+ * @description this function verifies the selected state of a block
1939
+ */
1940
+ verifyColorBlockSelectedState: (blockIndex) => {
1941
+ utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), blockIndex)
1942
+ .should('have.class', 'selected-button-icon')
1943
+ .within(() => {
1944
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.colorBlockSelectedIcon(), 'visible');
1945
+ });
1946
+ },
1947
+
1948
+ /**
1949
+ * Verifies the background color of grid
1950
+ * @param {string} colorValue - The expected background color value.
1951
+ */
1952
+ verifyGridFillColorSpecifyCorrectAnswerSection: (colorValue) => {
1953
+ utilities.verifyCSS(gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection(), {
1954
+ 'background-color': colorValue
1955
+ });
1956
+ },
1957
+
1958
+ /**
1959
+ * Verifies the background color of grid
1960
+ * @param {string} colorValue - The expected background color value.
1961
+ */
1962
+ verifyGridFillColorPreviewTab: (colorValue) => {
1963
+ utilities.verifyCSS(gridQuestionCommonComponent.tableCellWrapperPreviewTab(), {
1964
+ 'background-color': colorValue
1965
+ });
1966
+ },
1967
+
1968
+ /**
1969
+ * Verifies the border color of grid
1970
+ * @param {string} colorValue - The expected border color value.
1971
+ */
1972
+ verifyGridBorderColorSpecifyCorrectAnswer: (colorValue) => {
1973
+ utilities.verifyCSS(gridQuestionCommonComponent.tableCellWrapperSpecifyCorrectAnswerSection(), {
1974
+ 'border-color': colorValue
1975
+ });
1976
+ },
1977
+
1978
+ /**
1979
+ * Verifies the border color of grid
1980
+ * @param {string} colorValue - The expected border color value.
1981
+ */
1982
+ verifyGridBorderColorPreviewTab: (colorValue) => {
1983
+ utilities.verifyCSS(gridQuestionCommonComponent.tableCellWrapperPreviewTab(), {
1984
+ 'border-color': colorValue
1985
+ });
1986
+ },
1987
+
1988
+ /**
1989
+ * Selects a color block by index.
1990
+ * @param {number} blockIndex - The index of the color block to select.
1991
+ */
1992
+ selectColorBlock: (blockIndex) => {
1993
+ utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), blockIndex)
1994
+ .click();
1995
+ }
1996
+ }
1997
+
1998
+ const tests = {
1999
+ verifyContentsOfSpecifyCorrectAnswerSection: () => {
2000
+ it(`When the user selects any scoring type except for manual scored, then the question grid should be displayed in the specify correct answer section`, () => {
2001
+ gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 0, column: 0 }, 'None');
2002
+ gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 0, column: 1 }, 'Heading');
2003
+ gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 0, column: 1 }, 'True');
2004
+ gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 0, column: 2 }, 'Heading');
2005
+ gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 0, column: 2 }, 'False');
2006
+ gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 1, column: 0 }, 'Heading');
2007
+ gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 1, column: 0 }, 'Elephants are the only mammals that can\'t jump');
2008
+ gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 1, column: 1 }, 'Radio button');
2009
+ gridQuestionCommonComponent.steps.verifyTableCellPropertySpecifyCorrectAnswerSection({ row: 2, column: 0 }, 'Subheading');
2010
+ gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 2, column: 0 }, 'Bats are blind and navigate by using echolocation');
2011
+ gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 3, column: 0 }, 'Whale are mammals');
2012
+ gridQuestionCommonComponent.steps.verifyTextInCellPropertyInputField({ row: 4, column: 0 }, 'Tigers can jump upto 3 metres');
2013
+
2014
+ });
2015
+ },
2016
+
2017
+ /**
2018
+ * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
2019
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
2020
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
2021
+ */
2022
+ verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
2023
+ it(`The user should be able to check an option in the ${accordionName} accordion`, () => {
2024
+ gridQuestionCommonComponent.steps.setAnswerInSpecifyCorrectAnswerSection({ row: 1, column: 0 });
2025
+ });
2026
+
2027
+ it(`When the user has unchecked all the options in the ${accordionName} accordion, \'Error: Please set a correct answer.\' error message should be thrown along with an error icon on the \'${accordionName}\' accordion`, () => {
2028
+ gridQuestionCommonComponent.steps.uncheckOptionInSpecifyCorrectAnswerSection({ row: 1, column: 0 });
2029
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible')
2030
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.');
2031
+ if (accordionName == 'Correct') {
2032
+ autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
2033
+ .within(() => {
2034
+ utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'visible');
2035
+ });
2036
+ } else {
2037
+ autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
2038
+ .within(() => {
2039
+ utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'visible');
2040
+ });
2041
+ };
2042
+ });
2043
+
2044
+ autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredCorrectAnswerErrorMessageCSSAndA11y();
2045
+
2046
+ it('When the user checks an option in the question grid, the error message should disappear', () => {
2047
+ gridQuestionCommonComponent.steps.setAnswersForAllQuestionStemsInSpecifyCorrectAnswerSection([{ row: 1, column: 0 }, { row: 2, column: 1 }, { row: 3, column: 0 }, { row: 4, column: 1 }]);
2048
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
2049
+ });
2050
+
2051
+ autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
2052
+
2053
+ it(`CSS of \'${accordionName}\' accordion contents`, { tags: 'css' }, () => {
2054
+ gridQuestionCommonComponent.gridSpecifyCorrectAnswerSection()
2055
+ .within(() => {
2056
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell().parent(), 1), {
2057
+ 'background-color': css.color.matrixHeadingCellBg,
2058
+ 'border-color': `${css.color.matrixCellBorder}`
2059
+ });
2060
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell().parent(), 6), {
2061
+ 'background-color': css.color.matrixSubheadingCellBg,
2062
+ 'border-color': `${css.color.matrixCellBorder}`
2063
+ });
2064
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell().parent(), 9), {
2065
+ 'background-color': css.color.defaultBackground,
2066
+ 'border-color': `${css.color.matrixCellBorder}`
2067
+ });
2068
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.optionsButton, 0), {
2069
+ 'background-color': css.color.matrixHeadingCellBg,
2070
+ 'color': `${css.color.matrixCellBorder}`
2071
+ });
2072
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.optionsButton, 0).find('svg'), {
2073
+ 'color': css.color.activeButtons
2074
+ });
2075
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell(), 1).find('.question-text-wrapper'), {
2076
+ 'color': css.color.text,
2077
+ 'font-size': css.fontSize.heading,
2078
+ 'font-weight': css.fontWeight.bold
2079
+ });
2080
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell(), 6).find('.question-text-wrapper'), {
2081
+ 'color': css.color.text,
2082
+ 'font-size': css.fontSize.default,
2083
+ 'font-weight': css.fontWeight.bold
2084
+ });
2085
+ utilities.verifyCSS(utilities.getNthElement(gridQuestionCommonComponent.tableCell(), 9).find('.question-text-wrapper'), {
2086
+ 'color': css.color.text,
2087
+ 'font-size': css.fontSize.default,
2088
+ 'font-weight': css.fontWeight.regular
2089
+ });
2090
+ });
2091
+ });
2092
+
2093
+ it('Accessibility of \'Correct\' accordion contents', { tags: 'a11y' }, () => {
2094
+ cy.checkAccessibility(gridQuestionCommonComponent.tableCell().parents('.correct-answer-accordion'));
2095
+ });
2096
+ },
2097
+
2098
+ /**
2099
+ * Verifies the contents of the 'Default options' dropdown
2100
+ * @param {{'Multiple selection grid' | 'Single selection grid'}} questionType - The name of the question type to be used for validation.
2101
+ * @example - verifyDefaultOptionLabelAndDropdown('Multiple selection grid');
2102
+ */
2103
+ verifyDefaultOptionLabelAndDropdown: (questionType) => {
2104
+ const cellPropertyArray = (questionType === 'Multiple selection grid') ?
2105
+ ['Checkboxes', 'Checkboxes with text', 'No checkboxes'] :
2106
+ ['Radio buttons', 'Radio buttons with text', 'No radio buttons'];
2107
+
2108
+ it(`'Default option' label and dropdown should be displayed and in 'Default option' dropdown '${cellPropertyArray[0]}' option should be selected by default`, () => {
2109
+ utilities.verifyInnerText(gridQuestionCommonComponent.defaultOptionLabel(), 'Default option');
2110
+ utilities.verifyInnerText(gridQuestionCommonComponent.defaultOptionDropdown(), cellPropertyArray[0]);
2111
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.defaultOptionDropdown(), 'visible');
2112
+ });
2113
+
2114
+ it(`Clicking on default option dropdown should open a list of default option types - ${cellPropertyArray}`, () => {
2115
+ gridQuestionCommonComponent.steps.expandDefaultOptionDropdown()
2116
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.defaultOptionDropdownListOptions().eq(0), 'visible')
2117
+ cellPropertyArray.forEach((option, count) => {
2118
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.defaultOptionDropdownListOptions(), count), option);
2119
+ });
2120
+ });
2121
+
2122
+ it('CSS of default option type dropdown in active state', { tags: 'css' }, () => {
2123
+ utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionDropdownListOptions().eq(0), {
2124
+ 'color': css.color.liText,
2125
+ 'font-size': css.fontSize.default,
2126
+ 'font-weight': css.fontWeight.regular,
2127
+ 'background-color': css.color.liTextSelectedBg
2128
+ })
2129
+ utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionDropdownListOptions().eq(1), {
2130
+ 'background-color': css.color.transparent
2131
+ });
2132
+ });
2133
+
2134
+ it('Accessibility of default option type dropdown in active state', { tags: 'a11y' }, () => {
2135
+ cy.checkAccessibility(commonComponents.dropdownList())
2136
+ });
2137
+
2138
+ it('On selecting an option from the default option dropdown, the dropdown should close', () => {
2139
+ gridQuestionCommonComponent.steps.selectOptionFromDefaultOptionDropdown(cellPropertyArray[1]);
2140
+ utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist');
2141
+ });
2142
+
2143
+ it('CSS of default option section', { tags: 'css' }, () => {
2144
+ utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionLabel(), {
2145
+ 'color': css.color.labels,
2146
+ 'font-size': css.fontSize.normal,
2147
+ 'font-weight': css.fontWeight.semibold
2148
+ });
2149
+ utilities.verifyCSS(gridQuestionCommonComponent.defaultOptionDropdown().find('.dropdown-label-text'), {
2150
+ 'color': css.color.liText,
2151
+ 'font-size': css.fontSize.default,
2152
+ 'font-weight': css.fontWeight.regular
2153
+ });
2154
+ });
2155
+ },
2156
+
2157
+ verifyDefaultTextLabelAndDropdown: () => {
2158
+ const defaultTextDropdown = ['True / false', 'Yes / no', 'Agree / disagree', 'Custom'];
2159
+ it(`\'Default text\' label and dropdown should be displayed and in \'Default text\' dropdown \'${defaultTextDropdown[0]}\' option should be selected by default`, () => {
2160
+ utilities.verifyInnerText(gridQuestionCommonComponent.defaultTextLabel(), 'Default text');
1168
2161
  utilities.verifyInnerText(gridQuestionCommonComponent.defaultTextDropdown(), defaultTextDropdown[0]);
1169
2162
  utilities.verifyElementVisibilityState(gridQuestionCommonComponent.defaultTextDropdown(), 'visible');
1170
2163
  });
@@ -1333,6 +2326,715 @@ const tests = {
1333
2326
  });
1334
2327
  });
1335
2328
  },
2329
+
2330
+ verifyRowNumerationContents: () => {
2331
+ const enumerationOptions = ['Numerical', 'Uppercase alphabet', 'Lowercase alphabet', 'Uppercase roman numeral', 'Lowercase roman numeral'];
2332
+ it('\'Row style and layout\' label should be displayed', () => {
2333
+ utilities.verifyInnerText(gridQuestionCommonComponent.rowStyleAndLayoutTitle(), 'Row style and layout');
2334
+ });
2335
+
2336
+ it('\'Row numeration\' label and dropdown should be displayed and by default \'None\' should be selected', () => {
2337
+ utilities.verifyInnerText(gridQuestionCommonComponent.rowNumerationLabel(), 'Row numeration');
2338
+ utilities.verifyInnerText(gridQuestionCommonComponent.rowNumerationDropdown(), 'None');
2339
+ });
2340
+
2341
+ it('By default, \'Numeration style\' label and options should not be displayed', () => {
2342
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.numerationStyleLabel(), 'notExist');
2343
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.numerationStyleOptions(), 'notExist');
2344
+ });
2345
+
2346
+ it(`When user expands the dropdown ${enumerationOptions.join(', ')} should be displayed and by default None should be selected`, () => {
2347
+ gridQuestionCommonComponent.steps.expandRowNumerationDropdown();
2348
+ enumerationOptions.forEach((dropdownOption, index) => {
2349
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.rowNumerationDropdownOptions(), index), dropdownOption)
2350
+ });
2351
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.rowNumerationDropdownOptions(), 5), 'None');
2352
+ gridQuestionCommonComponent.steps.verifyRowNumerationOptionSelected('None');
2353
+ });
2354
+
2355
+ it('When the user selects any option other than \'None\' then a \'Numeration style\' label should be displayed with 3 options', () => {
2356
+ gridQuestionCommonComponent.steps.selectOptionFromRowNumerationDropdown('Uppercase alphabet');
2357
+ utilities.verifyInnerText(gridQuestionCommonComponent.numerationStyleLabel(), 'Numeration style');
2358
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.numerationStyleOptions(), 'visible');
2359
+ utilities.verifyElementCount(gridQuestionCommonComponent.numerationStyleOptions(), 3);
2360
+ });
2361
+
2362
+ it('By default the first numeration style should be selected', () => {
2363
+ gridQuestionCommonComponent.steps.verifyNumerationStyleOptionSelected(0);
2364
+ });
2365
+ },
2366
+
2367
+ verifyRowNumerationEditTabFunctionality: () => {
2368
+ it('When \'None\' option is selected then row numeration should not be displayed', () => {
2369
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.rowNumerationSpecifyCorrectAnswerSection(), 'notExist');
2370
+ });
2371
+
2372
+ Object.keys(enumerationOptions).forEach(option => {
2373
+ it(`When "${option}" option is selected in the dropdown, then in the specify correct answer section grid, numeration should be displayed`, () => {
2374
+ gridQuestionCommonComponent.steps.expandRowNumerationDropdown();
2375
+ gridQuestionCommonComponent.steps.selectOptionFromRowNumerationDropdown(option);
2376
+ gridQuestionCommonComponent.steps.verifyRowNumerationSpecifyCorrectAnswer(enumerationOptions[option]);
2377
+ });
2378
+ });
2379
+
2380
+ it('By default, the numbers displayed should be according to the first numeration style', () => {
2381
+ gridQuestionCommonComponent.steps.verifyNumerationStyleSpecifyCorrectAnswer(0);
2382
+ });
2383
+
2384
+ it('When user selects other numeration style options they should be reflected in the specify correct answer section grid', () => {
2385
+ gridQuestionCommonComponent.steps.selectNumerationStyleOption(1);
2386
+ gridQuestionCommonComponent.steps.verifyNumerationStyleSpecifyCorrectAnswer(1);
2387
+ gridQuestionCommonComponent.steps.selectNumerationStyleOption(2);
2388
+ gridQuestionCommonComponent.steps.verifyNumerationStyleSpecifyCorrectAnswer(2);
2389
+ });
2390
+ },
2391
+
2392
+ verifyRowNumerationPreviewTabFunctionality: () => {
2393
+ it('When \'None\' option is selected then row numeration should not be displayed', () => {
2394
+ createQuestionBasePage.steps.switchToPreviewTab();
2395
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.rowNumerationPreviewTab(), 'notExist');
2396
+ createQuestionBasePage.steps.switchToEditTab();
2397
+ });
2398
+
2399
+ Object.keys(enumerationOptions).forEach(option => {
2400
+ it(`When "${option}" option is selected in the dropdown, then in the preview tab grid, numeration should be displayed`, () => {
2401
+ gridQuestionCommonComponent.steps.expandRowNumerationDropdown();
2402
+ gridQuestionCommonComponent.steps.selectOptionFromRowNumerationDropdown(option);
2403
+ createQuestionBasePage.steps.switchToPreviewTab();
2404
+ gridQuestionCommonComponent.steps.verifyRowNumerationPreviewTab(enumerationOptions[option]);
2405
+ createQuestionBasePage.steps.switchToEditTab();
2406
+ });
2407
+ });
2408
+
2409
+ it('By default, the numbers displayed should be according to the first numeration style', () => {
2410
+ createQuestionBasePage.steps.switchToPreviewTab();
2411
+ gridQuestionCommonComponent.steps.verifyNumerationStylePreviewTab(0);
2412
+ });
2413
+
2414
+ it('When user selects other numeration style options they should be reflected in the preview tab grid', () => {
2415
+ createQuestionBasePage.steps.switchToEditTab();
2416
+ gridQuestionCommonComponent.steps.selectNumerationStyleOption(1);
2417
+ createQuestionBasePage.steps.switchToPreviewTab();
2418
+ gridQuestionCommonComponent.steps.verifyNumerationStylePreviewTab(1);
2419
+ createQuestionBasePage.steps.switchToEditTab();
2420
+ gridQuestionCommonComponent.steps.selectNumerationStyleOption(2);
2421
+ createQuestionBasePage.steps.switchToPreviewTab();
2422
+ gridQuestionCommonComponent.steps.verifyNumerationStylePreviewTab(2);
2423
+ });
2424
+ },
2425
+
2426
+ verifyOptionAlignmentInCellContentsAndFunctionalityEditTab: () => {
2427
+ it('\'Option alignment in cell\' label should be displayed', () => {
2428
+ utilities.verifyInnerText(gridQuestionCommonComponent.optionAlignmentInCellLabel(), 'Option alignment in cell');
2429
+ });
2430
+
2431
+ it(`${optionAlignmentOptions} toggle options should be displayed and by default \'Center\' should be selected`, () => {
2432
+ optionAlignmentOptions.forEach((option) => {
2433
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.optionAlignmentInCellButton(option), 'visible');
2434
+ });
2435
+ gridQuestionCommonComponent.steps.verifyOptionAlignmentInCellButtonSelected('center');
2436
+ gridQuestionCommonComponent.steps.verifyOptionAlignmentInCellSpecifyCorrectAnswerSection('center');
2437
+ });
2438
+
2439
+ optionAlignmentOptions.forEach(option => {
2440
+ it(`When the user selects ${option} then the options in the grid should be aligned according to the option`, () => {
2441
+ gridQuestionCommonComponent.steps.selectAlignmentOption(option);
2442
+ gridQuestionCommonComponent.steps.verifyOptionAlignmentInCellSpecifyCorrectAnswerSection(option);
2443
+ });
2444
+ });
2445
+ },
2446
+
2447
+ verifyOptionAlignmentInCellFunctionalityPreviewTab: () => {
2448
+ it(`By default options should be \'Center\' aligned`, () => {
2449
+ gridQuestionCommonComponent.steps.verifyOptionAlignmentInCellPreviewTab('center');
2450
+ });
2451
+
2452
+ optionAlignmentOptions.forEach(option => {
2453
+ it(`When the user selects ${option} then the options in the grid should be aligned according to the option`, () => {
2454
+ createQuestionBasePage.steps.switchToEditTab();
2455
+ gridQuestionCommonComponent.steps.selectAlignmentOption(option);
2456
+ createQuestionBasePage.steps.switchToPreviewTab();
2457
+ gridQuestionCommonComponent.steps.verifyOptionAlignmentInCellPreviewTab(option);
2458
+ });
2459
+ });
2460
+ },
2461
+
2462
+ verifyARIALabelContentsAndFunctionalityEditTab: () => {
2463
+ ariaLabelSectionComponent.tests.verifyAriaLabelSectionContents('row headers');
2464
+
2465
+ it('When the users adds a new row header, the count of the aria label text input fields should update accordingly', () => {
2466
+ specifyRowsAndColumnsComponent.steps.increaseRowInputStepperCount(1);
2467
+ utilities.verifyElementCount(ariaLabelSectionComponent.ariaLabelInputField(), 3);
2468
+ ariaLabelSectionComponent.steps.verifyAriaLabelTextInputFields(2);
2469
+ });
2470
+
2471
+ it('When the user deletes any row header, the count of the aria label texts input fields should update accordingly', () => {
2472
+ specifyRowsAndColumnsComponent.steps.decreaseRowInputStepperCount(1);
2473
+ utilities.verifyElementCount(ariaLabelSectionComponent.ariaLabelInputField(), 2);
2474
+ ariaLabelSectionComponent.steps.verifyAriaLabelTextInputFields(0);
2475
+ ariaLabelSectionComponent.steps.verifyAriaLabelTextInputFields(1);
2476
+ });
2477
+
2478
+ it('When the user sets aria label, then in the answer input fields of the specify correct answer section, the aria labels should not change', () => {
2479
+ ariaLabelSectionComponent.steps.enterTextInAriaLabelInputField(0, 'Select correct option');
2480
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelSpecifyCorrectAnswerSection(0, 'Select correct option');
2481
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelSpecifyCorrectAnswerSection(1, 'Response 2');
2482
+ });
2483
+ },
2484
+
2485
+ verifyARIALabelFunctionalityPreviewTab: () => {
2486
+ it('When the user has not set \'ARIA label\' input field, then default aria labels should be present for the answer input fields in the preview tab', () => {
2487
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelPreviewTab(0, 'Response 1');
2488
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelPreviewTab(1, 'Response 2');
2489
+ });
2490
+
2491
+ it('When the user has set \'ARIA label\', then it should be present for the answer input fields in the preview tab', () => {
2492
+ createQuestionBasePage.steps.switchToEditTab();
2493
+ ariaLabelSectionComponent.steps.enterTextInAriaLabelInputField(0, 'Select correct option');
2494
+ createQuestionBasePage.steps.switchToPreviewTab();
2495
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelPreviewTab(0, 'Select correct option');
2496
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelPreviewTab(1, 'Response 2');
2497
+ });
2498
+
2499
+ it('Accessibility of input field in preview tab when custom \'ARIA label\' is set', { tags: 'a11y' }, () => {
2500
+ cy.checkAccessibility(commonComponents.previewTabQuestionWrapper());
2501
+ });
2502
+
2503
+ it('When the user clears the set value in the \'ARIA label\' input field, then the default aria labels should be present for the answer input fields in the preview tab', () => {
2504
+ createQuestionBasePage.steps.switchToEditTab();
2505
+ ariaLabelSectionComponent.steps.clearTextInAriaLabelInputField(0);
2506
+ createQuestionBasePage.steps.switchToPreviewTab();
2507
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelPreviewTab(0, 'Response 1');
2508
+ gridQuestionCommonComponent.steps.verifyRowHeaderAriaLabelPreviewTab(1, 'Response 2');
2509
+ });
2510
+ },
2511
+
2512
+ verifyRowAndColumnSpacingContentAndFunctionalityEditTab: () => {
2513
+ it('\'Row spacing\' label and dropdown should be displayed and by default \'No spacing\' option is selected', () => {
2514
+ utilities.verifyInnerText(gridQuestionCommonComponent.rowSpacingDropdownLabel(), 'Row spacing');
2515
+ utilities.verifyInnerText(gridQuestionCommonComponent.rowSpacingDropdown(), 'No spacing');
2516
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.rowSpacingDropdown(), 'visible');
2517
+ });
2518
+
2519
+ it(`When user expands \'Row spacing\' then ${rowColumnOptions} should be displayed then \'No spacing\' option is selected`, () => {
2520
+ gridQuestionCommonComponent.steps.expandRowSpacingDropdown();
2521
+ rowColumnOptions.forEach((option, index) => {
2522
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.rowSpacingDropdownOptions(), index), option);
2523
+ });
2524
+ gridQuestionCommonComponent.steps.verifyRowSpacingOptionSelected('No spacing');
2525
+ gridQuestionCommonComponent.steps.selectRowSpacingDropdownOption('No spacing');
2526
+ utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist');
2527
+ });
2528
+
2529
+ rowColumnOptions.forEach((option) => {
2530
+ it(`When user selects \'Row spacing\' ${option} option then ${option} spacing should be displayed between the row options`, () => {
2531
+ gridQuestionCommonComponent.steps.expandRowSpacingDropdown();
2532
+ gridQuestionCommonComponent.steps.selectRowSpacingDropdownOption(option);
2533
+ gridQuestionCommonComponent.steps.verifyTableRowSpacingSpecifyCorrectAnswerSection(option);
2534
+ });
2535
+ });
2536
+
2537
+ it('\'Column spacing\' label and dropdown should be displayed and by default \'No spacing\' option is selected', () => {
2538
+ utilities.verifyInnerText(gridQuestionCommonComponent.columnSpacingDropdownLabel(), 'Column spacing');
2539
+ utilities.verifyInnerText(gridQuestionCommonComponent.columnSpacingDropdown(), 'No spacing');
2540
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.columnSpacingDropdown(), 'visible');
2541
+ });
2542
+
2543
+ it(`When user expands \'Column spacing\' then ${rowColumnOptions} should be displayed then \'No spacing\' option is selected`, () => {
2544
+ gridQuestionCommonComponent.steps.expandColumnSpacingDropdown();
2545
+ rowColumnOptions.forEach((option, index) => {
2546
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.columnSpacingDropdownOptions(), index), option);
2547
+ });
2548
+ gridQuestionCommonComponent.steps.verifyColumnSpacingOptionSelected('No spacing');
2549
+ gridQuestionCommonComponent.steps.selectColumnSpacingDropdownOption('No spacing');
2550
+ utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist');
2551
+ });
2552
+
2553
+ rowColumnOptions.forEach((option) => {
2554
+ it(`When user selects \'Column spacing\' ${option} option then ${option} spacing should be displayed between the columns`, () => {
2555
+ gridQuestionCommonComponent.steps.expandColumnSpacingDropdown();
2556
+ gridQuestionCommonComponent.steps.selectColumnSpacingDropdownOption(option);
2557
+ gridQuestionCommonComponent.steps.verifyTableColumnSpacingSpecifyCorrectAnswerSection(option);
2558
+ });
2559
+ });
2560
+ },
2561
+
2562
+ verifyRowAndColumnSpacingFunctionalityPreviewTab: () => {
2563
+ rowColumnOptions.forEach((option) => {
2564
+ it(`When user selects \'Row spacing\' ${option} option then ${option} spacing should be displayed between the row options`, () => {
2565
+ gridQuestionCommonComponent.steps.expandRowSpacingDropdown();
2566
+ gridQuestionCommonComponent.steps.selectRowSpacingDropdownOption(option);
2567
+ createQuestionBasePage.steps.switchToPreviewTab();
2568
+ gridQuestionCommonComponent.steps.verifyTableRowSpacingPreviewTab(option);
2569
+ createQuestionBasePage.steps.switchToEditTab();
2570
+ });
2571
+ });
2572
+
2573
+ rowColumnOptions.forEach((option) => {
2574
+ it(`When user selects \'Column spacing\' ${option} option then ${option} spacing should be displayed between the columns`, () => {
2575
+ gridQuestionCommonComponent.steps.expandColumnSpacingDropdown();
2576
+ gridQuestionCommonComponent.steps.selectColumnSpacingDropdownOption(option);
2577
+ createQuestionBasePage.steps.switchToPreviewTab();
2578
+ gridQuestionCommonComponent.steps.verifyTableColumnSpacingPreviewTab(option);
2579
+ createQuestionBasePage.steps.switchToEditTab();
2580
+ });
2581
+ });
2582
+ },
2583
+
2584
+ verifyCellMinimumHeightContentAndFunctionalityEditTab: () => {
2585
+ it('\'Cell minimum height\' label and input field should be displayed and input field should be prefilled with 96px by default', () => {
2586
+ utilities.verifyInnerText(gridQuestionCommonComponent.cellMinimumHeightLabel(), 'Cell minimum height');
2587
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightInputField('96');
2588
+ });
2589
+
2590
+ it('By default the minimum cell height of the table cells should be 96px', () => {
2591
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightSpecifyCorrectAnswer('96');
2592
+ });
2593
+
2594
+ it('User should not be able to enter a value below 54px and above 320px', () => {
2595
+ gridQuestionCommonComponent.steps.enterTextInCellMinimumHeightInputField(20);
2596
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightInputField('54');
2597
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightSpecifyCorrectAnswer('54');
2598
+ gridQuestionCommonComponent.steps.enterTextInCellMinimumHeightInputField(800);
2599
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightInputField('320');
2600
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightSpecifyCorrectAnswer('320');
2601
+ });
2602
+
2603
+ it('When user edits the input field value it should be reflected in the table cells', () => {
2604
+ gridQuestionCommonComponent.steps.enterTextInCellMinimumHeightInputField(200);
2605
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightSpecifyCorrectAnswer('200');
2606
+ });
2607
+ },
2608
+
2609
+ verifyCellMinimumHeightFunctionalityPreviewTab: () => {
2610
+ it('By default the minimum cell height of the table cells should be 96px', () => {
2611
+ createQuestionBasePage.steps.switchToPreviewTab();
2612
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightPreviewTab('96');
2613
+ });
2614
+
2615
+ it('When user edits the input field value it should be reflected in the table cells', () => {
2616
+ createQuestionBasePage.steps.switchToEditTab();
2617
+ gridQuestionCommonComponent.steps.enterTextInCellMinimumHeightInputField(200);
2618
+ createQuestionBasePage.steps.switchToPreviewTab();
2619
+ gridQuestionCommonComponent.steps.verifyCellMinimumHeightPreviewTab('200');
2620
+ });
2621
+ },
2622
+
2623
+ verifyColumnDimensionsContentsAndFunctionalityPreviewTab: () => {
2624
+ it('\'Column dimensions\' label and dropdown should be displayed and by default \'Auto\' option is selected', () => {
2625
+ utilities.verifyInnerText(gridQuestionCommonComponent.columnDimensionsLabel(), 'Column dimensions');
2626
+ utilities.verifyInnerText(gridQuestionCommonComponent.columnDimensionsDropdown(), 'Auto');
2627
+ });
2628
+
2629
+ it(`When user expands \'Column dimensions\' then ${columnDimensions} should be displayed then \'Auto\' option is selected`, () => {
2630
+ gridQuestionCommonComponent.steps.expandColumnDimensionsDropdown();
2631
+ columnDimensions.forEach((option, index) => {
2632
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.columnDimensionsDropdownOptions(), index), option);
2633
+ });
2634
+ gridQuestionCommonComponent.steps.verifyColumnDimensionsDropdownOptionSelected('Auto');
2635
+ gridQuestionCommonComponent.steps.selectColumnDimensionsDropdownOption('Auto');
2636
+ utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist')
2637
+ });
2638
+
2639
+ columnDimensions.forEach((option) => {
2640
+ it(`When user selects \'Column dimensions\' ${option} option then ${option} spacing should be displayed between the columns`, () => {
2641
+ gridQuestionCommonComponent.steps.expandColumnDimensionsDropdown();
2642
+ gridQuestionCommonComponent.steps.selectColumnDimensionsDropdownOption(option);
2643
+ gridQuestionCommonComponent.steps.verifyColumnDimensionsSpecifyCorrectAnswer(option);
2644
+ });
2645
+ });
2646
+
2647
+ it(`When user selects ${columnDimensions[1]} then Specify for all columns, Specify for first column only, Specify for individual columns radio buttons should be displayed`, () => {
2648
+ utilities.verifyInnerText(gridQuestionCommonComponent.specifyForAllColumnsLabel(), 'Specify for all columns');
2649
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.specifyForAllColumnsRadioButton(), 'exist');
2650
+ utilities.verifyInnerText(gridQuestionCommonComponent.specifyForFirstColumnOnlyLabel(), 'Specify for first column only');
2651
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.specifyForFirstColumnOnlyRadioButton(), 'exist');
2652
+ utilities.verifyInnerText(gridQuestionCommonComponent.specifyForIndividualColumnsLabel(), 'Specify for individual columns');
2653
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.specifyForIndividualColumnsRadioButton(), 'exist');
2654
+ });
2655
+
2656
+ it('By default, \'Specify for all columns\' should be selected and \'Column width (px)\' label and input field should be displayed with 225 by default', () => {
2657
+ gridQuestionCommonComponent.steps.verifyCustomDimensionsRadioButtonSelected('Specify for all columns');
2658
+ utilities.verifyInnerText(gridQuestionCommonComponent.columnWidthLabel(), 'Column width (px)');
2659
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '225');
2660
+ });
2661
+
2662
+ it('User should not be able to enter value below 108 and above 320 in the \'Column width (px)\' input field', () => {
2663
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 90);
2664
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '108');
2665
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 400);
2666
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '320');
2667
+ });
2668
+
2669
+ it('When the user edits the \'Column width (px)\' input field value then it should be reflected in the specify correct answer section', () => {
2670
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 160);
2671
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '160');
2672
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(0, '160');
2673
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(1, '160');
2674
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(2, '160');
2675
+ });
2676
+
2677
+ it('When the user selects Specify for first column only \'Column width (px)\' label and input field should be displayed', () => {
2678
+ gridQuestionCommonComponent.steps.selectCustomDimensionsRadioButton('Specify for first column only');
2679
+ gridQuestionCommonComponent.steps.verifyCustomDimensionsRadioButtonSelected('Specify for first column only');
2680
+ utilities.verifyInnerText(gridQuestionCommonComponent.columnWidthLabel(), 'Column width (px)');
2681
+ });
2682
+
2683
+ it('When the user edits the \'Column width (px)\' input field value then it should be reflected in the specify correct answer section only for the first column', () => {
2684
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 200);
2685
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '200');
2686
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(0, '200');
2687
+ gridQuestionCommonComponent.steps.verifyTableColumnDoeNotHaveSpecifiedWidthSpecifyCorrectAnswer(1, '200');
2688
+ gridQuestionCommonComponent.steps.verifyTableColumnDoeNotHaveSpecifiedWidthSpecifyCorrectAnswer(2, '200');
2689
+ });
2690
+
2691
+ it('When the user selects Specify for individual columns \'Column 1 width (px)\' label and input field should be displayed for the columns', () => {
2692
+ gridQuestionCommonComponent.steps.selectCustomDimensionsRadioButton('Specify for individual columns');
2693
+ gridQuestionCommonComponent.steps.verifyCustomDimensionsRadioButtonSelected('Specify for individual columns');
2694
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.columnWidthLabel(), 0), 'Column 1 width (px)');
2695
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.columnWidthLabel(), 1), 'Column 2 width (px)');
2696
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.columnWidthLabel(), 2), 'Column 3 width (px)');
2697
+ utilities.verifyElementCount(gridQuestionCommonComponent.columnWidthLabel(), 3);
2698
+ utilities.verifyElementCount(gridQuestionCommonComponent.columnWidthInputField(), 3);
2699
+ });
2700
+
2701
+ it('When the user adds a new column the label field and input field for the column should be displayed', () => {
2702
+ specifyRowsAndColumnsComponent.steps.increaseColumnInputStepperCount(1)
2703
+ utilities.verifyElementCount(gridQuestionCommonComponent.columnWidthLabel(), 4);
2704
+ utilities.verifyElementCount(gridQuestionCommonComponent.columnWidthInputField(), 4);
2705
+ });
2706
+
2707
+ it('When the user deletes a column the label field and input field for the column should not be displayed', () => {
2708
+ specifyRowsAndColumnsComponent.steps.decreaseColumnInputStepperCount(1);
2709
+ utilities.verifyElementCount(gridQuestionCommonComponent.columnWidthLabel(), 3);
2710
+ utilities.verifyElementCount(gridQuestionCommonComponent.columnWidthInputField(), 3);
2711
+ });
2712
+
2713
+ it('When the user edits the input field then the column width should update for the specified column', () => {
2714
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 200);
2715
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '200');
2716
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(1, 210);
2717
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(1, '210');
2718
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(2, 240);
2719
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(2, '240');
2720
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(0, '200');
2721
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(1, '210');
2722
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthSpecifyCorrectAnswer(2, '240');
2723
+ });
2724
+ },
2725
+
2726
+ verifyColumnDimensionsFunctionalityPreviewTab: () => {
2727
+ columnDimensions.forEach((option) => {
2728
+ it(`When user selects \'Column dimensions\' ${option} option then ${option} spacing should be displayed between the columns`, () => {
2729
+ gridQuestionCommonComponent.steps.expandColumnDimensionsDropdown();
2730
+ gridQuestionCommonComponent.steps.selectColumnDimensionsDropdownOption(option);
2731
+ createQuestionBasePage.steps.switchToPreviewTab();
2732
+ gridQuestionCommonComponent.steps.verifyColumnDimensionsPreviewTab(option);
2733
+ createQuestionBasePage.steps.switchToEditTab();
2734
+ });
2735
+ });
2736
+
2737
+ it('When the user selects \'Specify for all columns\' radio button edits the \'Column width (px)\' input field value then it should be reflected in the preview tab', () => {
2738
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 160);
2739
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '160');
2740
+ createQuestionBasePage.steps.switchToPreviewTab();
2741
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(0, '160');
2742
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(1, '160');
2743
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(2, '160');
2744
+ });
2745
+
2746
+ it('When the user selects \'Specify for first column\' radio button edits the \'Column width (px)\' input field value then it should be reflected in the preview tab only for the first column', () => {
2747
+ createQuestionBasePage.steps.switchToEditTab();
2748
+ gridQuestionCommonComponent.steps.selectCustomDimensionsRadioButton('Specify for first column only');
2749
+ gridQuestionCommonComponent.steps.verifyCustomDimensionsRadioButtonSelected('Specify for first column only');
2750
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 200);
2751
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '200');
2752
+ createQuestionBasePage.steps.switchToPreviewTab();
2753
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(0, '200');
2754
+ gridQuestionCommonComponent.steps.verifyTableColumnDoeNotHaveSpecifiedWidthPreviewTab(1, '200');
2755
+ gridQuestionCommonComponent.steps.verifyTableColumnDoeNotHaveSpecifiedWidthPreviewTab(2, '200');
2756
+ });
2757
+
2758
+ it('When the user selects \'Specify for individual columns\' radio button edits the input field then the column width should update for the specified column', () => {
2759
+ createQuestionBasePage.steps.switchToEditTab();
2760
+ gridQuestionCommonComponent.steps.selectCustomDimensionsRadioButton('Specify for individual columns');
2761
+ gridQuestionCommonComponent.steps.verifyCustomDimensionsRadioButtonSelected('Specify for individual columns');
2762
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(0, 200);
2763
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(0, '200');
2764
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(1, 210);
2765
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(1, '210');
2766
+ gridQuestionCommonComponent.steps.enterTextInColumnWidthInputField(2, 240);
2767
+ gridQuestionCommonComponent.steps.verifyColumnWidthInputField(2, '240');
2768
+ createQuestionBasePage.steps.switchToPreviewTab();
2769
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(0, '200');
2770
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(1, '210');
2771
+ gridQuestionCommonComponent.steps.verifyTableColumnWidthPreviewTab(2, '240');
2772
+ });
2773
+ },
2774
+
2775
+ verifyFillColorContentsAndFunctionalityEditTab: () => {
2776
+ it('Grid label should be displayed', () => {
2777
+ utilities.verifyInnerText(gridQuestionCommonComponent.gridLabel(), 'Grid');
2778
+ });
2779
+
2780
+ it('\'Fill color\' label and two color blocks and an \'Edit color\' button should be displayed. The selected color block should be of color \'rgb(245, 248, 255)\' and the other color block should have \'No color\'', () => {
2781
+ utilities.verifyInnerText(gridQuestionCommonComponent.fillColorLabel(), 'Fill color');
2782
+ gridQuestionCommonComponent.steps.verifyColorBlockColor(0, css.color.defaultBackground);
2783
+ gridQuestionCommonComponent.steps.verifyColorBlockSelectedState(0);
2784
+ gridQuestionCommonComponent.steps.verifyColorBlockColor(1, css.color.none);
2785
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.editColorButton(), 0), 'Edit color');
2786
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.editColorButton(), 'visible');
2787
+ });
2788
+
2789
+ it('When the user hovers over the color blocks in the \'Fill color\' section, hex code of the selected color should be displayed in a tooltip', () => {
2790
+ utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), 0)
2791
+ .verifyTooltip('#FFFFFF');
2792
+ utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), 1)
2793
+ .verifyTooltip('None');
2794
+ });
2795
+
2796
+ it('By default, the first color option should be in selected state', () => {
2797
+ gridQuestionCommonComponent.steps.verifyColorBlockSelectedState(0);
2798
+ });
2799
+
2800
+ it('When the default color block is in selected state in the \'Fill color\' section, then the background color of the grid in the specify correct answer section should be the default selected color', () => {
2801
+ gridQuestionCommonComponent.steps.verifyGridFillColorSpecifyCorrectAnswerSection(css.color.defaultBackground);
2802
+ });
2803
+
2804
+ it('When the user selects the \'None\' color block, it should get in selected state and the no background color should be present for the grid in the specify correct answer section', () => {
2805
+ gridQuestionCommonComponent.steps.selectColorBlock(1);
2806
+ gridQuestionCommonComponent.steps.verifyGridFillColorSpecifyCorrectAnswerSection(css.color.transparent);
2807
+ });
2808
+
2809
+ it('When the user clicks on the \'Edit color\' button, modifies color for the selected color block, then the background color of the grid in the specify correct answer section should be the modified selected color', () => {
2810
+ gridQuestionCommonComponent.steps.editColor(0);
2811
+ colorPopupComponent.steps.clickInColorSaturationPalette();
2812
+ colorPopupComponent.steps.clickOnOkButton();
2813
+ gridQuestionCommonComponent.steps.verifyGridFillColorSpecifyCorrectAnswerSection(modifiedColor);
2814
+ });
2815
+ },
2816
+
2817
+ verifyFillColorFunctionalityPreviewTab: () => {
2818
+ it('When the default color block is in selected state in the \'Fill color\' section, then the background color of the grid in the preview tab should be the default selected color', () => {
2819
+ createQuestionBasePage.steps.switchToPreviewTab();
2820
+ gridQuestionCommonComponent.steps.verifyGridFillColorPreviewTab(css.color.defaultBackground);
2821
+ });
2822
+
2823
+ it('When the user selects the \'None\' color block, it should get in selected state and the no background color should be present for the grid in the preview tab', () => {
2824
+ createQuestionBasePage.steps.switchToEditTab();
2825
+ gridQuestionCommonComponent.steps.selectColorBlock(1);
2826
+ createQuestionBasePage.steps.switchToPreviewTab();
2827
+ gridQuestionCommonComponent.steps.verifyGridFillColorPreviewTab(css.color.transparent);
2828
+ });
2829
+
2830
+ it('When the user clicks on the \'Edit color\' button, modifies color for the selected color block, then the color block should get updated accordingly', () => {
2831
+ createQuestionBasePage.steps.switchToEditTab();
2832
+ gridQuestionCommonComponent.steps.editColor(0);
2833
+ colorPopupComponent.steps.clickInColorSaturationPalette();
2834
+ colorPopupComponent.steps.clickOnOkButton();
2835
+ createQuestionBasePage.steps.switchToPreviewTab();
2836
+ gridQuestionCommonComponent.steps.verifyGridFillColorPreviewTab(modifiedColor);
2837
+ });
2838
+ },
2839
+
2840
+ verifyBorderColorContentsAndFunctionalityEditTab: () => {
2841
+ it('\'Border color\' label and two color blocks and an \'Edit color\' button should be displayed. The selected color block should be of color \'rgb(82, 0, 255) and the other color block should have \'No color\'', () => {
2842
+ utilities.verifyInnerText(gridQuestionCommonComponent.borderColorLabel(), 'Border color');
2843
+ utilities.verifyInnerText(utilities.getNthElement(gridQuestionCommonComponent.editColorButton(), 1), 'Edit color');
2844
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.editColorButton(), 'visible');
2845
+ gridQuestionCommonComponent.steps.verifyColorBlockColor(2, css.color.activeComponentBorder);
2846
+ gridQuestionCommonComponent.steps.verifyColorBlockSelectedState(2);
2847
+ gridQuestionCommonComponent.steps.verifyColorBlockColor(3, css.color.none);
2848
+ });
2849
+
2850
+ it('When the user hovers over the color blocks in the \'Border color\' section, hex code of the selected color should be displayed in a tooltip', () => {
2851
+ utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), 2)
2852
+ .verifyTooltip('#5200FF');
2853
+ utilities.getNthElement(gridQuestionCommonComponent.colorBlock(), 3)
2854
+ .verifyTooltip('None');
2855
+ });
2856
+
2857
+ it('By default, the first color option should be in selected state', () => {
2858
+ gridQuestionCommonComponent.steps.verifyColorBlockSelectedState(2);
2859
+ });
2860
+
2861
+ it('When the default color block is in selected state in the \'Border color\' section, then the border color of the grid in the specify correct answer section should be the default selected color', () => {
2862
+ gridQuestionCommonComponent.steps.verifyGridBorderColorSpecifyCorrectAnswer(css.color.activeComponentBorder);
2863
+ });
2864
+
2865
+ it('When the user selects the \'None\' color block, it should get in selected state and the no border color should be present for the grid in the specify correct answer section', () => {
2866
+ gridQuestionCommonComponent.steps.selectColorBlock(3);
2867
+ gridQuestionCommonComponent.steps.verifyGridBorderColorSpecifyCorrectAnswer(css.color.transparent);
2868
+ });
2869
+
2870
+ it('When the user clicks on the \'Edit color\' button, modifies color for the selected color block, then the border color of the grid in the specify correct answer section should be the modified selected color', () => {
2871
+ gridQuestionCommonComponent.steps.editColor(1);
2872
+ colorPopupComponent.steps.clickInColorSaturationPalette();
2873
+ colorPopupComponent.steps.clickOnOkButton();
2874
+ gridQuestionCommonComponent.steps.verifyGridBorderColorSpecifyCorrectAnswer(modifiedColor);
2875
+ });
2876
+ },
2877
+
2878
+ verifyBorderColorFunctionalityPreviewTab: () => {
2879
+ it('When the default color block is in selected state in the \'Fill color\' section, then the border color of the grid in the preview tab should be the default selected color', () => {
2880
+ gridQuestionCommonComponent.steps.verifyGridBorderColorPreviewTab(css.color.activeComponentBorder);
2881
+ });
2882
+
2883
+ it('When the user selects the \'None\' color block, it should get in selected state and the no border color should be present for the grid in the preview tab', () => {
2884
+ createQuestionBasePage.steps.switchToEditTab();
2885
+ gridQuestionCommonComponent.steps.selectColorBlock(3);
2886
+ createQuestionBasePage.steps.switchToPreviewTab();
2887
+ gridQuestionCommonComponent.steps.verifyGridBorderColorPreviewTab(css.color.transparent);
2888
+ });
2889
+
2890
+ it('When the user clicks on the \'Edit color\' button, modifies color for the selected color block, then the color block should get updated accordingly', () => {
2891
+ createQuestionBasePage.steps.switchToEditTab();
2892
+ gridQuestionCommonComponent.steps.editColor(1);
2893
+ colorPopupComponent.steps.clickInColorSaturationPalette();
2894
+ colorPopupComponent.steps.clickOnOkButton();
2895
+ createQuestionBasePage.steps.switchToPreviewTab();
2896
+ gridQuestionCommonComponent.steps.verifyGridBorderColorPreviewTab(modifiedColor);
2897
+ });
2898
+ },
2899
+
2900
+ verifyColorPopupUpdateColorFunctionality: () => {
2901
+ it('When the user moves the color picker in the color saturation palette, color in the selected color block and the hex code should change, color in the hue color palette and the opacity value should not change', () => {
2902
+ gridQuestionCommonComponent.steps.editColor(0);
2903
+ colorPopupComponent.steps.clickInColorSaturationPalette();
2904
+ colorPopupComponent.steps.verifySelectedColorBlock('rgb(118, 59, 59)');
2905
+ colorPopupComponent.steps.verifySaturationPaletteColor('rgb(119, 60, 60)');
2906
+ colorPopupComponent.steps.verifyHuePaletteColor('rgb(255, 0, 0)');
2907
+ colorPopupComponent.steps.verifyHexValue('#763b3b');
2908
+ colorPopupComponent.steps.verifyOpacityGradientPaletteColor('rgb(119, 60, 60)');
2909
+ });
2910
+
2911
+ it('When the user moves the color picker in the color hue palette, color in the selected color block, the hex code and the saturation color palette should change and the opacity value should not change', () => {
2912
+ colorPopupComponent.steps.clickInColorHuePalette();
2913
+ colorPopupComponent.steps.verifySelectedColorBlock('rgb(59, 118, 118)');
2914
+ colorPopupComponent.steps.verifyHuePaletteColor('rgb(0, 255, 255)');
2915
+ colorPopupComponent.steps.verifyHexValue('#3b7676');
2916
+ colorPopupComponent.steps.verifyOpacityGradientPaletteColor('rgb(60, 119, 119)');
2917
+ });
2918
+
2919
+ it('When the user changes the color using hex code, the color in color saturation palette and color hue palette should change and the opacity value should not change', () => {
2920
+ colorPopupComponent.steps.addInputToHexInputField('#ff0000');
2921
+ colorPopupComponent.steps.verifyHexValue('#ff0000');
2922
+ colorPopupComponent.steps.verifySaturationPaletteColor('rgb(255, 0, 0)');
2923
+ colorPopupComponent.steps.verifyHuePaletteColor('rgb(255, 0, 0)');
2924
+ colorPopupComponent.steps.verifyOpacityGradientPaletteColor('rgb(255, 0, 0)');
2925
+ });
2926
+ },
2927
+
2928
+ verifyColorPopupCancelOkButtonFunctionality: () => {
2929
+ it('When the user modifies the selected color in the color popup and clicks on \'Cancel\' button, then the popup should close, the color block should not change and the modifications in the color popup should not persist', () => {
2930
+ gridQuestionCommonComponent.steps.editColor(0);
2931
+ colorPopupComponent.steps.addInputToHexInputField('#ff0000');
2932
+ colorPopupComponent.steps.clickOnOpacityGradientHuePalette();
2933
+ colorPopupComponent.steps.clickOnCancelButton();
2934
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
2935
+ gridQuestionCommonComponent.steps.verifyColorBlockColor(0, css.color.defaultBackground);
2936
+ });
2937
+
2938
+ it('When the user modifies the selected color in the color popup and clicks on \'Ok\' button, then the popup should close, the color block should change to the new selected color and the modifications in the color popup should persist', () => {
2939
+ cy.log('Pre-step: clicking on the edit color button')
2940
+ gridQuestionCommonComponent.steps.editColor(0);
2941
+ colorPopupComponent.steps.addInputToHexInputField('#ff0000');
2942
+ colorPopupComponent.steps.clickOnOpacityGradientHuePalette();
2943
+ colorPopupComponent.steps.clickOnOkButton();
2944
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
2945
+ gridQuestionCommonComponent.steps.verifyColorBlockColor(0, 'rgba(255, 0, 0, 0.5)');
2946
+ });
2947
+ },
2948
+
2949
+ verifyEnableOuterBorderContentAndFunctionalityEditTab: () => {
2950
+ it('\'Enable outer border for question\' label should be displayed along with 2 options - Outer and None', () => {
2951
+ utilities.verifyInnerText(gridQuestionCommonComponent.enableOuterBorderForQuestionLabel(), 'Enable outer border for question');
2952
+ outerBorder.forEach((option) => {
2953
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.enableOuterBorderForQuestionOptions(option.toLowerCase()), 'exist');
2954
+ });
2955
+ });
2956
+
2957
+ it('By default outer option should be selected and an outer border should be displayed for the table', () => {
2958
+ gridQuestionCommonComponent.steps.verifyOuterBorderOptionSelected('outer');
2959
+ gridQuestionCommonComponent.steps.verifyTableOuterBorderSpecifyCorrectAnswer('Outer');
2960
+ });
2961
+
2962
+ it('When user selects \'None\' option an outer border should not be displayed for the table', () => {
2963
+ gridQuestionCommonComponent.steps.selectOuterBorderOption('none');
2964
+ gridQuestionCommonComponent.steps.verifyOuterBorderOptionSelected('none');
2965
+ gridQuestionCommonComponent.steps.verifyTableOuterBorderSpecifyCorrectAnswer('None');
2966
+ });
2967
+ },
2968
+
2969
+ verifyEnableOuterBorderFunctionalityPreviewTab: () => {
2970
+ it('By default an outer border should be displayed for the table', () => {
2971
+ gridQuestionCommonComponent.steps.verifyOuterBorderOptionSelected('outer');
2972
+ createQuestionBasePage.steps.switchToPreviewTab();
2973
+ gridQuestionCommonComponent.steps.verifyTableOuterBorderPreviewTab('Outer');
2974
+ });
2975
+
2976
+ it('When user selects \'None\' option an outer border should not be displayed for the table', () => {
2977
+ createQuestionBasePage.steps.switchToEditTab();
2978
+ gridQuestionCommonComponent.steps.selectOuterBorderOption('none');
2979
+ gridQuestionCommonComponent.steps.verifyOuterBorderOptionSelected('none');
2980
+ createQuestionBasePage.steps.switchToPreviewTab();
2981
+ gridQuestionCommonComponent.steps.verifyTableOuterBorderPreviewTab('None');
2982
+ });
2983
+ },
2984
+
2985
+ verifyInnerBorderContentAndFunctionalityEditTab: () => {
2986
+ it(`\'Inner border\' label should be displayed along with 4 options - ${innerBorder}`, () => {
2987
+ utilities.verifyInnerText(gridQuestionCommonComponent.innerBorderLabel(), 'Inner border');
2988
+ innerBorder.forEach((option) => {
2989
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.innerBorderOptions(option.toLowerCase()), 'exist');
2990
+ });
2991
+ });
2992
+
2993
+ it('By default inner option should be selected and an inner borders should be displayed for the table', () => {
2994
+ gridQuestionCommonComponent.steps.verifyInnerBorderOptionSelected('inner');
2995
+ gridQuestionCommonComponent.steps.verifyTableInnerBorderSpecifyCorrectAnswer('inner');
2996
+ });
2997
+
2998
+ innerBorder.forEach((option) => {
2999
+ it(`When user selects ${option} option an ${option} border should be displayed for the table`, () => {
3000
+ gridQuestionCommonComponent.steps.selectInnerBorderOption(option);
3001
+ gridQuestionCommonComponent.steps.verifyTableInnerBorderSpecifyCorrectAnswer(option);
3002
+ });
3003
+ });
3004
+
3005
+ it('When user selects vertical option then radio buttons should be displayed - Apply to all columns and Apply to first column only and by default Apply to all columns should be checked', () => {
3006
+ gridQuestionCommonComponent.steps.selectInnerBorderOption('vertical');
3007
+ utilities.verifyInnerText(gridQuestionCommonComponent.applyToAllColumnsLabel(), 'Apply to all columns');
3008
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.applyToAllColumnsRadioButton(), 'exist');
3009
+ utilities.verifyInnerText(gridQuestionCommonComponent.applyToFirstColumnLabel(), 'Apply to first column only');
3010
+ utilities.verifyElementVisibilityState(gridQuestionCommonComponent.applyToFirstColumnRadioButton(), 'exist');
3011
+ gridQuestionCommonComponent.steps.verifyApplyToAllColumnsRadioButtonSelectedState();
3012
+ });
3013
+
3014
+ it('When user selects Apply to first column radio button then the table should be updated accordingly', () => {
3015
+ gridQuestionCommonComponent.steps.checkApplyToFirstColumnRadioButton();
3016
+ gridQuestionCommonComponent.steps.verifyTableInnerBorderSpecifyCorrectAnswer('Vertical - apply to first column');
3017
+ });
3018
+ },
3019
+
3020
+ verifyInnerBorderFunctionalityPreviewTab: () => {
3021
+ innerBorder.forEach((option) => {
3022
+ it(`When user selects ${option} option an ${option} border should be displayed for the table`, () => {
3023
+ gridQuestionCommonComponent.steps.selectInnerBorderOption(option);
3024
+ createQuestionBasePage.steps.switchToPreviewTab();
3025
+ gridQuestionCommonComponent.steps.verifyTableInnerBorderPreviewTab(option);
3026
+ createQuestionBasePage.steps.switchToEditTab();
3027
+ });
3028
+ });
3029
+
3030
+ it('When user selects Apply to first column radio button then the table should be updated accordingly', () => {
3031
+ createQuestionBasePage.steps.switchToEditTab();
3032
+ gridQuestionCommonComponent.steps.selectInnerBorderOption('vertical');
3033
+ gridQuestionCommonComponent.steps.checkApplyToFirstColumnRadioButton();
3034
+ createQuestionBasePage.steps.switchToPreviewTab();
3035
+ gridQuestionCommonComponent.steps.verifyTableInnerBorderPreviewTab('Vertical - apply to first column');
3036
+ });
3037
+ }
1336
3038
  }
1337
3039
 
1338
3040
  export const gridQuestionCommonComponent = {