itemengine-cypress-automation 1.0.143-migrationScripts-d059d60.0 → 1.0.144-21MatchRepoUpdate-0ab2c79.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. package/cypress/e2e/ILC/AudioResponseNew/additionalSettingsBasic.js +104 -0
  2. package/cypress/e2e/ILC/ContentBlocks/additionalSection.js +92 -0
  3. package/cypress/e2e/ILC/ContentBlocks/editTabBasics.js +11 -1
  4. package/cypress/e2e/ILC/ContentBlocks/previewTab.js +91 -0
  5. package/cypress/e2e/ILC/ContentBlocks/styleAndLayoutCustomizationSection.js +3 -3
  6. package/cypress/e2e/ILC/Desmos/desmosFourFunctionCalculatorEditTabBasicSection.js +2 -1
  7. package/cypress/e2e/ILC/Desmos/desmosFourFunctionCalculatorPreviewContents.smoke.js +2 -1
  8. package/cypress/e2e/ILC/Desmos/desmosGeometryToolEditTabBasicSection.js +1 -0
  9. package/cypress/e2e/ILC/Desmos/desmosGeometryToolPreviewContents.smoke.js +2 -1
  10. package/cypress/e2e/ILC/Desmos/desmosGraphingCalculatorEditTabBasicSection.js +1 -0
  11. package/cypress/e2e/ILC/Desmos/desmosGraphingCalculatorPreviewContents.smoke.js +2 -1
  12. package/cypress/e2e/ILC/Desmos/desmosMatrixCalculatorEditTabBasicSection.js +2 -2
  13. package/cypress/e2e/ILC/Desmos/desmosMatrixCalculatorPreviewContents.smoke.js +2 -1
  14. package/cypress/e2e/ILC/Desmos/desmosScientificCalculatorEditTabBasicSection.js +3 -2
  15. package/cypress/e2e/ILC/Desmos/desmosScientificCalculatorPreviewContents.smoke.js +2 -1
  16. package/cypress/e2e/ILC/DesmosGraphing/additionalSettings.js +0 -5
  17. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/additionalSettingsBasic.js +124 -0
  18. package/cypress/e2e/ILC/DrawingResponse/drawingResponseAdditionalSettings.js +0 -9
  19. package/cypress/e2e/ILC/DrawingResponse/drawingResponsePreviewTabContents.smoke.js +17 -17
  20. package/cypress/e2e/ILC/EssayResponse/additionalSettingsBasic.js +83 -0
  21. package/cypress/e2e/ILC/EssayResponse/createCustomCategory.smoke.js +32 -30
  22. package/cypress/e2e/ILC/EssayResponse/editCategoryFlyout.js +25 -21
  23. package/cypress/e2e/ILC/EssayResponse/equationEditor.smoke.js +40 -41
  24. package/cypress/e2e/ILC/EssayResponse/equationEditorCategories1.js +249 -99
  25. package/cypress/e2e/ILC/EssayResponse/equationEditorCategories2.js +118 -187
  26. package/cypress/e2e/ILC/EssayResponseBasic/previewContentsForAllViews.smoke.js +1 -1
  27. package/cypress/e2e/ILC/EssayResponseMath/mathCharacters.js +1 -1
  28. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/additionalSettings.js +11 -11
  29. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/dropzoneSettings.js +1 -1
  30. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/previewContentsForAllViews.smoke.js +1 -3
  31. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/additionalSettingsBasic.js +138 -0
  32. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/additionalSettingsForDropdowns.js +309 -0
  33. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/dropdownSettings.js +181 -0
  34. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/additionalSettingsBasic.js +132 -0
  35. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/additionalSettingsBasic.js +143 -0
  36. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/additionalSettingsForDropdowns.js +345 -0
  37. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  38. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/supportedFileTypes.js +49 -0
  39. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/additionalSettingsBasic.js +25 -0
  40. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/additionalSettingsForAnswerInputFields.js +251 -0
  41. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/supportedFileTypes.js +49 -0
  42. package/cypress/e2e/ILC/FillInTheGapsTextNew/additionalSettingsBasic.js +93 -0
  43. package/cypress/e2e/ILC/FillInTheGapsTextNew/additionalSettingsForAnswerInputFields.js +215 -0
  44. package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabBasicSection.js +1 -1
  45. package/cypress/e2e/ILC/FillInTheGapsTextNew/textContainerSettings.js +219 -0
  46. package/cypress/e2e/ILC/GeoGebraTools/3DGraphingCalculatorEditTabBasicSection.js +96 -0
  47. package/cypress/e2e/ILC/GeoGebraTools/3DGraphingCalculatorPreviewTabContents.smoke.js +75 -0
  48. package/cypress/e2e/ILC/GeoGebraTools/casCalculatorEditTabBasicSection.js +96 -0
  49. package/cypress/e2e/ILC/GeoGebraTools/casCalculatorPreviewTabContents.smoke.js +75 -0
  50. package/cypress/e2e/ILC/GeoGebraTools/geometryCalculatorEditTabBasicSection.js +96 -0
  51. package/cypress/e2e/ILC/GeoGebraTools/geometryCalculatorPreviewTabContents.smoke.js +76 -0
  52. package/cypress/e2e/ILC/GeoGebraTools/graphingCalculatorEditTabBasicSection.js +96 -0
  53. package/cypress/e2e/ILC/GeoGebraTools/graphingCalculatorPreviewTabContents.smoke.js +73 -0
  54. package/cypress/e2e/ILC/GeoGebraTools/probablityCalculatorEditTabBasicSection.js +96 -0
  55. package/cypress/e2e/ILC/GeoGebraTools/probablityCalculatorPreviewTabContents.smoke.js +75 -0
  56. package/cypress/e2e/ILC/GeoGebraTools/scientificCalculatorEditTabBasicSection.js +96 -0
  57. package/cypress/e2e/ILC/GeoGebraTools/scientificCalculatorPreviewTabContents.smoke.js +75 -0
  58. package/cypress/e2e/ILC/GeogebraActivity/additionalSettings.js +10 -8
  59. package/cypress/e2e/ILC/GeogebraActivity/gradingViewAndCorrectAnswerViewContents.smoke.js +3 -2
  60. package/cypress/e2e/ILC/GeogebraActivity/headerSection.js +2 -1
  61. package/cypress/e2e/ILC/GeogebraActivity/insertResourceLink.js +318 -0
  62. package/cypress/e2e/ILC/GeogebraActivity/previewTabContent.smoke.js +2 -1
  63. package/cypress/e2e/ILC/Graphing/additionalSettingsBasic.js +15 -4
  64. package/cypress/e2e/ILC/GridFill/allOrNothingBasicForAllViews.smoke.js +280 -0
  65. package/cypress/e2e/ILC/GridFill/checkAnswerFunctionalityForAllViews.smoke.js +136 -0
  66. package/cypress/e2e/ILC/GridFill/editTabScoringSection.js +205 -0
  67. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +213 -0
  68. package/cypress/e2e/ILC/GridFill/scoring/manuallyAndNonScored.js +106 -0
  69. package/cypress/e2e/ILC/GridFill/specifyCorrectAnswerSection.js +79 -0
  70. package/cypress/e2e/ILC/MultipleSelection/additionalSettingsBasic.js +108 -0
  71. package/cypress/e2e/ILC/MultipleSelectionGridNew/allOrNothingBasicForAllViews.smoke.js +251 -0
  72. package/cypress/e2e/ILC/MultipleSelectionGridNew/previewContentsForAllViews.smoke.js +180 -0
  73. package/cypress/e2e/ILC/ShortTextResponseNew/additionalSettings.js +48 -56
  74. package/cypress/e2e/ILC/SingleSelection/additionalSettingsBasic.js +107 -0
  75. package/cypress/e2e/ILC/SingleSelectionGridNew/allOrNothingBasicForAllViews.smoke.js +251 -0
  76. package/cypress/e2e/ILC/SingleSelectionGridNew/previewContentsForAllViews.smoke.js +180 -0
  77. package/cypress/e2e/ILC/TextEntryMath/allOrNothingBasicForAllViews.smoke.js +12 -3
  78. package/cypress/e2e/ILC/TextEntryMath/checkAnswerFunctionalityForAllViews.smoke.js +4 -1
  79. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodEquivalentStructures.js +93 -68
  80. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodMatchExact.js +59 -52
  81. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodMatchValue.js +59 -52
  82. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodSymbolsAreEquivalent.js +61 -50
  83. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodValueIsEquivalent.js +65 -51
  84. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodsWithoutSetResponse.js +55 -46
  85. package/cypress/e2e/ILC/TextEntryMath/previewContentsForAllViews.smoke.js +6 -3
  86. package/cypress/e2e/ILC/TextEntryMathWithImage/allOrNothingScoringForAllViews.smoke.js +11 -9
  87. package/cypress/e2e/ILC/TextEntryMathWithImage/checkAnswerFunctionalityForAllViews.smoke.js +4 -3
  88. package/cypress/e2e/ILC/TextEntryMathWithImage/previewTabContentsForAllViews.smoke.js +4 -2
  89. package/cypress/e2e/ILC/UploadResponse/additionalSettingsBasic.js +85 -0
  90. package/cypress/e2e/ILC/UploadResponse/editTabScoringSection.js +12 -12
  91. package/cypress/e2e/ILC/UploadResponse/uploadResponseEditTabBasicSections.js +1 -1
  92. package/cypress/fixtures/constants.js +2 -0
  93. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +1114 -1511
  94. package/cypress/fixtures/theme/ilc.json +7 -1
  95. package/cypress/pages/audioResponsePage.js +26 -2
  96. package/cypress/pages/components/additionalSettingsAccessibilitySectionComponent.js +1 -0
  97. package/cypress/pages/components/additionalSettingsPanel.js +3 -10
  98. package/cypress/pages/components/ariaLabelSectionComponent.js +84 -0
  99. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +5 -2
  100. package/cypress/pages/components/autoScoredStudentViewSettings.js +1 -1
  101. package/cypress/pages/components/commonComponents.js +1 -1
  102. package/cypress/pages/components/createCustomCategoryFlyout.js +2 -2
  103. package/cypress/pages/components/createQuestionBasePage.js +1 -1
  104. package/cypress/pages/components/desmosToolComponent.js +1 -0
  105. package/cypress/pages/components/draggableOptionContainer.js +1 -1
  106. package/cypress/pages/components/editCategoryFlyout.js +9 -10
  107. package/cypress/pages/components/equationEditorFlyout.js +20 -11
  108. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +167 -3
  109. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +149 -6
  110. package/cypress/pages/components/gradingViewEnumerationComponent.js +151 -0
  111. package/cypress/pages/components/gridQuestionCommonComponent.js +390 -0
  112. package/cypress/pages/components/imageCanvasComponent.js +25 -1
  113. package/cypress/pages/components/index.js +5 -1
  114. package/cypress/pages/components/placeholderTextSectionComponent.js +110 -0
  115. package/cypress/pages/components/responseAreaSettingsPopupComponent.js +2 -2
  116. package/cypress/pages/contentBlocksPage.js +60 -1
  117. package/cypress/pages/dragAndDropIntoCategoriesPage.js +4 -17
  118. package/cypress/pages/essayResponsePage.js +14 -11
  119. package/cypress/pages/fillInTheGapsDragAndDropPage.js +15 -0
  120. package/cypress/pages/fillInTheGapsDropdownPage.js +121 -2
  121. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +3 -1
  122. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +70 -3
  123. package/cypress/pages/fillInTheGapsOverImageTextPage.js +33 -3
  124. package/cypress/pages/fillInTheGapsTextPage.js +81 -4
  125. package/cypress/pages/geoGebraActivityPage.js +75 -11
  126. package/cypress/pages/geoGebraToolsPage.js +292 -0
  127. package/cypress/pages/graphingPage.js +2 -1
  128. package/cypress/pages/gridFillPage.js +713 -0
  129. package/cypress/pages/index.js +3 -1
  130. package/cypress/pages/multipleSelectionGridPage.js +71 -317
  131. package/cypress/pages/multipleSelectionPage.js +2 -1
  132. package/cypress/pages/selectQuestionResourceToolPage.js +13 -2
  133. package/cypress/pages/singleSelectionGridPage.js +78 -329
  134. package/cypress/pages/singleSelectionPage.js +2 -1
  135. package/cypress/pages/textEntryMathPage.js +24 -6
  136. package/cypress/pages/textEntryMathWithImagePage.js +1 -1
  137. package/cypress/pages/uploadResponsePage.js +4 -3
  138. package/package.json +1 -1
  139. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/additionalSettings.js +0 -43
  140. package/cypress/pages/components/fillInTheGapsCommonComponents.js +0 -642
