itemengine-cypress-automation 1.0.14 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridAdditionalSettings.js +830 -0
  2. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridAutoScoredScoring.js +990 -0
  3. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridEditTabBasicSection.js +588 -0
  4. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridEditTabScoringSection.js +297 -0
  5. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridHeaderSection.js +98 -0
  6. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridManuallyAndNonScoredScoring.js +206 -0
  7. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridPartialDifferentWeights.js +1152 -0
  8. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridPartialEqualWeights.js +1108 -0
  9. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridRandomizeOptions.js +124 -0
  10. package/cypress/e2e/ILC/MultipleSelectionGrid/multipleSelectionGridSetCorrectAnswerSection.js +175 -0
  11. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAdditionalSettingsBasic.js +235 -0
  12. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoring.js +205 -0
  13. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoringWithAlternateAnswer.js +472 -0
  14. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabBasicSection.js +589 -0
  15. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabScoringSection.js +282 -0
  16. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridHeaderSection.js +97 -0
  17. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridManuallyAndNonScored.js +146 -0
  18. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridOptionsAdditionalSettings.js +345 -0
  19. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeights.js +188 -0
  20. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeightsWithAlternateAnswer.js +662 -0
  21. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeights.js +190 -0
  22. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeightsWIthAlternateAnswer.js +595 -0
  23. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridQuestionStemAdditionalSettings.js +258 -0
  24. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridRandomizeOptions.js +122 -0
  25. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridSetCorrectAnswerSection.js +183 -0
  26. package/package.json +1 -1
