itemengine-cypress-automation 1.0.120 → 1.0.122-updateILCRepo28Feb-2c3e0e3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/AudioResponseNew/editTabBasicSection.js +13 -1
- package/cypress/e2e/ILC/AudioResponseNew/gradingViewAndCorrectAnswerViewContents.smoke.js +2 -0
- package/cypress/e2e/ILC/AudioResponseNew/previewContentsForAllViews.smoke.js +1 -0
- package/cypress/e2e/ILC/AudioResponseNew/standardRecorderStyle.smoke.js +2 -0
- package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +1 -1
- package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +2 -2
- package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/studentViewSettings.js +1 -4
- package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingForAllViews.smoke.js +273 -0
- package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/checkAnswerFunctionalityForAllViews.smoke.js +116 -0
- package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/previewContentsForAllViews.smoke.js +136 -0
- package/cypress/e2e/ILC/FillInTheGapsDropdownNew/allOrNothingForAllView.smoke.js +224 -0
- package/cypress/e2e/ILC/FillInTheGapsDropdownNew/checkAnswerFunctionalityForAllViews.smoke.js +120 -0
- package/cypress/e2e/ILC/FillInTheGapsDropdownNew/previewContentsForAllViews.smoke.js +158 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/backgroundImageAndCanvasProperties.js +1 -1
- package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/studentViewSettings.js +1 -4
- package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/dropdownAndDropdownMenuSection.js +246 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/dropdownOptionsSection.js +332 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/editTabBasicSection.js +409 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/headerSection.js +80 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/studentViewSettings.js +213 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/HeaderSection.js +1 -1
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsBasic.js +2 -2
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialEqualWeightsBasic.js +1 -1
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/allOrNothingForAllViews.smoke.js +2 -2
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/backgroundImageAndCanvasProperties.js +68 -68
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/editTabScoringSection.js +6 -6
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/previewContentsForAllViews.smoke.js +1 -1
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/setLimitSection.js +3 -289
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specialCharactersSection.js +1 -1
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specifyCorrectAnswerSection.js +2 -2
- package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +2 -23
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +191 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +190 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +284 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingPenaltyScoring.js +52 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/manuallyAndNonScored.js +113 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +217 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsBasic.js +234 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +217 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +217 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsBasic.js +136 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +197 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +169 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +197 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/allOrNothingForAllViews.smoke.js +219 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/checkAnswerFunctionalityForAllViews.smoke.js +115 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabBasicSection.js +142 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/previewContentsForAllViews.smoke.js +152 -0
- package/cypress/e2e/ILC/FillInTheGapsTextNew/setLimitSection.js +39 -0
- package/cypress/e2e/ILC/MultipleSelection/studentViewSettings.js +2 -12
- package/cypress/e2e/ILC/ShortTextResponseNew/conditionalCheckboxes.js +497 -0
- package/cypress/e2e/ILC/ShortTextResponseNew/editTabBasicSections.js +503 -0
- package/cypress/e2e/ILC/ShortTextResponseNew/responseAnswersAndAcceptedStudentInput.js +233 -0
- package/cypress/e2e/ILC/ShortTextResponseNew/specialCharactersSection.js +291 -0
- package/cypress/e2e/ILC/ShortTextResponseNew/studentViewSettings.js +332 -0
- package/cypress/e2e/ILC/SingleSelection/studentViewSettings.js +2 -12
- package/cypress/e2e/ILC/TextEntryMath/editTabBasicSection.js +9 -8
- package/cypress/e2e/ILC/TextEntryMath/editTabScoringSection.js +4 -4
- package/cypress/e2e/ILC/TextEntryMath/minimumScoringPenaltyPointsAndRoundingDropdown.js +8 -2
- package/cypress/e2e/ILC/TextEntryMath/specifyCorrectAnswerSection.js +5 -2
- package/cypress/e2e/ILC/TextEntryMathWithImage/allOrNothingScoringForAllViews.smoke.js +334 -0
- package/cypress/e2e/ILC/TextEntryMathWithImage/backgroundImageAndCanvasProperties.js +419 -0
- package/cypress/e2e/ILC/TextEntryMathWithImage/checkAnswerFunctionalityForAllViews.smoke.js +166 -0
- package/cypress/e2e/ILC/TextEntryMathWithImage/previewTabContentsForAllViews.smoke.js +166 -0
- package/cypress/e2e/ILC/UploadResponse/editTabScoringSection.js +51 -0
- package/cypress/e2e/ILC/UploadResponse/gradingViewAndCorrectAnswerViewContents.smoke.js +99 -0
- package/cypress/e2e/ILC/UploadResponse/manuallyAndNonScoredScoring.js +71 -0
- package/cypress/e2e/ILC/UploadResponse/previewContentsForAllViews.smoke.js +155 -0
- package/cypress/e2e/ILC/UploadResponse/uploadResponseHeaderSection.js +66 -0
- package/cypress/fixtures/theme/ilc.json +3 -1
- package/cypress/pages/audioResponsePage.js +2 -1
- package/cypress/pages/components/additionalSettingsPanel.js +27 -0
- package/cypress/pages/components/autoScoredPreviewBase.js +1 -1
- package/cypress/pages/components/autoScoredScoringSection.js +1 -1
- package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +1 -1
- package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +1 -1
- package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +2 -2
- package/cypress/pages/components/autoScoredStudentViewSettings.js +8 -1
- package/cypress/pages/components/backgroundImageUploadComponent.js +5 -5
- package/cypress/pages/components/createQuestionBasePage.js +8 -2
- package/cypress/pages/components/essayResponseCommonComponents.js +6 -0
- package/cypress/pages/components/fillInTheGapsCommonComponents.js +13 -0
- package/cypress/pages/components/fillInTheGapsDragAndDropCommonComponents.js +40 -0
- package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +422 -314
- package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +438 -710
- package/cypress/pages/components/{figOverImageCanvasComponent.js → imageCanvasComponent.js} +274 -272
- package/cypress/pages/components/index.js +3 -3
- package/cypress/pages/components/maximumRecorderLengthComponent.js +55 -11
- package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +1 -1
- package/cypress/pages/components/questionInputFieldComponent.js +49 -23
- package/cypress/pages/components/scoringSectionBase.js +1 -1
- package/cypress/pages/createItemPage.js +67 -2
- package/cypress/pages/fillInTheGapsDragAndDropPage.js +172 -711
- package/cypress/pages/fillInTheGapsDropdownPage.js +75 -72
- package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +4 -4
- package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +109 -273
- package/cypress/pages/fillInTheGapsOverImageTextPage.js +49 -291
- package/cypress/pages/fillInTheGapsTextPage.js +52 -199
- package/cypress/pages/index.js +5 -5
- package/cypress/pages/multipleSelectionPage.js +1 -0
- package/cypress/pages/shortTextResponsePage.js +575 -33
- package/cypress/pages/singleSelectionGridPage.js +1 -2
- package/cypress/pages/singleSelectionPage.js +5 -6
- package/cypress/pages/textEntryMathPage.js +46 -22
- package/cypress/pages/textEntryMathWithImagePage.js +212 -0
- package/cypress/pages/uploadResponsePage.js +74 -21
- package/package.json +2 -2
- package/cypress/e2e/ILC/AudioResponseNew/minimalRecorderStyle.js +0 -482
- package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditor.smoke.js +0 -412
- package/cypress/pages/components/figOverImageCommonComponent.js +0 -1113
- package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +0 -1155
- package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +0 -1561
- package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +0 -1396
- package/cypress/pages/fillInTheGapsScoring.js +0 -5872
- package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +0 -260
@@ -0,0 +1,219 @@
|
|
1
|
+
import { dialogBoxBase, fillInTheGapsTextPage, gradingViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
const grepTags = Cypress.env('grepTags');
|
5
|
+
let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
|
6
|
+
const views = utilities.getViews(correctAnswerViews);
|
7
|
+
var itemReferenceID = "";
|
8
|
+
|
9
|
+
describe('Create item page - Fill in the gaps with text: All or nothing ', () => {
|
10
|
+
before(() => {
|
11
|
+
cy.loginAs('admin');
|
12
|
+
});
|
13
|
+
|
14
|
+
if (!grepTags || !grepTags.includes('smoke')) {
|
15
|
+
describe('Question preview modes: Student view and Grading view', () => {
|
16
|
+
abortEarlySetup();
|
17
|
+
before(() => {
|
18
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
19
|
+
cy.barsPreLoaderWait();
|
20
|
+
fillInTheGapsTextPage.steps.addResponseArea();
|
21
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
22
|
+
});
|
23
|
+
|
24
|
+
fillInTheGapsTextPage.tests.verifyPreviewModesAndScoreWhenPointsAndCorrectAnswersIsNotSet();
|
25
|
+
|
26
|
+
it('When the user sets correct answer responses and allots points, then the alloted points should be displayed in the preview tab', () => {
|
27
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
28
|
+
fillInTheGapsTextPage.steps.allotPoints(20);
|
29
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
30
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
31
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(0, 20);
|
32
|
+
});
|
33
|
+
|
34
|
+
it('When the user attempts question in preview tab and switches to edit tab, then on re-switching to the preview tab, users response should not persist', () => {
|
35
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
36
|
+
fillInTheGapsTextPage.steps.resetQuestionPreview();
|
37
|
+
fillInTheGapsTextPage.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '' }, { responseIndex: 1, responseText: '' }, { responseIndex: 2, responseText: '' }]);
|
38
|
+
});
|
39
|
+
});
|
40
|
+
};
|
41
|
+
|
42
|
+
views.forEach((view) => {
|
43
|
+
describe(`${view}: Auto scored - All or nothing scoring`, { tags: 'smoke' }, () => {
|
44
|
+
abortEarlySetup();
|
45
|
+
before(() => {
|
46
|
+
switch (view) {
|
47
|
+
case 'Question preview':
|
48
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
49
|
+
cy.barsPreLoaderWait();
|
50
|
+
fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
|
51
|
+
fillInTheGapsTextPage.steps.allotPoints(20);
|
52
|
+
fillInTheGapsTextPage.steps.addResponseArea();
|
53
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
54
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
55
|
+
break;
|
56
|
+
case 'Item preview':
|
57
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
58
|
+
itemPreviewPage.steps.switchToPreviewTab();
|
59
|
+
break;
|
60
|
+
case 'Grading view':
|
61
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
62
|
+
break;
|
63
|
+
};
|
64
|
+
});
|
65
|
+
|
66
|
+
beforeEach(() => {
|
67
|
+
switch (view) {
|
68
|
+
case 'Question preview':
|
69
|
+
fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
70
|
+
fillInTheGapsTextPage.steps.resetQuestionPreview();
|
71
|
+
break;
|
72
|
+
case 'Item preview':
|
73
|
+
fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
74
|
+
itemPreviewPage.steps.resetQuestionPreview();
|
75
|
+
break;
|
76
|
+
case 'Grading view':
|
77
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
if (view === 'Question preview') {
|
83
|
+
after(() => {
|
84
|
+
fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
|
85
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
86
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
87
|
+
});
|
88
|
+
};
|
89
|
+
|
90
|
+
it('When the user selects \'Grading\' view without attempting the question, dropzone numeration should be displayed, correct answers section with a label \'Correct answers\' should be displayed with correct answers and respective option numeration', () => {
|
91
|
+
if (view === 'Grading view') {
|
92
|
+
studentViewPage.steps.submitResponse();
|
93
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
94
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
95
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 20);
|
96
|
+
};
|
97
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
98
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(0, 20);
|
99
|
+
fillInTheGapsTextPage.steps.switchToGradingView();
|
100
|
+
fillInTheGapsTextPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
|
101
|
+
};
|
102
|
+
fillInTheGapsTextPage.steps.verifyResponseAreaNumeration();
|
103
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.correctAnswersLabel(), 'Correct answers:');
|
104
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
|
105
|
+
});
|
106
|
+
|
107
|
+
it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
|
108
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Marigold' }, { responseIndex: 1, responseText: 'Rose' }, { responseIndex: 2, responseText: 'Sunflower' }]);
|
109
|
+
if (view === 'Grading view') {
|
110
|
+
studentViewPage.steps.submitResponse();
|
111
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
112
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
113
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 20);
|
114
|
+
};
|
115
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
116
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(0, 20);
|
117
|
+
fillInTheGapsTextPage.steps.switchToGradingView();
|
118
|
+
};
|
119
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(0);
|
120
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
|
121
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
|
122
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
123
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
|
124
|
+
});
|
125
|
+
|
126
|
+
it('When the user attempts the question partially correct, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
|
127
|
+
if (view === 'Grading view') {
|
128
|
+
studentViewPage.steps.clearResponses();
|
129
|
+
};
|
130
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Sunflower' }]);
|
131
|
+
if (view === 'Grading view') {
|
132
|
+
studentViewPage.steps.submitResponse();
|
133
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
134
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
135
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 20);
|
136
|
+
};
|
137
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
138
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(0, 20);
|
139
|
+
fillInTheGapsTextPage.steps.switchToGradingView();
|
140
|
+
};
|
141
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(0);
|
142
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
|
143
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
|
144
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
145
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
|
146
|
+
});
|
147
|
+
|
148
|
+
it('When user attempts the question correctly, the user should be awarded full points and on switching to \'Grading\' view, then correct icons should be displayed beside all the correct responses, correct icon should be displayed besides the correct answer responses, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
|
149
|
+
if (view === 'Grading view') {
|
150
|
+
studentViewPage.steps.clearResponses();
|
151
|
+
};
|
152
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
153
|
+
if (view === 'Grading view') {
|
154
|
+
studentViewPage.steps.submitResponse();
|
155
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
156
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
157
|
+
gradingViewPage.steps.verifyGradingViewScore(20, 20);
|
158
|
+
};
|
159
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
160
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(20, 20);
|
161
|
+
fillInTheGapsTextPage.steps.switchToGradingView();
|
162
|
+
fillInTheGapsTextPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
|
163
|
+
};
|
164
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(0);
|
165
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
|
166
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
|
167
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
168
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
169
|
+
});
|
170
|
+
});
|
171
|
+
});
|
172
|
+
|
173
|
+
if (!grepTags || !grepTags.includes('smoke')) {
|
174
|
+
describe('Question preview: Auto scored - All or nothing: Minimum scoring', () => {
|
175
|
+
abortEarlySetup();
|
176
|
+
before(() => {
|
177
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
178
|
+
cy.barsPreLoaderWait();
|
179
|
+
fillInTheGapsTextPage.steps.allotPoints(20);
|
180
|
+
fillInTheGapsTextPage.steps.addResponseArea();
|
181
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
182
|
+
});
|
183
|
+
|
184
|
+
it('When the user selects \'Award minimum score\' from the minimum scoring dropdown, does not attempt the question and switches to grading view, then the user should be awarded with minimum points', () => {
|
185
|
+
fillInTheGapsTextPage.steps.expandMinimumScoringDropdown();
|
186
|
+
fillInTheGapsTextPage.steps.selectOptionFromMinimumScoringDropdown('Award minimum score');
|
187
|
+
fillInTheGapsTextPage.steps.allotMinimumPoints(2);
|
188
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
189
|
+
fillInTheGapsTextPage.steps.switchToGradingView();
|
190
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(2, 20);
|
191
|
+
fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
192
|
+
});
|
193
|
+
|
194
|
+
it('When the user has selected \'Award minimum score\' from the minimum scoring dropdown, attempts the question incorrectly and switches to grading view, the user should be awarded with minimum points', () => {
|
195
|
+
fillInTheGapsTextPage.steps.resetQuestionPreview();
|
196
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Marigold' }, { responseIndex: 1, responseText: 'Rose' }, { responseIndex: 2, responseText: 'Sunflower' }]);
|
197
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(2, 20);
|
198
|
+
fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
199
|
+
});
|
200
|
+
|
201
|
+
it('When the user selects \'Award minimum score only if attempted\' from the minimum scoring dropdown, does not attempt the question and switches to grading view, then the user should be awarded with 0 points', () => {
|
202
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
203
|
+
fillInTheGapsTextPage.steps.expandMinimumScoringDropdown();
|
204
|
+
fillInTheGapsTextPage.steps.selectOptionFromMinimumScoringDropdown('Award minimum score only if attempted');
|
205
|
+
fillInTheGapsTextPage.steps.allotMinimumPoints(2);
|
206
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
207
|
+
fillInTheGapsTextPage.steps.switchToGradingView();
|
208
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(0, 20);
|
209
|
+
fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
210
|
+
});
|
211
|
+
|
212
|
+
it('When the user has selected \'Award minimum score\' from the minimum scoring dropdown, attempts the question incorrectly and switches to grading view, the user should be awarded with minimum points', () => {
|
213
|
+
fillInTheGapsTextPage.steps.resetQuestionPreview();
|
214
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Marigold' }, { responseIndex: 1, responseText: 'Rose' }, { responseIndex: 2, responseText: 'Sunflower' }]);
|
215
|
+
fillInTheGapsTextPage.steps.verifyPreviewScore(2, 20);
|
216
|
+
});
|
217
|
+
});
|
218
|
+
};
|
219
|
+
});
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import { fillInTheGapsTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
var itemReferenceID = "";
|
5
|
+
const checkAnswerViews = ['Question preview', 'Item preview', 'Student view'];
|
6
|
+
const views = utilities.getViews(checkAnswerViews);
|
7
|
+
|
8
|
+
describe('Create item page - Fill in the gaps with text - Check answer functionality', () => {
|
9
|
+
before(() => {
|
10
|
+
cy.loginAs('admin');
|
11
|
+
});
|
12
|
+
|
13
|
+
views.forEach((view) => {
|
14
|
+
//Note: Remove after https://redmine.zeuslearning.com/issues/549542 is fixed
|
15
|
+
const checkAnswer = (view) => {
|
16
|
+
switch (view) {
|
17
|
+
case 'Question preview':
|
18
|
+
case 'Item preview':
|
19
|
+
fillInTheGapsTextPage.steps.checkAnswer();
|
20
|
+
break;
|
21
|
+
case 'Student view':
|
22
|
+
studentViewPage.steps.checkAnswer();
|
23
|
+
break;
|
24
|
+
default:
|
25
|
+
throw new Error(`Unsupported page identifier: ${view}`);
|
26
|
+
}
|
27
|
+
};
|
28
|
+
describe(`${view} - Check answer functionality`, { tags: 'smoke' }, () => {
|
29
|
+
abortEarlySetup();
|
30
|
+
before(() => {
|
31
|
+
switch (view) {
|
32
|
+
case 'Question preview':
|
33
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
34
|
+
cy.barsPreLoaderWait();
|
35
|
+
fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
|
36
|
+
fillInTheGapsTextPage.steps.allotPoints(20);
|
37
|
+
fillInTheGapsTextPage.steps.addResponseArea();
|
38
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
39
|
+
fillInTheGapsTextPage.steps.checkAllowStudentToCheckAnswerCheckbox();
|
40
|
+
fillInTheGapsTextPage.steps.allotPoints(20);
|
41
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
42
|
+
break;
|
43
|
+
case 'Item preview':
|
44
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
45
|
+
itemPreviewPage.steps.switchToPreviewTab();
|
46
|
+
break;
|
47
|
+
case 'Student view':
|
48
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
49
|
+
break;
|
50
|
+
}
|
51
|
+
});
|
52
|
+
|
53
|
+
beforeEach(() => {
|
54
|
+
switch (view) {
|
55
|
+
case 'Question preview':
|
56
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
57
|
+
fillInTheGapsTextPage.steps.resetQuestionPreview();
|
58
|
+
break;
|
59
|
+
case 'Item preview':
|
60
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
61
|
+
itemPreviewPage.steps.resetQuestionPreview();
|
62
|
+
break;
|
63
|
+
case 'Student view':
|
64
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
if (view === 'Question preview') {
|
70
|
+
after(() => {
|
71
|
+
fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
|
72
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
73
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
74
|
+
});
|
75
|
+
};
|
76
|
+
|
77
|
+
it('When the user selects \'Check answer\' button without attempting the question, then correct/incorrect icons, correct/incorrect answer status message and correct answer section should not be displayed', () => {
|
78
|
+
checkAnswer(view);
|
79
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectIconsNotExist();
|
80
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
|
81
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
82
|
+
});
|
83
|
+
|
84
|
+
it('When the user attempts the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' should be displayed. Correct answer section should not be displayed', () => {
|
85
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Marigold' }, { responseIndex: 1, responseText: 'Rose' }, { responseIndex: 2, responseText: 'Sunflower' }]);
|
86
|
+
checkAnswer(view);
|
87
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(0);
|
88
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
|
89
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
|
90
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
91
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
92
|
+
});
|
93
|
+
|
94
|
+
it('When the user attempts the question partially correct and clicks on \'Check answer\' button, then incorrect icons should be displayed besides all incorrect responses, correct icons should be displayed besides correct responses, a status message with text \'Your answer is incorrect\' should be displayed. Correct answer section should not be displayed', () => {
|
95
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Sunflower' }]);
|
96
|
+
checkAnswer(view);
|
97
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(0);
|
98
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
|
99
|
+
fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
|
100
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
|
101
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
102
|
+
});
|
103
|
+
|
104
|
+
it('When user attempts the question correctly, and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, a status message with text \'Your answer is correct\' should be displayed. Correct answer section should not be displayed', () => {
|
105
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: 'Leaf' }, { responseIndex: 2, responseText: 'Stem' }]);
|
106
|
+
checkAnswer(view);
|
107
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(0);
|
108
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
|
109
|
+
fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
|
110
|
+
fillInTheGapsTextPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
111
|
+
fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionNotExists();
|
112
|
+
});
|
113
|
+
});
|
114
|
+
});
|
115
|
+
});
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import { fillInTheGapsTextPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
const css = Cypress.env('css');
|
5
|
+
|
6
|
+
describe('Create item page - Fill in the gaps with text: Question instructions, question input field', () => {
|
7
|
+
before(() => {
|
8
|
+
cy.loginAs('admin');
|
9
|
+
});
|
10
|
+
|
11
|
+
describe('Question instructions input field - Edit tab', () => {
|
12
|
+
abortEarlySetup();
|
13
|
+
before(() => {
|
14
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
15
|
+
cy.barsPreLoaderWait();
|
16
|
+
});
|
17
|
+
|
18
|
+
fillInTheGapsTextPage.tests.verifyQuestionInstructionsInputFieldEditTab();
|
19
|
+
});
|
20
|
+
|
21
|
+
describe('Question instructions input field - Preview tab', () => {
|
22
|
+
abortEarlySetup();
|
23
|
+
before(() => {
|
24
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
25
|
+
cy.barsPreLoaderWait();
|
26
|
+
});
|
27
|
+
|
28
|
+
fillInTheGapsTextPage.tests.verifyQuestionInstructionsInputFieldPreviewTab();
|
29
|
+
});
|
30
|
+
|
31
|
+
describe('Question input field - Edit tab', () => {
|
32
|
+
abortEarlySetup();
|
33
|
+
before(() => {
|
34
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
35
|
+
cy.barsPreLoaderWait();
|
36
|
+
});
|
37
|
+
|
38
|
+
it('\'Question\' label and input field should be displayed and by default in the question input field, sample \'Lorem Ipsum\' text along with two response areas should be present', () => {
|
39
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.questionLabel(), 'Question');
|
40
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.questionInputField(), 'Lorem ipsum dolor sit amet, \n1\nclose\nonsectetur adipiscing elit. Ut pellentesque tincidunt ornare. Integer porttitor est quis urna porttitor,eget \n2\nclose\ntempus tellus dapibus.');
|
41
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.responseArea(), 2);
|
42
|
+
});
|
43
|
+
|
44
|
+
it('The response area should be displayed with a settings button, numeric count and a close button in the question input field', () => {
|
45
|
+
for (let index = 0; index < 2; index++) {
|
46
|
+
fillInTheGapsTextPage.steps.verifyResponseAreaContents(index)
|
47
|
+
};
|
48
|
+
});
|
49
|
+
|
50
|
+
it('CSS of Question input field contents', { tags: 'css' }, () => {
|
51
|
+
utilities.verifyCSS(fillInTheGapsTextPage.questionInputField(), {
|
52
|
+
'color': css.color.text,
|
53
|
+
'font-size': css.fontSize.default,
|
54
|
+
'font-weight': css.fontWeight.regular
|
55
|
+
});
|
56
|
+
utilities.verifyCSS(fillInTheGapsTextPage.responseArea().find('.add_response_element'), {
|
57
|
+
'background-color': css.color.figActiveComponentBg,
|
58
|
+
'border': `1px solid ${css.color.activeButtons}`
|
59
|
+
});
|
60
|
+
utilities.verifyCSS(fillInTheGapsTextPage.responseAreaNumeration(), {
|
61
|
+
'color': css.color.liText,
|
62
|
+
'font-size': '32px',
|
63
|
+
'font-weight': css.fontWeight.regular
|
64
|
+
});
|
65
|
+
fillInTheGapsTextPage.responseAreaCloseButton()
|
66
|
+
.verifyPseudoClassBeforeProperty('color', css.color.activeButtons)
|
67
|
+
});
|
68
|
+
|
69
|
+
it('When the user has not focused inside the question input field, the \'add text container\' button should be in disabled state', () => {
|
70
|
+
fillInTheGapsTextPage.steps.verifyResponseAreaButtonDisabled();
|
71
|
+
});
|
72
|
+
|
73
|
+
it('When the user focuses in the question input field, the \'+add text container\' button should get enabled, and when the user clicks on the \'+add text container\' button, a response area in the question input field, a response accordion along with \'Response #\' label in the \'Specify correct answer\' section, a new \'aria label for text containers\' input field in the additional settings should get added', () => {
|
74
|
+
fillInTheGapsTextPage.steps.focusInQuestionInputField();
|
75
|
+
fillInTheGapsTextPage.steps.verifyResponseAreaButtonEnabled();
|
76
|
+
fillInTheGapsTextPage.steps.clickOnAddResponseAreaButton();
|
77
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.responseArea(), 3);
|
78
|
+
fillInTheGapsTextPage.steps.verifyResponseAreaContents(2);
|
79
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.answerInputFieldSpecifyCorrectAnswerSection(), 3);
|
80
|
+
utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextPage.responseAccordionLabel(), 2), 'Response 3');
|
81
|
+
fillInTheGapsTextPage.steps.expandAdditonalSettings();
|
82
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.enterAriaLabelInputField(), 3);
|
83
|
+
});
|
84
|
+
|
85
|
+
it('When the user clicks on the \'close\' button present on a response area, the response area in the question input field should get removed and the count of the response areas present in the question input field should get updated accordingly, response field along with \'Response #\' label in the \'specify correct answer\' section, \'Response #\' accordion in the additional settings accordion and the respective response field in the \'Preview tab\' should also get removed', () => {
|
86
|
+
cy.log('Switching to edit tab')
|
87
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
88
|
+
fillInTheGapsTextPage.steps.deleteAResponseArea(1);
|
89
|
+
cy.log('Checking if 3rd response area gets removed from the question input field and the numeric counts get updated')
|
90
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.responseArea(), 2);
|
91
|
+
for (let index = 0; index < 2; index++) {
|
92
|
+
fillInTheGapsTextPage.steps.verifyResponseAreaContents(index)
|
93
|
+
};
|
94
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.responseAccordion(), 2);
|
95
|
+
for (let index = 0; index < 2; index++) {
|
96
|
+
utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextPage.responseAccordionLabel(), index), `Response ${index + 1}`);
|
97
|
+
};
|
98
|
+
});
|
99
|
+
|
100
|
+
it('When the user removes all response areas from the question input field, an error message \'Error: Minimum one response token is required.\' should be displayed', () => {
|
101
|
+
cy.log('Switching to edit tab')
|
102
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
103
|
+
fillInTheGapsTextPage.steps.deleteAResponseArea(0);
|
104
|
+
fillInTheGapsTextPage.steps.deleteAResponseArea(0);
|
105
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.errorMessage(), 'Error: Minimum one response token is required.')
|
106
|
+
});
|
107
|
+
|
108
|
+
fillInTheGapsTextPage.tests.verifyErrorMessageCSSAndA11y();
|
109
|
+
|
110
|
+
fillInTheGapsTextPage.tests.addResponseAreaAndVerifyMinimumOneAreaRequiredErrorMessageNotExist();
|
111
|
+
|
112
|
+
fillInTheGapsTextPage.tests.verifyQuestionInputFieldPlaceholderText();
|
113
|
+
});
|
114
|
+
|
115
|
+
describe('Question input field - Preview tab', () => {
|
116
|
+
abortEarlySetup();
|
117
|
+
before(() => {
|
118
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
119
|
+
cy.barsPreLoaderWait();
|
120
|
+
});
|
121
|
+
|
122
|
+
it('When the user adds a new response area in the question input field, the added response area should be displayed in the preview tab', () => {
|
123
|
+
fillInTheGapsTextPage.steps.addResponseArea();
|
124
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
125
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.answerInputFieldPreviewTab(), 3);
|
126
|
+
});
|
127
|
+
|
128
|
+
it('When the user edits the question input field text, the modified text should be visible in the preview tab', () => {
|
129
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
130
|
+
fillInTheGapsTextPage.steps.addInputToQuestionInputField('Lorem ipsum');
|
131
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
132
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.questionContainerPreviewTab(), 'Lorem ipsum dolor sit amet, \n\nonsectetur adipiscing elit. Ut pellentesque tincidunt ornare. Integer porttitor est quis urna porttitor,eget \n\ntempus tellus dapibus.\n\nLorem ipsum');
|
133
|
+
});
|
134
|
+
|
135
|
+
it('When the user deletes a response area, it should get deleted from the question preview', () => {
|
136
|
+
fillInTheGapsTextPage.steps.switchToEditTab();
|
137
|
+
fillInTheGapsTextPage.steps.deleteAResponseArea(2);
|
138
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
139
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.questionContainerPreviewTab(), 'Lorem ipsum dolor sit amet, \n\nonsectetur adipiscing elit. Ut pellentesque tincidunt ornare. Integer porttitor est quis urna porttitor,eget \n\ntempus tellus dapibus.Lorem ipsum');
|
140
|
+
});
|
141
|
+
});
|
142
|
+
});
|
@@ -0,0 +1,152 @@
|
|
1
|
+
import { fillInTheGapsTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
const previewContentViews = ['Question preview', 'Item view', 'Item preview', 'Student view', 'Grading view', 'Correct answer view'];
|
5
|
+
const views = utilities.getViews(previewContentViews);
|
6
|
+
var itemReferenceID = "";
|
7
|
+
const css = Cypress.env('css');
|
8
|
+
|
9
|
+
describe('Create item page - Fill in the gaps with text - Preview contents in all views', () => {
|
10
|
+
before(() => {
|
11
|
+
cy.loginAs('admin');
|
12
|
+
});
|
13
|
+
|
14
|
+
views.forEach((view) => {
|
15
|
+
describe(`Preview tab contents - ${view}`, { tags: 'smoke' }, () => {
|
16
|
+
abortEarlySetup();
|
17
|
+
before(() => {
|
18
|
+
switch (view) {
|
19
|
+
case 'Question preview':
|
20
|
+
fillInTheGapsTextPage.steps.navigateToCreateQuestion('fill in the gaps with text');
|
21
|
+
cy.barsPreLoaderWait();
|
22
|
+
fillInTheGapsTextPage.steps.addTextInQuestionInstructionsInputField('Fill in the gaps');
|
23
|
+
fillInTheGapsTextPage.steps.allotPoints(10);
|
24
|
+
fillInTheGapsTextPage.steps.addResponseArea();
|
25
|
+
fillInTheGapsTextPage.steps.selectAcceptedStudentInputType(1, 'Number');
|
26
|
+
fillInTheGapsTextPage.steps.selectAcceptedStudentInputType(2, 'Integer');
|
27
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: '20.00' }, { responseIndex: 2, responseText: '7' }]);
|
28
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
29
|
+
break;
|
30
|
+
case 'Item view':
|
31
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
32
|
+
break;
|
33
|
+
case 'Item preview':
|
34
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
35
|
+
fillInTheGapsTextPage.steps.switchToPreviewTab();
|
36
|
+
break;
|
37
|
+
case 'Student view':
|
38
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
39
|
+
break;
|
40
|
+
case 'Grading view':
|
41
|
+
cy.visit(`/item-engine/demo/render-item/grading-view/${utilities.base64Encoding(itemReferenceID)}`);
|
42
|
+
break;
|
43
|
+
case 'Correct answer view':
|
44
|
+
cy.visit(`/item-engine/demo/render-item/correct-answer-view/${utilities.base64Encoding(itemReferenceID)}`);
|
45
|
+
break;
|
46
|
+
default:
|
47
|
+
throw new Error('Invalid view');
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
after(() => {
|
52
|
+
if (view === 'Question preview') {
|
53
|
+
fillInTheGapsTextPage.steps.clickOnSaveQuestionButton();
|
54
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
55
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
56
|
+
}
|
57
|
+
if (view === 'Student view') {
|
58
|
+
studentViewPage.steps.submitResponse();
|
59
|
+
utilities.verifyElementVisibilityState(studentViewPage.buttonGoToGradingView(), 'visible');
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
it('Question instructions should be visible', () => {
|
64
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.questionInstructionsText(), 'Fill in the gaps');
|
65
|
+
utilities.verifyElementVisibilityState(fillInTheGapsTextPage.questionInstructionsText(), 'visible');
|
66
|
+
});
|
67
|
+
|
68
|
+
if (view !== 'Grading view' && view !== 'Correct answer view') {
|
69
|
+
it('The sample \'Lorem Ipsum\' text along with three answer input fields should be displayed in the question field and they should be empty.', () => {
|
70
|
+
utilities.verifyInnerText(fillInTheGapsTextPage.questionContainerPreviewTab(), 'Lorem ipsum dolor sit amet, \n\nonsectetur adipiscing elit. Ut pellentesque tincidunt ornare. Integer porttitor est quis urna porttitor,eget \n\ntempus tellus dapibus.\n');
|
71
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.answerInputFieldPreviewTab(), 3);
|
72
|
+
fillInTheGapsTextPage.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '' }, { responseIndex: 1, responseText: '' }, { responseIndex: 2, responseText: '' }]);
|
73
|
+
});
|
74
|
+
|
75
|
+
it('User should be able to enter text in the answer input fields', () => {
|
76
|
+
fillInTheGapsTextPage.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: '20.00' }, { responseIndex: 2, responseText: '7' }]);
|
77
|
+
fillInTheGapsTextPage.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: '20.00' }, { responseIndex: 2, responseText: '7' }]);
|
78
|
+
});
|
79
|
+
} else if (view === 'Grading view') {
|
80
|
+
it('The answer input fields should be displayed filled with answers', () => {
|
81
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.answerInputFieldPreviewTab(), 3);
|
82
|
+
fillInTheGapsTextPage.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: '20.00' }, { responseIndex: 2, responseText: '7' }]);
|
83
|
+
});
|
84
|
+
|
85
|
+
it('The input fields should not be editable', () => {
|
86
|
+
fillInTheGapsTextPage.steps.verifyAnswerInputFieldDisabled(0);
|
87
|
+
fillInTheGapsTextPage.steps.verifyAnswerInputFieldDisabled(1);
|
88
|
+
fillInTheGapsTextPage.steps.verifyAnswerInputFieldDisabled(2);
|
89
|
+
});
|
90
|
+
} else {
|
91
|
+
it('The answer input fields should be displayed filled with correct answers', () => {
|
92
|
+
utilities.verifyElementCount(fillInTheGapsTextPage.answerInputFieldPreviewTab(), 3);
|
93
|
+
fillInTheGapsTextPage.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower' }, { responseIndex: 1, responseText: '20.00' }, { responseIndex: 2, responseText: '7' }]);
|
94
|
+
});
|
95
|
+
}
|
96
|
+
|
97
|
+
it('CSS of preview contents', { tags: 'css' }, () => {
|
98
|
+
utilities.verifyCSS(fillInTheGapsTextPage.questionContainerPreviewTab(), {
|
99
|
+
'color': css.color.text,
|
100
|
+
'font-size': css.fontSize.default,
|
101
|
+
'font-weight': css.fontWeight.regular
|
102
|
+
});
|
103
|
+
switch (view) {
|
104
|
+
case 'Question preview':
|
105
|
+
case 'Item preview':
|
106
|
+
case 'Item view':
|
107
|
+
case 'Item preview':
|
108
|
+
case 'Student view':
|
109
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab().parent('.response-input-field'), {
|
110
|
+
'background-color': css.color.optionsBg,
|
111
|
+
});
|
112
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab().parent().find('fieldset'), {
|
113
|
+
'border': `1px solid ${css.color.optionsSelectedText}`,
|
114
|
+
});
|
115
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab(), {
|
116
|
+
'color': css.color.text,
|
117
|
+
'font-size': css.fontSize.default,
|
118
|
+
'font-weight': css.fontWeight.regular
|
119
|
+
});
|
120
|
+
break;
|
121
|
+
case 'Grading view':
|
122
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab().parent('.response-input-field'), {
|
123
|
+
'background-color': css.color.optionsBg,
|
124
|
+
});
|
125
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab().parent().find('fieldset'), {
|
126
|
+
'border': `1px solid ${css.color.correctAnswer}`
|
127
|
+
});
|
128
|
+
break;
|
129
|
+
case 'Correct answer view':
|
130
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab().parent('.response-input-field'), {
|
131
|
+
'background-color': css.color.optionsBg,
|
132
|
+
});
|
133
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab().parent().find('fieldset'), {
|
134
|
+
'border': `1px solid ${css.color.optionsSelectedText}`,
|
135
|
+
});
|
136
|
+
utilities.verifyCSS(fillInTheGapsTextPage.answerInputFieldPreviewTab(), {
|
137
|
+
'color': css.color.text,
|
138
|
+
'font-size': css.fontSize.default,
|
139
|
+
'font-weight': css.fontWeight.regular
|
140
|
+
});
|
141
|
+
break;
|
142
|
+
default:
|
143
|
+
throw new Error('Invalid view');
|
144
|
+
}
|
145
|
+
});
|
146
|
+
|
147
|
+
it('Accessibility of preview tab', { tags: 'a11y' }, () => {
|
148
|
+
cy.checkAccessibility(fillInTheGapsTextPage.answerInputFieldPreviewTab().parents('[class*="question-preview-wrapper"]'));
|
149
|
+
});
|
150
|
+
});
|
151
|
+
});
|
152
|
+
});
|