@@ -4,6 +4,7 @@ import { autoScoredSpecifyCorrectAnswerSection } from "./autoScoredSpecifyCorrec
4
4
  import { commonComponents } from "./commonComponents";
5
5
  import { optionsWrapperComponent } from "./optionsWrapperComponent";
6
6
  import { createQuestionBasePage } from "./createQuestionBasePage";
7
+ import { placeholderTextSectionComponent } from "./placeholderTextSectionComponent";
7
8
  const css = Cypress.env('css');
8
9
 
9
10
  const selectors = {
@@ -43,10 +44,12 @@ const selectors = {
43
44
  //Preview tab
44
45
  dropdownWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-dropdown-wrapper'),
45
46
  dropdownPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [aria-haspopup="listbox"]'),
47
+ dropdownPlaceholderText: () => cy.get('.cloze-with-dropdown-placeholder'),
48
+ dropdownTextLabel: () => cy.get('.dropdown-label-text'),
46
49
  dropdownNumerationPreviewTab: () => cy.get('.answer-numeration-number-box'),
47
- correctAnswersLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="correct-answers-label"]'),
48
50
  correctAnswerResponseNumeration: () => cy.get('.answer-numeration-number-box'),
49
51
  tickIconWrapper: () => cy.get('.tick-icon-wrapper [data-name*="Rectangle"]'),
52
+ correctAnswerResponseWrapperWithoutEnumeration: () => cy.get('[class*="response-dropdown"] input'),
50
53
 
51
54
  //additional settings
52
55
  enterAriaLabelInputField: () => cy.get('input[aria-label*="Enter ARIA label"]')
@@ -136,7 +139,7 @@ const steps = {
136
139
  */
137
140
  expandDropdownInSpecifyCorrectAnswerSection: (dropdownIndex) => {
138
141
  utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex)
139
- .click({ position: "right" });
142
+ .click({ position: 'right' }, { force: true });
140
143
  utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex)
141
144
  .should('have.attr', 'aria-expanded', 'true');
142
145
  },
