itemengine-cypress-automation 1.0.27 → 1.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,131 @@
1
+ import { fillInTheGapsDropdownPage } from "../../../pages/fillInTheGapsDropdownPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ let optionsForResponse1 = ['changing', 'progressively', 'healthy', 'new'];
5
+ let optionsForResponse2 = ['increasingly', 'decreasingly', 'extensively', 'exclusively'];
6
+
7
+ describe('Create Item page - Fill in the Gaps: Scoring Section', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Scoring Section contents', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ cy.log('Navigate to fill in the gaps - dropdown question type');
16
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
17
+ });
18
+
19
+ fillInTheGapsDropdownPage.tests.verifyScoringTypeLabelAndDropdown('autoScored');
20
+
21
+ fillInTheGapsDropdownPage.tests.verifyAutoScoredScoringTypeSectionWithCSSAnda11y();
22
+ });
23
+
24
+ describe('Auto Scored: All or nothing scoring - Edit tab', () => {
25
+ //The error message 'Error: Please set a correct answer.' is not covered here. It is covered in correct answer section
26
+ abortEarlySetup();
27
+ before(() => {
28
+ cy.log('Navigate to fill in the gaps - dropdown question type');
29
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
30
+ });
31
+
32
+ fillInTheGapsDropdownPage.tests.verifyAutoScoredAllOrNothingPointsAndMinimumScoreAwardedLabelAndInputField();
33
+ fillInTheGapsDropdownPage.tests.verifyPointsFieldErrorState(10);
34
+ fillInTheGapsDropdownPage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
35
+
36
+ it('When the user selects an option form the Response dropdown then the Correct tab error icon should disappear', () => {
37
+ cy.log('Pre step: Adding response options')
38
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1)
39
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'changing')
40
+ fillInTheGapsDropdownPage.setCorrectAnswerErrorIcon()
41
+ .should('not.exist');
42
+ });
43
+ });
44
+
45
+ describe('Auto Scored: Partial - equal weights scoring - Edit tab', () => {
46
+ abortEarlySetup();
47
+ before(() => {
48
+ cy.log('Navigate to fill in the gaps - dropdown question type');
49
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
50
+ cy.log('Adding a response token to question field')
51
+ fillInTheGapsDropdownPage.questionInputField()
52
+ .click();
53
+ fillInTheGapsDropdownPage.ckEditorAddResponseButton()
54
+ .click();
55
+ });
56
+
57
+ fillInTheGapsDropdownPage.tests.verifyAutoScoredPartialEqualWeightsScoringEditTabContents();
58
+
59
+ it('When user adds a response to the question, then one more response dropdown should be displayed in the set correct answer section and points per response score should be updated accordingly', () => {
60
+ fillInTheGapsDropdownPage.questionInputField()
61
+ .click();
62
+ fillInTheGapsDropdownPage.ckEditorAddResponseButton()
63
+ .click();
64
+ fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
65
+ .should('have.length', '3');
66
+ fillInTheGapsDropdownPage.partialEqualWeightsPointsPerResponseScore()
67
+ .each(($element) => {
68
+ cy.wrap($element)
69
+ .verifyInnerText('1.33');
70
+ });
71
+ });
72
+
73
+ fillInTheGapsDropdownPage.tests.verifyAutoScoredPartialEqualWeightsScoringEditTabFunctionality()
74
+ });
75
+
76
+ describe('Auto Scored: Partial - different weights scoring - Edit tab', () => {
77
+ abortEarlySetup();
78
+ before(() => {
79
+ cy.log('Navigate to fill in the gaps - dropdown question type');
80
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
81
+ cy.log('Adding a response token to question field')
82
+ fillInTheGapsDropdownPage.questionInputField()
83
+ .click();
84
+ fillInTheGapsDropdownPage.ckEditorAddResponseButton()
85
+ .click();
86
+ });
87
+
88
+ fillInTheGapsDropdownPage.tests.verifyAutoScoredPartialDifferentWeightsScoringEditTabContents()
89
+
90
+ it('When user sets an answer in the response dropdown then the \'Points per response\' input field should be enabled', () => {
91
+ cy.log('Pre step: Adding options for response 1')
92
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
93
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
94
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'changing')
95
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'extensively')
96
+ fillInTheGapsDropdownPage.pointsInputField()
97
+ .each(($element) => {
98
+ cy.wrap($element)
99
+ .should('be.enabled');
100
+ });
101
+ });
102
+
103
+ fillInTheGapsDropdownPage.tests.verifyAutoScoredPartialDifferentWeightsScoringEditTabFunctionality()
104
+ });
105
+
106
+ describe('Manually Scored scoring - Edit tab', () => {
107
+ abortEarlySetup();
108
+ before(() => {
109
+ cy.log('Navigate to fill in the gaps - dropdown question type');
110
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
111
+ });
112
+
113
+ it('User should be able to select \'Manually scored\' scoring type from scoring type dropdown', () => {
114
+ fillInTheGapsDropdownPage.steps.selectAScoringTypeFromScoringTypeDropdown('Manually scored')
115
+ });
116
+
117
+ fillInTheGapsDropdownPage.tests.verifyManuallyScoredScoringContents()
118
+ fillInTheGapsDropdownPage.tests.verifyPointsFieldErrorState(10);
119
+ fillInTheGapsDropdownPage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
120
+ });
121
+
122
+ describe('Non Scored scoring - Edit tab', () => {
123
+ abortEarlySetup();
124
+ before(() => {
125
+ cy.log('Navigate to fill in the gaps - dropdown question type');
126
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
127
+ });
128
+
129
+ fillInTheGapsDropdownPage.tests.verifyEditTabNonScoredScoringSectionContents();
130
+ });
131
+ });
@@ -0,0 +1,126 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { dialogBoxBase } from "../../../pages";
3
+ import { commonComponents } from "../../../pages/components";
4
+ import { fillInTheGapsDropdownPage } from "../../../pages/fillInTheGapsDropdownPage";
5
+ const css = Cypress.env('css');
6
+
7
+ let optionsForResponse1 = ['changing', 'progressively', 'healthy', 'new'];
8
+
9
+ describe('Create question page - Essay response: Header section and Saving question', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Header section contents', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
18
+ });
19
+
20
+ fillInTheGapsDropdownPage.tests.verifyCreateQuestionPageQuestionTypeHeader('Fill in the gaps with dropdown');
21
+ });
22
+
23
+ describe('Tabs section', () => {
24
+ abortEarlySetup();
25
+ before(() => {
26
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
27
+ });
28
+
29
+ fillInTheGapsDropdownPage.tests.verifyTabsSection();
30
+ });
31
+
32
+ describe('Cancel button', () => {
33
+ abortEarlySetup();
34
+ before(() => {
35
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
36
+ });
37
+
38
+ fillInTheGapsDropdownPage.tests.verifyCancelButton('fill in the gaps with dropdown');
39
+ });
40
+
41
+ describe('Save Question button', () => {
42
+ abortEarlySetup();
43
+ before(() => {
44
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
45
+ cy.barsPreLoaderWait();
46
+ });
47
+
48
+ describe('Validation error messages', () => {
49
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
50
+
51
+ it('Validation error messages should be displayed below required input fields', () => {
52
+ fillInTheGapsDropdownPage.questionInstructionsLabelEditTab()
53
+ .parents('.edit-question-instruction-wrapper')
54
+ .within(() => {
55
+ fillInTheGapsDropdownPage.errorMessage()
56
+ .verifyInnerText('Error: Question instructions are required.')
57
+ .and('be.visible');
58
+ });
59
+ for (let index = 0; index < 4; index++) {
60
+ fillInTheGapsDropdownPage.optionWrapper()
61
+ .eq(index)
62
+ .within(() => {
63
+ fillInTheGapsDropdownPage.optionIsRequiredErrorMessage()
64
+ .verifyInnerText('Error: Option is required.');
65
+ });
66
+ };
67
+ fillInTheGapsDropdownPage.pointsLabel()
68
+ .parents('.cloze-with-text-points-wrapper')
69
+ .within(() => {
70
+ fillInTheGapsDropdownPage.errorMessage()
71
+ .verifyInnerText('Error: Please enter points.');
72
+ });
73
+ fillInTheGapsDropdownPage.setCorrectAnswerErrorIcon()
74
+ .should('have.text', 'Error-Icon');
75
+ fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
76
+ .parents('.cloze-with-text-authoring-mode-response-wrapper')
77
+ .within(() => {
78
+ fillInTheGapsDropdownPage.errorMessage()
79
+ .verifyInnerText('Error: Please set a correct answer.');
80
+ });
81
+ });
82
+
83
+ it('Validation error messages should disappear when required input fields are filled', () => {
84
+ fillInTheGapsDropdownPage.steps.addQuestionInstructions();
85
+ fillInTheGapsDropdownPage.questionInstructionsLabelEditTab()
86
+ .parents('.edit-question-instruction-wrapper')
87
+ .within(() => {
88
+ fillInTheGapsDropdownPage.errorMessage()
89
+ .should('not.exist');
90
+ });
91
+ fillInTheGapsDropdownPage.steps.allotPoints(20);
92
+ fillInTheGapsDropdownPage.pointsLabel()
93
+ .parents('.cloze-with-text-points-wrapper')
94
+ .within(() => {
95
+ fillInTheGapsDropdownPage.errorMessage()
96
+ .should('not.exist');
97
+ });
98
+ cy.log('Pre step: Adding response options')
99
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1)
100
+ fillInTheGapsDropdownPage.optionsSectionWrapper()
101
+ .within(() => {
102
+ fillInTheGapsDropdownPage.optionIsRequiredErrorMessage()
103
+ .should('not.exist');
104
+ });
105
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'changing')
106
+ fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
107
+ .parents('.cloze-with-text-authoring-mode-response-wrapper')
108
+ .within(() => {
109
+ fillInTheGapsDropdownPage.errorMessage()
110
+ .should('not.exist');
111
+ });
112
+ fillInTheGapsDropdownPage.setCorrectAnswerErrorIcon()
113
+ .should('not.exist');
114
+ });
115
+
116
+ commonComponents.tests.verifya11yOfCreateItemWrapperContents();
117
+ });
118
+
119
+ describe('Saving a question', () => {
120
+ it('When user has filled all the mandatory fields then on clicking on Save Question button the question should get saved and a snackbar with text \'Saved successfully!\' should be displayed', () => {
121
+ fillInTheGapsDropdownPage.steps.saveAQuestionAndVerifySnackbar();
122
+ });
123
+ fillInTheGapsDropdownPage.tests.verifySavedSuccessfullySnackbarCSSanda11y();
124
+ });
125
+ });
126
+ });
@@ -0,0 +1,57 @@
1
+ import { fillInTheGapsDropdownPage, fillInTheGapsScoring } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ let optionsForResponse1 = ['Correct answer 1', 'Alternate correct answer 1', 'Incorrect answer 1', 'Incorrect answer 2'];
5
+ let optionsForResponse2 = ['Correct answer 2', 'Alternate correct answer 2', 'Incorrect answer 1', 'Incorrect answer 2'];
6
+
7
+ describe('Fill in the gaps - dropdown Manually and Non scored scoring types', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Question Preview: Manually Scored', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ cy.log('Adding question instructions and options, select Manually Scored scoring type and add points for the question');
16
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
17
+ fillInTheGapsDropdownPage.steps.addQuestionInstructions();
18
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
19
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
20
+ fillInTheGapsDropdownPage.steps.selectAScoringTypeFromScoringTypeDropdown('Manually scored')
21
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
22
+ });
23
+
24
+ it('When the user switches to the Preview tab, the question instruction, sample \'Lorem Ipsum\' text along with a response dropdown should be displayed', () => {
25
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab()
26
+ fillInTheGapsDropdownPage.steps.verifyQuestionInstructionsText();
27
+ fillInTheGapsDropdownPage.questionInputField()
28
+ .should('have.text', 'Lorem ipsum dolor sit amet, 1Responsecloseonsectetur adipiscing elit. Ut pellentesque tinciduntornare. Integer porttitor est quis urna porttitor, eget tempus tellus dapibus.');
29
+ fillInTheGapsDropdownPage.previewTabQuestionContainer()
30
+ .verifyInnerText('Lorem ipsum dolor sit amet, \n​\n​\nonsectetur adipiscing elit. Ut pellentesque tinciduntornare. Integer porttitor est quis urna porttitor, eget tempus tellus dapibus.');
31
+ fillInTheGapsDropdownPage.previewTabResponseDropdown()
32
+ .should('have.length', 1)
33
+ .and('be.visible');
34
+ });
35
+
36
+ fillInTheGapsDropdownPage.tests.verifyShowCorrectAnswerAndPointsNotDisplayedInPreviewTab()
37
+ });
38
+
39
+ describe('Question Preview: Non Scored', () => {
40
+ abortEarlySetup();
41
+ before(() => {
42
+ cy.log('Adding question instructions and options, select Non Scored scoring type and set correct answer');
43
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
44
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
45
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
46
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
47
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
48
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
49
+ fillInTheGapsDropdownPage.steps.selectAScoringTypeFromScoringTypeDropdown('Non scored');
50
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
51
+ fillInTheGapsDropdownPage.steps.setMaximumCheckAnswerAttempts(10)
52
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
53
+ });
54
+
55
+ fillInTheGapsScoring.tests.verifyNonScoredScoring('fill in the gaps - dropdown');
56
+ });
57
+ });
@@ -0,0 +1,119 @@
1
+ import { fillInTheGapsDropdownPage, fillInTheGapsScoring } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+
4
+ let optionsForResponse1 = ['Correct answer 1', 'Alternate correct answer 1', 'Incorrect answer 1', 'Incorrect answer 2'];
5
+ let optionsForResponse2 = ['Correct answer 2', 'Alternate correct answer 2', 'Incorrect answer 1', 'Incorrect answer 2'];
6
+
7
+ describe('Fill in the gaps - dropdown scoring section partial - equal weights', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ })
11
+
12
+ describe('Question Preview Auto Scored: Partial - equal weights', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ cy.log('Navigate to Fill in the gaps - dropdown question type, fill the necessary details and points and switch to preview tab');
16
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
17
+ cy.barsPreLoaderWait();
18
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
19
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
20
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
21
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
22
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
23
+ fillInTheGapsDropdownPage.steps.allotPoints('10');
24
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
25
+ fillInTheGapsDropdownPage.partialEqualWeightsCheckbox()
26
+ .click();
27
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
28
+ fillInTheGapsDropdownPage.allowStudentsToCheckAnswerCheckbox()
29
+ .click();
30
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
31
+ });
32
+
33
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialEqualWeightsScoring('fill in the gaps - dropdown')
34
+ });
35
+
36
+ describe('Question preview: Partial - equal weights with alternate answer and match from all responses - \"false\"', () => {
37
+ abortEarlySetup();
38
+ before(() => {
39
+ cy.log('Navigate to fill in the gaps - dropdown question type, adding correct answer responses and alternate answer responses, adding points and switch to preview tab');
40
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
41
+ cy.barsPreLoaderWait();
42
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
43
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
44
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
45
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
46
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
47
+ fillInTheGapsDropdownPage.steps.allotPoints('10');
48
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
49
+ fillInTheGapsDropdownPage.alternateAnswerButton()
50
+ .click();
51
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Alternate correct answer 1');
52
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Alternate correct answer 2');
53
+ fillInTheGapsDropdownPage.steps.allotPoints('6');
54
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
55
+ fillInTheGapsDropdownPage.partialEqualWeightsCheckbox()
56
+ .click();
57
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
58
+ fillInTheGapsDropdownPage.allowStudentsToCheckAnswerCheckbox()
59
+ .click();
60
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
61
+ });
62
+
63
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialEqualWeightsWithAlternateAnswerAndMatchFromAllResponsesFalse('fill in the gaps - dropdown')
64
+ });
65
+
66
+ describe('Question preview: Partial - equal weights with alternate answer and match from all responses - \"true\"', () => {
67
+ abortEarlySetup();
68
+ before(() => {
69
+ cy.log('Navigate to fill in the gaps - dropdown question type, adding correct answer responses and alternate answer responses and points for both correct and alternate answer');
70
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
71
+ cy.barsPreLoaderWait();
72
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
73
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
74
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
75
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
76
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
77
+ fillInTheGapsDropdownPage.steps.allotPoints('10');
78
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
79
+ fillInTheGapsDropdownPage.alternateAnswerButton()
80
+ .click();
81
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Alternate correct answer 1');
82
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Alternate correct answer 2');
83
+ fillInTheGapsDropdownPage.steps.allotPoints('6');
84
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
85
+ fillInTheGapsDropdownPage.matchFromAllResponsesCheckbox()
86
+ .click();
87
+ fillInTheGapsDropdownPage.partialEqualWeightsCheckbox()
88
+ .click();
89
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
90
+ fillInTheGapsDropdownPage.allowStudentsToCheckAnswerCheckbox()
91
+ .click();
92
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
93
+ });
94
+
95
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialEqualWeightsWithAlternateAnswerAndMatchFromAllResponsesTrue('fill in the gaps - dropdown')
96
+ });
97
+
98
+ describe('Partial Equal Weights: Round down score', () => {
99
+ abortEarlySetup();
100
+ before(() => {
101
+ cy.log('Add question instructions and options, set correct answers, select partial - equal weights scoring and add points (in decimals) for correct answer options');
102
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
103
+ cy.barsPreLoaderWait();
104
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
105
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
106
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
107
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
108
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
109
+ fillInTheGapsDropdownPage.partialEqualWeightsCheckbox()
110
+ .click();
111
+ fillInTheGapsDropdownPage.pointsInputField()
112
+ .type('8.5');
113
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
114
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
115
+ });
116
+
117
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialEqualWeightsRoundDownScore('fill in the gaps - dropdown')
118
+ });
119
+ });
@@ -0,0 +1,86 @@
1
+ import { fillInTheGapsDropdownPage } from "../../../pages/fillInTheGapsDropdownPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const optionsForResponse1 = ['changing', 'progressively', 'healthy', 'new'];
4
+
5
+ describe('Create Item page - Fill in the gaps - dropdown Randomize options functionality', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Randomize options - Functionality', () => {
11
+ let randomizedOptionsString = '';
12
+ abortEarlySetup();
13
+ before(() => {
14
+ cy.log('Navigate to fill in the gaps - dropdown question type');
15
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
16
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
17
+ });
18
+
19
+ it('When the \'Randomize options\' functionality is disabled, then the options displayed in the preview tab response dropdown should be in the order in which the user has set them in the \'option for responses\' section', () => {
20
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
21
+ fillInTheGapsDropdownPage.previewTabResponseDropdown()
22
+ .click();
23
+ fillInTheGapsDropdownPage.steps.verifyResponseDropdownOptions(optionsForResponse1);
24
+ cy.log('selecting an option to collapse the response dropdown')
25
+ fillInTheGapsDropdownPage.steps.selectOptionFromResponseDropdown('new');
26
+ });
27
+
28
+ it('When the user expands the response dropdown in the \'Set correct answer\' section, the dropdown options should be in the order in which the user has set them in the \'option for responses\' section', () => {
29
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
30
+ fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
31
+ .click();
32
+ fillInTheGapsDropdownPage.steps.verifyResponseDropdownOptions(optionsForResponse1);
33
+ });
34
+
35
+ it('When the user enables the \'Randomize options\' functionality, then the options should be displayed in a random order in the preview tab response dropdown', () => {
36
+ fillInTheGapsDropdownPage.randomizeOptionsCheckbox()
37
+ .click()
38
+ .should('be.checked');
39
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
40
+ fillInTheGapsDropdownPage.previewTabResponseDropdown()
41
+ .click();
42
+ fillInTheGapsDropdownPage.steps.verifyRandomizeOptionOrder(optionsForResponse1);
43
+ });
44
+
45
+ it('When the user switches to Edit tab and does not modify any question properties, then the order of the options should not change in the preview tab response dropdown', () => {
46
+ fillInTheGapsDropdownPage.dropdownList()
47
+ .then(($element) => {
48
+ randomizedOptionsString = $element.text();
49
+ cy.log('selecting an option to collapse the response dropdown')
50
+ fillInTheGapsDropdownPage.steps.selectOptionFromResponseDropdown('new');
51
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
52
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
53
+ fillInTheGapsDropdownPage.previewTabResponseDropdown()
54
+ .click();
55
+ fillInTheGapsDropdownPage.dropdownList()
56
+ .should('have.text', randomizedOptionsString);
57
+ cy.log('selecting an option to collapse the response dropdown')
58
+ fillInTheGapsDropdownPage.steps.selectOptionFromResponseDropdown('changing');
59
+ });
60
+ });
61
+
62
+ it('When the user switches to Edit tab and modifies any of question properties, then the order of the options should change in the preview tab response dropdown', () => {
63
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
64
+ fillInTheGapsDropdownPage.steps.allotPoints(5);
65
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
66
+ fillInTheGapsDropdownPage.previewTabResponseDropdown()
67
+ .click();
68
+ fillInTheGapsDropdownPage.steps.verifyRandomizeOptionOrder(optionsForResponse1);
69
+ fillInTheGapsDropdownPage.dropdownList()
70
+ .should('not.have.text', randomizedOptionsString);
71
+ cy.log('selecting an option to collapse the response dropdown')
72
+ fillInTheGapsDropdownPage.steps.selectOptionFromResponseDropdown('changing');
73
+ });
74
+
75
+ it('When the user disables the \'Randomize options\' functionality, then the options should be displayed in the order in which the user has set them in the \'option for responses\' section in the preview tab response dropdown', () => {
76
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
77
+ fillInTheGapsDropdownPage.randomizeOptionsCheckbox()
78
+ .click()
79
+ .should('not.be.checked');
80
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
81
+ fillInTheGapsDropdownPage.previewTabResponseDropdown()
82
+ .click();
83
+ fillInTheGapsDropdownPage.steps.verifyResponseDropdownOptions(optionsForResponse1);
84
+ });
85
+ });
86
+ });
@@ -0,0 +1,122 @@
1
+ import { fillInTheGapsScoring } from "../../../pages/fillInTheGapsScoring";
2
+ import { fillInTheGapsDropdownPage } from "../../../pages/fillInTheGapsDropdownPage";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ const css = Cypress.env('css');
5
+
6
+ let optionsForResponse1 = ['Correct answer 1', 'Alternate correct answer 1', 'Incorrect answer 1', 'Incorrect answer 2'];
7
+ let optionsForResponse2 = ['Correct answer 2', 'Alternate correct answer 2', 'Incorrect answer 1', 'Incorrect answer 2'];
8
+
9
+ describe('Partial Different scoring', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Question Preview: AutoScored - Partial different weights', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ cy.log('Navigate to Fill in the gaps - dropdown question type, fill the necessary details and points, uncheck round down score checkbox and switch to preview tab');
18
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
19
+ cy.barsPreLoaderWait();
20
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
21
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
22
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
23
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
24
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
25
+ fillInTheGapsDropdownPage.partialDifferentWeightsCheckbox()
26
+ .click();
27
+ fillInTheGapsDropdownPage.steps.addPartialDifferentWeightsPoints([5.4, 4.8]);
28
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
29
+ fillInTheGapsDropdownPage.rounddownScoreCheckbox()
30
+ .click();
31
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
32
+ fillInTheGapsDropdownPage.allowStudentsToCheckAnswerCheckbox()
33
+ .click();
34
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
35
+ });
36
+
37
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialDifferentWeightsScoring('fill in the gaps - dropdown');
38
+ });
39
+
40
+ describe('Question Preview: AutoScored - Partial different weights with alternate answer with \'Match from all responses - \"false\"', () => {
41
+ abortEarlySetup();
42
+ before(() => {
43
+ cy.log('Navigate to Fill in the gaps - dropdown question type, fill the necessary details and points, uncheck round down score checkbox and switch to preview tab');
44
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
45
+ cy.barsPreLoaderWait();
46
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
47
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
48
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
49
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
50
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
51
+ fillInTheGapsDropdownPage.partialDifferentWeightsCheckbox()
52
+ .click();
53
+ fillInTheGapsDropdownPage.steps.addPartialDifferentWeightsPoints([5, 7]);
54
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
55
+ fillInTheGapsDropdownPage.alternateAnswerButton()
56
+ .click();
57
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Alternate correct answer 1');
58
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Alternate correct answer 2');
59
+ cy.log('Setting alternate answer points less than correct answer points')
60
+ fillInTheGapsDropdownPage.steps.addPartialDifferentWeightsPoints([3, 6]);
61
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
62
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
63
+ fillInTheGapsDropdownPage.allowStudentsToCheckAnswerCheckbox()
64
+ .click();
65
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
66
+ });
67
+
68
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialDifferentWeightsWithAlternateAnswerAndMatchFromAllResponsesFalse('fill in the gaps - dropdown');
69
+ });
70
+
71
+ describe('Question Preview: AutoScored - Partial different weights with alternate answer with \'Match from all responses - \"true\"', () => {
72
+ abortEarlySetup();
73
+ before(() => {
74
+ cy.log('Navigate to Fill in the gaps - dropdown question type, fill the necessary details and points, uncheck round down score checkbox and switch to preview tab');
75
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
76
+ cy.barsPreLoaderWait();
77
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
78
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
79
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
80
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
81
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
82
+ fillInTheGapsDropdownPage.partialDifferentWeightsCheckbox()
83
+ .click();
84
+ fillInTheGapsDropdownPage.steps.addPartialDifferentWeightsPoints([5, 7]);
85
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
86
+ fillInTheGapsDropdownPage.alternateAnswerButton()
87
+ .click();
88
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Alternate correct answer 1');
89
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Alternate correct answer 2');
90
+ fillInTheGapsDropdownPage.steps.addPartialDifferentWeightsPoints([3, 6]);
91
+ fillInTheGapsDropdownPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
92
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
93
+ fillInTheGapsDropdownPage.allowStudentsToCheckAnswerCheckbox()
94
+ .click();
95
+ fillInTheGapsDropdownPage.matchFromAllResponsesCheckbox()
96
+ .click();
97
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
98
+ });
99
+
100
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialDifferentWeightsWithAlternateAnswerAndMatchFromAllResponsesTrue('fill in the gaps - dropdown');
101
+ });
102
+
103
+ describe('Partial Different Weights: Round down score', () => {
104
+ abortEarlySetup();
105
+ before(() => {
106
+ cy.log('Add question instructions and options, set correct answers, select partial - different weights scoring and add points (in decimals) for correct answer options');
107
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown')
108
+ cy.barsPreLoaderWait();
109
+ fillInTheGapsDropdownPage.steps.addResponseTokenInQuestionField();
110
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(0, optionsForResponse1);
111
+ fillInTheGapsDropdownPage.steps.addInputToResponseOptionFields(1, optionsForResponse2);
112
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'Correct answer 1');
113
+ fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, 'Correct answer 2');
114
+ fillInTheGapsDropdownPage.partialDifferentWeightsCheckbox()
115
+ .click();
116
+ fillInTheGapsDropdownPage.steps.addPartialDifferentWeightsPoints([1.36, 2.89]);
117
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
118
+ });
119
+
120
+ fillInTheGapsScoring.tests.verifyAutoScoredPartialDifferentWeightsRoundDownScore('fill in the gaps - dropdown');
121
+ });
122
+ });