@@ -0,0 +1,124 @@
1
+ import { multipleSelectionGridPage } from "../../../pages/multipleSelectionGridPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ const options = ['Fully agree as true', 'Fully agree as false', 'Somewhat agree', 'Somewhat disagree'];
7
+
8
+ describe('Create Item page - multiple Selection Grid: Randomize options functionality', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Randomize options - Functionality : Edit tab', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ cy.log('Navigating to multiple selection grid question type');
17
+ multipleSelectionGridPage.steps.navigateToCreateQuestion('multiple selection grid');
18
+ cy.log('Adding question instructions, question stems, options, setting correct answer, adding points and switching to Preview tab');
19
+ cy.barsPreLoaderWait()
20
+ multipleSelectionGridPage.steps.addQuestionInstructions();
21
+ multipleSelectionGridPage.steps.addOption();
22
+ multipleSelectionGridPage.steps.addOption();
23
+ multipleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
24
+ multipleSelectionGridPage.steps.addInputToAllOptionsFields(options);
25
+ multipleSelectionGridPage.steps.allotPoints(10);
26
+ });
27
+
28
+ it('\'Randomize options\' checkbox and label should be displayed and by default it should be unchecked', () => {
29
+ multipleSelectionGridPage.randomizeOptionsCheckboxLabel()
30
+ .verifyInnerText('Randomize options')
31
+ .should('be.visible');
32
+ multipleSelectionGridPage.steps.verifyRandomizeOptionsCheckboxUnchecked()
33
+ });
34
+
35
+ it('CSS of \'Randomize options\'', { tags: 'css' }, () => {
36
+ multipleSelectionGridPage.randomizeOptionsCheckboxLabel()
37
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
38
+ });
39
+
40
+ it('Accessibility of \'Randomize options\'', { tags: 'a11y' }, () => {
41
+ cy.checkAccessibility(multipleSelectionGridPage.randomizeOptionsCheckbox().parents('.randomize-checkbox-wrapper'))
42
+ });
43
+
44
+ it('When the \'Randomize options\' functionality is disabled, the question stems and options in the set correct answer table should be displayed in the order in which the user has set them in the \'Question stem\' and \'Options\' section', () => {
45
+ multipleSelectionGridPage.steps.verifyRandomizeOptionsCheckboxUnchecked()
46
+ multipleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStems);
47
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(options);
48
+ });
49
+
50
+ it('When the user enables the \'Randomize options\' functionality, then the question stems and options in the set correct answer table should be in the order in which the user has set them in the \'Question stem\' and \'Options\' section', () => {
51
+ multipleSelectionGridPage.steps.selectRandomizeOptionsCheckbox()
52
+ multipleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStems);
53
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(options);
54
+ });
55
+
56
+ it('CSS of \'Randomize options\' functionality - checked state', { tags: 'css' }, () => {
57
+ multipleSelectionGridPage.randomizeOptionsCheckbox()
58
+ .parents('[data-ngie-testid="randomize-options-checkbox"]')
59
+ .find('svg g g')
60
+ .should('have.css', 'fill', css.color.activeButtons);
61
+ });
62
+
63
+ it('Accessibility of \'Randomize options\' functionality - checked state', { tags: 'a11y' }, () => {
64
+ cy.checkAccessibility(multipleSelectionGridPage.randomizeOptionsCheckbox().parents('.randomize-checkbox-wrapper'))
65
+ });
66
+ });
67
+
68
+ describe('Randomize options - Functionality : Preview tab', () => {
69
+ let questionStemsArray = [];
70
+ abortEarlySetup();
71
+ before(() => {
72
+ cy.log('Navigating to multiple selection grid question type');
73
+ multipleSelectionGridPage.steps.navigateToCreateQuestion('multiple selection grid');
74
+ cy.log('Adding question instructions, question stems, options, setting correct answer and adding points for Autoscored Partial equal weights scoring type and switching to Preview tab');
75
+ cy.barsPreLoaderWait()
76
+ multipleSelectionGridPage.steps.addQuestionInstructions();
77
+ multipleSelectionGridPage.steps.addOption();
78
+ multipleSelectionGridPage.steps.addOption();
79
+ multipleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
80
+ multipleSelectionGridPage.steps.addInputToAllOptionsFields(options);
81
+ multipleSelectionGridPage.steps.allotPoints(10);
82
+ multipleSelectionGridPage.steps.switchToPreviewTab();
83
+ });
84
+
85
+ it('When the \'Randomize options\' functionality is disabled, the question stems and options in the preview tab answer table should be displayed in the order in which the user has set them in the \'Question stem\' section', () => {
86
+ multipleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStems);
87
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
88
+ });
89
+
90
+ it('When the user enables the \'Randomize options\' functionality, then question stems in the preview tab answer table should be displayed in a random order and the options should be displayed in the order in which the user has set them', () => {
91
+ multipleSelectionGridPage.steps.switchToEditTab()
92
+ multipleSelectionGridPage.steps.selectRandomizeOptionsCheckbox()
93
+ multipleSelectionGridPage.steps.switchToPreviewTab();
94
+ multipleSelectionGridPage.steps.verifyRandomizeQuestionStemsOrder(questionStems);
95
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
96
+ questionStemsArray = multipleSelectionGridPage.steps.getQuestionStemsArray();
97
+ });
98
+
99
+ it('When the user switches to \'Edit tab\' and does not modify any question properties, then the order of the question stems and options should not change in the preview tab answer table', () => {
100
+ multipleSelectionGridPage.steps.switchToEditTab();
101
+ multipleSelectionGridPage.steps.switchToPreviewTab();
102
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
103
+ multipleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStemsArray);
104
+ });
105
+
106
+ it('When the user switches to \'Edit tab\' and modifies any of question properties, then the order of the question stems should change and the options should be displayed in the order in which the user has set them in the preview tab answer table', () => {
107
+ multipleSelectionGridPage.steps.switchToEditTab();
108
+ multipleSelectionGridPage.steps.clearPointsField();
109
+ multipleSelectionGridPage.steps.allotPoints(12);
110
+ multipleSelectionGridPage.steps.switchToPreviewTab();
111
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
112
+ multipleSelectionGridPage.steps.verifyRandomizeQuestionStemsOrder(questionStems);
113
+ multipleSelectionGridPage.steps.verifyQuestionStemsAreRerandomized(questionStemsArray);
114
+ });
115
+
116
+ it('When the user disables the \'Randomize options\' functionality, then the question stems and options in the preview tab answer table should be displayed in the order in which the user has set them in the \'Question stem\' section', () => {
117
+ multipleSelectionGridPage.steps.switchToEditTab()
118
+ multipleSelectionGridPage.steps.deselectRandomizeOptionsCheckbox()
119
+ multipleSelectionGridPage.steps.switchToPreviewTab();
120
+ multipleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStems);
121
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
122
+ });
123
+ });
124
+ });
@@ -0,0 +1,175 @@
1
+ import { dialogBoxBase } from "../../../pages/dialogBoxBase";
2
+ import { multipleSelectionGridPage } from "../../../pages/multipleSelectionGridPage";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ const css = Cypress.env('css');
5
+
6
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
7
+ const options = ['Fully agree as true', 'Fully agree as false', 'Somewhat agree', 'Somewhat disagree'];
8
+
9
+ describe('Create Item page - Multiple Selection Grid: Set correct answer, Alternate correct answer - Edit tab cases', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Set Correct Answer section', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ multipleSelectionGridPage.steps.navigateToCreateQuestion('multiple selection grid');
18
+ });
19
+
20
+ multipleSelectionGridPage.tests.verifyAutoScoredSetCorrectAnswerHeaderSectionContents('multiple selection grid');
21
+
22
+ it('In the Set Correct Answer section table, 4 columns and 2 rows with \'Question stem\' header and \'No question stem added\' should be displayed with disabled checkboxes should be displayed', () => {
23
+ for (let index = 0; index < 4; index++) {
24
+ multipleSelectionGridPage.steps.verifyTableRowCheckboxesInSetCorrectAnswerTable(index, 2);
25
+ multipleSelectionGridPage.steps.verifyDisabledTableRowCheckboxesInSetCorrectAnswerTable(index);
26
+ }
27
+ multipleSelectionGridPage.setCorrectAnswerTableNoQuestionStemAddedLabel()
28
+ .verifyInnerText('No question stem added');
29
+ multipleSelectionGridPage.setCorrectAnswerTableQuestionStemTitle()
30
+ .verifyInnerText('Question stem');
31
+ });
32
+
33
+ it('When user adds question stems and options then the checkboxes should be enabled and user should be able to set correct answer by checking the checkboxes besides the question stems in the table', () => {
34
+ cy.log('Pre-step: Adding question instructions, question stem and options')
35
+ multipleSelectionGridPage.steps.addQuestionInstructions()
36
+ multipleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
37
+ multipleSelectionGridPage.steps.addInputToAllOptionsFields(options.slice(0, 2));
38
+ for (let index = 0; index < 2; index++) {
39
+ multipleSelectionGridPage.steps.verifyEnabledUncheckedTableRowCheckboxesInSetCorrectAnswerTable(index)
40
+ }
41
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(0, [0]);
42
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(1, [0, 1]);
43
+ });
44
+
45
+ it('CSS of Set answer in the Correct answer tab contents', { tags: 'css' }, () => {
46
+ multipleSelectionGridPage.correctTab()
47
+ .find('[class*="TabList"]')
48
+ .verifyCSS(css.color.activeButtons, css.fontSize.default, css.fontWeight.bold)
49
+ });
50
+
51
+ //Note: a11y checked in header section file
52
+
53
+ it('When user clicks on Add alternate answer button without selecting options for all question stems then a warning popup should be displayed', () => {
54
+ multipleSelectionGridPage.steps.clickOnAddAlternateAnswerButton()
55
+ dialogBoxBase.dialogBox()
56
+ .should('exist');
57
+ dialogBoxBase.steps.closeWarningPopup();
58
+ });
59
+
60
+ it('When user closes the warning popup Please set correct answer error message should be displayed as user has partially selected correct answer', () => {
61
+ multipleSelectionGridPage.steps.verifyPleaseSetACorrectAnswerErrorMessage()
62
+ });
63
+
64
+ it('When user selects all the options then the error message should disappear', () => {
65
+ multipleSelectionGridPage.steps.allotPoints('10')
66
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(2, [1]);
67
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(3, [0, 1]);
68
+ multipleSelectionGridPage.errorMessage()
69
+ .should('not.exist');
70
+ });
71
+ });
72
+
73
+ describe('Alternate correct answer', () => {
74
+ abortEarlySetup();
75
+ before(() => {
76
+ multipleSelectionGridPage.steps.navigateToCreateQuestion('multiple selection grid');
77
+ multipleSelectionGridPage.steps.addQuestionInstructions()
78
+ });
79
+
80
+ multipleSelectionGridPage.tests.verifyAutoScoredAlternateAnswer();
81
+
82
+ it('When user has added points and selected correct answer in the Correct tab, then the user should be able to add alternate answer for the question using \'Add Alternate Answer\' button', () => {
83
+ cy.log('Pre step: Adding 2 options')
84
+ multipleSelectionGridPage.steps.addOption();
85
+ multipleSelectionGridPage.steps.addOption();
86
+ multipleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
87
+ multipleSelectionGridPage.steps.addInputToAllOptionsFields(options);
88
+ multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInSetCorrectAnswerTable([[3], [0, 1], [0], [0, 1]]);
89
+ multipleSelectionGridPage.steps.allotPoints(10);
90
+ multipleSelectionGridPage.steps.addAlternateTab(1);
91
+ });
92
+
93
+ it('When user adds Alternate answer tab then the question stems and option stems should be prefilled and the checkboxes should be deselected', () => {
94
+ multipleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStems);
95
+ multipleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(options);
96
+ for (let index = 0; index < 4; index++) {
97
+ multipleSelectionGridPage.steps.verifyEnabledUncheckedTableRowCheckboxesInSetCorrectAnswerTable(index)
98
+ }
99
+ });
100
+
101
+ it('CSS of Alternate correct answer tab', { tags: 'css' }, () => {
102
+ multipleSelectionGridPage.alternateAnswerTab(1)
103
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.bold)
104
+ cy.log('CSS of inactive Correct answer tab')
105
+ multipleSelectionGridPage.correctTab()
106
+ .verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.bold)
107
+ });
108
+
109
+ it('Accessibility of Alternate correct answer tab', { tags: 'a11y' }, () => {
110
+ cy.checkAccessibility(multipleSelectionGridPage.correctTab().parents('[class*="AlternatePointsComponentstyles__AnswerTabWrapper"]'));
111
+ });
112
+
113
+ it('User should be able to set alternate correct answer by checking the checkboxes besides the question stems in Alternate answer tab', () => {
114
+ multipleSelectionGridPage.steps.allotPoints(5);
115
+ multipleSelectionGridPage.steps.setAnswersForAllQuestionStemsInSetCorrectAnswerTable([[0], [1], [0, 1], [0]]);
116
+ });
117
+
118
+ it('User should be able to add another alternate answer for the question using \'Add Alternate Answer\' button and the name for this new tab should be \'Alternate 2\'', () => {
119
+ multipleSelectionGridPage.steps.addAlternateTab(2);
120
+ });
121
+
122
+ multipleSelectionGridPage.tests.verifyWarningPopupAndTabNavigationWhenNoPointsAddedInAlternateTab();
123
+
124
+ //Failing due to https://redmine.zeuslearning.com/issues/534286
125
+ it('When user partially selects correct answer the Please set correct answer error message should not disappear', () => {
126
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(0, [0]);
127
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(1, [0, 1]);
128
+ multipleSelectionGridPage.steps.verifyPleaseSetACorrectAnswerErrorMessage()
129
+ });
130
+
131
+ it('When user selects all the options then the error message should disappear', () => {
132
+ multipleSelectionGridPage.steps.allotPoints('10')
133
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(2, [2]);
134
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(3, [0, 1])
135
+ multipleSelectionGridPage.errorMessage()
136
+ .should('not.exist');
137
+ });
138
+
139
+ it('When the user clicks on the \'Close\' button alongside alternate answer tab, alternate answer tab should get removed and the name of the alternate answer tabs should get updated accordingly', () => {
140
+ cy.log('Set correct answer and points in alternate 2 tab, then switch to Alternate 1 tab and click delete icon button');
141
+ multipleSelectionGridPage.steps.navigateToAlternateTab(1);
142
+ multipleSelectionGridPage.steps.deleteAlternateTab();
143
+ multipleSelectionGridPage.alternateAnswerTab(2)
144
+ .should('not.exist');
145
+ multipleSelectionGridPage.alternateAnswerTab(1)
146
+ .verifyInnerText('Alternate 1');
147
+ });
148
+
149
+ //Failing due to https://redmine.zeuslearning.com/issues/534286
150
+ it('On deleting option set as correct answer option in Alternate answer tab, \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'Alternate 1\' tab', () => {
151
+ multipleSelectionGridPage.steps.deleteOption(2)
152
+ multipleSelectionGridPage.errorMessage()
153
+ .verifyInnerText('Error: Please set a correct answer.');
154
+ multipleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsDisplayed()
155
+ });
156
+
157
+ it('On reselecting correct answer option in Alternate answer tab, \'Error: Please set a correct answer.\' validation error message should disappear', () => {
158
+ multipleSelectionGridPage.steps.setAnswersForQuestionStemInSetCorrectAnswerTable(2, [0, 1]);
159
+ multipleSelectionGridPage.steps.verifyErrorMessageIsNotDisplayed();
160
+ multipleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
161
+ });
162
+
163
+ it('On deleting a question stem no error messages should be displayed and no error icon should appear', () => {
164
+ multipleSelectionGridPage.steps.deleteQuestionStem(1)
165
+ multipleSelectionGridPage.steps.verifyErrorMessageIsNotDisplayed();
166
+ multipleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
167
+ });
168
+
169
+ it('When the user is on \'Alternate 1\' tab then on deleting option set as correct answer option only in the Correct answer tab, tab should be switched from \'Alternate 1\' to \'CORRECT\' tab and \'Error: Please set a correct answer.\' validation error message should be thrown alongwith an error icon besides the \'Correct\' tab', () => {
170
+ multipleSelectionGridPage.steps.deleteOption(2)
171
+ multipleSelectionGridPage.steps.verifyActiveStateOfCorrectTab()
172
+ multipleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsDisplayed()
173
+ });
174
+ });
175
+ });
@@ -0,0 +1,235 @@
1
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ const options = ['Fully agree as true', 'Fully agree as false'];
7
+
8
+ const fontSizeDropdownOptions = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
9
+ const fontSizes = ['16px', '12px', '14px', '17px', '20px', '24px'];
10
+
11
+ describe('Create Item page - Single Selection Grid: Additional settings', () => {
12
+ before(() => {
13
+ cy.loginAs('admin');
14
+ });
15
+
16
+ describe('Additional Settings accordion', () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ cy.log('Navigating to Single selection grid question type');
20
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
21
+ });
22
+
23
+ singleSelectionGridPage.tests.verifyAdditonalSettingsAccordionProperties();
24
+ });
25
+
26
+ describe('Additional settings: Font size contents', () => {
27
+ abortEarlySetup();
28
+ before(() => {
29
+ cy.log('Navigating to Single selection grid question type');
30
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
31
+ singleSelectionGridPage.steps.expandAdditonalSettings();
32
+ });
33
+
34
+ singleSelectionGridPage.tests.verifyFontSizeSectionContents();
35
+ });
36
+
37
+ describe('Additional settings: Font size contents set correct answer section', () => {
38
+ abortEarlySetup();
39
+ before(() => {
40
+ cy.log('Navigating to Single selection grid question type');
41
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
42
+ singleSelectionGridPage.steps.addQuestionInstructions();
43
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
44
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
45
+ singleSelectionGridPage.steps.allotPoints(10);
46
+ singleSelectionGridPage.steps.expandAdditonalSettings();
47
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption('Lowercase alphabet')
48
+ singleSelectionGridPage.steps.addInputToTitleForOptionsInputField('Title for options')
49
+ });
50
+
51
+ //Failing due to https://redmine.zeuslearning.com/issues/534772
52
+ fontSizeDropdownOptions.forEach((option, fontsIndex) => {
53
+ it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size of the preview (options, question instructions question stems) should be changed to ${option} in the set correct answer table`, () => {
54
+ singleSelectionGridPage.steps.selectFontSizeOptionFromFontSizeDropdown(fontsIndex)
55
+ singleSelectionGridPage.fontSizeDropdown()
56
+ .verifyInnerText(`${option}`);
57
+ singleSelectionGridPage.setCorrectAnswerTableHeader()
58
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
59
+ singleSelectionGridPage.questionStemNumeration()
60
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
61
+ singleSelectionGridPage.setCorrectAnswertableQuestionStem()
62
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
63
+ singleSelectionGridPage.setCorrectAnswerTableQuestionStemTitle()
64
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
65
+ singleSelectionGridPage.setCorrectAnswerTableOptionsTitle()
66
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
67
+ });
68
+ });
69
+ });
70
+
71
+ describe('Additional settings: Font size contents preview tab section', () => {
72
+ abortEarlySetup();
73
+ before(() => {
74
+ cy.log('Navigating to Single selection grid question type');
75
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
76
+ singleSelectionGridPage.steps.addQuestionInstructions();
77
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
78
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
79
+ singleSelectionGridPage.steps.allotPoints(10);
80
+ singleSelectionGridPage.steps.expandAdditonalSettings();
81
+ singleSelectionGridPage.steps.selectQuestionStemNumerationDropdownOption('Lowercase alphabet');
82
+ singleSelectionGridPage.steps.addInputToTitleForOptionsInputField('Title for options');
83
+ });
84
+
85
+ fontSizeDropdownOptions.forEach((option, fontsIndex) => {
86
+ it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size of the preview (options, question instructions question stems) should be changed to ${option} in the preview tab Answer table`, () => {
87
+ singleSelectionGridPage.steps.selectFontSizeOptionFromFontSizeDropdown(fontsIndex)
88
+ singleSelectionGridPage.fontSizeDropdown()
89
+ .verifyInnerText(`${option}`);
90
+ singleSelectionGridPage.steps.switchToPreviewTab();
91
+ singleSelectionGridPage.questionInstructionsText()
92
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
93
+ singleSelectionGridPage.previewTabAnswerTableHeader()
94
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
95
+ singleSelectionGridPage.previewTabQuestionStemNumeration()
96
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
97
+ singleSelectionGridPage.previewTabAnswertableQuestionStem()
98
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
99
+ singleSelectionGridPage.previewTabAnswerTableQuestionStemTitle()
100
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
101
+ singleSelectionGridPage.previewTabAnswerTableOptionsTitle()
102
+ .should('have.css', 'font-size', fontSizes[fontsIndex]);
103
+ singleSelectionGridPage.steps.switchToEditTab();
104
+ });
105
+ });
106
+ });
107
+
108
+ describe('Additional settings: Check answer', () => {
109
+ abortEarlySetup();
110
+ before(() => {
111
+ cy.log('Navigating to Single selection grid question type');
112
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
113
+ singleSelectionGridPage.steps.addQuestionInstructions();
114
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
115
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
116
+ singleSelectionGridPage.steps.allotPoints(10);
117
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([0, 1, 0, 1]);
118
+ singleSelectionGridPage.steps.expandAdditonalSettings();
119
+ });
120
+
121
+ singleSelectionGridPage.tests.verifyCheckAnswerSectionAndPreviewTabCheckAnswerButton();
122
+ });
123
+
124
+ describe('Additional settings: Check answer functionality', () => {
125
+ abortEarlySetup();
126
+ before(() => {
127
+ cy.log('Navigating to Single selection grid question type');
128
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
129
+ singleSelectionGridPage.steps.addQuestionInstructions();
130
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
131
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
132
+ singleSelectionGridPage.steps.allotPoints(10);
133
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([0, 1, 0, 1]);
134
+ singleSelectionGridPage.steps.expandAdditonalSettings();
135
+ singleSelectionGridPage.steps.setMaximumCheckAnswerAttempts(2);
136
+ singleSelectionGridPage.steps.switchToPreviewTab();
137
+ });
138
+
139
+ singleSelectionGridPage.tests.verifyCheckAnswerButtonFunctionalityWhenQuestionIsUnattempted()
140
+
141
+ it('When the user has selected correct answer for two options then on clicking on the Check Answer button, green checkmark icon should be displayed besides the selected correct option, red crossmark should not be displayed beside empty response and \'Incorrect Answer\' label should be displayed below the box', () => {
142
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 1]);
143
+ singleSelectionGridPage.steps.checkAnswer();
144
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1]);
145
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
146
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder();
147
+ });
148
+
149
+ it('When the user has selected all correct answer options then on clicking on the Check Answer button, green checkmark icon should be displayed besides the responses and \'Correct Answer\' label should be displayed below the box', () => {
150
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 1, 0, 1]);
151
+ singleSelectionGridPage.steps.checkAnswer();
152
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1, 0, 1]);
153
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
154
+ singleSelectionGridPage.steps.verifyCorrectAttemptBorder();
155
+ });
156
+
157
+ singleSelectionGridPage.tests.verifyDisabledCheckAnswerButtonWithCSSAnda11y();
158
+
159
+ it('When the user updates the value of Maximum check answer attempts input field, it should get reflected on the Preview tab', () => {
160
+ singleSelectionGridPage.steps.switchToEditTab();
161
+ singleSelectionGridPage.steps.clearMaximumCheckAnswerAttemptsInputField();
162
+ singleSelectionGridPage.steps.addInputToMaximumCheckAnswerAttemptsInputField(1);
163
+ singleSelectionGridPage.steps.switchToPreviewTab();
164
+ singleSelectionGridPage.checkAnswerButton()
165
+ .should('be.enabled');
166
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 1, 0, 1]);
167
+ singleSelectionGridPage.steps.checkAnswer();
168
+ singleSelectionGridPage.checkAnswerButton()
169
+ .should('be.disabled');
170
+ });
171
+
172
+ it('When the \'Maximum check answer attempts\' input field has value \'0\' and user switches to Preview tab, then the \'Check Answer\' button should be enabled and user should be able to check answer multiple times', () => {
173
+ singleSelectionGridPage.steps.switchToEditTab();
174
+ singleSelectionGridPage.steps.clearMaximumCheckAnswerAttemptsInputField();
175
+ singleSelectionGridPage.steps.addInputToMaximumCheckAnswerAttemptsInputField(0);
176
+ cy.log('Switching to Preview tab')
177
+ singleSelectionGridPage.steps.switchToPreviewTab();
178
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 1, 1, 1]);
179
+ singleSelectionGridPage.steps.checkAnswer();
180
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(0, 1)
181
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIcon(1, 1)
182
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(2, 1)
183
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIcon(3, 1)
184
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
185
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder();
186
+ singleSelectionGridPage.checkAnswerButton()
187
+ .should('be.enabled');
188
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
189
+ singleSelectionGridPage.steps.checkAnswer();
190
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIconForAllQuestionStems([1, 0, 1, 0]);
191
+ singleSelectionGridPage.correctIcon()
192
+ .should('not.exist');
193
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
194
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder();
195
+ singleSelectionGridPage.checkAnswerButton()
196
+ .should('be.enabled');
197
+ });
198
+
199
+ it('When the \'Maximum check answer attempts\' input field is empty and user switches to Preview tab, then the \'Check Answer\' button should be enabled and user should be able to check answer multiple times', () => {
200
+ singleSelectionGridPage.steps.switchToEditTab();
201
+ singleSelectionGridPage.steps.clearMaximumCheckAnswerAttemptsInputField()
202
+ singleSelectionGridPage.steps.switchToPreviewTab();
203
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 1, 1, 1]);
204
+ singleSelectionGridPage.steps.checkAnswer();
205
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(0, 1)
206
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIcon(1, 1)
207
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(2, 1)
208
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIcon(3, 1)
209
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
210
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder();
211
+ singleSelectionGridPage.checkAnswerButton()
212
+ .should('be.enabled');
213
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
214
+ singleSelectionGridPage.steps.checkAnswer();
215
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIconForAllQuestionStems([1, 0, 1, 0]);
216
+ singleSelectionGridPage.correctIcon()
217
+ .should('not.exist');
218
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
219
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder();
220
+ singleSelectionGridPage.checkAnswerButton()
221
+ .should('be.enabled');
222
+ });
223
+ });
224
+
225
+ describe('Additional Settings: Details section', () => {
226
+ abortEarlySetup();
227
+ before(() => {
228
+ cy.log('Navigating to Single selection grid question type');
229
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
230
+ singleSelectionGridPage.steps.expandAdditonalSettings();
231
+ });
232
+
233
+ singleSelectionGridPage.tests.verifyDetailsSection();
234
+ });
235
+ });