@@ -161,7 +164,7 @@ const steps = {
161
164
  */
162
165
  expandDropdownInPreviewTab: (dropdownIndex) => {
163
166
  utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex)
164
- .click();
167
+ .click({ force: true });
165
168
  utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex)
166
169
  .should('have.attr', 'aria-expanded', 'true');
167
170
  },
@@ -587,6 +590,82 @@ const steps = {
587
590
  .should('have.value', points)
588
591
  .blur();
589
592
  },
593
+
594
+ /**
595
+ * Verifies the placeholder text of a dropdown in the preview tab.
596
+ * @param {number} dropdownIndex - The index of the dropdown to verify.
597
+ * @param {string} placeholderText - The expected placeholder text.
598
+ * @returns {void}
599
+ */
600
+ verifyDropdownPlaceholderTextPreviewTab: (dropdownIndex, placeholderText) => {
601
+ fillInTheGapsDropdownCommonComponent.dropdownWrapperPreviewTab()
602
+ .eq(dropdownIndex)
603
+ .within(() => {
604
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.dropdownPlaceholderText(), placeholderText);
605
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.dropdownPlaceholderText(), 'visible');
606
+ });
607
+ },
608
+
609
+ /**
610
+ * Verifies that the placeholder text does not exist for a dropdown in the preview tab.
611
+ * @param {number} dropdownIndex - The index of the dropdown to verify.
612
+ * @returns {void}
613
+ */
614
+ verifyDropdownPlaceholderTextNotExistsPreviewTab: (dropdownIndex) => {
615
+ fillInTheGapsDropdownCommonComponent.dropdownWrapperPreviewTab()
616
+ .eq(dropdownIndex)
617
+ .within(() => {
618
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.dropdownPlaceholderText(), 'notExist');
619
+ });
620
+ },
621
+
622
+ verifyDropdownNumerationNotExistsPreviewTab: () => {
623
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.dropdownNumerationPreviewTab(), 'notExist');
624
+ },
625
+
626
+ /**
627
+ * Verifies the placeholder text of a dropdown in the preview tab.
628
+ * @param {number} dropdownIndex - The index of the dropdown to verify.
629
+ * @param {string} placeholderText - The expected placeholder text.
630
+ * @returns {void}
631
+ */
632
+ verifyDropdownPlaceholderTextSpecifyCorrectAnswerSection: (dropdownIndex, placeholderText) => {
633
+ fillInTheGapsDropdownCommonComponent.dropdownWrapperSpecifyCorrectAnswerSection()
634
+ .eq(dropdownIndex)
635
+ .within(() => {
636
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.dropdownPlaceholderText(), placeholderText);
637
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.dropdownPlaceholderText(), 'visible');
638
+ });
639
+ },
640
+
641
+ /**
642
+ * Verifies that the placeholder text does not exist for a dropdown in the preview tab.
643
+ * @param {number} dropdownIndex - The index of the dropdown to verify.
644
+ * @returns {void}
645
+ */
646
+ verifyDropdownPlaceholderTextNotExistsSpecifyCorrectAnswerSection: (dropdownIndex) => {
647
+ fillInTheGapsDropdownCommonComponent.dropdownWrapperSpecifyCorrectAnswerSection()
648
+ .eq(dropdownIndex)
649
+ .within(() => {
650
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.dropdownPlaceholderText(), 'notExist');
651
+ });
652
+ },
653
+
654
+ verifyDropdownNumerationNotExistsSpecifyCorrectAnswerSection: () => {
655
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.dropdownNumerationSpecifyCorrectAnswerSection(), 'notExist');
656
+ },
657
+
658
+ verifyDropdownAriaLabelPreviewTab: (inputFieldIndex, ariaLabel) => {
659
+ fillInTheGapsDropdownCommonComponent.dropdownPreviewTab()
660
+ .eq(inputFieldIndex)
661
+ .should('have.attr', 'aria-label', ariaLabel)
662
+ },
663
+
664
+ verifyDropdownAriaLabelSpecifyCorrectAnswerSection: (inputFieldIndex, ariaLabel) => {
665
+ fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection()
666
+ .eq(inputFieldIndex)
667
+ .should('have.attr', 'aria-label', ariaLabel)
668
+ }
590
669
  }
