itemengine-cypress-automation 1.0.83 → 1.0.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/cypress/e2e/ILC/DesmosGraphing/previewTabContent.smoke.js +3 -3
  2. package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/allOrNothingBasicForGroupedOptionsLayout.js +30 -0
  3. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +1 -1
  4. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/FillInTheGapsOverImageDragAndDropScoring/allOrNothingGroupedScoring.js +158 -0
  5. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/FillInTheGapsOverImageDragAndDropScoring/partialDifferentWeightsBasic.js +3 -3
  6. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/additionalSettings.js +43 -0
  7. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/backgroundImageAndCanvasProperties.js +510 -0
  8. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/clickAndDrop.js +678 -0
  9. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/headerSection.js +82 -0
  10. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/minimumScoringPenaltyPointsAndRoundingDropdown.js +198 -0
  11. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/studentViewSettingsForGroupedLayout.js +263 -0
  12. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/responseLevelAlternateAnswersBasicScoring.js +80 -0
  13. package/cypress/e2e/ILC/Protractor/protractorEditTabBasicsSection.js +2 -0
  14. package/cypress/e2e/ILC/Ruler/rulerEditTabBasicsSection.js +2 -0
  15. package/cypress/e2e/ILC/ToolSettings/toolSettingsPreviewContents.smoke.js +177 -171
  16. package/cypress/pages/components/backgroundImageUploadComponent.js +19 -3
  17. package/cypress/pages/components/draggableOptionContainer.js +13 -0
  18. package/cypress/pages/components/essayResponseCommonComponents.js +175 -25
  19. package/cypress/pages/components/figOverImageCanvasComponent.js +257 -0
  20. package/cypress/pages/components/imageActionsComponent.js +30 -0
  21. package/cypress/pages/components/index.js +5 -5
  22. package/cypress/pages/components/measuringToolComponent.js +0 -54
  23. package/cypress/pages/components/opacityComponent.js +64 -0
  24. package/cypress/pages/dragAndDropIntoCategoriesPage.js +16 -1
  25. package/cypress/pages/essayResponsePage.js +5 -7
  26. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +152 -11
  27. package/cypress/pages/protractorPage.js +3 -1
  28. package/cypress/pages/rulerPage.js +5 -24
  29. package/cypress/pages/selectQuestionResourceToolPage.js +1 -1
  30. package/{deploy.yaml → deploy/e2e/deploy.yaml} +1 -1
  31. package/deploy/smoke/deploy.yaml +29 -0
  32. package/deploy/smoke/run.sh +6 -0
  33. package/package.json +1 -1
  34. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +0 -0
  35. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +0 -0
  36. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +0 -0
  37. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/allOrNothingPenaltyScoring.js +0 -0
  38. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/manuallyAndNonScoredScoring.js +0 -0
  39. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perCorrectOptionAlternativePointsGreaterThanCorrectPoints.js +0 -0
  40. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perCorrectOptionBasic.js +0 -0
  41. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perCorrectOptionCorrectPointsEqualToAlternativePoints.js +0 -0
  42. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perCorrectOptionCorrectPointsGreaterThanAlternativePoints.js +0 -0
  43. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perCorrectOptionMinimumAndPenaltyScoring.js +0 -0
  44. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perDropzoneAlternativePointsGreaterThanCorrectPoints.js +0 -0
  45. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perDropzoneBasic.js +0 -0
  46. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perDropzoneCorrectPointsEqualToAlternativePoints.js +0 -0
  47. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perDropzoneCorrectPointsGreaterThanAlternativePoints.js +0 -0
  48. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/Scoring/perDropzoneMinimumAndPenaltyScoring.js +0 -0
  49. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/allOrNothingBasicForAllViews.smoke.js +0 -0
  50. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/checkAnswerFunctionalityForAllViews.smoke.js +0 -0
  51. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/clickAndDrop.js +0 -0
  52. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/draggableOptions.js +0 -0
  53. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/editTabBasicSection.js +0 -0
  54. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/editTabScoring.js +0 -0
  55. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/headerSection.js +0 -0
  56. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/manuallyAndNonScoredScoringEditTab.js +0 -0
  57. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/minimumScoringPenaltyPointsAndRoundingDropdown.js +0 -0
  58. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/previewContentsForAllViews.smoke.js +0 -0
  59. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/specifyCorrectAnswerSection.js +0 -0
  60. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/studentViewSettings.js +0 -0
  61. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/studentViewSettingsForGroupedLayout.js +0 -0
  62. /package/cypress/e2e/ILC/{DragAndDropIntoCategories → DragAndDropIntoCategoriesNew}/switchingCasesBetweenOptionsLayout.js +0 -0
  63. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +0 -0
  64. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +0 -0
  65. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +0 -0
  66. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/allOrNothingPenaltyScoring.js +0 -0
  67. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/manuallyAndNonScored.js +0 -0
  68. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +0 -0
  69. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialDifferentWeightsBasic.js +0 -0
  70. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +0 -0
  71. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +0 -0
  72. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialEqualWeightsBasic.js +0 -0
  73. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +0 -0
  74. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +0 -0
  75. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +0 -0
  76. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/allOrNothingForAllViews.smoke.js +0 -0
  77. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/checkAnswerFunctionalityForAllViews.smoke.js +0 -0
  78. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/editTabScoringSection.js +0 -0
  79. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/previewContentsForAllViews.smoke.js +0 -0
  80. /package/cypress/e2e/ILC/{FillInTheGapsOverImageText → FillInTheGapsOverImageTextNew}/specifyCorrectAnswerSection.js +0 -0
  81. /package/{run.sh → deploy/e2e/run.sh} +0 -0
