itemengine-cypress-automation 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.build_wna +4 -0
- package/README.md +3 -0
- package/currents.config.js +6 -0
- package/cypress/API/createItem/toggleItemMode.js +15 -0
- package/cypress/config-files/ildev.json +15 -0
- package/cypress/config-files/ilprod.json +15 -0
- package/cypress/config-files/ilqa.json +15 -0
- package/cypress/config-files/ilstage.json +15 -0
- package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
- package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
- package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
- package/cypress/fixtures/accessibilityConfig.json +6 -0
- package/cypress/fixtures/constants.js +18 -0
- package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
- package/cypress/fixtures/specialAndMathCharacters.js +118 -0
- package/cypress/fixtures/theme/ilc.json +150 -0
- package/cypress/fixtures/theme/ngie.json +26 -0
- package/cypress/fixtures/uploads/20mbFile.png +0 -0
- package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
- package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
- package/cypress/fixtures/uploads/image.png +0 -0
- package/cypress/fixtures/uploads/sample.aac +0 -0
- package/cypress/fixtures/uploads/sample.accdb +0 -0
- package/cypress/fixtures/uploads/sample.csv +100 -0
- package/cypress/fixtures/uploads/sample.doc +0 -0
- package/cypress/fixtures/uploads/sample.gif +0 -0
- package/cypress/fixtures/uploads/sample.heic +0 -0
- package/cypress/fixtures/uploads/sample.heif +0 -0
- package/cypress/fixtures/uploads/sample.hevc +0 -0
- package/cypress/fixtures/uploads/sample.jpeg +0 -0
- package/cypress/fixtures/uploads/sample.jpg +0 -0
- package/cypress/fixtures/uploads/sample.mp3 +0 -0
- package/cypress/fixtures/uploads/sample.mp4 +0 -0
- package/cypress/fixtures/uploads/sample.pdf +0 -0
- package/cypress/fixtures/uploads/sample.ppt +0 -0
- package/cypress/fixtures/uploads/sample.pub +0 -0
- package/cypress/fixtures/uploads/sample.rtf +7902 -0
- package/cypress/fixtures/uploads/sample.svg +10 -0
- package/cypress/fixtures/uploads/sample.txt +1 -0
- package/cypress/fixtures/uploads/sample.wav +0 -0
- package/cypress/fixtures/uploads/sample.xlsx +0 -0
- package/cypress/fixtures/uploads/sample.xps +0 -0
- package/cypress/fixtures/uploads/sample.zip +0 -0
- package/cypress/fixtures/uploads/sample1.jpg +0 -0
- package/cypress/fixtures/uploads/sample1.mp3 +0 -0
- package/cypress/fixtures/uploads/sample1.zip +0 -0
- package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
- package/cypress/fixtures/uploads/sample2.jpg +0 -0
- package/cypress/fixtures/uploads/sample2.mp3 +0 -0
- package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
- package/cypress/pages/audioPlayerPage.js +628 -0
- package/cypress/pages/audioResponsePage.js +264 -0
- package/cypress/pages/components/additionalSettingsPanel.js +174 -0
- package/cypress/pages/components/answerNumerationComponent.js +109 -0
- package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
- package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
- package/cypress/pages/components/autoScoredScoringSection.js +195 -0
- package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
- package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
- package/cypress/pages/components/ckEditorToolbar.js +64 -0
- package/cypress/pages/components/colorPopupComponent.js +293 -0
- package/cypress/pages/components/commonComponents.js +93 -0
- package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
- package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
- package/cypress/pages/components/createQuestionBasePage.js +225 -0
- package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
- package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
- package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
- package/cypress/pages/components/draggableOptionsContainer.js +857 -0
- package/cypress/pages/components/editCategoryFlyout.js +40 -0
- package/cypress/pages/components/equationEditorFlyout.js +158 -0
- package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
- package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
- package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
- package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
- package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
- package/cypress/pages/components/gridCommonComponents.js +951 -0
- package/cypress/pages/components/index.js +38 -0
- package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
- package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
- package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
- package/cypress/pages/components/mcqOptionsComponent.js +263 -0
- package/cypress/pages/components/mcqPreviewComponents.js +78 -0
- package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
- package/cypress/pages/components/mcqScoringComponent.js +120 -0
- package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
- package/cypress/pages/components/optionsWrapperComponent.js +221 -0
- package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
- package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
- package/cypress/pages/components/questionInstructionsComponent.js +112 -0
- package/cypress/pages/components/scoringSectionBase.js +308 -0
- package/cypress/pages/components/setPointsPopupBase.js +79 -0
- package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
- package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
- package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
- package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
- package/cypress/pages/createItemPage.js +28 -0
- package/cypress/pages/dialogBoxBase.js +111 -0
- package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
- package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
- package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
- package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
- package/cypress/pages/essayResponseBasicPage.js +57 -0
- package/cypress/pages/essayResponseMathPage.js +47 -0
- package/cypress/pages/essayResponsePage.js +385 -0
- package/cypress/pages/feedbackScalePage.js +698 -0
- package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
- package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
- package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
- package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
- package/cypress/pages/fillInTheGapsScoring.js +5974 -0
- package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
- package/cypress/pages/fillInTheGapsTextPage.js +225 -0
- package/cypress/pages/highlightImagePage.js +1316 -0
- package/cypress/pages/highlightPage.js +870 -0
- package/cypress/pages/index.js +30 -0
- package/cypress/pages/listMatchingPage.js +1330 -0
- package/cypress/pages/listMatchingScoring.js +2635 -0
- package/cypress/pages/listOrderingPage.js +751 -0
- package/cypress/pages/listSortingPage.js +1201 -0
- package/cypress/pages/multipleSelectionGridPage.js +359 -0
- package/cypress/pages/multipleSelectionPage.js +88 -0
- package/cypress/pages/passagePage.js +426 -0
- package/cypress/pages/readingRulerPage.js +302 -0
- package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
- package/cypress/pages/shortTextResponsePage.js +197 -0
- package/cypress/pages/singleSelectionGridPage.js +370 -0
- package/cypress/pages/singleSelectionPage.js +65 -0
- package/cypress/pages/uploadResponsePage.js +110 -0
- package/cypress/pages/videoResponsePage.js +375 -0
- package/cypress/support/commands.js +140 -0
- package/cypress/support/e2e.js +14 -0
- package/cypress/support/helpers/abortEarly.js +19 -0
- package/cypress/support/helpers/accessibility.js +34 -0
- package/cypress/support/helpers/cypressUtilities.js +64 -0
- package/cypress/support/helpers/localStorage.js +13 -0
- package/cypress/support/helpers/selectText.js +77 -0
- package/cypress/support/helpers/utilities.js +126 -0
- package/cypress.config.js +76 -0
- package/il.yaml +14 -0
- package/language +1 -0
- package/package.json +26 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, commonComponents, createQuestionBasePage, fillInTheGapsCommonComponents, optionsWrapperComponent, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase, fillInTheGapsDropdownCommonComponent } from "./components"
|
2
|
+
import { answerNumerationComponent } from "./components/answerNumerationComponent";
|
3
|
+
import { fillInTheGapsTextPage } from "./fillInTheGapsTextPage"
|
4
|
+
const css = Cypress.env('css');
|
5
|
+
|
6
|
+
const selectors = {
|
7
|
+
...fillInTheGapsTextPage,
|
8
|
+
...questionInstructionsComponent,
|
9
|
+
...fillInTheGapsCommonComponents,
|
10
|
+
...optionsWrapperComponent,
|
11
|
+
...fillInTheGapsDropdownCommonComponent,
|
12
|
+
previewTabResponseDropdown: () => cy.get('.cloze-with-text-response-preview-wrapper [class*="icon-chevron"]'),
|
13
|
+
previewTabResponseDropdownWrapper: () => cy.get('.cloze-with-text-preview .response-dropdown-wrapper .dropdown-form-control '),
|
14
|
+
responseDropdownAnswerNumeration: () => cy.get('.response-input-adornment')
|
15
|
+
}
|
16
|
+
|
17
|
+
const steps = {
|
18
|
+
...createQuestionBasePage.steps,
|
19
|
+
...questionInstructionsComponent.steps,
|
20
|
+
...additionalSettingsPanel.steps,
|
21
|
+
...scoringSectionBase.steps,
|
22
|
+
...fillInTheGapsCommonComponents.steps,
|
23
|
+
...autoScoredPreviewBase.steps,
|
24
|
+
...autoScoredAdditionalSettings.steps,
|
25
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
26
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
27
|
+
...answerNumerationComponent.steps,
|
28
|
+
...fillInTheGapsDropdownCommonComponent.steps,
|
29
|
+
selectResponseFromPreviewTabResponseDropdown: (dropdownIndex, dropdownOption) => {
|
30
|
+
fillInTheGapsDropdownPage.previewTabResponseDropdown()
|
31
|
+
.eq(dropdownIndex)
|
32
|
+
.click({ position: "right"}); //Added this as normal clicking fails when placeholder is provided
|
33
|
+
fillInTheGapsDropdownCommonComponent.steps.selectOptionFromResponseDropdown(dropdownOption);
|
34
|
+
fillInTheGapsDropdownPage.previewTabResponseDropdown()
|
35
|
+
.eq(dropdownIndex)
|
36
|
+
.verifyInnerText(dropdownOption);
|
37
|
+
},
|
38
|
+
|
39
|
+
verifyAnswerNumerationShouldNotExistInPreviewTabResponseDropdown: () => {
|
40
|
+
cy.log('Checking the answer numeration should not be displayed in the response dropdown')
|
41
|
+
fillInTheGapsDropdownPage.previewTabResponseDropdownWrapper()
|
42
|
+
.each(($el) => {
|
43
|
+
cy.wrap($el)
|
44
|
+
.within(() => {
|
45
|
+
fillInTheGapsDropdownPage.responseDropdownAnswerNumeration()
|
46
|
+
.should('not.exist');
|
47
|
+
});
|
48
|
+
});
|
49
|
+
},
|
50
|
+
}
|
51
|
+
|
52
|
+
const tests = {
|
53
|
+
...createQuestionBasePage.tests,
|
54
|
+
...questionInstructionsComponent.tests,
|
55
|
+
...fillInTheGapsCommonComponents.tests,
|
56
|
+
...scoringSectionBase.tests,
|
57
|
+
...autoScoredScoringSection.tests,
|
58
|
+
...additionalSettingsPanel.tests,
|
59
|
+
...autoScoredAdditionalSettings.tests,
|
60
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
61
|
+
...commonComponents.tests,
|
62
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
63
|
+
...autoScoredScoringSectionMultipleResponsesType.tests,
|
64
|
+
...answerNumerationComponent.tests,
|
65
|
+
verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
|
66
|
+
it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
|
67
|
+
fillInTheGapsCommonComponents.setCorrectAnswerResponseFieldLabel()
|
68
|
+
.verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.regular);
|
69
|
+
fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
|
70
|
+
.should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
|
71
|
+
.and('have.css', 'background-color', css.color.defaultBackground);
|
72
|
+
});
|
73
|
+
|
74
|
+
it('By default 1 dropdown along with label \'Response 1\' should be displayed in the \'Set correct answer\' section', () => {
|
75
|
+
fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
|
76
|
+
.should('have.length', 1);
|
77
|
+
fillInTheGapsDropdownPage.setCorrectAnswerResponseFieldLabel()
|
78
|
+
.verifyInnerText('Response 1');
|
79
|
+
});
|
80
|
+
|
81
|
+
it('When the user selects any option from the dropdown, that option should get set as correct answer option and it should get displayed on the dropdown', () => {
|
82
|
+
fillInTheGapsDropdownPage.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, 'changing');
|
83
|
+
});
|
84
|
+
|
85
|
+
it('CSS of \'correct\' answer that appears on the dropdown', { tags: 'css' }, () => {
|
86
|
+
fillInTheGapsDropdownPage.responseDropdownSetCorrectAnswerSection()
|
87
|
+
.find('span')
|
88
|
+
.verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
|
89
|
+
});
|
90
|
+
|
91
|
+
autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
export const fillInTheGapsDropdownPage = {
|
96
|
+
...selectors,
|
97
|
+
steps,
|
98
|
+
tests
|
99
|
+
}
|
@@ -0,0 +1,232 @@
|
|
1
|
+
import utilities from "../support/helpers/utilities";
|
2
|
+
import { createQuestionBasePage, figOverImageCommonComponent, fillInTheGapsDropdownCommonComponent, commonComponents, uploadImageSectionComponent, optionsWrapperComponent, ckEditorToolbar, equationEditorFlyout, autoScoredSetCorrectAnswerSection, scoringSectionBase, autoScoredScoringSectionMultipleResponsesType, autoScoredScoringSection, previewScoringAndShowCorrectAnswerComponent, additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, questionInstructionsComponent } from "./components"
|
3
|
+
|
4
|
+
const selectors = {
|
5
|
+
...figOverImageCommonComponent,
|
6
|
+
...fillInTheGapsDropdownCommonComponent,
|
7
|
+
...questionInstructionsComponent,
|
8
|
+
responseDropdownPreviewTab: () => cy.get('[class*="ImageWithDropdownPreviewstyles__DraggableInput"] [class*="icon-chevron"]'),
|
9
|
+
responseDropdownWrapperPreviewTab: () => cy.get('[class*="ImageWithDropdownPreviewstyles__IconDiv"]'),
|
10
|
+
//Correct answer container
|
11
|
+
previewTabCorrectAnswerContainer: () => cy.get('.cloze-with-text-correct-answer-wrapper'),
|
12
|
+
previewTabCorrectAnswerLabel: () => cy.get('.cloze-with-text-correct-answer-label'),
|
13
|
+
previewTabCorrectAnswerResponseWrapper: () => cy.get('[class*="ImageWithDropdownPreviewstyles__ItemWrapperDiv"]'),
|
14
|
+
correctAnswerContainerResponseNumeration: () => cy.get('[class*="ImageWithDropdownPreviewstyles__NumerationWrapper"]'),
|
15
|
+
}
|
16
|
+
|
17
|
+
const steps = {
|
18
|
+
...createQuestionBasePage.steps,
|
19
|
+
...fillInTheGapsDropdownCommonComponent.steps,
|
20
|
+
...figOverImageCommonComponent.steps,
|
21
|
+
...commonComponents.steps,
|
22
|
+
...uploadImageSectionComponent.steps,
|
23
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
24
|
+
...optionsWrapperComponent.steps,
|
25
|
+
...ckEditorToolbar.steps,
|
26
|
+
...equationEditorFlyout.steps,
|
27
|
+
...previewScoringAndShowCorrectAnswerComponent.steps,
|
28
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
29
|
+
...additionalSettingsPanel.steps,
|
30
|
+
...autoScoredAdditionalSettings.steps,
|
31
|
+
...autoScoredPreviewBase.steps,
|
32
|
+
...autoScoredScoringSection.steps,
|
33
|
+
...questionInstructionsComponent.steps,
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @param {number} responseContainerIndex Index of response container
|
37
|
+
* @param {number[]} responseContainerPositionCoordinates Position coordinates of the response container
|
38
|
+
* @description Verify position coordinates of response dropdown in preview tab
|
39
|
+
*/
|
40
|
+
verifyResponseDropdownPositionCoordinatesInPreviewTab: (responseContainerIndex, responseContainerPositionCoordinates) => {
|
41
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab()
|
42
|
+
.eq(responseContainerIndex)
|
43
|
+
.parents('.react-draggable')
|
44
|
+
.invoke('attr', 'style')
|
45
|
+
.then(($styleAttribute) => {
|
46
|
+
let transformValue = $styleAttribute;
|
47
|
+
let position = transformValue.split('(')[1]
|
48
|
+
.split(')')[0]
|
49
|
+
.split(',');
|
50
|
+
let horizontalCoordinate = position[0].trim();
|
51
|
+
let verticalCoordinate = position[1].trim();
|
52
|
+
expect(horizontalCoordinate).to.be.eq(responseContainerPositionCoordinates[0]);
|
53
|
+
expect(verticalCoordinate).to.be.eq(responseContainerPositionCoordinates[1]);
|
54
|
+
});
|
55
|
+
},
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @param {number} responseDropdownIndex Index of dropdown in preview tab
|
59
|
+
* @description Verify dropdown is displayed in preview tab
|
60
|
+
*/
|
61
|
+
verifyResponseDropdownIsDisplayedInPreviewTab: (responseDropdownIndex) => {
|
62
|
+
utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab().eq(responseDropdownIndex), 'visible');
|
63
|
+
},
|
64
|
+
|
65
|
+
verifyDisabledResponseDropdownInPreviewTab: () => {
|
66
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab()
|
67
|
+
.should('have.class', 'Mui-disabled');
|
68
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab()
|
69
|
+
.click();
|
70
|
+
fillInTheGapsOverImageDropdownPage.dropdownList()
|
71
|
+
.should('not.exist');
|
72
|
+
},
|
73
|
+
|
74
|
+
/**
|
75
|
+
* @param {number} responseDropdownIndex Index of response dropdown in preview tab
|
76
|
+
* @description Expand response dropdown in preview tab
|
77
|
+
*/
|
78
|
+
expandResponseDropdownInPreviewTab: (responseDropdownIndex) => {
|
79
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab()
|
80
|
+
.eq(responseDropdownIndex)
|
81
|
+
.click();
|
82
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab()
|
83
|
+
.eq(responseDropdownIndex)
|
84
|
+
.should('have.attr', 'aria-expanded', 'true');
|
85
|
+
},
|
86
|
+
|
87
|
+
/**
|
88
|
+
* @param {number} dropdownIndex Index of the dropdown
|
89
|
+
* @param {string} dropdownOption Option to be selected in the dropdown
|
90
|
+
* @description Select option from dropdown in preview tab
|
91
|
+
*/
|
92
|
+
selectResponseFromDropdownInPreviewTab: (dropdownIndex, dropdownOption) => {
|
93
|
+
fillInTheGapsOverImageDropdownPage.steps.expandResponseDropdownInPreviewTab(dropdownIndex);
|
94
|
+
fillInTheGapsDropdownCommonComponent.steps.selectOptionFromResponseDropdown(dropdownOption);
|
95
|
+
fillInTheGapsOverImageDropdownPage.steps.verifyTextDisplayedInDropdownInPreviewTab(dropdownIndex, dropdownOption);
|
96
|
+
},
|
97
|
+
|
98
|
+
verifyTextDisplayedInDropdownInPreviewTab: (dropdownIndex, dropdownText) => {
|
99
|
+
utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab().eq(dropdownIndex), dropdownText);
|
100
|
+
},
|
101
|
+
|
102
|
+
/**
|
103
|
+
* @param {string[]} correctAnswerArray array of correct answer response
|
104
|
+
* @param {string[]} optionNumerationArray numeration of the correct answer response
|
105
|
+
* @description verify the correct answer responses in the correct answer container
|
106
|
+
*/
|
107
|
+
verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount: (correctAnswerArray, optionNumerationArray) => {
|
108
|
+
fillInTheGapsOverImageDropdownPage.previewTabCorrectAnswerContainer()
|
109
|
+
.should('be.visible')
|
110
|
+
.within(() => {
|
111
|
+
correctAnswerArray.forEach((responseFieldText, count) => {
|
112
|
+
utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.previewTabCorrectAnswerResponseWrapper().eq(count), responseFieldText);
|
113
|
+
});
|
114
|
+
optionNumerationArray.forEach((optionNumeration, count) => {
|
115
|
+
utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.correctAnswerContainerResponseNumeration().eq(count), optionNumeration);
|
116
|
+
});
|
117
|
+
});
|
118
|
+
fillInTheGapsOverImageDropdownPage.previewTabCorrectAnswerResponseWrapper()
|
119
|
+
.should('have.length', optionNumerationArray.length);
|
120
|
+
},
|
121
|
+
|
122
|
+
verifyPreviewTabCorrectAnswerContainerNotExist: () => {
|
123
|
+
utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.previewTabCorrectAnswerContainer(), 'notExist');
|
124
|
+
},
|
125
|
+
|
126
|
+
/**
|
127
|
+
* @param {number} index - The index of the incorrect option to verify.
|
128
|
+
* @description Verify that the incorrect option at the specified index has a cross-mark icon and is visible.
|
129
|
+
*/
|
130
|
+
verifyIncorrectOptionCrossmarkIcon: (index) => {
|
131
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownWrapperPreviewTab()
|
132
|
+
.eq(index)
|
133
|
+
.find('.tick-icon-wrapper')
|
134
|
+
.should('have.class', 'icon-incorrect')
|
135
|
+
.and('be.visible');
|
136
|
+
},
|
137
|
+
|
138
|
+
/**
|
139
|
+
* @param {number} index - The index of the correct option to verify.
|
140
|
+
* @description Verify that the correct option at the specified index has a check-mark icon and is visible.
|
141
|
+
*/
|
142
|
+
verifyCorrectOptionCheckmarkIcon: (index) => {
|
143
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownWrapperPreviewTab()
|
144
|
+
.eq(index)
|
145
|
+
.find('.tick-icon-wrapper')
|
146
|
+
.should('have.class', 'icon-correct')
|
147
|
+
.and('be.visible');
|
148
|
+
},
|
149
|
+
|
150
|
+
/**
|
151
|
+
* @param {number} index - The index of the option to verify.
|
152
|
+
* @description Verify that the option at the specified index does not have a check-mark or cross-mark.
|
153
|
+
*/
|
154
|
+
verifyCheckmarkOrCrossmarkNotVisible: (index) => {
|
155
|
+
utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.responseDropdownWrapperPreviewTab().eq(index).find('.tick-icon-wrapper'), 'notExist');
|
156
|
+
},
|
157
|
+
|
158
|
+
/**
|
159
|
+
* @param {index} responseDropdownIndex Index of response dropdown
|
160
|
+
* @param {string} ariaLabel Aria-label of response dropdown
|
161
|
+
* @description Verify aria-label of response dropdown in preview tab
|
162
|
+
*/
|
163
|
+
verifyDropdownAriaLabelAttributeInPreviewTab: (responseDropdownIndex, ariaLabel) => {
|
164
|
+
fillInTheGapsOverImageDropdownPage.responseDropdownPreviewTab()
|
165
|
+
.eq(responseDropdownIndex)
|
166
|
+
.should('have.attr', 'aria-label', ariaLabel);
|
167
|
+
},
|
168
|
+
|
169
|
+
/**
|
170
|
+
* @param {number} rowIndex Index of the row in which response container is placed
|
171
|
+
* @param {number} responseContainerIndex Index of the response container
|
172
|
+
* @description Verify the vertical position of the response container as per the row
|
173
|
+
*/
|
174
|
+
verifyResponseContainerVerticalPosition: (rowIndex, responseContainerIndex) => {
|
175
|
+
let verticalCoordinate = '';
|
176
|
+
switch (rowIndex) {
|
177
|
+
case 1:
|
178
|
+
verticalCoordinate = '10px';
|
179
|
+
break;
|
180
|
+
case 2:
|
181
|
+
verticalCoordinate = '59px';
|
182
|
+
break;
|
183
|
+
default:
|
184
|
+
throw new Error('Invalid row index');
|
185
|
+
}
|
186
|
+
figOverImageCommonComponent.responseContainer()
|
187
|
+
.eq(responseContainerIndex)
|
188
|
+
.invoke('attr', 'style')
|
189
|
+
.then(($styleAttribute) => {
|
190
|
+
let transformValue = $styleAttribute;
|
191
|
+
let coordinatesArray = transformValue.split('(')[1]
|
192
|
+
.split(')')[0]
|
193
|
+
.split(',');
|
194
|
+
let responseVerticalCoordinate = coordinatesArray[1].trim();
|
195
|
+
expect(responseVerticalCoordinate).to.be.eq(verticalCoordinate);
|
196
|
+
});
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
const tests = {
|
201
|
+
...figOverImageCommonComponent.tests,
|
202
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
203
|
+
...fillInTheGapsDropdownCommonComponent.tests,
|
204
|
+
...scoringSectionBase.tests,
|
205
|
+
...autoScoredScoringSectionMultipleResponsesType.tests,
|
206
|
+
...autoScoredScoringSection.tests,
|
207
|
+
...commonComponents.tests,
|
208
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
209
|
+
...questionInstructionsComponent.tests,
|
210
|
+
|
211
|
+
/**
|
212
|
+
* @param {number} minimumScoreIfAttemptedPoints - The minimum score awarded if attempted.
|
213
|
+
* @param {number} allocatedPoints - The expected allocated points for the question.
|
214
|
+
* @description Verify minimum score awarded if attempted functionality when an incorrect answer is attempted.
|
215
|
+
*/
|
216
|
+
verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (minimumScoreIfAttemptedPoints, allocatedPoints) => {
|
217
|
+
it('When user has provided minimum score awarded (if attempted) points, then in preview tab on selecting incorrect answer, minimum score should be provided for the question', () => {
|
218
|
+
cy.log('Switch to edit tab and set minimum score if attempted points')
|
219
|
+
fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
|
220
|
+
fillInTheGapsOverImageDropdownPage.steps.allotMinimumScoreAwardedIfAttempted(minimumScoreIfAttemptedPoints);
|
221
|
+
fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
|
222
|
+
fillInTheGapsOverImageDropdownPage.steps.selectResponseFromDropdownInPreviewTab(0, 'Branch');
|
223
|
+
fillInTheGapsOverImageDropdownPage.steps.verifyPreviewTabScoreText(minimumScoreIfAttemptedPoints, allocatedPoints);
|
224
|
+
});
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
export const fillInTheGapsOverImageDropdownPage = {
|
229
|
+
...selectors,
|
230
|
+
steps,
|
231
|
+
tests,
|
232
|
+
}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import { questionInstructionsComponent, scoringSectionBase, createQuestionBasePage, additionalSettingsPanel, commonComponents, autoScoredPreviewBase, autoScoredAdditionalSettings, autoScoredSetCorrectAnswerSection, autoScoredScoringSectionMultipleResponsesType, autoScoredScoringSection, specialCharactersFlyoutComponent, specialAndCustomSpecialCharactersComponent, previewScoringAndShowCorrectAnswerComponent, figOverImageCommonComponent, uploadImageSectionComponent, fillInTheGapsTextCommonComponent, studentResponseAndLayoutComponent } from "./components";
|
2
|
+
import { answerNumerationComponent } from "./components/answerNumerationComponent";
|
3
|
+
|
4
|
+
const selectors = {
|
5
|
+
...scoringSectionBase,
|
6
|
+
...createQuestionBasePage,
|
7
|
+
...additionalSettingsPanel,
|
8
|
+
...questionInstructionsComponent,
|
9
|
+
...commonComponents,
|
10
|
+
...autoScoredSetCorrectAnswerSection,
|
11
|
+
...autoScoredAdditionalSettings,
|
12
|
+
...autoScoredPreviewBase,
|
13
|
+
...autoScoredScoringSectionMultipleResponsesType,
|
14
|
+
...specialCharactersFlyoutComponent,
|
15
|
+
...specialAndCustomSpecialCharactersComponent,
|
16
|
+
...previewScoringAndShowCorrectAnswerComponent,
|
17
|
+
...answerNumerationComponent,
|
18
|
+
...figOverImageCommonComponent,
|
19
|
+
...uploadImageSectionComponent,
|
20
|
+
...fillInTheGapsTextCommonComponent,
|
21
|
+
}
|
22
|
+
|
23
|
+
const steps = {
|
24
|
+
...createQuestionBasePage.steps,
|
25
|
+
...questionInstructionsComponent.steps,
|
26
|
+
...scoringSectionBase.steps,
|
27
|
+
...additionalSettingsPanel.steps,
|
28
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
29
|
+
...autoScoredPreviewBase.steps,
|
30
|
+
...autoScoredSetCorrectAnswerSection.steps,
|
31
|
+
...autoScoredScoringSection.steps,
|
32
|
+
...autoScoredAdditionalSettings.steps,
|
33
|
+
...specialCharactersFlyoutComponent.steps,
|
34
|
+
...autoScoredScoringSectionMultipleResponsesType.steps,
|
35
|
+
...answerNumerationComponent.steps,
|
36
|
+
...figOverImageCommonComponent.steps,
|
37
|
+
...uploadImageSectionComponent.steps,
|
38
|
+
...fillInTheGapsTextCommonComponent.steps,
|
39
|
+
...previewScoringAndShowCorrectAnswerComponent.steps,
|
40
|
+
...commonComponents.steps,
|
41
|
+
...specialAndCustomSpecialCharactersComponent.steps,
|
42
|
+
/**
|
43
|
+
* @param {number} responseContainerIndex Index of response container
|
44
|
+
* @param {number[]} responseContainerPositionCoordinates Position coordinates of the response container
|
45
|
+
* @description Verify position coordinates of response dropdown in preview tab
|
46
|
+
*/
|
47
|
+
verifyResponseFieldPositionCoordinatesInPreviewTab: (responseContainerIndex, responseContainerPositionCoordinates) => {
|
48
|
+
fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
|
49
|
+
.eq(responseContainerIndex)
|
50
|
+
.parents('.react-draggable')
|
51
|
+
.invoke('attr', 'style')
|
52
|
+
.then(($styleAttribute) => {
|
53
|
+
let transformValue = $styleAttribute;
|
54
|
+
let position = transformValue.split('(')[1]
|
55
|
+
.split(')')[0]
|
56
|
+
.split(',');
|
57
|
+
let horizontalCoordinate = position[0].trim();
|
58
|
+
let verticalCoordinate = position[1].trim();
|
59
|
+
expect(horizontalCoordinate).to.be.eq(responseContainerPositionCoordinates[0]);
|
60
|
+
expect(verticalCoordinate).to.be.eq(responseContainerPositionCoordinates[1]);
|
61
|
+
});
|
62
|
+
},
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @param {number} rowIndex Index of the row in which response container is placed
|
66
|
+
* @param {number} responseContainerIndex Index of the response container
|
67
|
+
* @description Verify the vertical position of the response container as per the row
|
68
|
+
*/
|
69
|
+
verifyResponseContainerVerticalPosition: (rowIndex, responseContainerIndex) => {
|
70
|
+
let verticalCoordinate = '';
|
71
|
+
switch (rowIndex) {
|
72
|
+
case 1:
|
73
|
+
verticalCoordinate = '33px';
|
74
|
+
break;
|
75
|
+
case 2:
|
76
|
+
verticalCoordinate = '94px';
|
77
|
+
break;
|
78
|
+
default:
|
79
|
+
throw new Error('Invalid row index');
|
80
|
+
}
|
81
|
+
figOverImageCommonComponent.responseContainer()
|
82
|
+
.eq(responseContainerIndex)
|
83
|
+
.invoke('attr', 'style')
|
84
|
+
.then(($styleAttribute) => {
|
85
|
+
let transformValue = $styleAttribute;
|
86
|
+
let coordinatesArray = transformValue.split('(')[1]
|
87
|
+
.split(')')[0]
|
88
|
+
.split(',');
|
89
|
+
let responseVerticalCoordinate = coordinatesArray[1].trim();
|
90
|
+
expect(responseVerticalCoordinate).to.be.eq(verticalCoordinate);
|
91
|
+
});
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
const tests = {
|
96
|
+
...commonComponents.tests,
|
97
|
+
...createQuestionBasePage.tests,
|
98
|
+
...questionInstructionsComponent.tests,
|
99
|
+
...additionalSettingsPanel.tests,
|
100
|
+
...scoringSectionBase.tests,
|
101
|
+
...autoScoredSetCorrectAnswerSection.tests,
|
102
|
+
...autoScoredAdditionalSettings.tests,
|
103
|
+
...autoScoredScoringSection.tests,
|
104
|
+
...specialCharactersFlyoutComponent.tests,
|
105
|
+
...specialAndCustomSpecialCharactersComponent.tests,
|
106
|
+
...previewScoringAndShowCorrectAnswerComponent.tests,
|
107
|
+
...autoScoredScoringSectionMultipleResponsesType.tests,
|
108
|
+
...answerNumerationComponent.tests,
|
109
|
+
...uploadImageSectionComponent.tests,
|
110
|
+
...fillInTheGapsTextCommonComponent.tests,
|
111
|
+
...figOverImageCommonComponent.tests,
|
112
|
+
/**
|
113
|
+
* Verify minimum score awarded if attempted functionality when an incorrect answer is attempted.
|
114
|
+
* @param {number} minimumScoreIfAttemptedPoints - The minimum score awarded if attempted.
|
115
|
+
* @param {number} allocatedPoints - The expected allocated points for the question.
|
116
|
+
*/
|
117
|
+
verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (minimumScoreIfAttemptedPoints, allocatedPoints) => {
|
118
|
+
it('When user has provided minimum score awarded (if attempted) points, then in preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
|
119
|
+
cy.log('Switch to edit tab and set minimum score if attempted points')
|
120
|
+
fillInTheGapsOverImageTextPage.steps.switchToEditTab();
|
121
|
+
fillInTheGapsOverImageTextPage.steps.allotMinimumScoreAwardedIfAttempted(minimumScoreIfAttemptedPoints);
|
122
|
+
fillInTheGapsOverImageTextPage.steps.switchToPreviewTab();
|
123
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, 'Branch');
|
124
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, 'Stem');
|
125
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabScoreText(`${minimumScoreIfAttemptedPoints}`, `${allocatedPoints}`);
|
126
|
+
});
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
export const fillInTheGapsOverImageTextPage = {
|
132
|
+
...selectors,
|
133
|
+
steps,
|
134
|
+
tests
|
135
|
+
}
|