591
670
 
592
671
  const tests = {
@@ -737,6 +816,91 @@ const tests = {
737
816
  it('Accessibility of Dropdown and Dropdown menu section', { tags: 'a11y' }, () => {
738
817
  cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.dropdownLabel().parents('.student-view-settings-container'));
739
818
  });
819
+ },
820
+
821
+ verifyPlaceholderTextPreviewTabFunctionality: () => {
822
+ it('When \'Placeholder text\' input field is empty then no \'Placeholder text\' should be displayed in the preview tab dropdown', () => {
823
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(0);
824
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(1);
825
+ });
826
+
827
+ it('When the user adds a text in the Placeholder input field, the added placeholder should be displayed in the preview tab dropdown', () => {
828
+ createQuestionBasePage.steps.switchToEditTab();
829
+ placeholderTextSectionComponent.steps.addInputToPlaceholderTextInputField('Add answer');
830
+ createQuestionBasePage.steps.switchToPreviewTab();
831
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(0, 'Add answer');
832
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(1, 'Add answer');
833
+ });
834
+
835
+ //Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
836
+
837
+ it('Accessibility of \'Placeholder text\'', { tags: 'a11y' }, () => {
838
+ cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab().parents('[class*="question-preview-wrapper"]'));
839
+ });
840
+
841
+ it('When the user selects an option in the dropdown, then the placeholder text should disappear and on switching from edit tab to preview tab, the placeholder text should re-appear for the dropdown', () => {
842
+ fillInTheGapsDropdownCommonComponent.steps.selectResponseFromDropdownInPreviewTab([{ dropdownIndex: 0, dropdownOption: 'Flower' }]);
843
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(0);
844
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(1, 'Add answer');
845
+ createQuestionBasePage.steps.resetQuestionPreview();
846
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(0, 'Add answer');
847
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(1, 'Add answer');
848
+ });
849
+
850
+ it('When the user removes the placeholder text input field, then placeholder text should get updated accordingly for both the preview tab dropdowns', () => {
851
+ createQuestionBasePage.steps.switchToEditTab();
852
+ placeholderTextSectionComponent.steps.clearPlaceholderTextInputField();
853
+ createQuestionBasePage.steps.switchToPreviewTab();
854
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(0);
855
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(1);
856
+ });
857
+ },
858
+
859
+ verifyIndividualPlaceholderTextPreviewTabFunctionality: () => {
860
+ it('When "Customize placeholder text for individual text containers" checkbox is checked and \'Placeholder text\' input fields for individual text containers are kept empty, then no \'Placeholder text\' should be displayed in the preview tab dropdown', () => {
861
+ createQuestionBasePage.steps.switchToEditTab();
862
+ placeholderTextSectionComponent.steps.checkCustomizePlaceholderTextCheckbox();
863
+ createQuestionBasePage.steps.switchToPreviewTab();
864
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(0);
865
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(1);
866
+ });
867
+
868
+ it('When the user has set a placeholder text in either individual placeholder text input field, then placeholder text should be displayed for the respective dropdown in preview tab', () => {
869
+ createQuestionBasePage.steps.switchToEditTab();
870
+ placeholderTextSectionComponent.steps.addInputToIndividualPlaceholderTextInputField(0, 'Response a');
871
+ createQuestionBasePage.steps.switchToPreviewTab();
872
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(0, 'Response a');
873
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(1);
874
+ });
875
+
876
+ it('When the user removes the placeholder text from individual placeholder text input field, then placeholder text should get updated accordingly for both the dropdown in preview tab', () => {
877
+ createQuestionBasePage.steps.switchToEditTab();
878
+ placeholderTextSectionComponent.steps.clearIndividualPlaceholderTextInputField(0);
879
+ createQuestionBasePage.steps.switchToPreviewTab();
880
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(0);
881
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(1);
882
+ });
883
+
884
+ it('When the user has set placeholder text in individual placeholder text input field, then it should override the placeholder text set in the global placeholder text input field', () => {
885
+ cy.log('Pre step: Adding global placeholder text and individual placeholder text')
886
+ createQuestionBasePage.steps.switchToEditTab();
887
+ placeholderTextSectionComponent.steps.addInputToPlaceholderTextInputField('Global placeholder');
888
+ placeholderTextSectionComponent.steps.addInputToIndividualPlaceholderTextInputField(0, 'Response 1');
889
+ createQuestionBasePage.steps.switchToPreviewTab();
890
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(0, 'Response 1');
891
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(1, 'Global placeholder');
892
+ });
893
+
894
+ it('Accessibility of \'Placeholder text\' in preview tab', { tags: 'a11y' }, () => {
895
+ cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab().parents('[class*="question-preview-wrapper"]'));
896
+ });
897
+
898
+ it('When the user selects an option from the dropdown, then the placeholder text should disappear and on switching from edit tab to preview tab, the placeholder text should re-appear in the preview tab', () => {
899
+ fillInTheGapsDropdownCommonComponent.steps.selectResponseFromDropdownInPreviewTab([{ dropdownIndex: 0, dropdownOption: 'Flower' }]);
900
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextNotExistsPreviewTab(0);
901
+ createQuestionBasePage.steps.resetQuestionPreview();
902
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownPlaceholderTextPreviewTab(1, 'Global placeholder');
903
+ });
740
904
  }
