itemengine-cypress-automation 1.0.574-scoring-fix-dd14c63.0 → 1.0.575-IEI-7071-main-366a409.0

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.
@@ -1,4 +1,4 @@
1
- import { createQuestionBasePage, autoScoredStudentViewSettings, autoScoredScoringPreviewTab, scoringSectionBaseEditTab, questionInstructionsComponent, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, additionalSettingsPanel, acceptedStudentInputComponent, studentViewSettingsLabelComponent, customizeSpecialCharacterComponent, studentResponseAndLayoutComponent } from "./components/";
1
+ import { createQuestionBasePage, autoScoredStudentViewSettings, autoScoredScoringPreviewTab, scoringSectionBaseEditTab, questionInstructionsComponent, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, additionalSettingsPanel, acceptedStudentInputComponent, studentViewSettingsLabelComponent, customizeSpecialCharacterComponent, studentResponseAndLayoutComponent, printPreviewComponent } from "./components/";
2
2
  import { dialogBoxBase } from "./dialogBoxBase";
3
3
  import utilities from "../support/helpers/utilities";
4
4
  import { createItemPage } from "./createItemPage";
@@ -16,6 +16,8 @@ const selectors = {
16
16
  ...commonComponents,
17
17
  ...additionalSettingsPanel,
18
18
  ...createQuestionBasePage,
19
+ ...printPreviewComponent,
20
+ ...autoScoredScoringSectionMultiResponseType,
19
21
 
20
22
  answerLabelSpecifyCorrectAnswerSection: () => cy.get('.answer-label'),
21
23
  displayCharacterCountLabel: () => cy.get('[data-ngie-testid="display-character-count-checkbox"] .MuiFormControlLabel-label'),
@@ -92,6 +94,23 @@ const selectors = {
92
94
  ariaLabelLabel: () => cy.get('.aria-label-wrapper .title-casing'),
93
95
  ariaLabelInputField: () => cy.get('.aria-label-wrapper [role="textbox"]'),
94
96
  questionInstructionsTextPreviewTab: () => cy.get('.question-instruction:visible'),
97
+ displayLinesForTheResponseLabel: () => cy.get('label[aria-label*="Display lines for the response"]'),
98
+ displayLinesForTheResponseCheckbox: () => cy.get('input[aria-label*="Display lines for the response"]'),
99
+ numberOfLinesInputField: () => cy.get('[aria-labelledby*="number-of-lines"]'),
100
+ numberOfLinesLabel: () => cy.get('.number-of-lines-label'),
101
+ lineSpacingLabel: () => cy.get('[id="Line-Spacing-dropdown-label"]'),
102
+ lineSpacingDropdown: () => cy.get('.print-layout-settings-detail-wrapper [aria-label*="Line Spacing"]'),
103
+ lineSpacingDropdownListOptions: (ariaLabel = null) => {
104
+ if (ariaLabel) {
105
+ return cy.get(`[aria-labelledby*="Line-Spacing-dropdown-label Line-Spacing-placeholder"] [role="option"][aria-label*="${ariaLabel}"]`)
106
+ } else {
107
+ return cy.get('[aria-labelledby*="Line-Spacing-dropdown-label Line-Spacing-placeholder"] [role="option"]')
108
+ }
109
+ },
110
+ numberOfLinesInPrintView: () => cy.get('.student-view [class*="ShortTextResponsePreviewstyle__OptionsWrapper"] [class*="ShortTextResponsePreviewstyle__Line"],[class*="ShortTextResponsePreviewstyle__Question"] [class*="ShortTextResponsePreviewstyle__Line"]'),
111
+ answerResponseInputField: () => cy.get('[aria-label*="Enter your response to the question here "]'),
112
+ answerResponseInputFieldWrapper: () => cy.get('.additional-option-placeholder-input input,.additional-option-placeholder-input textarea'),
113
+ answerInputField: () => cy.get('.additional-option-placeholder-input'),
95
114
  }
96
115
 
97
116
  const steps = {
@@ -106,6 +125,8 @@ const steps = {
106
125
  ...additionalSettingsPanel.steps,
107
126
  ...autoScoredSpecifyCorrectAnswerSection.steps,
108
127
  ...createItemPage.steps,
128
+ ...printPreviewComponent.steps,
129
+ ...autoScoredScoringSectionMultiResponseType.steps,
109
130
 
110
131
  verifyCorrectIcon: () => {
111
132
  utilities.verifyElementVisibilityState(autoScoredScoringPreviewTab.correctIcon(), 'visible');
@@ -179,6 +200,16 @@ const steps = {
179
200
  .type(text);
180
201
  },
181
202
 
203
+ /**
204
+ * @param {string} text text to entered in response input field
205
+ * @description enters text in answer input field
206
+ */
207
+ enterTextInAnswerInputField: (text) => {
208
+ shortTextResponsePage.answerResponseInputField()
209
+ .clear()
210
+ .type(text);
211
+ },
212
+
182
213
  clearAndFocusOutOfSpecifyCorrectAnswerInputField: () => {
183
214
  shortTextResponsePage.answerInputFieldSpecifyCorrectAnswerSection()
184
215
  .clear()
@@ -813,6 +844,14 @@ const steps = {
813
844
  steps.verifyClipboardFunctionButtonUnselectedState(index);
814
845
  },
815
846
 
847
+ deselectAllClipboardFunctionButton: () => {
848
+ for (let index = 0; index < 3; index++) {
849
+ shortTextResponsePage.clipboardFunctionButton(index)
850
+ .click();
851
+ steps.verifyClipboardFunctionButtonUnselectedState(index);
852
+ }
853
+ },
854
+
816
855
  enterTextInPlaceholderTextInputField: (text) => {
817
856
  shortTextResponsePage.placeholderTextInputField()
818
857
  .clear()
@@ -899,7 +938,99 @@ const steps = {
899
938
  verifyFlagThisItemNonAccessibleCheckboxIsUnchecked: () => {
900
939
  shortTextResponsePage.flagNonAccessibleCheckbox()
901
940
  .should('not.be.checked');
902
- }
941
+ },
942
+
943
+ verifyDisplayLinesForTheResponseCheckboxUnchecked: () => {
944
+ shortTextResponsePage.displayLinesForTheResponseCheckbox()
945
+ .should('not.be.checked');
946
+ },
947
+
948
+ verifyDisplayLinesForTheResponseCheckboxChecked: () => {
949
+ shortTextResponsePage.displayLinesForTheResponseCheckbox()
950
+ .should('be.checked');
951
+ },
952
+
953
+ checkDisplayLinesForTheResponseCheckbox: () => {
954
+ shortTextResponsePage.displayLinesForTheResponseCheckbox()
955
+ .click()
956
+ steps.verifyDisplayLinesForTheResponseCheckboxChecked();
957
+ },
958
+
959
+ uncheckDisplayLinesForTheResponseCheckbox: () => {
960
+ shortTextResponsePage.displayLinesForTheResponseCheckbox()
961
+ .click();
962
+ steps.verifyDisplayLinesForTheResponseCheckboxUnchecked();
963
+ },
964
+
965
+ expandLineSpacingDropdown: () => {
966
+ shortTextResponsePage.lineSpacingDropdown()
967
+ .click();
968
+ },
969
+
970
+ selectLineSpacingDropdownOption: (option) => {
971
+ shortTextResponsePage.lineSpacingDropdownListOptions(option)
972
+ .click();
973
+ utilities.verifyInnerText(shortTextResponsePage.lineSpacingDropdown(), option);
974
+ },
975
+
976
+ addValueInNumberOfLinesInputField: (value) => {
977
+ shortTextResponsePage.numberOfLinesInputField()
978
+ .clear()
979
+ .type(value)
980
+ .should('have.value', value);
981
+ },
982
+
983
+ verifyNumberOfLinesInPrintView: (expectedLines, expectedLineHeight) => {
984
+ shortTextResponsePage.numberOfLinesInPrintView()
985
+ .should('have.length', expectedLines)
986
+ .each(($line) => {
987
+ cy.wrap($line).should('have.css', 'height', expectedLineHeight);
988
+ });
989
+ },
990
+
991
+ copyTextFromAnswerResponseField: () => {
992
+ shortTextResponsePage.answerResponseInputField()
993
+ .focus()
994
+ .type('{selectall}')
995
+ .realPress(['Control', 'c']);
996
+ },
997
+
998
+ cutTextFromAnswerResponseField: () => {
999
+ shortTextResponsePage.answerResponseInputField()
1000
+ .focus()
1001
+ .type('{selectall}')
1002
+ .realPress(['Control', 'x']);
1003
+ },
1004
+
1005
+ pasteTextFromAnswerResponseField: () => {
1006
+ shortTextResponsePage.answerResponseInputField()
1007
+ .focus()
1008
+ .type('{selectall}')
1009
+ .realPress(['Control', 'c'])
1010
+ .realPress(['Control', 'v']);
1011
+ },
1012
+
1013
+ verifySpellCheckOfResponseFieldDisabledInAllViews: () => {
1014
+ shortTextResponsePage.answerResponseInputFieldWrapper()
1015
+ .should('have.prop', 'spellcheck', false);
1016
+ },
1017
+
1018
+ verifySpellCheckOfResponseFieldEnabledInAllViews: () => {
1019
+ shortTextResponsePage.answerInputField()
1020
+ .should('have.prop', 'spellcheck', true);
1021
+ },
1022
+
1023
+ /**
1024
+ * @param {string} text text to be entered in response field
1025
+ * @description enters text in response field
1026
+ *
1027
+ */
1028
+ enterTextInAnswerInputFieldAllViews: (text) => {
1029
+ shortTextResponsePage.answerResponseInputFieldWrapper()
1030
+ .eq(0)
1031
+ .clear()
1032
+ .type(text);
1033
+ },
903
1034
  }
904
1035
 
905
1036
  const tests = {
@@ -915,6 +1046,7 @@ const tests = {
915
1046
  ...additionalSettingsPanel.tests,
916
1047
  ...autoScoredSpecifyCorrectAnswerSection.tests,
917
1048
  ...studentResponseAndLayoutComponent.tests,
1049
+ ...printPreviewComponent.tests,
918
1050
 
919
1051
  /**
920
1052
  * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
@@ -931,15 +1063,11 @@ const tests = {
931
1063
  utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist');
932
1064
  });
933
1065
 
934
- autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredCorrectAnswerErrorMessageCSSAndA11y();
935
-
936
1066
  it('When gives an input to \'Answer\' input field,then error message should disappear', () => {
937
1067
  shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Nature');
938
1068
  commonComponents.steps.verifyErrorMessageIsNotDisplayed();
939
1069
  });
940
1070
 
941
- autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
942
-
943
1071
  it(`CSS of ${accordionName} accordion contents`, { tags: 'css' }, () => {
944
1072
  utilities.verifyCSS(utilities.getNthElement(shortTextResponsePage.correctAnswerAccordionLabel(), 0), {
945
1073
  'color': css.color.accordionLabel,
@@ -959,6 +1087,67 @@ const tests = {
959
1087
  utilities.verifyElementCount(shortTextResponsePage.answerInputFieldSpecifyCorrectAnswerSection(), 1);
960
1088
  });
961
1089
  },
1090
+
1091
+ verifyPrintLayoutSettingsAccordionAdditionalContent: () => {
1092
+ const lineSpacingDropdownOptions = ['Single', 'Double'];
1093
+ it('\'Display lines for the response\' label should be displayed', () => {
1094
+ utilities.verifyInnerText(shortTextResponsePage.displayLinesForTheResponseLabel(), 'Display lines for the response');
1095
+ utilities.verifyElementVisibilityState(shortTextResponsePage.displayLinesForTheResponseLabel(), 'visible');
1096
+ });
1097
+
1098
+ it('Display lines for the response checkbox should be displayed and by default checked', () => {
1099
+ utilities.verifyElementVisibilityState(shortTextResponsePage.displayLinesForTheResponseCheckbox(), 'exist');
1100
+ steps.verifyDisplayLinesForTheResponseCheckboxChecked();
1101
+ });
1102
+
1103
+ it('CSS of \'Display lines for the response\' section', { tags: 'css' }, () => {
1104
+ utilities.verifyCSS(shortTextResponsePage.displayLinesForTheResponseLabel(), {
1105
+ 'color': css.color.labelText,
1106
+ 'font-size': css.fontSize.normal,
1107
+ 'font-weight': css.fontWeight.regular
1108
+ });
1109
+ });
1110
+
1111
+ it('Accessibility of \'Display lines for the response\' section', { tags: 'a11y' }, () => {
1112
+ cy.checkAccessibility(shortTextResponsePage.displayLinesForTheResponseLabel().parents('.print-layout-settings-container'));
1113
+ });
1114
+
1115
+ it('User should be able to check and uncheck the \'Display lines for the response\' checkbox', () => {
1116
+ steps.uncheckDisplayLinesForTheResponseCheckbox();
1117
+ steps.checkDisplayLinesForTheResponseCheckbox();
1118
+ });
1119
+
1120
+ it('Number of lines label and input field should be displayed when \'Display lines for the response\' checkbox is checked', () => {
1121
+ utilities.verifyInnerText(shortTextResponsePage.numberOfLinesLabel(), 'Number of lines');
1122
+ utilities.verifyElementVisibilityState(shortTextResponsePage.numberOfLinesLabel(), 'visible');
1123
+ utilities.verifyElementVisibilityState(shortTextResponsePage.numberOfLinesInputField(), 'exist');
1124
+ });
1125
+
1126
+ it('User should be able to enter value in Number of lines input field', () => {
1127
+ shortTextResponsePage.steps.addValueInNumberOfLinesInputField('5');
1128
+ });
1129
+
1130
+ it(`\'Line Spacing\' label should be displayed and \'Line Spacing\' dropdown should be displayed and in \'Line Spacing\' dropdown \'${lineSpacingDropdownOptions[0]}\' option should be selected by default`, () => {
1131
+ utilities.verifyInnerText(shortTextResponsePage.lineSpacingLabel(), 'Line spacing');
1132
+ utilities.verifyElementVisibilityState(shortTextResponsePage.lineSpacingDropdown(), 'visible');
1133
+ utilities.verifyInnerText(shortTextResponsePage.lineSpacingDropdown(), lineSpacingDropdownOptions[0]);
1134
+ });
1135
+
1136
+ it(`\'Line Spacing\' dropdown should have the following options: ${lineSpacingDropdownOptions.join(', ')}`, () => {
1137
+ steps.expandLineSpacingDropdown()
1138
+ lineSpacingDropdownOptions.forEach((option, count) => {
1139
+ utilities.verifyInnerText(shortTextResponsePage.lineSpacingDropdownListOptions().eq(count), option)
1140
+ });
1141
+ shortTextResponsePage.steps.selectLineSpacingDropdownOption('Double')
1142
+ });
1143
+
1144
+ it('User should be able to select options from Line Spacing dropdown', () => {
1145
+ lineSpacingDropdownOptions.forEach((option) => {
1146
+ shortTextResponsePage.steps.expandLineSpacingDropdown();
1147
+ shortTextResponsePage.steps.selectLineSpacingDropdownOption(option)
1148
+ });
1149
+ });
1150
+ },
962
1151
  }
963
1152
 
964
1153
  export const shortTextResponsePage = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.574-scoring-fix-dd14c63.0",
3
+ "version": "1.0.575-IEI-7071-main-366a409.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,245 +0,0 @@
1
- import { shortTextResponsePage } from "../../../pages/shortTextResponsePage";
2
- import abortEarlySetup from "../../../support/helpers/abortEarly";
3
- const css = Cypress.env('css');
4
-
5
- describe('Create item page - Single selection: All or nothing with alternative answer', () => {
6
- before(() => {
7
- cy.loginAs('admin');
8
- });
9
-
10
- describe('Question preview: Auto scored - All or nothing with alternative answer - When \'Correct answer\' points are more than \'Alternative answer\' points', () => {
11
- abortEarlySetup();
12
- before(() => {
13
- shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
14
- cy.barsPreLoaderWait();
15
- shortTextResponsePage.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
16
- shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Buildings');
17
- shortTextResponsePage.steps.allotPoints(20);
18
- shortTextResponsePage.steps.clickOnAddAlternativeAnswerButton();
19
- shortTextResponsePage.steps.allotPoints(10);
20
- shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Fossil fuel combustion');
21
- //shortTextResponsePage.steps.checkAllowStudentToCheckAnswerCheckbox();
22
- shortTextResponsePage.steps.switchToPreviewTab();
23
- });
24
-
25
- //TODO: need to fix it after https://redmine.zeuslearning.com/issues/561054 is resolved
26
- it('When the user selects \'Grading\' view without attempting the question then incorrect answer border and correct answer section should be displayed and correct/incorrect icons should not be displayed', () => {
27
- shortTextResponsePage.steps.switchToGradingView();
28
- shortTextResponsePage.steps.verifyCorrectIncorrectIconNotVisibleGradingView();
29
- // shortTextResponsePage.steps.verifyCorrectIncorrectBorderNotExist();
30
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Buildings');
31
- shortTextResponsePage.steps.switchToStudentView();
32
- });
33
-
34
- it('When the user attempts the question with response from the correct accordion, then the user should be awarded with points specified for correct accordion and on switching to \'Grading\' view, correct icon and correct answer border should be displayed and correct answer section should not be displayed', () => {
35
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Buildings');
36
- shortTextResponsePage.steps.verifyPreviewScore(20, 20);
37
- shortTextResponsePage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
38
- shortTextResponsePage.steps.switchToGradingView();
39
- shortTextResponsePage.steps.verifyCorrectIcon();
40
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
41
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
42
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
43
- /*cy.log('When the user has attempted the question with response from the correct accordion and clicks on \'Check answer\' button, then correct icon and correct answer border should be displayed in the question preview')
44
- shortTextResponsePage.steps.checkAnswer();
45
- shortTextResponsePage.steps.verifyCorrectIcon();
46
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
47
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();*/
48
- });
49
-
50
- shortTextResponsePage.tests.verifyPointsCorrectAnswerLabelAndBorderCSSAndA11y('short text response');
51
-
52
- it('When the user attempts the question with response from the alternative accordion, then the user should be awarded with points specified for alternative accordion (less than overall points) and on switching to \'Grading\' view, correct icon should be displayed beside response input field and correct answer border be displayed and correct answer section should not be displayed', () => {
53
- shortTextResponsePage.steps.resetQuestionPreview();
54
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Fossil fuel combustion');
55
- shortTextResponsePage.steps.verifyPreviewScore(10, 20);
56
- shortTextResponsePage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
57
- shortTextResponsePage.steps.switchToGradingView();
58
- shortTextResponsePage.steps.verifyCorrectIcon();
59
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
60
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
61
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
62
- /*cy.log('When the user has attempted the question with response from the alternative accordion and clicks on \'Check answer\' button, then correct icon should only be displayed beside response input field and correct answer border should be displayed in question preview');
63
- shortTextResponsePage.steps.checkAnswer();
64
- shortTextResponsePage.steps.verifyCorrectIcon();
65
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
66
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();*/
67
- });
68
-
69
- it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icon should be displayed beside response input field, incorrect answer border and correct answer section should be displayed in question preview', () => {
70
- shortTextResponsePage.steps.resetQuestionPreview();
71
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Incorrect answer');
72
- shortTextResponsePage.steps.verifyPreviewScore(0, 20);
73
- shortTextResponsePage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
74
- shortTextResponsePage.steps.switchToGradingView();
75
- shortTextResponsePage.steps.verifyIncorrectIcon();
76
- shortTextResponsePage.steps.verifyIncorrectAttemptBorder();
77
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Buildings');
78
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
79
- /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icon should be displayed beside response input field and incorrect answer border should not be displayed in question preview')
80
- shortTextResponsePage.steps.checkAnswer();
81
- shortTextResponsePage.steps.verifyIncorrectIcon();
82
- shortTextResponsePage.steps.verifyIncorrectAttemptBorder();
83
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();*/
84
- });
85
-
86
- shortTextResponsePage.tests.verifyIncorrectAnswerLabelAndBorderCSSAndA11y('single selection');
87
-
88
- it('When the user sets \'Award minimum score only if attempted\' in minimum scoring dropdown and allots minimum points such that minimum points are less than alternative answer points, then attempts the question with response from the alternative accordion, the user should be awarded with alternative answer points', () => {
89
- shortTextResponsePage.steps.switchToEditTab();
90
- shortTextResponsePage.steps.expandMinimumScoringDropdown();
91
- shortTextResponsePage.steps.selectOptionFromMinimumScoringDropdown('Award minimum score only if attempted');
92
- shortTextResponsePage.steps.allotMinimumPoints(3);
93
- shortTextResponsePage.steps.switchToPreviewTab();
94
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Fossil fuel combustion');
95
- shortTextResponsePage.steps.verifyPreviewScore(10, 20);
96
- });
97
-
98
- it('When the user sets minimum points such that minimum points are greater than alternative answer points, then attempts the question with response from the alternative accordion, the user should be awarded with minimum points', () => {
99
- shortTextResponsePage.steps.switchToEditTab();
100
- shortTextResponsePage.steps.allotMinimumPoints(13);
101
- shortTextResponsePage.steps.switchToPreviewTab();
102
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Fossil fuel combustion');
103
- shortTextResponsePage.steps.verifyPreviewScore(13, 20);
104
- });
105
- });
106
-
107
- describe('Question preview: Auto scored - All or nothing with alternative answer - When \'Alternative answer\' points are more than \'Correct answer\' points', () => {
108
- abortEarlySetup();
109
- before(() => {
110
- shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
111
- cy.barsPreLoaderWait();
112
- shortTextResponsePage.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
113
- shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Buildings');
114
- shortTextResponsePage.steps.allotPoints(10);
115
- shortTextResponsePage.steps.clickOnAddAlternativeAnswerButton();
116
- shortTextResponsePage.steps.allotPoints(20);
117
- shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Fossil fuel combustion');
118
- //shortTextResponsePage.steps.checkAllowStudentToCheckAnswerCheckbox();
119
- shortTextResponsePage.steps.switchToPreviewTab();
120
- });
121
-
122
- //TODO: need to fix it after https://redmine.zeuslearning.com/issues/561054 is resolved
123
- it('When the user selects \'Grading\' view without attempting the question, correct/incorrect icons should not be displayed and answer input field should have incorrect answer border and correct answer section should be displayed below response input field', () => {
124
- shortTextResponsePage.steps.switchToGradingView();
125
- //shortTextResponsePage.steps.verifyCorrectIncorrectBorderNotExist();
126
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Fossil fuel combustion');
127
- shortTextResponsePage.steps.switchToStudentView();
128
- });
129
-
130
- it('When the user attempts the question with response from the correct accordion, then the user should be awarded with points specified for correct accordion (less than overall points) and on switching to \'Grading\' view, correct icon should be displayed beside response input field, correct answer border should be displayed and correct answer section should not be displayed', () => {
131
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Buildings');
132
- shortTextResponsePage.steps.verifyPreviewScore(10, 20);
133
- shortTextResponsePage.steps.switchToGradingView();
134
- shortTextResponsePage.steps.verifyCorrectIcon();
135
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
136
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
137
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
138
- /*cy.log('When the user has attempted the question with response from the correct accordion and clicks on \'Check answer\' button, then correct icon should be displayed beside correct response input field, correct answer border should be displayed in question preview')
139
- shortTextResponsePage.steps.checkAnswer();
140
- shortTextResponsePage.steps.verifyCorrectIcon();
141
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
142
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();*/
143
- });
144
-
145
- it('When the user attempts the question with response from the alternative accordion, then the user should be awarded with points specified for alternative accordion and on switching to \'Grading\' view, correct icon should be displayed beside response input field, correct answer border should be displayed and correct answer section should not be displayed', () => {
146
- shortTextResponsePage.steps.resetQuestionPreview();
147
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Fossil fuel combustion');
148
- shortTextResponsePage.steps.verifyPreviewScore(20, 20);
149
- shortTextResponsePage.steps.switchToGradingView();
150
- shortTextResponsePage.steps.verifyCorrectIcon();
151
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
152
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
153
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
154
- /*cy.log('When the user has attempted the question with response input field from the alternative accordion and clicks on \'Check answer\' button, then correct icon should beside response input field and correct answer border should be displayed in the question preview')
155
- shortTextResponsePage.steps.checkAnswer();
156
- shortTextResponsePage.steps.verifyCorrectIcon();
157
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
158
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();*/
159
- });
160
-
161
- it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icon should be displayed beside response input field, incorrect answer border and correct answer section should be displayed', () => {
162
- shortTextResponsePage.steps.resetQuestionPreview();
163
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Fossil');
164
- shortTextResponsePage.steps.verifyPreviewScore(0, 20);
165
- shortTextResponsePage.steps.switchToGradingView();
166
- shortTextResponsePage.steps.verifyIncorrectIcon();
167
- shortTextResponsePage.steps.verifyIncorrectAttemptBorder();
168
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Fossil fuel combustion');
169
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
170
- /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icon should be displayed beside response input field and incorrect answer border should be displayed question preview')
171
- shortTextResponsePage.steps.checkAnswer();
172
- shortTextResponsePage.steps.verifyIncorrectIcon();
173
- shortTextResponsePage.steps.verifyIncorrectAttemptBorder();*/
174
- });
175
- });
176
-
177
- describe('Question preview: Auto scored - All or nothing with alternative answer - When \'Correct answer\' points is equal to \'Alternative answer\' points', () => {
178
- abortEarlySetup();
179
- before(() => {
180
- shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
181
- cy.barsPreLoaderWait();
182
- shortTextResponsePage.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
183
- shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Buildings');
184
- shortTextResponsePage.steps.allotPoints(20);
185
- shortTextResponsePage.steps.clickOnAddAlternativeAnswerButton();
186
- shortTextResponsePage.steps.allotPoints(20);
187
- shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Fossil fuel combustion');
188
- //shortTextResponsePage.steps.checkAllowStudentToCheckAnswerCheckbox();
189
- shortTextResponsePage.steps.switchToPreviewTab();
190
- });
191
-
192
- //TODO: need to fix it after https://redmine.zeuslearning.com/issues/561054 is resolved
193
- it('When the user switches to \'Grading\' view without attempting the question, then incorrect border and correct answer section should be displayed', () => {
194
- shortTextResponsePage.steps.switchToGradingView();
195
- //shortTextResponsePage.steps.verifyCorrectIncorrectBorderNotExist();
196
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Buildings');
197
- shortTextResponsePage.steps.switchToStudentView();
198
- });
199
-
200
- it('When the user attempts the question with response from the correct accordion, then the user should be awarded with points specified for correct accordion and on switching to \'Grading\' view, correct icon should be displayed beside response input field, correct answer border should be displayed and correct answer section should not be displayed', () => {
201
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Buildings');
202
- shortTextResponsePage.steps.verifyPreviewScore(20, 20);
203
- shortTextResponsePage.steps.switchToGradingView();
204
- shortTextResponsePage.steps.verifyCorrectIcon();
205
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
206
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
207
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
208
- /*cy.log('When the user has attempted the question with response input field from the correct accordion and clicks on \'Check answer\' button, then correct icon should be displayed beside response input field and correct answer border should be displayed in question preview')
209
- shortTextResponsePage.steps.checkAnswer();
210
- shortTextResponsePage.steps.verifyCorrectIcon();
211
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();*/
212
- });
213
-
214
- it('When the user attempts the question with response from the alternative accordion, then the user should be awarded with points specified for alternative accordion (same as correct answer points) and on switching to \'Grading\' view, correct icon should only be displayed beside response input field, correct answer border and correct answer section should not be displayed in question preview', () => {
215
- shortTextResponsePage.steps.resetQuestionPreview();
216
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Fossil fuel combustion');
217
- shortTextResponsePage.steps.verifyPreviewScore(20, 20);
218
- shortTextResponsePage.steps.switchToGradingView();
219
- shortTextResponsePage.steps.verifyCorrectIcon();
220
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
221
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();
222
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
223
- /*cy.log('When the user has attempted the question with response input field from the alternative accordion and clicks on \'Check answer\' button, then correct icon should only be displayed beside response input field and correct answer border should be displayed in question preview')
224
- shortTextResponsePage.steps.checkAnswer();
225
- shortTextResponsePage.steps.verifyCorrectIcon();
226
- shortTextResponsePage.steps.verifyCorrectAttemptBorder();
227
- shortTextResponsePage.steps.verifyCorrectAnswerWrapperNotExist();*/
228
- });
229
-
230
- it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icon should be displayed beside response input field, incorrect answer border and correct answer section should be displayed in question preview', () => {
231
- shortTextResponsePage.steps.resetQuestionPreview();
232
- shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Incorrect');
233
- shortTextResponsePage.steps.verifyPreviewScore(0, 20);
234
- shortTextResponsePage.steps.switchToGradingView();
235
- shortTextResponsePage.steps.verifyIncorrectIcon();
236
- shortTextResponsePage.steps.verifyIncorrectAttemptBorder();
237
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Buildings');
238
- shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
239
- /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icon should only be displayed beside incorrect response input field, correct icon should not be displayed beside unattempted correct options, incorrect answer border and a label should not be displayed in question preview')
240
- shortTextResponsePage.steps.checkAnswer();
241
- shortTextResponsePage.steps.verifyIncorrectIcon();
242
- shortTextResponsePage.steps.verifyIncorrectAttemptBorder();*/
243
- });
244
- });
245
- });