@@ -0,0 +1,82 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { dialogBoxBase, fillInTheGapsOverImageDragAndDropPage } from "../../../pages";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const options = ['Flower', 'Leaves'];
5
+
6
+ describe('Create item page - Fill in the gaps over image - drag and drop: Header section and Saving question', () => {
7
+ before(() => {
8
+ cy.loginAs('admin');
9
+ });
10
+
11
+ describe('Header section contents', () => {
12
+ abortEarlySetup();
13
+ before(() => {
14
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
15
+ });
16
+
17
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyCreateQuestionPageQuestionTypeHeader('Fill in the gaps over image with drag and drop');
18
+ });
19
+
20
+ describe('Tabs section', () => {
21
+ abortEarlySetup();
22
+ before(() => {
23
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
24
+ });
25
+
26
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyTabsSection();
27
+ });
28
+
29
+ describe('Cancel button', () => {
30
+ abortEarlySetup();
31
+ before(() => {
32
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
33
+ });
34
+
35
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyCancelButton('fill in the gaps over image - drag and drop')
36
+ });
37
+
38
+ describe('Save Question button', () => {
39
+ abortEarlySetup();
40
+ before(() => {
41
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
42
+ cy.barsPreLoaderWait();
43
+ });
44
+
45
+ describe('Validation error messages', () => {
46
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
47
+
48
+ it('Validation error messages should be displayed below required input fields', () => {
49
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyQuestionInstructionsErrorMessage();
50
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsOverImageDragAndDropPage.errorMessage(), 1), 'Error: Image is required.');
51
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsOverImageDragAndDropPage.errorMessage(), 2), 'Error: Please insert a dropzone.');
52
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPointsFieldErrorMessage();
53
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyOptionsInputFieldErrorMessage(0);
54
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyCorrectAnswerErrorIconIsVisible();
55
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyCorrectAnswerErrorMessage();
56
+ });
57
+
58
+ it('Validation error messages should disappear when required input fields are filled', () => {
59
+ fillInTheGapsOverImageDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options in the correct dropzone');
60
+ fillInTheGapsOverImageDragAndDropPage.steps.addInputToOptionsInputField(options);
61
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
62
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
63
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
64
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
65
+ fillInTheGapsOverImageDragAndDropPage.steps.enterAndVerifyImageAlternativeTextInInputField('Image alternative text');
66
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Flower': 0, 'Leaves': 1 });
67
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPoints(10);
68
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyErrorMessageIsNotDisplayed();
69
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyCorrectAnswerErrorIconNotExists();
70
+ });
71
+
72
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyCreateItemWrapperContentsA11y();
73
+ });
74
+
75
+ describe('Saving a question', () => {
76
+ it('Clicking on Save Question button the question should get saved and a snackbar with text \'Saved successfully!\' should be displayed', () => {
77
+ fillInTheGapsOverImageDragAndDropPage.steps.saveAQuestionAndVerifySnackbar();
78
+ });
79
+ fillInTheGapsOverImageDragAndDropPage.tests.verifySavedSuccessfullySnackbarCSSAndA11y();
80
+ });
81
+ });
82
+ });
@@ -0,0 +1,198 @@
1
+ import { fillInTheGapsOverImageDragAndDropPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+ const penaltyScoringTypeArray = ['No penalty points', 'Penalty points for the entire question', 'Penalty points for each incorrect dropzone'];
6
+
7
+ describe('Create item page - Fill in the gaps over image with drag and drop: Minimum scoring, Penalty scoring, Rounding - Edit tab', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Scoring section: Minimum scoring - Edit tab', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
16
+ cy.barsPreLoaderWait();
17
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPoints(10);
18
+ });
19
+
20
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyMinimumScoringDropdown();
21
+
22
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyMinimumPointsLabelAndInputField();
23
+
24
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyMinimumPointsFieldErrorState();
25
+ });
26
+
27
+ describe('Scoring section: Penalty scoring - Edit tab', () => {
28
+ abortEarlySetup();
29
+ before(() => {
30
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
31
+ cy.barsPreLoaderWait();
32
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
33
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
34
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
35
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
36
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPoints(10);
37
+ fillInTheGapsOverImageDragAndDropPage.steps.selectAutoScoredScoringSubtype('Partial equal weights');
38
+ });
39
+
40
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyPenaltyScoringDropdown(penaltyScoringTypeArray);
41
+
42
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyPenaltyPointsLabelAndInputField();
43
+
44
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyPenaltyPointsErrorState();
45
+
46
+ it('When the user selects \'Penalty points for each incorrect dropzone\' from the penalty scoring dropdown, \'Automatically set penalty for each incorrect dropzone to total points / no. of incorrect dropzones\' label and checkbox should be displayed, by default the checkbox should be unchecked. Two radio buttons with labels - \'Specify total penalty points\' and \'Specify points for each incorrect option\' should be displayed. By default, \'Specify total penalty points\' radio button should be checked', () => {
47
+ fillInTheGapsOverImageDragAndDropPage.steps.expandPenaltyScoringDropdown();
48
+ fillInTheGapsOverImageDragAndDropPage.steps.selectOptionFromPenaltyScoringDropdown('Penalty points for each incorrect dropzone');
49
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.automaticallySetPenaltyPointsCheckboxLabel(), 'Automatically set penalty for each incorrect dropzone to total points / no. of incorrect dropzones');
50
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.specifyTotalPenaltyPointsRadioButtonLabel(), 'Specify total penalty points');
51
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.specifyPointsForEachIncorrectOptionRadioButtonLabel(), 'Specify points for each incorrect dropzone');
52
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyAutomaticallySetPenaltyPointsCheckboxUncheckedState();
53
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyTotalPenaltyPointsRadioButtonCheckedState();
54
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyPointsForEachIncorrectOptionRadioButtonUncheckedState();
55
+ });
56
+
57
+ it('When \'Specify total penalty points\' is selected, a penalty points detail section with \'Total penalty points\' label and empty input field, \'Penalty points for each incorrect dropzone: -\' label should be displayed', () => {
58
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionInputFieldLabel(), 'Total penalty points');
59
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyTotalPenaltyPointsValue('');
60
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 'Penalty points for each incorrect dropzone: -');
61
+ });
62
+
63
+ it('When the user allots total penalty points, then \'points for each incorrect option\' should get updated as per the count of incorrect options available', () => {
64
+ fillInTheGapsOverImageDragAndDropPage.steps.allotTotalPenaltyPoints(5);
65
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPenaltyPointsForEachIncorrectDropzone(2.5);
66
+ });
67
+
68
+ it('When the user adds a new option, then \'points for each incorrect option\' should get updated accordingly', () => {
69
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(40);
70
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPenaltyPointsForEachIncorrectDropzone(1.67);
71
+ });
72
+
73
+ it('When the user deletes an option, then \'points for each incorrect option\' should get updated accordingly', () => {
74
+ fillInTheGapsOverImageDragAndDropPage.steps.removeDropzone(0);
75
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPenaltyPointsForEachIncorrectDropzone(2.5);
76
+ });
77
+
78
+ it('CSS of the penalty points section - Total penalty points', { tags: 'css' }, () => {
79
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.automaticallySetPenaltyPointsCheckboxLabel(), {
80
+ 'color': css.color.labelText,
81
+ 'font-size': css.fontSize.default,
82
+ 'font-weight': css.fontWeight.regular
83
+ });
84
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.automaticallySetPenaltyPointsCheckbox().parent().find('svg'), {
85
+ 'fill': css.color.uncheckedCheckbox
86
+ });
87
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.specifyTotalPenaltyPointsRadioButton().parent().find('svg'), {
88
+ 'fill': css.color.activeButtons
89
+ });
90
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.specifyPointsForEachIncorrectOptionRadioButton().parent().find('svg path'), {
91
+ 'fill': css.color.uncheckedCheckbox
92
+ });
93
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.specifyTotalPenaltyPointsRadioButtonLabel(), {
94
+ 'color': css.color.labelText,
95
+ 'font-size': css.fontSize.default,
96
+ 'font-weight': css.fontWeight.regular
97
+ });
98
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.specifyPointsForEachIncorrectOptionRadioButtonLabel(), {
99
+ 'color': css.color.labelText,
100
+ 'font-size': css.fontSize.default,
101
+ 'font-weight': css.fontWeight.regular
102
+ });
103
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionInputFieldLabel(), {
104
+ 'color': css.color.labelText,
105
+ 'font-size': css.fontSize.default,
106
+ 'font-weight': css.fontWeight.regular
107
+ });
108
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.totalPenaltyPointsInputField(), {
109
+ 'color': css.color.text,
110
+ 'font-size': css.fontSize.default,
111
+ 'font-weight': css.fontWeight.regular
112
+ });
113
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), {
114
+ 'color': css.color.labelText,
115
+ 'font-size': css.fontSize.default,
116
+ 'font-weight': css.fontWeight.regular
117
+ });
118
+ });
119
+
120
+ it('Accessibility of the penalty points section - Total penalty points', { tags: 'a11y' }, () => {
121
+ cy.checkAccessibility(fillInTheGapsOverImageDragAndDropPage.automaticallySetPenaltyPointsCheckboxLabel().parents('.penalty-score-for-each-incorrect-wrapper'));
122
+ });
123
+
124
+ it('When the user selects \'Specify points for each incorrect answer\', a penalty points detail section with \'Penalty points for each incorrect dropzone:\' label and empty input field, \'Total penalty points: -\' label should be displayed', () => {
125
+ cy.log('Pre-step: Clearing the total penalty points input field')
126
+ fillInTheGapsOverImageDragAndDropPage.steps.clearTotalPenaltyPointsInputField();
127
+ fillInTheGapsOverImageDragAndDropPage.steps.selectPenaltyPointsForEachIncorrectOptionType('Specify points for each incorrect option');
128
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionInputFieldLabel(), 'Penalty points for each incorrect dropzone');
129
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPenaltyPointsForEachIncorrectDropzoneValue('');
130
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 'Total penalty points: -');
131
+ });
132
+
133
+ it('When the user allots Penalty points for each incorrect dropzone, then \'Total penalty points\' should get updated as per the count of incorrect options available', () => {
134
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPenaltyPointsForEachIncorrectDropzone(1);
135
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyTotalPenaltyPoints(2);
136
+ });
137
+
138
+ it('When the user adds a new option, then \'Total penalty points\' should get updated accordingly', () => {
139
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea();
140
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyTotalPenaltyPoints(3);
141
+ });
142
+
143
+ it('When the user deletes an option, then \'points for each incorrect option\' should get updated accordingly', () => {
144
+ fillInTheGapsOverImageDragAndDropPage.steps.removeDropzone(0);
145
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyTotalPenaltyPoints(2);
146
+ });
147
+
148
+ it('CSS of the penalty points section - Penalty points for each incorrect dropzone', { tags: 'css' }, () => {
149
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionInputFieldLabel(), {
150
+ 'color': css.color.labelText,
151
+ 'font-size': css.fontSize.default,
152
+ 'font-weight': css.fontWeight.regular
153
+ });
154
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.penaltyPointsForEachIncorrectOptionInputField(), {
155
+ 'color': css.color.text,
156
+ 'font-size': css.fontSize.default,
157
+ 'font-weight': css.fontWeight.regular
158
+ });
159
+ utilities.verifyCSS(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), {
160
+ 'color': css.color.labelText,
161
+ 'font-size': css.fontSize.default,
162
+ 'font-weight': css.fontWeight.regular
163
+ });
164
+ });
165
+
166
+ it('Accessibility of the penalty points section - Penalty points for each incorrect dropzone', { tags: 'a11y' }, () => {
167
+ cy.checkAccessibility(fillInTheGapsOverImageDragAndDropPage.automaticallySetPenaltyPointsCheckboxLabel().parents('.penalty-score-for-each-incorrect-wrapper'));
168
+ });
169
+
170
+ it('When the user switches to the \'Specify total penalty points\' option, the total penalty points input field should be filled as per the total penalty points in \'Specify points for each incorrect option\'', () => {
171
+ fillInTheGapsOverImageDragAndDropPage.steps.selectPenaltyPointsForEachIncorrectOptionType('Specify total penalty points');
172
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyTotalPenaltyPointsValue(2);
173
+ utilities.verifyInnerText(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 'Penalty points for each incorrect dropzone: 1');
174
+ });
175
+
176
+ it('When the user checks the \'Automatically set penalty for each incorrect dropzone to total points / no. of incorrect dropzones\' checkbox, both radio buttons should get disabled, \'Specify points for each incorrect option\' should get checked, in the penalty points details section, \'Penalty points for each incorrect dropzone: #\' and \'Total penalty points: #\' should be displayed as per the alloted points and available incorrect options', () => {
177
+ fillInTheGapsOverImageDragAndDropPage.steps.checkAutomaticallySetPenaltyPointsCheckbox();
178
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyTotalPenaltyPointsDisabledState();
179
+ fillInTheGapsOverImageDragAndDropPage.steps.verifySpecifyPointsForEachIncorrectOptionRadioButtonSelectedAndDisabledState();
180
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 0), 'Penalty points for each incorrect dropzone: 5');
181
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsOverImageDragAndDropPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 1), 'Total penalty points: 10');
182
+ });
183
+ });
184
+
185
+ describe('Scoring section: Rounding - Edit tab', () => {
186
+ abortEarlySetup();
187
+ before(() => {
188
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
189
+ cy.barsPreLoaderWait();
190
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPoints(10);
191
+ fillInTheGapsOverImageDragAndDropPage.steps.selectAutoScoredScoringSubtype('Partial equal weights')
192
+ });
193
+
194
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyRoundingDropdown();
195
+
196
+ fillInTheGapsOverImageDragAndDropPage.tests.verifyRoundNegativeScoreToZeroLabelAndCheckbox();
197
+ });
198
+ });
@@ -0,0 +1,263 @@
1
+ import { fillInTheGapsOverImageDragAndDropPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ let flowers = [['Flower', 'Petals', 'Seed', 'Pollen'],
4
+ ['Leaflet', 'Leaves', 'Leaf', 'Green'],
5
+ ['Stem', 'Branch', 'Trunk', 'Tree'],
6
+ ['Rose', 'Lily', 'Orchid', 'Tulip']
7
+ ];
8
+ let groupTitles = ['Group A', 'Group B', 'Group C', 'Group D'];
9
+
10
+ describe('Create Item page - Fill in the gaps over image - drag and drop: Student view settings for grouped options layout', () => {
11
+ before(() => {
12
+ cy.loginAs('admin');
13
+ });
14
+
15
+ describe('Randomize options - Functionality : Edit tab', () => {
16
+ abortEarlySetup();
17
+ before(() => {
18
+ cy.log('Navigate to fill in the gaps over image - drag and drop question type');
19
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
20
+ cy.barsPreLoaderWait();
21
+ fillInTheGapsOverImageDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options into correct dropzone');
22
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
23
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
24
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
25
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(40);
26
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
27
+ fillInTheGapsOverImageDragAndDropPage.steps.setGroupedOptions();
28
+ });
29
+
30
+ it('When the \'Randomize options\' functionality is disabled, then the group container as well as the options inside the group should be displayed in the order in which the user has set them in the \'Options for drag & drop\' section', () => {
31
+ flowers.forEach((options, index) => {
32
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(index, options);
33
+ });
34
+ });
35
+
36
+ it('When the user enables the \'Randomize options\' functionality, then the group container as well as the options inside the group should be in the order in which the user has set them in the \'Options for drag & drop\' section', () => {
37
+ fillInTheGapsOverImageDragAndDropPage.steps.checkRandomizeOptionsCheckbox();
38
+ flowers.forEach((options, index) => {
39
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(index, options);
40
+ });
41
+ });
42
+ });
43
+
44
+ describe('Randomize options - Functionality : Preview tab', () => {
45
+ let optionsArray = [];
46
+ let groupTitleArray = [];
47
+ abortEarlySetup();
48
+ before(() => {
49
+ cy.log('Navigate to fill in the gaps over image - drag and drop question type');
50
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
51
+ cy.barsPreLoaderWait();
52
+ fillInTheGapsOverImageDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options into correct dropzone');
53
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
54
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
55
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
56
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(40);
57
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
58
+ fillInTheGapsOverImageDragAndDropPage.steps.setGroupedOptions();
59
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
60
+ });
61
+
62
+ it('When the \'Randomize options\' functionality is disabled, then the group container as well as the options inside the group should be displayed in the order in which the user has set them in the \'Options for drag & drop\' section', () => {
63
+ groupTitles.forEach((groupTitle, groupIndex) => {
64
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedOptionsTitlePreviewTab(groupIndex, groupTitle);
65
+ })
66
+ flowers.forEach((options, index) => {
67
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(index, options);
68
+ });
69
+ });
70
+
71
+ it('When the user enables the \'Randomize options\' functionality, then the group container as well as the options inside the group should be displayed in a random order', () => {
72
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToEditTab();
73
+ fillInTheGapsOverImageDragAndDropPage.steps.checkRandomizeOptionsCheckbox();
74
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
75
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizationOfGroupsInPreviewTab(groupTitles);
76
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[0], flowers[0]);
77
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[1], flowers[1]);
78
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[2], flowers[2]);
79
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[3], flowers[3]);
80
+ optionsArray = fillInTheGapsOverImageDragAndDropPage.steps.getOptionsArray();
81
+ groupTitleArray = fillInTheGapsOverImageDragAndDropPage.steps.getGroupTitleArray();
82
+ });
83
+
84
+ it('When the user switches to \'Edit tab\' and does not modify any question properties, then the order of group containers as well as the options inside the group should not change', () => {
85
+ fillInTheGapsOverImageDragAndDropPage.steps.resetQuestionPreview();
86
+ groupTitleArray.forEach((groupTitle, groupIndex) => {
87
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedOptionsTitlePreviewTab(groupIndex, groupTitle);
88
+ });
89
+ flowers.forEach((options, index) => {
90
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(index, options);
91
+ });
92
+ });
93
+
94
+ it('When the user switches to \'Edit tab\' and modifies any of question properties, then the order of group containers as well as the options inside the group should change', () => {
95
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToEditTab();
96
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPoints(5);
97
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
98
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizationOfGroupsInPreviewTab(groupTitles);
99
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[0], flowers[0]);
100
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[1], flowers[1]);
101
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[2], flowers[2]);
102
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyRandomizeOptionOrderInGroup(groupTitles[3], flowers[3]);
103
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyOptionsAreRerandomized(optionsArray);
104
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupsAreRerandomized(groupTitleArray);
105
+ });
106
+
107
+ it('When the user disables the \'Randomize options\' functionality, then the order of group containers as well as the options inside the group should be displayed in the order in which the user has set them in the \'Options for drag & drop\' section', () => {
108
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToEditTab();
109
+ fillInTheGapsOverImageDragAndDropPage.steps.uncheckRandomizeOptionsCheckbox();
110
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
111
+ flowers.forEach((options, index) => {
112
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(index, options);
113
+ });
114
+ });
115
+ });
116
+
117
+ describe('Allow multiple instances of same draggable option - Functionality : Edit tab', () => {
118
+ abortEarlySetup();
119
+ before(() => {
120
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
121
+ cy.barsPreLoaderWait();
122
+ fillInTheGapsOverImageDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options into correct dropzone');
123
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
124
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
125
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
126
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(40);
127
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
128
+ fillInTheGapsOverImageDragAndDropPage.steps.expandDraggableOptionsLayoutDropdown();
129
+ fillInTheGapsOverImageDragAndDropPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
130
+ fillInTheGapsOverImageDragAndDropPage.steps.addGroupTitle(groupTitles[0]);
131
+ fillInTheGapsOverImageDragAndDropPage.steps.addMultipleOptionFields(2);
132
+ fillInTheGapsOverImageDragAndDropPage.steps.addInputToOptionsInputField(flowers[0]);
133
+ fillInTheGapsOverImageDragAndDropPage.steps.addGroupWithTitleAndOptionsInDraggableOptionsSection(groupTitles[1], flowers[1]);
134
+ });
135
+
136
+ it('When the \'Allow multiple instances of same draggable option\' functionality is disabled, then on setting correct answer in the dropzone, the draggable options should get removed from the respective group of the options container', () => {
137
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Flower': 0 });
138
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, ['Petals', 'Seed', 'Pollen']);
139
+ });
140
+
141
+ it('When the user enables the \'Allow multiple instances of same draggable option\' functionality, then on setting correct answer in the dropzone, the draggable options should persist in respective group of the options container', () => {
142
+ fillInTheGapsOverImageDragAndDropPage.steps.checkAllowMultipleInstancesOfSameDraggableOptionCheckbox();
143
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Leaves': 1 });
144
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInSpecifyCorrectAnswerSection(1, ['Leaves']);
145
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, flowers[0]);
146
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(1, flowers[1]);
147
+ });
148
+
149
+ it('The user should be able to use the same draggable option for multiple dropzones', () => {
150
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Leaves': 2 });
151
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInSpecifyCorrectAnswerSection(1, ['Leaves']);
152
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInSpecifyCorrectAnswerSection(2, ['Leaves']);
153
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, flowers[0]);
154
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(1, flowers[1]);
155
+ });
156
+
157
+ it('When the user removes the draggable option and moves it into the options container, only one option should be displayed in the respective group', () => {
158
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Leaves');
159
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Leaves');
160
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(1, flowers[1]);
161
+ });
162
+
163
+ it('When the user disables the \'Allow multiple instances of same draggable option\' functionality, the duplicate answer set as correct answer should get removed from the dropzone and the draggable option should also not exist in the options container of the \'Set correct answer\' section', () => {
164
+ cy.log('Pre step: Setting identical options as correct responses')
165
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Leaves': 1 });
166
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Leaves': 2 });
167
+ fillInTheGapsOverImageDragAndDropPage.steps.uncheckAllowMultipleInstancesOfSameDraggableOptionCheckbox();
168
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInSpecifyCorrectAnswerSection(1, ['Leaves']);
169
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDropzoneTextSpecifyCorrectAnswerSection(2, '');
170
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(1, ['Leaflet', 'Leaf', 'Green']);
171
+ });
172
+ });
173
+
174
+ describe('Allow multiple instances of same draggable option - Functionality: Preview tab', () => {
175
+ abortEarlySetup();
176
+ before(() => {
177
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
178
+ cy.barsPreLoaderWait();
179
+ fillInTheGapsOverImageDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options into correct dropzone');
180
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
181
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
182
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
183
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(40);
184
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
185
+ fillInTheGapsOverImageDragAndDropPage.steps.expandDraggableOptionsLayoutDropdown();
186
+ fillInTheGapsOverImageDragAndDropPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
187
+ fillInTheGapsOverImageDragAndDropPage.steps.addGroupTitle(groupTitles[0]);
188
+ fillInTheGapsOverImageDragAndDropPage.steps.addMultipleOptionFields(2);
189
+ fillInTheGapsOverImageDragAndDropPage.steps.addInputToOptionsInputField(flowers[0]);
190
+ fillInTheGapsOverImageDragAndDropPage.steps.addGroupWithTitleAndOptionsInDraggableOptionsSection(groupTitles[1], flowers[1]);
191
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
192
+ });
193
+
194
+ it('When the \'Allow multiple instances of same draggable option\' functionality is disabled, then on attempting the question, the draggable options should get removed from the options container', () => {
195
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Flower': 0 });
196
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(0, ['Petals', 'Seed', 'Pollen']);
197
+ });
198
+
199
+ it('When the \'Allow multiple instances of same draggable option\' functionality is enabled, then on attempting the question, the draggable options should persist in the options container', () => {
200
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToEditTab();
201
+ fillInTheGapsOverImageDragAndDropPage.steps.checkAllowMultipleInstancesOfSameDraggableOptionCheckbox();
202
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
203
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Flower': 0 });
204
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionPreviewTab(0, 'Flower');
205
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(0, flowers[0]);
206
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(1, flowers[1]);
207
+ });
208
+
209
+ it('The user should be able to use the same draggable option for multiple dropzones', () => {
210
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Leaves': 1 });
211
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Leaves': 2 });
212
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(1, ['Leaves']);
213
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(2, ['Leaves']);
214
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(0, flowers[0]);
215
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(1, flowers[1]);
216
+ });
217
+
218
+ it('When the user removes the draggable option and moves it into the options container, only one option should be displayed in the respective group', () => {
219
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInOptionsContainerInPreviewTab('Leaves');
220
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInOptionsContainerInPreviewTab('Leaves');
221
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(1, flowers[1]);
222
+ });
223
+
224
+ it('When the user disables the \'Allow multiple instances of same draggable option\' functionality, then on attempting the question, the draggable options should get removed from the options container', () => {
225
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToEditTab();
226
+ fillInTheGapsOverImageDragAndDropPage.steps.uncheckAllowMultipleInstancesOfSameDraggableOptionCheckbox();
227
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
228
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Leaves': 1 });
229
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(1, ['Leaves']);
230
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyGroupedContainerContentsInPreviewTab(1, ['Leaflet', 'Leaf', 'Green']);
231
+ });
232
+ });
233
+
234
+ describe('Allow multiple instances of same draggable option - Scoring', () => {
235
+ before(() => {
236
+ fillInTheGapsOverImageDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps over image with drag and drop');
237
+ cy.barsPreLoaderWait();
238
+ fillInTheGapsOverImageDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options into correct dropzone');
239
+ fillInTheGapsOverImageDragAndDropPage.steps.uploadFile('highlightImage.jpg');
240
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyImageIsUploaded();
241
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(10);
242
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(40);
243
+ fillInTheGapsOverImageDragAndDropPage.steps.insertResponseArea(80);
244
+ fillInTheGapsOverImageDragAndDropPage.steps.expandDraggableOptionsLayoutDropdown();
245
+ fillInTheGapsOverImageDragAndDropPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
246
+ fillInTheGapsOverImageDragAndDropPage.steps.addGroupTitle(groupTitles[0]);
247
+ fillInTheGapsOverImageDragAndDropPage.steps.addMultipleOptionFields(2);
248
+ fillInTheGapsOverImageDragAndDropPage.steps.addInputToOptionsInputField(flowers[0]);
249
+ fillInTheGapsOverImageDragAndDropPage.steps.checkAllowMultipleInstancesOfSameDraggableOptionCheckbox();
250
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Flower': 0 });
251
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Flower': 1 });
252
+ fillInTheGapsOverImageDragAndDropPage.steps.allotPoints(5);
253
+ fillInTheGapsOverImageDragAndDropPage.steps.switchToPreviewTab();
254
+ });
255
+
256
+ it('When the user has set same answer options in the \'Set correct answer\' section, then the user should be awarded full points on attempting the question with reused options', () => {
257
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Flower': 0 });
258
+ fillInTheGapsOverImageDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Flower': 1 });
259
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPreviewScore(5, 5);
260
+ fillInTheGapsOverImageDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
261
+ });
262
+ });
263
+ });
@@ -0,0 +1,80 @@
1
+ import { fillInTheGapsOverImageTextPage } from "../../../../pages";
2
+ import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+
4
+ describe('Create item page - Fill in the gaps over image with text: Response level alternate answer basic scoring', () => {
5
+ before(() => {
6
+ cy.loginAs('admin');
7
+ });
8
+
9
+ describe('Auto scored - All or nothing with response level alternate answers', () => {
10
+ abortEarlySetup();
11
+ before(() => {
12
+ fillInTheGapsOverImageTextPage.steps.navigateToCreateQuestion('fill in the gaps over image - text');
13
+ cy.barsPreLoaderWait();
14
+ fillInTheGapsOverImageTextPage.steps.uploadFile('highlightImage.jpg');
15
+ fillInTheGapsOverImageTextPage.steps.verifyImageIsUploaded();
16
+ fillInTheGapsOverImageTextPage.steps.insertResponseArea(10);
17
+ fillInTheGapsOverImageTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }]);
18
+ fillInTheGapsOverImageTextPage.steps.addAlternateAnswerInResponseAccordion(0);
19
+ fillInTheGapsOverImageTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 1, responseText: 'Fruit' }]);
20
+ fillInTheGapsOverImageTextPage.steps.allotPoints(15);
21
+ fillInTheGapsOverImageTextPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
22
+ fillInTheGapsOverImageTextPage.steps.switchToPreviewTab();
23
+ });
24
+
25
+ it('When the user selects \'Grading\' view without attempting the question, response area numeration should be displayed, correct answers section should be displayed with the first correct answer set in the response accordion', () => {
26
+ fillInTheGapsOverImageTextPage.steps.verifyPreviewScore(0, 15);
27
+ fillInTheGapsOverImageTextPage.steps.switchToGradingView();
28
+ fillInTheGapsOverImageTextPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
29
+ fillInTheGapsOverImageTextPage.steps.verifyResponseAreaNumeration();
30
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower']);
31
+ });
32
+
33
+ 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 besides the incorrect response, a status message with text \'Your answer is incorrect\' and correct answer section with the first correct answer set in the response accordion should be displayed', () => {
34
+ fillInTheGapsOverImageTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Roots' }]);
35
+ fillInTheGapsOverImageTextPage.steps.verifyPreviewScore(0, 15);
36
+ fillInTheGapsOverImageTextPage.steps.switchToGradingView();
37
+ fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionIcon(0);
38
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
39
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower']);
40
+ fillInTheGapsOverImageTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
41
+ cy.log('When the user attempts the question incorrectly and clicks on \'Check answer\' button, incorrect icon should be displayed besides the incorrect response, a status message with text \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
42
+ fillInTheGapsOverImageTextPage.steps.checkAnswer();
43
+ fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionIcon(0);
44
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
45
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerSectionNotExists();
46
+ });
47
+
48
+ it('When user attempts the question correctly with the first correct answer set for the response accordion, then the user should be awarded full points and on switching to \'Grading\' view, then correct icon should be displayed beside the correct response, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
49
+ fillInTheGapsOverImageTextPage.steps.resetQuestionPreview();
50
+ fillInTheGapsOverImageTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }]);
51
+ fillInTheGapsOverImageTextPage.steps.verifyPreviewScore(15, 15);
52
+ fillInTheGapsOverImageTextPage.steps.switchToGradingView();
53
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionIcon(0);
54
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
55
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerSectionNotExists();
56
+ fillInTheGapsOverImageTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
57
+ cy.log('When user attempts the question correctly with the first correct answer set for the response accordion and clicks on \'Check answer\' button, then correct icon should be displayed beside the correct response, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
58
+ fillInTheGapsOverImageTextPage.steps.checkAnswer();
59
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionIcon(0);
60
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
61
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerSectionNotExists();
62
+ });
63
+
64
+ it('When the user attempts the question with the alternate answer set for the response accordion, then the user should be awarded full points and on switching to \'Grading\' view, then correct icon should be displayed beside the correct response, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
65
+ fillInTheGapsOverImageTextPage.steps.resetQuestionPreview();
66
+ fillInTheGapsOverImageTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Fruit' }]);
67
+ fillInTheGapsOverImageTextPage.steps.verifyPreviewScore(15, 15);
68
+ fillInTheGapsOverImageTextPage.steps.switchToGradingView();
69
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionIcon(0);
70
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
71
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerSectionNotExists();
72
+ fillInTheGapsOverImageTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
73
+ cy.log('When the user attempts the question with the alternate answer set for the response accordion and clicks on \'Check answer\' button, then correct icon should be displayed beside the correct response, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
74
+ fillInTheGapsOverImageTextPage.steps.checkAnswer();
75
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionIcon(0);
76
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
77
+ fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerSectionNotExists();
78
+ });
79
+ });
80
+ });