741
905
  }
742
906
 
@@ -4,6 +4,7 @@ import { autoScoredScoringSectionMultiResponseType } from "./autoScoredScoringSe
4
4
  import { autoScoredSpecifyCorrectAnswerSection } from "./autoScoredSpecifyCorrectAnswerSection";
5
5
  import { commonComponents } from "./commonComponents";
6
6
  import { createQuestionBasePage } from "./createQuestionBasePage";
7
+ import { placeholderTextSectionComponent } from "./placeholderTextSectionComponent";
7
8
  import { scoringSectionBaseEditTab } from "./scoringSectionBaseEditTab";
8
9
  const css = Cypress.env('css');
9
10
  const conditionalCheckboxes = ['Case sensitive', 'Validate if answer is included in the response', 'Ignore extra spaces', 'Ignore single letter mistake'];
@@ -12,6 +13,7 @@ const conditionalCheckboxes = ['Case sensitive', 'Validate if answer is included
12
13
  const selectors = {
13
14
  answerInputFieldSpecifyCorrectAnswerSection: () => cy.get('.label-image-text-inline-text-field input'),
14
15
  answerInputFieldPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-input-field input'),
16
+ answerInputFieldWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-input-field'),
15
17
  responseAreaNumeration: () => cy.get('.response-input-adornment'),
16
18
  correctAnswerSectionWrapper: () => cy.get('.cloze-with-text-correct-answer-wrapper'),
17
19
  correctAnswersLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="correct-answer-label"]'),
@@ -19,6 +21,7 @@ const selectors = {
19
21
  correctAnswerResponseNumeration: () => cy.get('.answer-numeration-number-box'),
20
22
  correctAnswerResponseWrapper: () => cy.get('[class*="ClozeWithTextResponsestyles__AnswerCell"]'),
21
23
  correctAnswerResponse: () => cy.get('[class*="AnswerWrapperForLabel"]'),
24
+ correctAnswerResponseWrapperWithoutEnumeration: () => cy.get('.cloze-with-text-answer-status-response-preview-wrapper [class*="ResponseInputWrapper"] input'),
22
25
 
23
26
  setLimitLabel: () => cy.get('[class*="SetLimitWrapper"] .text-label'),
24
27
  minimumCharacterLimitLabel: () => cy.get('.label-image-min-max-container .additional-settings-label').eq(0),
@@ -47,7 +50,6 @@ const selectors = {
47
50
  responseAccordionPointsInputFieldWrapper: () => cy.get('[class*="ResponseComponentstyles__PointsWrapper"]'),
48
51
  responseAccordionAddAlternateButton: () => cy.get('.add-alternate-btn'),
49
52
  responseAccordionAddAlternateButtonLabel: () => cy.get('.add-alternate-btn p'),
50
- responseAreaNumeration: () => cy.get('.response-input-adornment'),
51
53
 
52
54
  //Special characters section
53
55
  specialCharactersLabel: () => cy.get('[class*="LabelImageWithTextstyles__CustomizedSpecialCharacterWrapper"]'),
@@ -84,9 +86,6 @@ const selectors = {
84
86
  //Student view settings
85
87
  spellCheckLabel: () => cy.get('[data-ngie-testid="spell-check-checkbox"] .MuiFormControlLabel-label'),
86
88
  spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input[type="checkbox"]'),
87
-
88
- //additional settings
89
- enterAriaLabelInputField: () => cy.get('input[aria-label*="Enter ARIA label"]')
90
89
  }
91
90
 
92
91
  const steps = {
@@ -765,6 +764,64 @@ const steps = {
765
764
  .should('have.value', points)
766
765
  .blur();
767
766
  },
767
+
768
+ verifyAnswerInputFieldPlaceholderTextPreviewTab: (answerFieldIndex, placeholderText) => {
769
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
770
+ .eq(answerFieldIndex)
771
+ .should('have.attr', 'placeholder', placeholderText)
772
+ },
773
+
774
+ verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab: (answerFieldIndex) => {
775
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
776
+ .eq(answerFieldIndex)
777
+ .should('not.have.attr', 'placeholder')
778
+ },
779
+
780
+ clearAnswerInputFieldPreviewTab: (answerFieldIndex) => {
781
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
782
+ .eq(answerFieldIndex)
783
+ .clear()
784
+ .blur();
785
+ },
786
+
787
+ verifyAnswerInputFieldEnumeration: (enumerationArray) => {
788
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), enumerationArray.length);
789
+ enumerationArray.forEach((option, index) => {
790
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
791
+ .eq(index)
792
+ .parents('.cloze-with-text-response-field-wrapper')
793
+ .within(() => {
794
+ utilities.verifyTextContent(fillInTheGapsTextCommonComponent.responseAreaNumeration(), `${option}`);
795
+ });
796
+ });
797
+ },
798
+
799
+ verifyCorrectAnswerResponsesEnumeration: (enumerationArray) => {
800
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.correctAnswerResponseWrapper(), enumerationArray.length);
801
+ enumerationArray.forEach((option, index) => {
802
+ fillInTheGapsTextCommonComponent.correctAnswerResponseWrapper()
803
+ .eq(index)
804
+ .within(() => {
805
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.correctAnswerResponseNumeration(), `${option}`);
806
+ });
807
+ });
808
+ },
809
+
810
+ verifyResponseAreaNumerationNotExists: () => {
811
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseAreaNumeration(), 'notExist');
812
+ },
813
+
814
+ verifyAnswerInputFieldAriaLabelPreviewTab: (inputFieldIndex, ariaLabel) => {
815
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
816
+ .eq(inputFieldIndex)
817
+ .should('have.attr', 'aria-label', ariaLabel)
818
+ },
819
+
820
+ verifyAnswerInputFieldAriaLabelSpecifyCorrectAnswerSection: (inputFieldIndex, ariaLabel) => {
821
+ fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection()
822
+ .eq(inputFieldIndex)
823
+ .should('have.attr', 'aria-label', ariaLabel)
824
+ }
768
825
  }
