itemengine-cypress-automation 1.0.63 → 1.0.65
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/EssayResponse/essayResponseGradingViewAndCorrectAnswerViewContents.js +106 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewContentsForAllViews.js +76 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextCheckAnswerForAllViews.js +125 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextPreviewContentsForAllViews.js +144 -0
- package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextShowCorrectAnswerForAllView.js +153 -0
- package/cypress/pages/components/essayResponseCommonComponents.js +39 -4
- package/cypress/pages/components/figOverImageCommonComponent.js +1 -1
- package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +1 -1
- package/cypress/pages/components/questionInstructionsComponent.js +1 -1
- package/cypress/pages/correctAnswerViewPage.js +21 -0
- package/cypress/pages/gradingViewPage.js +24 -0
- package/cypress/pages/index.js +4 -0
- package/cypress/pages/itemPreviewPage.js +25 -0
- package/cypress/pages/studentViewPage.js +23 -0
- package/cypress/support/helpers/utilities.js +10 -0
- package/package.json +1 -1
- package/scripts/sorry-cypress.mjs +2 -1
@@ -0,0 +1,106 @@
|
|
1
|
+
import { correctAnswerViewPage, essayResponsePage, itemPreviewPage, studentViewPage } from "../../../pages";
|
2
|
+
import { gradingViewPage } from "../../../pages";
|
3
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
4
|
+
import utilities from "../../../support/helpers/utilities";
|
5
|
+
const css = Cypress.env('css');
|
6
|
+
var itemReferenceID = "";
|
7
|
+
|
8
|
+
describe('Create item page - Essay response: Grading view, Correct answer view contents', () => {
|
9
|
+
before(() => {
|
10
|
+
cy.loginAs('admin');
|
11
|
+
});
|
12
|
+
|
13
|
+
describe('Grading view contents', () => {
|
14
|
+
abortEarlySetup();
|
15
|
+
before(() => {
|
16
|
+
cy.log('Navigating to Essay response question type');
|
17
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
18
|
+
cy.barsPreLoaderWait();
|
19
|
+
essayResponsePage.steps.addQuestionInstructions();
|
20
|
+
essayResponsePage.steps.allotPoints(10);
|
21
|
+
essayResponsePage.steps.clickOnSaveQuestionButton();
|
22
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
23
|
+
//Global variable issue, not working inside before
|
24
|
+
itemPreviewPage.referenceID()
|
25
|
+
.invoke('text')
|
26
|
+
.then(($refID) => {
|
27
|
+
itemReferenceID = $refID;
|
28
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
29
|
+
utilities.verifyElementVisibilityState(essayResponsePage.previewTabToolbarOption(), 'visible');
|
30
|
+
essayResponsePage.steps.selectPreviewTabToolbarOption('Bold (Ctrl+B)');
|
31
|
+
essayResponsePage.steps.selectPreviewTabToolbarOption('Italic (Ctrl+I)');
|
32
|
+
essayResponsePage.steps.selectPreviewTabToolbarOption('Underline (Ctrl+U)');
|
33
|
+
essayResponsePage.steps.enterInputInResponseField('This is a test for grading view preview contents');
|
34
|
+
studentViewPage.steps.submitResponse();
|
35
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
36
|
+
});
|
37
|
+
});
|
38
|
+
|
39
|
+
it('Question instructions should be visible', () => {
|
40
|
+
utilities.verifyInnerText(essayResponsePage.questionInstructionsText(), 'Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
41
|
+
utilities.verifyElementVisibilityState(essayResponsePage.questionInstructionsText(), 'visible');
|
42
|
+
});
|
43
|
+
|
44
|
+
it('The response submitted by the student should be visible in the response field of the grading view. The formatting toolbar options should not be visible in grading view', () => {
|
45
|
+
essayResponsePage.responseField()
|
46
|
+
.verifyInnerHTML('<p><strong><em><u>This is a test for grading view preview contents</u></em></strong></p>');
|
47
|
+
utilities.verifyElementVisibilityState(essayResponsePage.previewTabToolbarWrapper(), 'hidden');
|
48
|
+
});
|
49
|
+
|
50
|
+
it('The content in the response field should not be editable', () => {
|
51
|
+
essayResponsePage.steps.verifyGradingViewResponseFieldIsNonEditable();
|
52
|
+
});
|
53
|
+
|
54
|
+
it('Empty score input field and total score should be displayed', () => {
|
55
|
+
gradingViewPage.steps.verifyGradingViewScore('', 10);
|
56
|
+
});
|
57
|
+
|
58
|
+
it('CSS of content in the response field', { tags: 'css' }, () => {
|
59
|
+
utilities.verifyCSS(essayResponsePage.responseField().find('p'), {
|
60
|
+
'color': css.color.text,
|
61
|
+
'font-size': css.fontSize.default,
|
62
|
+
'font-weight': css.fontWeight.regular
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
it('Accessibility of content in the response field', { tags: 'a11y' }, () => {
|
67
|
+
cy.checkAccessibility(essayResponsePage.responseField().parents('.essay-preview-wrapper'));
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
describe('Correct answer view contents', () => {
|
72
|
+
abortEarlySetup();
|
73
|
+
before(() => {
|
74
|
+
cy.log('Navigating to Essay response question type');
|
75
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
76
|
+
cy.barsPreLoaderWait();
|
77
|
+
essayResponsePage.steps.addQuestionInstructions();
|
78
|
+
essayResponsePage.steps.allotPoints(10);
|
79
|
+
essayResponsePage.steps.clickOnSaveQuestionButton();
|
80
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
81
|
+
//Global variable issue, not working inside before
|
82
|
+
itemPreviewPage.referenceID()
|
83
|
+
.invoke('text')
|
84
|
+
.then(($refID) => {
|
85
|
+
itemReferenceID = $refID
|
86
|
+
cy.visit(`/item-engine/demo/render-item/correct-answer-view/${utilities.base64Encoding(itemReferenceID)}`);
|
87
|
+
});
|
88
|
+
});
|
89
|
+
|
90
|
+
it('Question instructions should be visible', () => {
|
91
|
+
utilities.verifyTextContent(correctAnswerViewPage.correctAnswerViewQuestionInstructions(), 'Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
92
|
+
utilities.verifyElementVisibilityState(correctAnswerViewPage.correctAnswerViewQuestionInstructions(), 'visible');
|
93
|
+
});
|
94
|
+
|
95
|
+
it('\'This is a manual scored question\' help text should be displayed in the correct answer view', () => {
|
96
|
+
utilities.verifyTextContent(correctAnswerViewPage.manualScoredQuestionHelpText(), 'This is a manual scored question.');
|
97
|
+
utilities.verifyElementVisibilityState(correctAnswerViewPage.manualScoredQuestionHelpText(), 'visible');
|
98
|
+
});
|
99
|
+
|
100
|
+
it('The points alloted to the question should be displayed', () => {
|
101
|
+
correctAnswerViewPage.steps.verifyAvailablePoints(10);
|
102
|
+
});
|
103
|
+
|
104
|
+
//Need to add CSS and A11y here once updated designs are available for correct answer
|
105
|
+
});
|
106
|
+
});
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { essayResponsePage, itemPreviewPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
const css = Cypress.env('css');
|
5
|
+
const views = ['Question preview', 'Item view', 'Item preview', 'Student view'];
|
6
|
+
var itemReferenceID = "";
|
7
|
+
|
8
|
+
describe('Create item page - Essay response: Preview contents', () => {
|
9
|
+
before(() => {
|
10
|
+
cy.loginAs('admin');
|
11
|
+
});
|
12
|
+
|
13
|
+
views.forEach((view) => {
|
14
|
+
describe(`Preview tab contents - ${view}`, () => {
|
15
|
+
abortEarlySetup();
|
16
|
+
before(() => {
|
17
|
+
switch (view) {
|
18
|
+
case 'Question preview':
|
19
|
+
cy.log('Navigating to Essay response question type');
|
20
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
21
|
+
cy.barsPreLoaderWait();
|
22
|
+
essayResponsePage.steps.addQuestionInstructions();
|
23
|
+
essayResponsePage.steps.allotPoints(10);
|
24
|
+
essayResponsePage.steps.switchToPreviewTab();
|
25
|
+
break;
|
26
|
+
case 'Item view':
|
27
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID[0])}`);
|
28
|
+
break;
|
29
|
+
case 'Item preview':
|
30
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID[0])}`);
|
31
|
+
itemPreviewPage.steps.switchToPreviewTab();
|
32
|
+
break;
|
33
|
+
case 'Student view':
|
34
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID[0])}`);
|
35
|
+
break;
|
36
|
+
};
|
37
|
+
});
|
38
|
+
|
39
|
+
if (view === 'Question preview') {
|
40
|
+
after(() => {
|
41
|
+
essayResponsePage.steps.clickOnSaveQuestionButton();
|
42
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
43
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
44
|
+
});
|
45
|
+
};
|
46
|
+
|
47
|
+
it('When the user switches to Preview tab, then the following options should be displayed in the response field toolbar - \'Bold, Italic, Underline, Superscript, Bulleted list, Numbered list, Link, Insert Image, Special Characters, Table\' along with a separator after \'Underline\' option', () => {
|
48
|
+
essayResponsePage.steps.verifyDefaultToolbarOptions();
|
49
|
+
});
|
50
|
+
|
51
|
+
it('Word count should be displayed in the format \'0/10000\'', () => {
|
52
|
+
essayResponsePage.steps.verifyResponseFieldWordCount('0/10000');
|
53
|
+
});
|
54
|
+
|
55
|
+
it('When the user updates the formatting options and types something in the response field, then the word count should update accordingly', () => {
|
56
|
+
essayResponsePage.steps.selectPreviewTabToolbarOption('Bold (Ctrl+B)');
|
57
|
+
essayResponsePage.steps.selectPreviewTabToolbarOption('Italic (Ctrl+I)');
|
58
|
+
essayResponsePage.steps.selectPreviewTabToolbarOption('Underline (Ctrl+U)');
|
59
|
+
essayResponsePage.steps.enterInputInResponseField('This is a test for grading view preview contents');
|
60
|
+
essayResponsePage.responseField()
|
61
|
+
.verifyInnerHTML('<p><strong><em><u>This is a test for grading view preview contents</u></em></strong><br></p>');
|
62
|
+
essayResponsePage.steps.verifyResponseFieldWordCount('9/10000');
|
63
|
+
});
|
64
|
+
|
65
|
+
it('CSS of formatting options in Preview tab', { tags: 'css' }, () => {
|
66
|
+
utilities.verifyCSS(essayResponsePage.previewTabToolbarOption('Bold (Ctrl+B)').find('.cke_button_icon'), {
|
67
|
+
'color': css.color.activeButtons
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
it('Accessibility of formatting options in Preview tab', { tags: 'a11y' }, () => {
|
72
|
+
cy.checkAccessibility(essayResponsePage.previewTabToolbarWrapper())
|
73
|
+
});
|
74
|
+
});
|
75
|
+
});
|
76
|
+
});
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import { fillInTheGapsOverImageTextPage } from "../../../pages/fillInTheGapsOverImageTextPage";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
import { itemPreviewPage } from "../../../pages";
|
5
|
+
const views = ['Question preview', 'Item preview', 'Student view'];
|
6
|
+
const correctTabAnswerArray = ['Flower', 'Leaf'];
|
7
|
+
const incorrectAnswerArray = ['Stem', 'Root'];
|
8
|
+
var itemReferenceID = "";
|
9
|
+
|
10
|
+
describe('Create item page - Fill in the gaps over image - text: Check answer', () => {
|
11
|
+
before(() => {
|
12
|
+
cy.loginAs('admin');
|
13
|
+
});
|
14
|
+
|
15
|
+
views.forEach((view) => {
|
16
|
+
// Remove after https://redmine.zeuslearning.com/issues/549542 is fixed
|
17
|
+
const checkAnswer = (view) => {
|
18
|
+
switch (view) {
|
19
|
+
case views[0]:
|
20
|
+
case views[1]:
|
21
|
+
fillInTheGapsOverImageTextPage.steps.checkAnswer();
|
22
|
+
break;
|
23
|
+
case views[2]:
|
24
|
+
cy.get('.check-answer-button')
|
25
|
+
.click();
|
26
|
+
break;
|
27
|
+
// Add more cases for additional pages if needed
|
28
|
+
default:
|
29
|
+
throw new Error(`Unsupported page identifier: ${view}`);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
describe(`Fill in the gaps over image - text: Check answer - ${view}`, () => {
|
33
|
+
abortEarlySetup();
|
34
|
+
before(() => {
|
35
|
+
switch (view) {
|
36
|
+
case 'Question preview':
|
37
|
+
cy.log('Navigating to Fill in the gaps over image - text question type');
|
38
|
+
fillInTheGapsOverImageTextPage.steps.navigateToCreateQuestion('fill in the gaps over image - text');
|
39
|
+
cy.barsPreLoaderWait();
|
40
|
+
fillInTheGapsOverImageTextPage.steps.addQuestionInstructions();
|
41
|
+
fillInTheGapsOverImageTextPage.steps.uploadFile('highlightImage.jpg');
|
42
|
+
fillInTheGapsOverImageTextPage.steps.clickOnImagePopupOkButton();
|
43
|
+
fillInTheGapsOverImageTextPage.steps.addResponseContainer();
|
44
|
+
fillInTheGapsOverImageTextPage.steps.addResponseContainer();
|
45
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldSetCorrectAnswerSection(0, correctTabAnswerArray[0]);
|
46
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldSetCorrectAnswerSection(1, correctTabAnswerArray[1]);
|
47
|
+
fillInTheGapsOverImageTextPage.steps.allotPoints(10);
|
48
|
+
fillInTheGapsOverImageTextPage.steps.expandAdditonalSettings();
|
49
|
+
fillInTheGapsOverImageTextPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
|
50
|
+
fillInTheGapsOverImageTextPage.steps.switchToPreviewTab();
|
51
|
+
break;
|
52
|
+
case 'Item preview':
|
53
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
54
|
+
itemPreviewPage.steps.switchToPreviewTab();
|
55
|
+
break;
|
56
|
+
case 'Student view':
|
57
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
58
|
+
break;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
|
62
|
+
afterEach(() => {
|
63
|
+
switch (view) {
|
64
|
+
case 'Question preview':
|
65
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabCorrectAnswerContainerNotExist();
|
66
|
+
fillInTheGapsOverImageTextPage.steps.resetQuestionPreview();
|
67
|
+
break;
|
68
|
+
case 'Item preview':
|
69
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabCorrectAnswerContainerNotExist();
|
70
|
+
itemPreviewPage.steps.resetQuestionPreview();
|
71
|
+
break;
|
72
|
+
case 'Student view':
|
73
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
});
|
77
|
+
|
78
|
+
if (view === 'Question preview') {
|
79
|
+
after(() => {
|
80
|
+
fillInTheGapsOverImageTextPage.steps.clickOnSaveQuestionButton();
|
81
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
82
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
83
|
+
});
|
84
|
+
};
|
85
|
+
|
86
|
+
it('When the user selects \'Check answer\' button without attempting the question, then red cross-mark icon or green check-mark icons, correct/incorrect answer label and border and correct answer container should not be displayed', () => {
|
87
|
+
checkAnswer(view);
|
88
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectIconsDoesNotExist();
|
89
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabelNotExists();
|
90
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectBorderNotExists();
|
91
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabCorrectAnswerContainerNotExist();
|
92
|
+
});
|
93
|
+
|
94
|
+
it('When the user attempts the question incorrectly and clicks on the \'Check answer\' button, then red cross-mark icons should be displayed beside all incorrect the options, a label \'Incorrect answer\' and incorrect answer border should be displayed below the question preview and the correct answer container should not be displayed', () => {
|
95
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, incorrectAnswerArray[0]);
|
96
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, incorrectAnswerArray[1]);
|
97
|
+
checkAnswer(view);
|
98
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionCrossmarkIcon(0);
|
99
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionCrossmarkIcon(1);
|
100
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectAttemptBorder();
|
101
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
102
|
+
});
|
103
|
+
|
104
|
+
it('When the user attempts the question partially correct, then on clicking on the \'Check answer\' button, green check-mark icon should be displayed besides the correct response, red cross-mark should be displayed besides incorrect response and \'Incorrect answer\' label should be displayed below the question preview', () => {
|
105
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, correctTabAnswerArray[0]);
|
106
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, incorrectAnswerArray[0]);
|
107
|
+
checkAnswer(view);
|
108
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionCheckmarkIcon(0);
|
109
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionCrossmarkIcon(1);
|
110
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectAttemptBorder();
|
111
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
112
|
+
});
|
113
|
+
|
114
|
+
it('When the user attempts the question correctly, then on clicking on the \'Check answer\' button, green check-mark icon should be displayed besides the correct response and \'Correct answer\' label should be displayed below the question preview', () => {
|
115
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, correctTabAnswerArray[0]);
|
116
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, correctTabAnswerArray[1]);
|
117
|
+
checkAnswer(view);
|
118
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionCheckmarkIcon(0);
|
119
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionCheckmarkIcon(1);
|
120
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectAttemptBorder();
|
121
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
|
122
|
+
});
|
123
|
+
});
|
124
|
+
});
|
125
|
+
});
|
@@ -0,0 +1,144 @@
|
|
1
|
+
import { fillInTheGapsOverImageTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
const css = Cypress.env('css');
|
5
|
+
const views = ['Question preview', 'Item view', 'Item preview', 'Student view', 'Grading view', 'Correct answer view'];
|
6
|
+
var itemReferenceID = "";
|
7
|
+
const correctTabAnswerArray = ['Flower', 'Leaf', 'Stem'];
|
8
|
+
|
9
|
+
//Note: Only one question per item should be present as we will need to use eqs and within to verify contents if multiple same elements are present for different question types
|
10
|
+
//Preview tab contents file should be created for all previous and new question types and this different views verification should be implemented for all q types
|
11
|
+
//Need to discuss how will be handling answer numeration
|
12
|
+
describe('Create item page - Fill in the gaps over image - text: Preview contents', () => {
|
13
|
+
before(() => {
|
14
|
+
cy.loginAs('admin');
|
15
|
+
});
|
16
|
+
|
17
|
+
views.forEach((view) => {
|
18
|
+
describe(`Preview tab contents - ${view}`, () => {
|
19
|
+
abortEarlySetup();
|
20
|
+
before(() => {
|
21
|
+
switch (view) {
|
22
|
+
case 'Question preview':
|
23
|
+
cy.log('Navigating to Fill in the gaps over image - text question type');
|
24
|
+
fillInTheGapsOverImageTextPage.steps.navigateToCreateQuestion('fill in the gaps over image - text');
|
25
|
+
cy.barsPreLoaderWait();
|
26
|
+
fillInTheGapsOverImageTextPage.steps.addQuestionInstructions();
|
27
|
+
fillInTheGapsOverImageTextPage.steps.uploadFile('highlightImage.jpg');
|
28
|
+
fillInTheGapsOverImageTextPage.steps.clickOnImagePopupOkButton();
|
29
|
+
fillInTheGapsOverImageTextPage.steps.addResponseContainer();
|
30
|
+
fillInTheGapsOverImageTextPage.steps.addResponseContainer();
|
31
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldSetCorrectAnswerSection(0, correctTabAnswerArray[0]);
|
32
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldSetCorrectAnswerSection(1, correctTabAnswerArray[1]);
|
33
|
+
fillInTheGapsOverImageTextPage.steps.allotPoints(10);
|
34
|
+
fillInTheGapsOverImageTextPage.steps.switchToPreviewTab();
|
35
|
+
break;
|
36
|
+
case 'Item view':
|
37
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
38
|
+
break;
|
39
|
+
case 'Item preview':
|
40
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
41
|
+
fillInTheGapsOverImageTextPage.steps.switchToPreviewTab();
|
42
|
+
break;
|
43
|
+
case 'Student view':
|
44
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
45
|
+
break;
|
46
|
+
case 'Grading view':
|
47
|
+
cy.visit(`/item-engine/demo/render-item/grading-view/${utilities.base64Encoding(itemReferenceID)}`);
|
48
|
+
break;
|
49
|
+
case 'Correct answer view':
|
50
|
+
cy.visit(`/item-engine/demo/render-item/correct-answer-view/${utilities.base64Encoding(itemReferenceID)}`);
|
51
|
+
break;
|
52
|
+
default:
|
53
|
+
throw new Error('Invalid view');
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
after(() => {
|
58
|
+
if (view === 'Question preview') {
|
59
|
+
fillInTheGapsOverImageTextPage.steps.clickOnSaveQuestionButton();
|
60
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
61
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
62
|
+
}
|
63
|
+
if (view === 'Student view') {
|
64
|
+
studentViewPage.steps.submitResponse();
|
65
|
+
utilities.verifyElementVisibilityState(studentViewPage.buttonGoToGradingView(), 'visible');
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
it('Question instructions should be visible', () => {
|
70
|
+
utilities.verifyInnerText(fillInTheGapsOverImageTextPage.questionInstructionsText(), 'Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
71
|
+
utilities.verifyElementVisibilityState(fillInTheGapsOverImageTextPage.questionInstructionsText(), 'visible');
|
72
|
+
});
|
73
|
+
|
74
|
+
it('When user has uploaded an image in the \'Image\' section then the uploaded image should be displayed in the preview tab', () => {
|
75
|
+
utilities.verifyElementVisibilityState(fillInTheGapsOverImageTextPage.imagePreviewTab(), 'visible');
|
76
|
+
});
|
77
|
+
|
78
|
+
if (view !== 'Grading view' && view !== 'Correct answer view') {
|
79
|
+
it('The added response fields should be displayed in the preview tab and they should be empty', () => {
|
80
|
+
utilities.verifyElementCount(fillInTheGapsOverImageTextPage.responseFieldPreviewTab(), 2);
|
81
|
+
fillInTheGapsOverImageTextPage.steps.verifyTextInResponseFieldPreviewTab(0, '');
|
82
|
+
fillInTheGapsOverImageTextPage.steps.verifyTextInResponseFieldPreviewTab(1, '');
|
83
|
+
});
|
84
|
+
|
85
|
+
it('User should be able to enter text in the response fields', () => {
|
86
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, correctTabAnswerArray[0]);
|
87
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, correctTabAnswerArray[1]);
|
88
|
+
fillInTheGapsOverImageTextPage.steps.verifyTextInResponseFieldPreviewTab(0, correctTabAnswerArray[0]);
|
89
|
+
fillInTheGapsOverImageTextPage.steps.verifyTextInResponseFieldPreviewTab(1, correctTabAnswerArray[1]);
|
90
|
+
});
|
91
|
+
} else {
|
92
|
+
it('The response fields should be displayed filled with answers', () => {
|
93
|
+
utilities.verifyElementCount(fillInTheGapsOverImageTextPage.responseFieldPreviewTab(), 2);
|
94
|
+
fillInTheGapsOverImageTextPage.steps.verifyTextInResponseFieldPreviewTab(0, correctTabAnswerArray[0]);
|
95
|
+
fillInTheGapsOverImageTextPage.steps.verifyTextInResponseFieldPreviewTab(1, correctTabAnswerArray[1]);
|
96
|
+
});
|
97
|
+
}
|
98
|
+
|
99
|
+
it('CSS of preview contents', { tags: 'css' }, () => {
|
100
|
+
utilities.verifyCSS(fillInTheGapsOverImageTextPage.responseContainerPointer().find('circle').eq(0), {
|
101
|
+
'fill': css.color.responseContainerPointer,
|
102
|
+
'r': '12px'
|
103
|
+
});
|
104
|
+
switch (view) {
|
105
|
+
case 'Question preview':
|
106
|
+
case 'Item preview':
|
107
|
+
case 'Item view':
|
108
|
+
case 'Item preview':
|
109
|
+
case 'Student view':
|
110
|
+
fillInTheGapsOverImageTextPage.steps.focusInResponseFieldPreviewTab(0);
|
111
|
+
utilities.verifyCSS(fillInTheGapsOverImageTextPage.responseFieldPreviewTab().parents('.cloze-with-text-response-preview-wrapper').find('fieldset').eq(0), {
|
112
|
+
'border': `1px solid ${css.color.activeButtons}`
|
113
|
+
});
|
114
|
+
utilities.verifyCSS(fillInTheGapsOverImageTextPage.responseFieldPreviewTab().parents('.cloze-with-text-response-preview-wrapper').find('fieldset').eq(1), {
|
115
|
+
'color': css.color.text,
|
116
|
+
'font-size': css.fontSize.default,
|
117
|
+
'font-weight': css.fontWeight.regular,
|
118
|
+
'border': `1px solid ${css.color.figDefaultComponentBorder}`
|
119
|
+
});
|
120
|
+
break;
|
121
|
+
case 'Grading view':
|
122
|
+
utilities.verifyCSS(fillInTheGapsOverImageTextPage.responseFieldPreviewTab().parents('.cloze-with-text-response-preview-wrapper').find('fieldset'), {
|
123
|
+
'border': `1px solid ${css.color.figDefaultComponentBorder}`
|
124
|
+
});
|
125
|
+
break;
|
126
|
+
case 'Correct answer view':
|
127
|
+
utilities.verifyCSS(fillInTheGapsOverImageTextPage.responseFieldPreviewTab().parents('.cloze-with-text-response-preview-wrapper').find('fieldset'), {
|
128
|
+
'color': css.color.text,
|
129
|
+
'font-size': css.fontSize.default,
|
130
|
+
'font-weight': css.fontWeight.regular,
|
131
|
+
'border': `1px solid ${css.color.figDefaultComponentBorder}`
|
132
|
+
});
|
133
|
+
break;
|
134
|
+
default:
|
135
|
+
throw new Error('Invalid view');
|
136
|
+
}
|
137
|
+
});
|
138
|
+
|
139
|
+
it('Accessibility of preview tab', { tags: 'a11y' }, () => {
|
140
|
+
cy.checkAccessibility(fillInTheGapsOverImageTextPage.questionInstructionsText().parents('[class*="ContentWrapper"]'));
|
141
|
+
});
|
142
|
+
});
|
143
|
+
});
|
144
|
+
});
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import { dialogBoxBase, fillInTheGapsOverImageTextPage, itemPreviewPage, studentViewPage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
import utilities from "../../../support/helpers/utilities";
|
4
|
+
import { gradingViewPage } from "../../../pages";
|
5
|
+
const views = ['Question preview', 'Item preview', 'Grading view'];
|
6
|
+
var itemReferenceID = "";
|
7
|
+
const correctTabAnswerArray = ['Flower', 'Leaf', 'Stem'];
|
8
|
+
const incorrectAnswerArray = ['Root', 'Branch', 'Seed'];
|
9
|
+
|
10
|
+
describe('Create item page - Fill in the gaps over image - text: Show correct answer', () => {
|
11
|
+
before(() => {
|
12
|
+
cy.loginAs('admin');
|
13
|
+
});
|
14
|
+
|
15
|
+
views.forEach((view) => {
|
16
|
+
describe(`Fill in the gaps over image - text: Show correct answer for all or nothing scoring - ${view}`, () => {
|
17
|
+
abortEarlySetup();
|
18
|
+
before(() => {
|
19
|
+
switch (view) {
|
20
|
+
case 'Question preview':
|
21
|
+
cy.log('Navigating to Fill in the gaps over image - text question type');
|
22
|
+
fillInTheGapsOverImageTextPage.steps.navigateToCreateQuestion('fill in the gaps over image - text');
|
23
|
+
cy.barsPreLoaderWait();
|
24
|
+
fillInTheGapsOverImageTextPage.steps.addQuestionInstructions();
|
25
|
+
fillInTheGapsOverImageTextPage.steps.uploadFile('highlightImage.jpg');
|
26
|
+
fillInTheGapsOverImageTextPage.steps.clickOnImagePopupOkButton();
|
27
|
+
fillInTheGapsOverImageTextPage.steps.addResponseContainer();
|
28
|
+
fillInTheGapsOverImageTextPage.steps.addResponseContainer();
|
29
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldSetCorrectAnswerSection(0, correctTabAnswerArray[0]);
|
30
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldSetCorrectAnswerSection(1, correctTabAnswerArray[1]);
|
31
|
+
fillInTheGapsOverImageTextPage.steps.allotPoints(10);
|
32
|
+
fillInTheGapsOverImageTextPage.steps.switchToPreviewTab();
|
33
|
+
break;
|
34
|
+
case 'Item preview':
|
35
|
+
cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
|
36
|
+
itemPreviewPage.steps.switchToPreviewTab();
|
37
|
+
break;
|
38
|
+
case 'Grading view':
|
39
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
afterEach(() => {
|
45
|
+
switch (view) {
|
46
|
+
case 'Question preview':
|
47
|
+
fillInTheGapsOverImageTextPage.steps.verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked();
|
48
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabCorrectAnswerContainerNotExist();
|
49
|
+
fillInTheGapsOverImageTextPage.steps.resetQuestionPreview();
|
50
|
+
break;
|
51
|
+
case 'Item preview':
|
52
|
+
itemPreviewPage.steps.verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked();
|
53
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabCorrectAnswerContainerNotExist();
|
54
|
+
itemPreviewPage.steps.resetQuestionPreview();
|
55
|
+
break;
|
56
|
+
case 'Grading view':
|
57
|
+
cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
|
58
|
+
break;
|
59
|
+
}
|
60
|
+
});
|
61
|
+
|
62
|
+
if (view === 'Question preview') {
|
63
|
+
after(() => {
|
64
|
+
fillInTheGapsOverImageTextPage.steps.clickOnSaveQuestionButton();
|
65
|
+
utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
|
66
|
+
itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
it('When the user selects \'Show correct answer\' checkbox without attempting the question, correct/incorrect icons or label should not be displayed, correct answer container along with \'Correct answers:\' label and correct responses with numeric count should be displayed below the question preview', () => {
|
71
|
+
if (view === 'Grading view') {
|
72
|
+
studentViewPage.steps.submitResponse();
|
73
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
74
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
75
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 10);
|
76
|
+
}
|
77
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
78
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabScoreText(0, 10);
|
79
|
+
fillInTheGapsOverImageTextPage.steps.checkShowCorrectAnswerCheckbox();
|
80
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
|
81
|
+
}
|
82
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectIconsDoesNotExist();
|
83
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabelNotExists();
|
84
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectBorderNotExists();
|
85
|
+
utilities.verifyInnerText(fillInTheGapsOverImageTextPage.previewTabCorrectAnswerLabel(), 'Correct answers:');
|
86
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount([correctTabAnswerArray[0], correctTabAnswerArray[1]], ['1', '2']);
|
87
|
+
});
|
88
|
+
|
89
|
+
it('When the user attempts the question incorrectly then on selecting \'Show correct answer\' checkbox, the user should be awarded 0 points and red cross-mark icons should be displayed beside all incorrect response fields, a label \'Incorrect answer\' and incorrect answer border should be displayed below the question preview and the correct answer container with all correct answers along with numeration should be displayed', () => {
|
90
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, incorrectAnswerArray[0]);
|
91
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, incorrectAnswerArray[1]);
|
92
|
+
if (view === 'Grading view') {
|
93
|
+
studentViewPage.steps.submitResponse();
|
94
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
95
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
96
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 10);
|
97
|
+
}
|
98
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
99
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabScoreText(0, 10);
|
100
|
+
fillInTheGapsOverImageTextPage.steps.checkShowCorrectAnswerCheckbox();
|
101
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
|
102
|
+
}
|
103
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionCrossmarkIcon(0);
|
104
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionCrossmarkIcon(1);
|
105
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
106
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectAttemptBorder();
|
107
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount([correctTabAnswerArray[0], correctTabAnswerArray[1]], ['1', '2']);
|
108
|
+
});
|
109
|
+
|
110
|
+
it('When the user attempts the question partially correct then on selecting \'Show correct answer\' checkbox, the user should be awarded 0 points, green check-mark should be displayed beside correct response fields, red cross-mark icons should be displayed incorrect response fields, a label \'Incorrect answer\' and incorrect answer border should be displayed below the question preview and the correct answer container with correct answers for incorrectly answered responses along with numeration should be displayed', () => {
|
111
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, incorrectAnswerArray[0]);
|
112
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, correctTabAnswerArray[1]);
|
113
|
+
if (view === 'Grading view') {
|
114
|
+
studentViewPage.steps.submitResponse();
|
115
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
116
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
117
|
+
gradingViewPage.steps.verifyGradingViewScore(0, 10);
|
118
|
+
}
|
119
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
120
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabScoreText(0, 10);
|
121
|
+
fillInTheGapsOverImageTextPage.steps.checkShowCorrectAnswerCheckbox();
|
122
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
|
123
|
+
}
|
124
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectOptionCrossmarkIcon(0);
|
125
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionCheckmarkIcon(1);
|
126
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
|
127
|
+
fillInTheGapsOverImageTextPage.steps.verifyIncorrectAttemptBorder();
|
128
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount([correctTabAnswerArray[0]], ['1']);
|
129
|
+
});
|
130
|
+
|
131
|
+
it('When the user attempts the question correctly then on selecting \'Show correct answer\' checkbox, the user should be awarded full points, green check-mark should be displayed beside correct response fields, a label \'Correct answer\' and correct answer border should be displayed below the question preview and the correct answer container should not be displayed', () => {
|
132
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(0, correctTabAnswerArray[0]);
|
133
|
+
fillInTheGapsOverImageTextPage.steps.enterTextInResponseFieldPreviewTab(1, correctTabAnswerArray[1]);
|
134
|
+
if (view === 'Grading view') {
|
135
|
+
studentViewPage.steps.submitResponse();
|
136
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
137
|
+
studentViewPage.steps.clickOnGoToGradingViewButton();
|
138
|
+
gradingViewPage.steps.verifyGradingViewScore(10, 10);
|
139
|
+
}
|
140
|
+
if (view === 'Question preview' || view === 'Item preview') {
|
141
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabScoreText(10, 10);
|
142
|
+
fillInTheGapsOverImageTextPage.steps.checkShowCorrectAnswerCheckbox();
|
143
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
|
144
|
+
}
|
145
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionCheckmarkIcon(0);
|
146
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectOptionCheckmarkIcon(1);
|
147
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
|
148
|
+
fillInTheGapsOverImageTextPage.steps.verifyCorrectAttemptBorder();
|
149
|
+
fillInTheGapsOverImageTextPage.steps.verifyPreviewTabCorrectAnswerContainerNotExist();
|
150
|
+
});
|
151
|
+
});
|
152
|
+
});
|
153
|
+
});
|
@@ -1,3 +1,5 @@
|
|
1
|
+
const defaultFormattingOptionsPreviewTab = ['Bold (Ctrl+B)', 'Italic (Ctrl+I)', 'Underline (Ctrl+U)', 'Superscript', 'Insert/Remove Bulleted List', 'Insert/Remove Numbered List', 'Insert Hyperlink', 'Insert Image', 'Special characters', 'Insert Table'];
|
2
|
+
|
1
3
|
const selectors = {
|
2
4
|
//Basic section
|
3
5
|
setWordLimitLabel: () => cy.get('[class*="EssayResponseComponentstyles__PropertyLabel"]'),
|
@@ -10,7 +12,13 @@ const selectors = {
|
|
10
12
|
showWordCountLabel: () => cy.get('.essay-response-question-word-limit-check-box-form-group').eq(1),
|
11
13
|
showWordCountCheckbox: () => cy.get('.essay-response-question-word-limit-check-box-form-group [type="checkbox"]').eq(1),
|
12
14
|
previewTabToolbarWrapper: () => cy.get('.toolbar-overlay'),
|
13
|
-
previewTabToolbarOption: (formattingOption) =>
|
15
|
+
previewTabToolbarOption: (formattingOption = null) => {
|
16
|
+
if (formattingOption) {
|
17
|
+
return cy.get(`.essay-preview-wrapper a[title = "${formattingOption}"]`).eq(0)
|
18
|
+
} else {
|
19
|
+
return cy.get('.essay-preview-wrapper a[title]').eq(0)
|
20
|
+
}
|
21
|
+
},
|
14
22
|
//Additional settings
|
15
23
|
studentResponseAndLayoutLabel: () => cy.get('.layout-text'),
|
16
24
|
predefinedTextLabel: () => cy.get('[class*="EssayResponsestyles__PropertyLabel"]'),
|
@@ -29,8 +37,8 @@ const selectors = {
|
|
29
37
|
customSpecialCharacterInputField: () => cy.get('input[aria-label="Custom Special Characters"]'),
|
30
38
|
wordLimitReachedWarningMessage: () => cy.get('[data-at="limit-reached"]'),
|
31
39
|
//Preview tab
|
32
|
-
responseField: () => cy.get('[title="Enter your response to the question here."]'),
|
33
|
-
responseFieldWordCount: () => cy.get('[data-at="character-count"]'),
|
40
|
+
responseField: () => cy.get('[title="Enter your response to the question here."]').eq(0),
|
41
|
+
responseFieldWordCount: () => cy.get('[data-at="character-count"]').eq(0),
|
34
42
|
}
|
35
43
|
|
36
44
|
const steps = {
|
@@ -53,8 +61,17 @@ const steps = {
|
|
53
61
|
},
|
54
62
|
|
55
63
|
enterTextInResponseField: (textContent) => {
|
64
|
+
essayResponseCommonComponents.steps.enterInputInResponseField(textContent);
|
65
|
+
essayResponseCommonComponents.steps.verifyResponseFieldInput(textContent);
|
66
|
+
},
|
67
|
+
|
68
|
+
enterInputInResponseField: (textContent) => {
|
69
|
+
essayResponseCommonComponents.responseField()
|
70
|
+
.type(textContent);
|
71
|
+
},
|
72
|
+
|
73
|
+
verifyResponseFieldInput: (textContent) => {
|
56
74
|
essayResponseCommonComponents.responseField()
|
57
|
-
.type(textContent)
|
58
75
|
.find('p')
|
59
76
|
.should('have.text', textContent);
|
60
77
|
},
|
@@ -78,6 +95,24 @@ const steps = {
|
|
78
95
|
essayResponseCommonComponents.responseField()
|
79
96
|
.type('{backspace}');
|
80
97
|
},
|
98
|
+
|
99
|
+
verifyGradingViewResponseFieldIsNonEditable: () => {
|
100
|
+
essayResponseCommonComponents.responseField()
|
101
|
+
.should('have.attr', 'contenteditable', 'false');
|
102
|
+
},
|
103
|
+
|
104
|
+
verifyDefaultToolbarOptions: () => {
|
105
|
+
essayResponseCommonComponents.previewTabToolbarOption()
|
106
|
+
.each(($element, count) => {
|
107
|
+
cy.wrap($element)
|
108
|
+
.should('have.attr', 'title', defaultFormattingOptionsPreviewTab[count])
|
109
|
+
.and('be.visible');
|
110
|
+
});
|
111
|
+
essayResponseCommonComponents.previewTabToolbarOption('Underline (Ctrl+U)')
|
112
|
+
.next()
|
113
|
+
.should('have.attr', 'role', 'separator')
|
114
|
+
.should('be.visible');
|
115
|
+
}
|
81
116
|
}
|
82
117
|
|
83
118
|
export const essayResponseCommonComponents = {
|
@@ -32,7 +32,7 @@ const selectors = {
|
|
32
32
|
setCorrectAnswerResponseFieldLabel: () => cy.get('.cloze-with-text-form-control-wrapper .input-field-label'),
|
33
33
|
imageSectionImageLabel: () => cy.get('[class*="LabelImageWithDropDownstyles__LabelWrapper"]'),
|
34
34
|
imageSectionImage: () => cy.get('.image-container img'),
|
35
|
-
imagePreviewTab: () => cy.get('
|
35
|
+
imagePreviewTab: () => cy.get('[class*="ClozeWithTextResponsestyles__ContentWrapper"] .image-container img'),
|
36
36
|
imagePropertiesContainer: () => cy.get('[class*="AddTextResponseOnImagestyles__DimensionsContainer"]'),
|
37
37
|
responseNumeration: () => cy.get('.response-input-adornment'),
|
38
38
|
uploadImageSectionWrapper: () => cy.get('[class*="ImagePopupWrapper"]'),
|
@@ -19,7 +19,7 @@ const selectors = {
|
|
19
19
|
ignoreSpacesBeforeAndAfterCheckbox: () => cy.get('.ngie-checkbox input').eq(1),
|
20
20
|
matchFromAllResponsesLabel: () => cy.get('.ngie-checkbox-control-label').eq(2),
|
21
21
|
matchFromAllResponsesCheckbox: () => cy.get('.ngie-checkbox input').eq(2),
|
22
|
-
responseFieldPreviewTab: () => cy.get('[class*="
|
22
|
+
responseFieldPreviewTab: () => cy.get('[class*="ClozeWithTextResponsestyles__ContentWrapper"] .response-input-field input[type="text"]'),
|
23
23
|
responseFieldWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-input-field'),
|
24
24
|
previewTabCorrectAnswerContainer: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectAnswerWrapper"]'),
|
25
25
|
previewTabCorrectAnswerResponseWrapper: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectResponseWrapper"] [aria-label*="Add answer for response"]'),
|
@@ -5,7 +5,7 @@ const css = Cypress.env('css');
|
|
5
5
|
const selectors = {
|
6
6
|
questionInstructionsLabelEditTab: () => cy.get('.edit-question-instruction-label'),
|
7
7
|
questionInstructionsInputField: () => cy.get('[title="Question Instructions"]'),
|
8
|
-
questionInstructionsText: () => cy.get('.
|
8
|
+
questionInstructionsText: () => cy.get('.question-instruction').eq(0),
|
9
9
|
}
|
10
10
|
|
11
11
|
const steps = {
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import utilities from "../support/helpers/utilities"
|
2
|
+
|
3
|
+
const selectors = {
|
4
|
+
correctAnswerViewQuestionInstructions: () => cy.get('.question-text-wrapper'),
|
5
|
+
manualScoredQuestionHelpText: () => cy.get('[class*="NoGuidanceWrapper"]'),
|
6
|
+
availablePoints: () => cy.get('.correct-answer-view-points')
|
7
|
+
}
|
8
|
+
|
9
|
+
const steps = {
|
10
|
+
/**
|
11
|
+
* @description Verify displayed available points
|
12
|
+
* @param {number} availablePoints displayed available points
|
13
|
+
*/
|
14
|
+
verifyAvailablePoints: (availablePoints) => {
|
15
|
+
utilities.verifyTextContent(correctAnswerViewPage.availablePoints(), `${availablePoints} Points`);
|
16
|
+
},
|
17
|
+
}
|
18
|
+
export const correctAnswerViewPage = {
|
19
|
+
...selectors,
|
20
|
+
steps
|
21
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import utilities from "../support/helpers/utilities";
|
2
|
+
|
3
|
+
const selectors = {
|
4
|
+
scoredPointsInputField: () => cy.get('[class*="GradingScoreWrapper"] input'),
|
5
|
+
TotalPoints: () => cy.get('[class*="GradingScoreWrapper"] [class*="TotalPoints"]')
|
6
|
+
}
|
7
|
+
|
8
|
+
const steps = {
|
9
|
+
/**
|
10
|
+
* @description Verify the displayed score in grading view
|
11
|
+
* @param {number} scoredPoints Points scored for the attempted answer
|
12
|
+
* @param {number} TotalPoints Total number of points
|
13
|
+
*/
|
14
|
+
verifyGradingViewScore: (scoredPoints, TotalPoints) => {
|
15
|
+
gradingViewPage.scoredPointsInputField()
|
16
|
+
.should('have.value', scoredPoints);
|
17
|
+
utilities.verifyTextContent(gradingViewPage.TotalPoints(), `/ ${TotalPoints} points`)
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
export const gradingViewPage = {
|
22
|
+
...selectors,
|
23
|
+
steps
|
24
|
+
}
|
package/cypress/pages/index.js
CHANGED
@@ -28,3 +28,7 @@ export * from './audioPlayerPage';
|
|
28
28
|
export * from './highlightImagePage';
|
29
29
|
export * from './fillInTheGapsOverImageDropdownPage';
|
30
30
|
export * from './fillInTheGapsOverImageTextPage';
|
31
|
+
export * from './itemPreviewPage';
|
32
|
+
export * from './studentViewPage';
|
33
|
+
export * from './gradingViewPage';
|
34
|
+
export * from './correctAnswerViewPage';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { createQuestionBasePage, autoScoredPreviewBase } from "./components";
|
2
|
+
|
3
|
+
const selectors = {
|
4
|
+
referenceID: () => cy.get('.edit-item-reference-id'),
|
5
|
+
}
|
6
|
+
|
7
|
+
const steps = {
|
8
|
+
...createQuestionBasePage.steps,
|
9
|
+
...autoScoredPreviewBase.steps,
|
10
|
+
getItemReferenceID: () => {
|
11
|
+
const itemRefID = [];
|
12
|
+
itemPreviewPage.referenceID()
|
13
|
+
.invoke('text')
|
14
|
+
.then(($text) => {
|
15
|
+
let refID = $text
|
16
|
+
itemRefID.push(refID)
|
17
|
+
});
|
18
|
+
return itemRefID;
|
19
|
+
},
|
20
|
+
}
|
21
|
+
|
22
|
+
export const itemPreviewPage = {
|
23
|
+
...selectors,
|
24
|
+
steps
|
25
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const selectors = {
|
2
|
+
submitButton: () => cy.get('button[aria-label="Submit"]'),
|
3
|
+
buttonGoToGradingView: () => cy.get('.action-btn-wrapper button'),
|
4
|
+
}
|
5
|
+
|
6
|
+
const steps = {
|
7
|
+
submitResponse: () => {
|
8
|
+
studentViewPage.submitButton()
|
9
|
+
.click();
|
10
|
+
},
|
11
|
+
|
12
|
+
clickOnGoToGradingViewButton: () => {
|
13
|
+
studentViewPage.buttonGoToGradingView()
|
14
|
+
.click();
|
15
|
+
cy.url()
|
16
|
+
.should('contain', 'grading-view');
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
export const studentViewPage = {
|
21
|
+
...selectors,
|
22
|
+
steps
|
23
|
+
}
|
@@ -116,6 +116,16 @@ const utilities = {
|
|
116
116
|
*/
|
117
117
|
triggerMouseout: (selector) => {
|
118
118
|
selector.trigger('mouseout');
|
119
|
+
},
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @description Perform base64 encoding on provided string
|
123
|
+
* @param {string} str string to undergo base64 encoding
|
124
|
+
* @returns {string} base64 encoded version of the provided string
|
125
|
+
*/
|
126
|
+
base64Encoding: (str) => {
|
127
|
+
const base64 = btoa(str);
|
128
|
+
return encodeURIComponent(base64).replace(/([!*'();:@&=+$,/?#[]~])/g, match => `%${match.charCodeAt(0).toString(16).toUpperCase()}`);
|
119
129
|
}
|
120
130
|
}
|
121
131
|
|
package/package.json
CHANGED
@@ -66,7 +66,8 @@ function setCommandLineEnvArgs() {
|
|
66
66
|
* @param {string} ciBuildId
|
67
67
|
*/
|
68
68
|
function runSorryCypress(ciBuildId, envArgs) {
|
69
|
-
let command = `cypress-cloud run --parallel --browser chrome --record --key ImagineLearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs}`;
|
69
|
+
// let command = `cypress-cloud run --parallel --browser chrome --record --key ImagineLearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs}`;
|
70
|
+
let command = `cypress-cloud run --parallel --browser chrome --record --key ImagineLearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs} --spec "cypress\e2e\ILC\ShortTextResponse\*.js"`;
|
70
71
|
execSync(command, { stdio: "inherit" });
|
71
72
|
}
|
72
73
|
|