itemengine-cypress-automation 1.0.338-12thMarchRegressionFixes-1cd5906.0 → 1.0.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +67 -0
- package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +66 -0
- package/cypress/pages/dialogBoxBase.js +13 -7
- package/cypress/pages/fillInTheGapsDragAndDropPage.js +71 -4
- package/cypress/pages/imageHighlightPage.js +69 -4
- package/cypress/pages/multipleSelectionGridPage.js +68 -1
- package/cypress/pages/multipleSelectionPage.js +67 -0
- package/cypress/pages/singleSelectionGridPage.js +68 -1
- package/cypress/pages/singleSelectionPage.js +67 -0
- package/package.json +2 -2
@@ -6,6 +6,7 @@ import { optionsWrapperComponent } from "./optionsWrapperComponent";
|
|
6
6
|
import { createQuestionBasePage } from "./createQuestionBasePage";
|
7
7
|
import { placeholderTextSectionComponent } from "./placeholderTextSectionComponent";
|
8
8
|
import { scoringSectionBaseEditTab } from "./scoringSectionBaseEditTab";
|
9
|
+
import { dialogBoxBase } from "../dialogBoxBase";
|
9
10
|
const css = Cypress.env('css');
|
10
11
|
|
11
12
|
const selectors = {
|
@@ -749,6 +750,72 @@ const steps = {
|
|
749
750
|
}
|
750
751
|
|
751
752
|
const tests = {
|
753
|
+
//TODO need to remove once Save as you go is available for all questions
|
754
|
+
/**
|
755
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
756
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
757
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
758
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
759
|
+
*/
|
760
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
761
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
762
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
763
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
764
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
765
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
766
|
+
});
|
767
|
+
|
768
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
769
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
770
|
+
'color': css.color.activeButtons,
|
771
|
+
'font-size': css.fontSize.default,
|
772
|
+
'font-weight': css.fontWeight.regular
|
773
|
+
});
|
774
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
775
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
776
|
+
});
|
777
|
+
|
778
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
779
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
780
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
781
|
+
});
|
782
|
+
|
783
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
784
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
785
|
+
'color': css.color.flyoutTitle,
|
786
|
+
'font-size': css.fontSize.heading,
|
787
|
+
'font-weight': css.fontWeight.semibold
|
788
|
+
});
|
789
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
790
|
+
'color': css.color.labels,
|
791
|
+
'font-size': css.fontSize.default,
|
792
|
+
'font-weight': css.fontWeight.regular
|
793
|
+
});
|
794
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
795
|
+
'fill': css.color.closeIcon
|
796
|
+
});
|
797
|
+
});
|
798
|
+
|
799
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
800
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
801
|
+
dialogBoxBase.steps.closeWarningPopup();
|
802
|
+
});
|
803
|
+
},
|
804
|
+
|
805
|
+
//TODO need to remove once Save as you go is available for all questions
|
806
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
807
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
808
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
809
|
+
.click();
|
810
|
+
dialogBoxBase.steps.closeWarningPopup();
|
811
|
+
//TODO: Need to add error message according to question types
|
812
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
813
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
814
|
+
.eq(1)
|
815
|
+
.should('have.attr', 'aria-expanded', 'true');
|
816
|
+
});
|
817
|
+
},
|
818
|
+
|
752
819
|
/**
|
753
820
|
* Verifies the contents and functionality of the 'Specify correct answer' accordion for fill in the gaps over image dropdown question.
|
754
821
|
* @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
|
@@ -1715,6 +1715,72 @@ const tests = {
|
|
1715
1715
|
fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholderTextPreviewTab(1, 'Global placeholder');
|
1716
1716
|
});
|
1717
1717
|
},
|
1718
|
+
|
1719
|
+
//TODO need to remove once Save as you go is available for all questions
|
1720
|
+
/**
|
1721
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
1722
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
1723
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
1724
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
1725
|
+
*/
|
1726
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
1727
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
1728
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
1729
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
1730
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
1731
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
1732
|
+
});
|
1733
|
+
|
1734
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
1735
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
1736
|
+
'color': css.color.activeButtons,
|
1737
|
+
'font-size': css.fontSize.default,
|
1738
|
+
'font-weight': css.fontWeight.regular
|
1739
|
+
});
|
1740
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
1741
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
1742
|
+
});
|
1743
|
+
|
1744
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
1745
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
1746
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
1747
|
+
});
|
1748
|
+
|
1749
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
1750
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
1751
|
+
'color': css.color.flyoutTitle,
|
1752
|
+
'font-size': css.fontSize.heading,
|
1753
|
+
'font-weight': css.fontWeight.semibold
|
1754
|
+
});
|
1755
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
1756
|
+
'color': css.color.labels,
|
1757
|
+
'font-size': css.fontSize.default,
|
1758
|
+
'font-weight': css.fontWeight.regular
|
1759
|
+
});
|
1760
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
1761
|
+
'fill': css.color.closeIcon
|
1762
|
+
});
|
1763
|
+
});
|
1764
|
+
|
1765
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
1766
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
1767
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1768
|
+
});
|
1769
|
+
},
|
1770
|
+
|
1771
|
+
//TODO need to remove once Save as you go is available for all questions
|
1772
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
1773
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
1774
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
1775
|
+
.click();
|
1776
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1777
|
+
//TODO: Need to add error message according to question types
|
1778
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
1779
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
1780
|
+
.eq(1)
|
1781
|
+
.should('have.attr', 'aria-expanded', 'true');
|
1782
|
+
});
|
1783
|
+
},
|
1718
1784
|
}
|
1719
1785
|
|
1720
1786
|
export const fillInTheGapsTextCommonComponent = {
|
@@ -15,11 +15,15 @@ const selectors = {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
const steps = {
|
18
|
-
allFieldsRequiredWarningPopupContents: () => {
|
18
|
+
allFieldsRequiredWarningPopupContents: (requiredFieldsArray = null) => {
|
19
19
|
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
20
|
-
utilities.verifyInnerText(dialogBoxBase.dialogBoxTitle(), '
|
21
|
-
utilities.verifyInnerText(dialogBoxBase.
|
22
|
-
|
20
|
+
utilities.verifyInnerText(dialogBoxBase.dialogBoxTitle(), 'Incomplete question');
|
21
|
+
utilities.verifyInnerText(dialogBoxBase.dialogBoxHelpText(), "Are you sure you want to save? Required fields are missing:");
|
22
|
+
if (requiredFieldsArray != null) {
|
23
|
+
requiredFieldsArray.forEach((field, index) => {
|
24
|
+
utilities.verifyInnerText(utilities.getNthElement(dialogBoxBase.dialogBoxWarningFieldList(), index), field);
|
25
|
+
});
|
26
|
+
}
|
23
27
|
},
|
24
28
|
|
25
29
|
closeWarningPopup: () => {
|
@@ -48,11 +52,13 @@ const tests = {
|
|
48
52
|
it('When user has made no edits and clicks on Save Question button, the user should get a warning popup', () => {
|
49
53
|
createQuestionBasePage.saveQuestionButton()
|
50
54
|
.click();
|
51
|
-
|
55
|
+
if (requiredFieldsArray != null) {
|
56
|
+
dialogBoxBase.steps.allFieldsRequiredWarningPopupContents(requiredFieldsArray);
|
57
|
+
}
|
52
58
|
});
|
53
59
|
|
54
|
-
it('
|
55
|
-
dialogBoxBase.steps.
|
60
|
+
it('Leave page popup should close on clicking the reject button', () => {
|
61
|
+
dialogBoxBase.steps.clickOnRejectButtonInDialogBox();
|
56
62
|
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
|
57
63
|
});
|
58
64
|
},
|
@@ -3,6 +3,7 @@ import utilities from "../support/helpers/utilities";
|
|
3
3
|
const css = Cypress.env('css');
|
4
4
|
import { createQuestionBasePage, optionsWrapperComponent, autoScoredScoringPreviewTab, scoringSectionBaseEditTab, questionInputFieldComponent, fillInTheGapsDragAndDropCommonComponents, correctIncorrectAnswerLabelComponent, questionInstructionsComponent, autoScoredStudentViewSettings, ckEditorToolbar, equationEditorFlyout, draggableOptionContainer, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, draggableOptionsSectionComponent, studentViewSettingsLabelComponent, randomizeOptionsComponent, enableOuterBorderComponent, allowMultipleInstancesOfSameDraggableOptionComponent, additionalSettingsPanel, responseAreaSettingsPopupComponent, gradingViewEnumerationComponent, ariaLabelSectionComponent, styleAndLayoutCustomizationAccordionComponent, figCommonStyleAndLayoutComponent, draggableOptionsStyleAndLayoutComponent } from "./components"
|
5
5
|
import { createItemPage } from "./createItemPage";
|
6
|
+
import { dialogBoxBase } from "./dialogBoxBase";
|
6
7
|
|
7
8
|
//TODO update option container selectors when https://redmine.zeuslearning.com/issues/563159 is resolved
|
8
9
|
const selectors = {
|
@@ -91,7 +92,7 @@ const steps = {
|
|
91
92
|
...styleAndLayoutCustomizationAccordionComponent.steps,
|
92
93
|
...figCommonStyleAndLayoutComponent.steps,
|
93
94
|
...draggableOptionsStyleAndLayoutComponent.steps,
|
94
|
-
|
95
|
+
...createItemPage.steps,
|
95
96
|
/**
|
96
97
|
* Sets options in dropzone in the Preview Tab based on the provided optionsObject.
|
97
98
|
* @param {Object} optionsObject - An object where keys are option texts and values are dropzone indices.
|
@@ -1040,6 +1041,72 @@ const tests = {
|
|
1040
1041
|
...styleAndLayoutCustomizationAccordionComponent.tests,
|
1041
1042
|
...figCommonStyleAndLayoutComponent.tests,
|
1042
1043
|
...draggableOptionsStyleAndLayoutComponent.tests,
|
1044
|
+
//TODO need to remove once Save as you go is available for all questions
|
1045
|
+
/**
|
1046
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
1047
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
1048
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
1049
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
1050
|
+
*/
|
1051
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
1052
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
1053
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
1054
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
1055
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
1056
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
1057
|
+
});
|
1058
|
+
|
1059
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
1060
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
1061
|
+
'color': css.color.activeButtons,
|
1062
|
+
'font-size': css.fontSize.default,
|
1063
|
+
'font-weight': css.fontWeight.regular
|
1064
|
+
});
|
1065
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
1066
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
1067
|
+
});
|
1068
|
+
|
1069
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
1070
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
1071
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
1072
|
+
});
|
1073
|
+
|
1074
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
1075
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
1076
|
+
'color': css.color.flyoutTitle,
|
1077
|
+
'font-size': css.fontSize.heading,
|
1078
|
+
'font-weight': css.fontWeight.semibold
|
1079
|
+
});
|
1080
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
1081
|
+
'color': css.color.labels,
|
1082
|
+
'font-size': css.fontSize.default,
|
1083
|
+
'font-weight': css.fontWeight.regular
|
1084
|
+
});
|
1085
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
1086
|
+
'fill': css.color.closeIcon
|
1087
|
+
});
|
1088
|
+
});
|
1089
|
+
|
1090
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
1091
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
1092
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1093
|
+
});
|
1094
|
+
},
|
1095
|
+
|
1096
|
+
//TODO need to remove once Save as you go is available for all questions
|
1097
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
1098
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
1099
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
1100
|
+
.click();
|
1101
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1102
|
+
//TODO: Need to add error message according to question types
|
1103
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
1104
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
1105
|
+
.eq(1)
|
1106
|
+
.should('have.attr', 'aria-expanded', 'true');
|
1107
|
+
});
|
1108
|
+
},
|
1109
|
+
|
1043
1110
|
verifyContentsOfSpecifyCorrectAnswerSection: () => {
|
1044
1111
|
it('When user selects a scoring type then in the \'Correct\' accordion, all the contents should be displayed', () => {
|
1045
1112
|
utilities.verifyElementCount(fillInTheGapsDragAndDropPage.dropzoneSpecifyCorrectAnswerSection(), 3);
|
@@ -1061,16 +1128,16 @@ const tests = {
|
|
1061
1128
|
|
1062
1129
|
it(`When the user has removed all the options from the dropzone in the ${accordionName} accordion, 'Error: Please set a correct answer.' error message should be thrown along with an error icon on the '${accordionName}' accordion`, () => {
|
1063
1130
|
fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Petals');
|
1064
|
-
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), '
|
1131
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist')
|
1065
1132
|
if (accordionName == 'Correct') {
|
1066
1133
|
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
1067
1134
|
.within(() => {
|
1068
|
-
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), '
|
1135
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'notExist');
|
1069
1136
|
});
|
1070
1137
|
} else {
|
1071
1138
|
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
1072
1139
|
.within(() => {
|
1073
|
-
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), '
|
1140
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'notExist');
|
1074
1141
|
});
|
1075
1142
|
};
|
1076
1143
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import utilities from "../support/helpers/utilities";
|
2
2
|
import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent, colorPopupComponent } from "./components";
|
3
3
|
import { createItemPage } from "./createItemPage";
|
4
|
+
import { dialogBoxBase } from "./dialogBoxBase";
|
4
5
|
const css = Cypress.env('css');
|
5
6
|
let imageWidth = 768;
|
6
7
|
let imageHeight = 432;
|
@@ -1554,6 +1555,71 @@ const tests = {
|
|
1554
1555
|
...additionalSettingsPanel.tests,
|
1555
1556
|
...gradingViewEnumerationComponent.tests,
|
1556
1557
|
...additionalSettingsAccessibilitySectionComponent.tests,
|
1558
|
+
//TODO need to remove once Save as you go is available for all questions
|
1559
|
+
/**
|
1560
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
1561
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
1562
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
1563
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
1564
|
+
*/
|
1565
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
1566
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
1567
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
1568
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
1569
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
1570
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
1571
|
+
});
|
1572
|
+
|
1573
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
1574
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
1575
|
+
'color': css.color.activeButtons,
|
1576
|
+
'font-size': css.fontSize.default,
|
1577
|
+
'font-weight': css.fontWeight.regular
|
1578
|
+
});
|
1579
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
1580
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
1581
|
+
});
|
1582
|
+
|
1583
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
1584
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
1585
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
1586
|
+
});
|
1587
|
+
|
1588
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
1589
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
1590
|
+
'color': css.color.flyoutTitle,
|
1591
|
+
'font-size': css.fontSize.heading,
|
1592
|
+
'font-weight': css.fontWeight.semibold
|
1593
|
+
});
|
1594
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
1595
|
+
'color': css.color.labels,
|
1596
|
+
'font-size': css.fontSize.default,
|
1597
|
+
'font-weight': css.fontWeight.regular
|
1598
|
+
});
|
1599
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
1600
|
+
'fill': css.color.closeIcon
|
1601
|
+
});
|
1602
|
+
});
|
1603
|
+
|
1604
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
1605
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
1606
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1607
|
+
});
|
1608
|
+
},
|
1609
|
+
|
1610
|
+
//TODO need to remove once Save as you go is available for all questions
|
1611
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
1612
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
1613
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
1614
|
+
.click();
|
1615
|
+
dialogBoxBase.steps.closeWarningPopup();
|
1616
|
+
//TODO: Need to add error message according to question types
|
1617
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
1618
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
1619
|
+
.eq(1)
|
1620
|
+
.should('have.attr', 'aria-expanded', 'true');
|
1621
|
+
});
|
1622
|
+
},
|
1557
1623
|
|
1558
1624
|
/**
|
1559
1625
|
* @param {string} scoringType scoring type 'All or nothing| Partial equal weights| Partial different weights'
|
@@ -1585,17 +1651,16 @@ const tests = {
|
|
1585
1651
|
|
1586
1652
|
it(`When the user has removed all the options from the dropzone in the ${accordionName} accordion, error message should not be thrown on the \'${accordionName}\' accordion`, () => {
|
1587
1653
|
imageHighlightPage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(1);
|
1588
|
-
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), '
|
1589
|
-
utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.')
|
1654
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist')
|
1590
1655
|
if (accordionName == 'Correct') {
|
1591
1656
|
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
1592
1657
|
.within(() => {
|
1593
|
-
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), '
|
1658
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'notExist');
|
1594
1659
|
});
|
1595
1660
|
} else {
|
1596
1661
|
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
1597
1662
|
.within(() => {
|
1598
|
-
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), '
|
1663
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'notExist');
|
1599
1664
|
});
|
1600
1665
|
};
|
1601
1666
|
});
|
@@ -184,7 +184,8 @@ const steps = {
|
|
184
184
|
|
185
185
|
verifyCorrectAnswerSectionNotExist: () => {
|
186
186
|
multipleSelectionGridPage.correctAnswerSection()
|
187
|
-
.should('not.exist');
|
187
|
+
.should('not.exist');
|
188
|
+
},
|
188
189
|
/**
|
189
190
|
* Verifies the contents of option fields within the options section.
|
190
191
|
* @param {Array<string>} optionsTextArray - An array of strings representing the expected text content for each option field.
|
@@ -212,6 +213,72 @@ const tests = {
|
|
212
213
|
...additionalSettingsPanel.tests,
|
213
214
|
...additionalSettingsAccessibilitySectionComponent.tests,
|
214
215
|
...styleAndLayoutCustomizationAccordionComponent.tests,
|
216
|
+
//TODO need to remove once Save as you go is available for all questions
|
217
|
+
/**
|
218
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
219
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
220
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
221
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
222
|
+
*/
|
223
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
224
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
225
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
226
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
227
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
228
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
229
|
+
});
|
230
|
+
|
231
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
232
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
233
|
+
'color': css.color.activeButtons,
|
234
|
+
'font-size': css.fontSize.default,
|
235
|
+
'font-weight': css.fontWeight.regular
|
236
|
+
});
|
237
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
238
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
239
|
+
});
|
240
|
+
|
241
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
242
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
243
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
244
|
+
});
|
245
|
+
|
246
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
247
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
248
|
+
'color': css.color.flyoutTitle,
|
249
|
+
'font-size': css.fontSize.heading,
|
250
|
+
'font-weight': css.fontWeight.semibold
|
251
|
+
});
|
252
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
253
|
+
'color': css.color.labels,
|
254
|
+
'font-size': css.fontSize.default,
|
255
|
+
'font-weight': css.fontWeight.regular
|
256
|
+
});
|
257
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
258
|
+
'fill': css.color.closeIcon
|
259
|
+
});
|
260
|
+
});
|
261
|
+
|
262
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
263
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
264
|
+
dialogBoxBase.steps.closeWarningPopup();
|
265
|
+
});
|
266
|
+
},
|
267
|
+
|
268
|
+
//TODO need to remove once Save as you go is available for all questions
|
269
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
270
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
271
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
272
|
+
.click();
|
273
|
+
dialogBoxBase.steps.closeWarningPopup();
|
274
|
+
//TODO: Need to add error message according to question types
|
275
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
276
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
277
|
+
.eq(1)
|
278
|
+
.should('have.attr', 'aria-expanded', 'true');
|
279
|
+
});
|
280
|
+
},
|
281
|
+
|
215
282
|
/**
|
216
283
|
* Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
|
217
284
|
* @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
|
@@ -914,6 +914,73 @@ const tests = {
|
|
914
914
|
...ckEditorInsertTableComponent.tests,
|
915
915
|
...ckEditorInsertImageComponent.tests,
|
916
916
|
...ckEditorLinkComponent.tests,
|
917
|
+
|
918
|
+
//TODO need to remove once Save as you go is available for all questions
|
919
|
+
/**
|
920
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
921
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
922
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
923
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
924
|
+
*/
|
925
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
926
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
927
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
928
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
929
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
930
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
931
|
+
});
|
932
|
+
|
933
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
934
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
935
|
+
'color': css.color.activeButtons,
|
936
|
+
'font-size': css.fontSize.default,
|
937
|
+
'font-weight': css.fontWeight.regular
|
938
|
+
});
|
939
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
940
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
941
|
+
});
|
942
|
+
|
943
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
944
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
945
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
946
|
+
});
|
947
|
+
|
948
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
949
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
950
|
+
'color': css.color.flyoutTitle,
|
951
|
+
'font-size': css.fontSize.heading,
|
952
|
+
'font-weight': css.fontWeight.semibold
|
953
|
+
});
|
954
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
955
|
+
'color': css.color.labels,
|
956
|
+
'font-size': css.fontSize.default,
|
957
|
+
'font-weight': css.fontWeight.regular
|
958
|
+
});
|
959
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
960
|
+
'fill': css.color.closeIcon
|
961
|
+
});
|
962
|
+
});
|
963
|
+
|
964
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
965
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
966
|
+
dialogBoxBase.steps.closeWarningPopup();
|
967
|
+
});
|
968
|
+
},
|
969
|
+
|
970
|
+
//TODO need to remove once Save as you go is available for all questions
|
971
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
972
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
973
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
974
|
+
.click();
|
975
|
+
dialogBoxBase.steps.closeWarningPopup();
|
976
|
+
//TODO: Need to add error message according to question types
|
977
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
978
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
979
|
+
.eq(1)
|
980
|
+
.should('have.attr', 'aria-expanded', 'true');
|
981
|
+
});
|
982
|
+
},
|
983
|
+
|
917
984
|
verifyPreviewModesAndScoreWhenPointsAndCorrectAnswersIsNotSet: () => {
|
918
985
|
it('When the user has not set correct answer option(s) and alloted points, \'Student view\' radio button should be checked, \'Grading view\' button should not be checked, 0 points should be displayed and no correct or incorrect icons should be displayed in the preview tab', () => {
|
919
986
|
utilities.verifyInnerText(autoScoredScoringPreviewTab.studentViewRadioButtonLabel(), 'Student view');
|
@@ -2,6 +2,7 @@ import utilities from "../support/helpers/utilities";
|
|
2
2
|
import { createQuestionBasePage, questionInstructionsComponent, gridQuestionCommonComponent, scoringSectionBaseEditTab, ckEditorToolbar, equationEditorFlyout, autoScoredScoringPreviewTab, correctIncorrectAnswerLabelComponent, autoScoredScoringSectionMultiResponseType, autoScoredStudentViewSettings, specifyRowsAndColumnsComponent, autoScoredSpecifyCorrectAnswerSection, randomizeOptionsComponent, studentViewSettingsLabelComponent, commonComponents, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, styleAndLayoutCustomizationAccordionComponent } from "./components";
|
3
3
|
const css = Cypress.env('css');
|
4
4
|
import { createItemPage } from "./createItemPage";
|
5
|
+
import { dialogBoxBase } from "./dialogBoxBase";
|
5
6
|
|
6
7
|
const selectors = {
|
7
8
|
...questionInstructionsComponent,
|
@@ -179,12 +180,78 @@ const tests = {
|
|
179
180
|
...randomizeOptionsComponent.tests,
|
180
181
|
...studentViewSettingsLabelComponent.tests,
|
181
182
|
...autoScoredStudentViewSettings.tests,
|
182
|
-
...specifyRowsAndColumnsComponent.tests,
|
183
|
+
...specifyRowsAndColumnsComponent.tests,
|
183
184
|
...commonComponents.tests,
|
184
185
|
...createQuestionBasePage.tests,
|
185
186
|
...additionalSettingsPanel.tests,
|
186
187
|
...additionalSettingsAccessibilitySectionComponent.tests,
|
187
188
|
...styleAndLayoutCustomizationAccordionComponent.tests,
|
189
|
+
//TODO need to remove once Save as you go is available for all questions
|
190
|
+
/**
|
191
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
192
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
193
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
194
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
195
|
+
*/
|
196
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
197
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
198
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
199
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
200
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
201
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
202
|
+
});
|
203
|
+
|
204
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
205
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
206
|
+
'color': css.color.activeButtons,
|
207
|
+
'font-size': css.fontSize.default,
|
208
|
+
'font-weight': css.fontWeight.regular
|
209
|
+
});
|
210
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
211
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
212
|
+
});
|
213
|
+
|
214
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
215
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
216
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
217
|
+
});
|
218
|
+
|
219
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
220
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
221
|
+
'color': css.color.flyoutTitle,
|
222
|
+
'font-size': css.fontSize.heading,
|
223
|
+
'font-weight': css.fontWeight.semibold
|
224
|
+
});
|
225
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
226
|
+
'color': css.color.labels,
|
227
|
+
'font-size': css.fontSize.default,
|
228
|
+
'font-weight': css.fontWeight.regular
|
229
|
+
});
|
230
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
231
|
+
'fill': css.color.closeIcon
|
232
|
+
});
|
233
|
+
});
|
234
|
+
|
235
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
236
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
237
|
+
dialogBoxBase.steps.closeWarningPopup();
|
238
|
+
});
|
239
|
+
},
|
240
|
+
|
241
|
+
//TODO need to remove once Save as you go is available for all questions
|
242
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
243
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
244
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
245
|
+
.click();
|
246
|
+
dialogBoxBase.steps.closeWarningPopup();
|
247
|
+
//TODO: Need to add error message according to question types
|
248
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
249
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
250
|
+
.eq(1)
|
251
|
+
.should('have.attr', 'aria-expanded', 'true');
|
252
|
+
});
|
253
|
+
},
|
254
|
+
|
188
255
|
/**
|
189
256
|
* Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
|
190
257
|
* @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
|
@@ -719,6 +719,73 @@ const tests = {
|
|
719
719
|
...autoScoredStudentViewSettings.tests,
|
720
720
|
...additionalSettingsAccessibilitySectionComponent.tests,
|
721
721
|
...mcqAdditionalSettingsBase.tests,
|
722
|
+
|
723
|
+
//TODO need to remove once Save as you go is available for all questions
|
724
|
+
/**
|
725
|
+
* @description Verifies the behavior of the 'Add alternative answer' button, warning popups, and validation error messages
|
726
|
+
* in the 'Specify correct answer' section for alternative answers in auto-scored questions.
|
727
|
+
* @param {string|null} questionType - The type of the question (e.g., 'list ordering'). Pass `null` if not applicable.
|
728
|
+
* @example - verifyAutoScoredAddAlternativeAnswerButtonAndValidation();
|
729
|
+
*/
|
730
|
+
verifyAutoScoredAddAlternativeAnswerButtonAndValidation: (questionType = null) => {
|
731
|
+
it('\'+ Add alternative answer\' button should be present', () => {
|
732
|
+
utilities.verifyInnerText(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'Add alternative answer');
|
733
|
+
utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton(), 'visible');
|
734
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
735
|
+
.verifyPseudoClassBeforeProperty('content', '""');
|
736
|
+
});
|
737
|
+
|
738
|
+
it('CSS of \'Add Alternative answer\' button', { tags: 'css' }, () => {
|
739
|
+
utilities.verifyCSS(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton().find('p'), {
|
740
|
+
'color': css.color.activeButtons,
|
741
|
+
'font-size': css.fontSize.default,
|
742
|
+
'font-weight': css.fontWeight.regular
|
743
|
+
});
|
744
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton()
|
745
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
|
746
|
+
});
|
747
|
+
|
748
|
+
it('If user has not selected correct answer in the correct accordion, then the Add alternative answer button should be in enabled state', () => {
|
749
|
+
utilities.verifyElementNotDisabled(autoScoredSpecifyCorrectAnswerSection.alternativeAnswerButton());
|
750
|
+
autoScoredSpecifyCorrectAnswerSection.steps.clickOnAddAlternativeAnswerButton();
|
751
|
+
});
|
752
|
+
|
753
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
754
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxTitle(), {
|
755
|
+
'color': css.color.flyoutTitle,
|
756
|
+
'font-size': css.fontSize.heading,
|
757
|
+
'font-weight': css.fontWeight.semibold
|
758
|
+
});
|
759
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
760
|
+
'color': css.color.labels,
|
761
|
+
'font-size': css.fontSize.default,
|
762
|
+
'font-weight': css.fontWeight.regular
|
763
|
+
});
|
764
|
+
utilities.verifyCSS(dialogBoxBase.buttonClose().find('svg'), {
|
765
|
+
'fill': css.color.closeIcon
|
766
|
+
});
|
767
|
+
});
|
768
|
+
|
769
|
+
it('Accessibility of warning popup', { tags: 'a11y' }, () => {
|
770
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
771
|
+
dialogBoxBase.steps.closeWarningPopup();
|
772
|
+
});
|
773
|
+
},
|
774
|
+
|
775
|
+
//TODO need to remove once Save as you go is available for all questions
|
776
|
+
verifyWarningPopupAndAccordionNavigationWhenNoPointsAddedInAlternativeAccordion: () => {
|
777
|
+
it('When user tries to expand correct accordion when all the mandatory fields are not filled in the alternative accordion, then a warning popup should be displayed and on closing the popup, alternative 2 accordion should be in expanded state', () => {
|
778
|
+
autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
|
779
|
+
.click();
|
780
|
+
dialogBoxBase.steps.closeWarningPopup();
|
781
|
+
//TODO: Need to add error message according to question types
|
782
|
+
utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'exist');
|
783
|
+
autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
|
784
|
+
.eq(1)
|
785
|
+
.should('have.attr', 'aria-expanded', 'true');
|
786
|
+
});
|
787
|
+
},
|
788
|
+
|
722
789
|
verifyPreviewModesAndScoreWhenPointsAndCorrectAnswersIsNotSet: () => {
|
723
790
|
it('When the user has not set correct answer option(s) and alloted points, \'Student view\' radio button should be checked, \'Grading view\' button should not be checked, 0 points should be displayed and no correct or incorrect icons should be displayed in the preview tab', () => {
|
724
791
|
utilities.verifyInnerText(autoScoredScoringPreviewTab.studentViewRadioButtonLabel(), 'Student view');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "itemengine-cypress-automation",
|
3
|
-
"version": "1.0.338
|
3
|
+
"version": "1.0.338",
|
4
4
|
"description": "",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -52,4 +52,4 @@
|
|
52
52
|
"devDependencies": {
|
53
53
|
"@applitools/eyes-cypress": "^3.47.0"
|
54
54
|
}
|
55
|
-
}
|
55
|
+
}
|