769
826
 
770
827
  const tests = {
@@ -1057,7 +1114,7 @@ const tests = {
1057
1114
  fillInTheGapsTextCommonComponent.steps.focusInAndFocusOutOfResponseAnswerInputFieldPreviewTab();
1058
1115
  fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
1059
1116
  });
1060
-
1117
+
1061
1118
  it('When the user updates minimum character limit in edit tab and enters character less than the minimum character limit value set and focus out of response field, then the warning message \'Minimum 6 characters are required\' should be displayed in preview tab', () => {
1062
1119
  createQuestionBasePage.steps.switchToEditTab();
1063
1120
  fillInTheGapsTextCommonComponent.steps.setMinimumLimit(6);
@@ -1479,7 +1536,93 @@ const tests = {
1479
1536
  fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '0' }]);
1480
1537
  fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '0' }]);
1481
1538
  });
1482
- }
1539
+ },
1540
+
1541
+ verifyPlaceholderTextPreviewTabFunctionality: () => {
1542
+ it('When \'Placeholder text\' input field is empty then no \'Placeholder text\' should be displayed in the preview tab answer input field', () => {
1543
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(0);
1544
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(1);
1545
+ });
1546
+
1547
+ it('When the user adds a text in the Placeholder input field, the added placeholder should be displayed in the preview tab answer input field', () => {
1548
+ createQuestionBasePage.steps.switchToEditTab();
1549
+ placeholderTextSectionComponent.steps.addInputToPlaceholderTextInputField('Add answer');
1550
+ createQuestionBasePage.steps.switchToPreviewTab();
1551
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(0, 'Add answer');
1552
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(1, 'Add answer');
1553
+ });
1554
+
1555
+ //Comment: not possible to check css of placeholder since it is added as an attribute, properties of placeholder is not visible in dev tools
1556
+
1557
+ it('Accessibility of \'Placeholder text\'', { tags: 'a11y' }, () => {
1558
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab().parents('[class*="question-preview-wrapper"]'));
1559
+ });
1560
+
1561
+ it('When the user starts typing in the answer input field, then the placeholder text should disappear and on clearing the input field the placeholder text should re-appear for the preview tab answer input fields', () => {
1562
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Response 1' }]);
1563
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(0);
1564
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(1, 'Add answer');
1565
+ fillInTheGapsTextCommonComponent.steps.clearAnswerInputFieldPreviewTab(0)
1566
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(0, 'Add answer');
1567
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(1, 'Add answer');
1568
+ });
1569
+
1570
+
1571
+ it('When the user removes the placeholder text input field, then placeholder text should get updated accordingly for both the preview tab answer input fields', () => {
1572
+ createQuestionBasePage.steps.switchToEditTab();
1573
+ placeholderTextSectionComponent.steps.clearPlaceholderTextInputField();
1574
+ createQuestionBasePage.steps.switchToPreviewTab();
1575
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(0);
1576
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(1);
1577
+ });
1578
+ },
1579
+
1580
+ verifyIndividualPlaceholderTextPreviewTabFunctionality: () => {
1581
+ it('When "Customize placeholder text for individual text containers" checkbox is checked and \'Placeholder text\' input fields for individual text containers are kept empty, then no \'Placeholder text\' should be displayed in the preview tab answer input field', () => {
1582
+ createQuestionBasePage.steps.switchToEditTab();
1583
+ placeholderTextSectionComponent.steps.checkCustomizePlaceholderTextCheckbox();
1584
+ createQuestionBasePage.steps.switchToPreviewTab();
1585
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(0);
1586
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(1);
1587
+ });
1588
+
1589
+ it('When the user has set a placeholder text in either individual placeholder text input field, then placeholder text should be displayed for the respective answer input field in preview tab', () => {
1590
+ createQuestionBasePage.steps.switchToEditTab();
1591
+ placeholderTextSectionComponent.steps.addInputToIndividualPlaceholderTextInputField(0, 'Response a');
1592
+ createQuestionBasePage.steps.switchToPreviewTab();
1593
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(0, 'Response a');
1594
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(1);
1595
+ });
1596
+
1597
+ it('When the user removes the placeholder text from individual placeholder text input field, then placeholder text should get updated accordingly for both the answer input field in preview tab', () => {
1598
+ createQuestionBasePage.steps.switchToEditTab();
1599
+ placeholderTextSectionComponent.steps.clearIndividualPlaceholderTextInputField(0);
1600
+ createQuestionBasePage.steps.switchToPreviewTab();
1601
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(0);
1602
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(1);
1603
+ });
1604
+
1605
+ it('When the user has set placeholder text in individual placeholder text input field, then it should override the placeholder text set in the global placeholder text input field', () => {
1606
+ cy.log('Pre step: Adding global placeholder text and individual placeholder text')
1607
+ createQuestionBasePage.steps.switchToEditTab();
1608
+ placeholderTextSectionComponent.steps.addInputToPlaceholderTextInputField('Global placeholder');
1609
+ placeholderTextSectionComponent.steps.addInputToIndividualPlaceholderTextInputField(0, 'Response 1');
1610
+ createQuestionBasePage.steps.switchToPreviewTab();
1611
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(0, 'Response 1');
1612
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(1, 'Global placeholder');
1613
+ });
1614
+
1615
+ it('Accessibility of \'Placeholder text\' in preview tab', { tags: 'a11y' }, () => {
1616
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab().parents('.response-input-field'))
1617
+ });
1618
+
1619
+ it('When the user enters text in the response field, then the placeholder text should disappear and on clearing the input field the placeholder text should re-appear in the preview tab', () => {
1620
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Option 1' }]);
1621
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextNotExistsPreviewTab(0);
1622
+ fillInTheGapsTextCommonComponent.steps.clearAnswerInputFieldPreviewTab(0);
1623
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(1, 'Global placeholder');
1624
+ });
1625
+ },
1483
1626
  }
1484
1627
 
1485
1628
  export const fillInTheGapsTextCommonComponent = {
@@ -0,0 +1,151 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+ const gradingEnumerationButtons = ['Numerical', 'Alphabet (uppercase)', 'Alphabet (lowercase)', 'Roman numeral (uppercase)', 'Roman numeral (lowercase)']
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ gradingViewLabel: () => cy.get('[class*="GradingViewLabel"]'),
7
+ gradingStyleLabel: () => cy.get('[class*="GradingStyleLabel"]'),
8
+ withEnumerationRadioButton: () => cy.get('[data-value="withEnumeration"] input'),
9
+ withEnumerationRadioButtonLabel: () => cy.get('[data-value="withEnumeration"] .ngie-radio-label'),
10
+ withoutEnumerationRadioButton: () => cy.get('[data-value="withoutEnumeration"] input'),
11
+ withoutEnumerationRadioButtonLabel: () => cy.get('[data-value="withoutEnumeration"] .ngie-radio-label'),
12
+ identifiersLabel: () => cy.get('[class*="identifiers-wrapper"] .options-label'),
13
+ numericalToggleButton: () => cy.get('[data-ngie-testid="numerical-toggle-button"]'),
14
+ alphabetUppercaseToggleButton: () => cy.get('[data-ngie-testid="alphabet-(uppercase)-toggle-button"]'),
15
+ alphabetLowercaseToggleButton: () => cy.get('[data-ngie-testid="alphabet-(lowercase)-toggle-button"]'),
16
+ romanNumeralUppercaseToggleButton: () => cy.get('[data-ngie-testid="roman-numeral-(uppercase)-toggle-button"]'),
17
+ romanNumeralLowercaseToggleButton: () => cy.get('[data-ngie-testid="roman-numeral-(lowercase)-toggle-button"]'),
18
+ identifiersToggleButtonLabel: () => cy.get('[class*="identifiers-wrapper"] .ngie-toggle-button-label'),
19
+ identifiersToggleButtonIcon: () => cy.get('[class*="identifiers-wrapper"] .ngie-toggle-button-icon')
20
+ }
21
+
22
+ const steps = {
23
+ verifyWithEnumerationRadioButtonCheckedState: () => {
24
+ gradingViewEnumerationComponent.withEnumerationRadioButton()
25
+ .should('be.checked');
26
+ },
27
+
28
+ selectIdentifierToggleButton: (toggleButton) => {
29
+ const toggleButtonMap = {
30
+ 'Numerical': gradingViewEnumerationComponent.numericalToggleButton(),
31
+ 'Alphabet (uppercase)': gradingViewEnumerationComponent.alphabetUppercaseToggleButton(),
32
+ 'Alphabet (lowercase)': gradingViewEnumerationComponent.alphabetLowercaseToggleButton(),
33
+ 'Roman numeral (uppercase)': gradingViewEnumerationComponent.romanNumeralUppercaseToggleButton(),
34
+ 'Roman numeral (lowercase)': gradingViewEnumerationComponent.romanNumeralLowercaseToggleButton()
35
+ };
36
+ if (!toggleButtonMap[toggleButton]) {
37
+ throw new Error('Invalid identifier toggle button');
38
+ }
39
+ toggleButtonMap[toggleButton]
40
+ .click()
41
+ .should('have.attr', 'aria-pressed', 'true');
42
+ },
43
+
44
+ selectEnumerationType: (enumerationType) => {
45
+ switch (enumerationType) {
46
+ case 'with enumeration':
47
+ gradingViewEnumerationComponent.withEnumerationRadioButton()
48
+ .click()
49
+ .should('be.checked');
50
+ break;
51
+ case 'without enumeration':
52
+ gradingViewEnumerationComponent.withoutEnumerationRadioButton()
53
+ .click()
54
+ .should('be.checked');
55
+ break;
56
+ default:
57
+ throw new Error('Invalid enumeration type');
58
+ }
59
+ }
60
+ }
61
+
62
+ const tests = {
63
+ verifyGradingViewEnumerationSectionContents: (typeOfInput) => {
64
+ it('"Grading view" label should be displayed', () => {
65
+ utilities.verifyInnerText(gradingViewEnumerationComponent.gradingViewLabel(), 'Grading view');
66
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.gradingViewLabel(), 'visible');
67
+ });
68
+
69
+ it('"Grading style" label along with two radio buttons, "with enumeration" and "without enumeration" should be displayed. By default, "with enumeration" radio button should be in checked state', () => {
70
+ utilities.verifyInnerText(gradingViewEnumerationComponent.gradingStyleLabel(), 'Grading style');
71
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.gradingStyleLabel(), 'visible');
72
+ utilities.verifyInnerText(gradingViewEnumerationComponent.withEnumerationRadioButtonLabel(), 'With enumeration');
73
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.withEnumerationRadioButtonLabel(), 'visible');
74
+ utilities.verifyInnerText(gradingViewEnumerationComponent.withoutEnumerationRadioButtonLabel(), 'Without enumeration');
75
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.withoutEnumerationRadioButtonLabel(), 'visible');
76
+ gradingViewEnumerationComponent.steps.verifyWithEnumerationRadioButtonCheckedState();
77
+ });
78
+
79
+ it(`When "with enumeration" radio button is in checked state, "${typeOfInput} identifiers" label along with ${gradingEnumerationButtons.length} toggle buttons. By default, 'Numerical' toggle button should be in selected state of the ${gradingEnumerationButtons.join(' , ')} toggle buttons`, () => {
80
+ utilities.verifyInnerText(gradingViewEnumerationComponent.identifiersLabel(), `${typeOfInput} identifiers`);
81
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.numericalToggleButton(), 'visible');
82
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.alphabetUppercaseToggleButton(), 'visible');
83
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.alphabetLowercaseToggleButton(), 'visible');
84
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.romanNumeralUppercaseToggleButton(), 'visible');
85
+ utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.romanNumeralLowercaseToggleButton(), 'visible');
86
+ gradingEnumerationButtons.forEach((button, buttonIndex) => {
87
+ utilities.verifyInnerText(utilities.getNthElement(gradingViewEnumerationComponent.identifiersToggleButtonLabel(), buttonIndex), button);
88
+ });
89
+ gradingViewEnumerationComponent.numericalToggleButton()
90
+ .should('have.attr', 'aria-pressed', 'true');
91
+ });
92
+
93
+ it('CSS of grading view section contents', { tags: 'css' }, () => {
94
+ utilities.verifyCSS(gradingViewEnumerationComponent.gradingViewLabel(), {
95
+ 'color': css.color.sectionHeading,
96
+ 'font-size': css.fontSize.default,
97
+ 'font-weight': css.fontWeight.semibold
98
+ });
99
+ utilities.verifyCSS(gradingViewEnumerationComponent.gradingStyleLabel(), {
100
+ 'color': css.color.labels,
101
+ 'font-size': css.fontSize.normal,
102
+ 'font-weight': css.fontWeight.semibold
103
+ });
104
+ utilities.verifyCSS(gradingViewEnumerationComponent.withoutEnumerationRadioButtonLabel(), {
105
+ 'color': css.color.labelText,
106
+ 'font-size': css.fontSize.normal,
107
+ 'font-weight': css.fontWeight.regular
108
+ });
109
+ utilities.verifyCSS(gradingViewEnumerationComponent.withEnumerationRadioButtonLabel(), {
110
+ 'color': css.color.labelText,
111
+ 'font-size': css.fontSize.normal,
112
+ 'font-weight': css.fontWeight.regular
113
+ });
114
+ utilities.verifyCSS(gradingViewEnumerationComponent.identifiersLabel(), {
115
+ 'color': css.color.labels,
116
+ 'font-size': css.fontSize.normal,
117
+ 'font-weight': css.fontWeight.semibold
118
+ });
119
+ utilities.verifyCSS(gradingViewEnumerationComponent.numericalToggleButton(), {
120
+ 'background-color': css.color.secondaryBtnBg,
121
+ 'border': `2px solid ${css.color.secondaryBtnActive}`
122
+ });
123
+ utilities.verifyCSS(utilities.getNthElement(gradingViewEnumerationComponent.identifiersToggleButtonLabel(), 0), {
124
+ 'color': css.color.secondaryBtnActive,
125
+ 'font-size': css.fontSize.default,
126
+ 'font-weight': css.fontWeight.regular
127
+ });
128
+ utilities.verifyCSS(utilities.getNthElement(gradingViewEnumerationComponent.identifiersToggleButtonIcon().find('tspan'), 0), {
129
+ 'fill': css.color.secondaryBtnActive
130
+ });
131
+ utilities.verifyCSS(gradingViewEnumerationComponent.alphabetLowercaseToggleButton(), {
132
+ 'background-color': css.color.secondaryBtnBg,
133
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`
134
+ });
135
+ utilities.verifyCSS(utilities.getNthElement(gradingViewEnumerationComponent.identifiersToggleButtonLabel(), 1), {
136
+ 'color': css.color.secondaryBtn,
137
+ 'font-size': css.fontSize.default,
138
+ 'font-weight': css.fontWeight.regular
139
+ });
140
+ utilities.verifyCSS(utilities.getNthElement(gradingViewEnumerationComponent.identifiersToggleButtonIcon().find('tspan'), 4), {
141
+ 'fill': css.color.figDefaultComponentBorder
142
+ });
143
+ });
144
+ }
145
+ }
146
+
147
+ export const gradingViewEnumerationComponent = {
148
+ ...selectors,
149
+ steps,
150
+ tests,
151
+ }