itemengine-cypress-automation 1.0.348 → 1.0.350-feature-thinkSphere-01c175a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/ILC/ThinkSphere/additionalSettings.js +52 -0
- package/cypress/e2e/ILC/ThinkSphere/createReviewItem.js +58 -0
- package/cypress/e2e/ILC/ThinkSphere/editTabBasicSection.js +366 -0
- package/cypress/e2e/ILC/ThinkSphere/editThinkSphereQuestion.smoke.js +26 -0
- package/cypress/e2e/ILC/ThinkSphere/headerSection.js +53 -0
- package/cypress/e2e/ILC/ThinkSphere/planPhase.js +216 -0
- package/cypress/e2e/ILC/ThinkSphere/solvePhase.js +263 -0
- package/cypress/fixtures/theme/ilc.json +10 -1
- package/cypress/fixtures/uploads/sample20MB.mp4 +0 -0
- package/cypress/fixtures/uploads/sample2MB.mp4 +0 -0
- package/cypress/fixtures/uploads/sample2MB_2.mp4 +0 -0
- package/cypress/pages/components/backgroundImageUploadComponent.js +32 -24
- package/cypress/pages/components/browseItemsPage.js +891 -7
- package/cypress/pages/components/ckEditorAudioPlayerComponent.js +1 -1
- package/cypress/pages/components/commonComponents.js +4 -1
- package/cypress/pages/components/createQuestionBasePage.js +1 -1
- package/cypress/pages/components/defaultToolDropdown.js +7 -6
- package/cypress/pages/dialogBoxBase.js +2 -1
- package/cypress/pages/index.js +2 -1
- package/cypress/pages/selectQuestionResourceToolPage.js +8 -2
- package/cypress/pages/thinkSpherePage.js +1307 -0
- package/package.json +2 -2
@@ -0,0 +1,1307 @@
|
|
1
|
+
import utilities from "../support/helpers/utilities";
|
2
|
+
import { browseItemsPage } from "../pages/components/browseItemsPage";
|
3
|
+
import { dialogBoxBase } from "../pages/dialogBoxBase";
|
4
|
+
import { backgroundImageUploadComponent, createQuestionBasePage, scoringSectionBaseEditTab, commonComponents, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, toolSettingsComponent, questionInstructionsComponent, studentViewSettingsLabelComponent, defaultToolDropdown, essayResponseCommonComponents, equationEditorSectionCommonComponent, equationEditorFlyout } from "./components"
|
5
|
+
import { drawingResponsePage } from "./drawingResponsePage";
|
6
|
+
import { optionsWrapperComponent } from "../pages/components/optionsWrapperComponent";
|
7
|
+
import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
|
8
|
+
const css = Cypress.env('css');
|
9
|
+
|
10
|
+
const selectors = {
|
11
|
+
...backgroundImageUploadComponent,
|
12
|
+
...questionInstructionsComponent,
|
13
|
+
...commonComponents,
|
14
|
+
...scoringSectionBaseEditTab,
|
15
|
+
...additionalSettingsPanel,
|
16
|
+
...drawingResponsePage,
|
17
|
+
...defaultToolDropdown,
|
18
|
+
...optionsWrapperComponent,
|
19
|
+
...essayResponseCommonComponents,
|
20
|
+
...equationEditorSectionCommonComponent,
|
21
|
+
...selectQuestionResourceToolPage,
|
22
|
+
...browseItemsPage,
|
23
|
+
editQuestionPencil: () => cy.get('[class*="Widgetstyles__HeaderContainer"] button.icon-pencil'),
|
24
|
+
widgetHeaderQuestionTitle: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="Widgetstyles__QuestionTypeText"]'),
|
25
|
+
imageUploadSection: () => cy.get('[class*="TabsComponentstyles__ImageUploadComponentWrapper"]'),
|
26
|
+
addThinkSphereQuestionButton: () => cy.get('.ngie-btn-contained').contains('add ThinkSphere question'),
|
27
|
+
whiteBoardImageProperties: () => cy.get('[class*="WhiteBoardImagePropertiesstyles__ImagePropertiesWrapper"]'),
|
28
|
+
whiteBoardImagePropertiesInputTypeFile: () => cy.get('[class*="WhiteBoardImagePropertiesstyles__ImagePropertiesWrapper"] input[type="file"]'),
|
29
|
+
topLeftButton: () => utilities.getNthElement(cy.get('button[class*="WhiteBoardImagePropertiesstyles__StyledButton"]'), 0),
|
30
|
+
centerButton: () => utilities.getNthElement(cy.get('button[class*="WhiteBoardImagePropertiesstyles__StyledButton"]'), 1),
|
31
|
+
topRightButton: () => utilities.getNthElement(cy.get('button[class*="WhiteBoardImagePropertiesstyles__StyledButton"]'), 2),
|
32
|
+
opacityLabel: () => utilities.getNthElement(cy.get('h2[class*="WhiteBoardImagePropertiesstyles__LayoutLabel"]'), 1),
|
33
|
+
imageAlternativeTextLabel: () => cy.get('div[class*="InlineTextFieldWithDebouncestyles__PropertyLabel"]'),
|
34
|
+
imageAlternativeTextInputField: () => cy.get('[class*="WhiteBoardImagePropertiesstyles__AltTextWrapper"] input'),
|
35
|
+
imageRadioButton: () => cy.get('div[data-value="image"]'),
|
36
|
+
imageRadioInput: () => cy.get('div[data-value="image"] input[type="radio"]'),
|
37
|
+
pageImageTitle: () => cy.get('div[class*="WhiteBoardImagePropertiesstyles__PageImageTitle"]'),
|
38
|
+
radioGroupWrapper: () => cy.get('div[class*="ngie-radio-group-wrapper"]'),
|
39
|
+
blankCanvasRadioInput: () => cy.get('div[data-value="blankCanvas"] input[type="radio"]'),
|
40
|
+
imageUploadSectionWrapper: () => cy.get('div[class*="UploadImagestyles__BackgroundImageWrapper"]'),
|
41
|
+
pageImagePropertiesTitle: () => cy.get('div[class*="WhiteBoardImagePropertiesstyles__PageImagePropertiesTitle"]'),
|
42
|
+
layoutLabel: () => cy.get('h2[class*="WhiteBoardImagePropertiesstyles__LayoutLabel"]'),
|
43
|
+
alignmentOptions: () => cy.get('ul[class*="WhiteBoardImagePropertiesstyles__AlignmentOptions"]'),
|
44
|
+
solvePhaseAccordion: () => utilities.getNthElement(cy.get('[class*="Solvestyles__SolvePhaseAccordionWrapper"] .ngie-accordion-summary'), 0),
|
45
|
+
solvePhaseAccordionLabel: () => utilities.getNthElement(cy.get('.thinksphere-author-phases-accordion [class*="Solvestyles__HeadingLabel"]'), 0),
|
46
|
+
solvePhaseAccordionExpandIcon: () => utilities.getNthElement(cy.get('.thinksphere-author-phases-accordion [class*="expandIconWrapper"]'), 0),
|
47
|
+
solveToolsAndControlsOptionsTiles: (formattingOption) => cy.get(`.icon-button-custom-format[aria-label*="${formattingOption}"]`),
|
48
|
+
solvePhaseAccordionContentWrapper: () => cy.get('.thinksphere-author-phases-accordion [class*="Solvestyles__ContentWrapper"]'),
|
49
|
+
customizeToolsAndControls: () => cy.get('.thinksphere-author-phases-accordion .customize-tools-and-controls-wrapper .ngie-accordion-summary'),
|
50
|
+
customizeToolsAndControlsIcon: () => cy.get('.thinksphere-author-phases-accordion .customize-tools-and-controls-wrapper [class*="expandIconWrapper"]'),
|
51
|
+
customizeToolsAndControlsLabel: () => cy.get('.thinksphere-author-phases-accordion .customize-tools-and-controls-wrapper [class*="Solvestyles__HeadingLabel"]'),
|
52
|
+
phasesSection: () => cy.get('[class*="Phasesstyles__PhasesWrapper"]'),
|
53
|
+
phasesSectionTitle: () => cy.get('[class*="Phasesstyles__PhasesTextWrapper"]'),
|
54
|
+
planPhaseSection: () => cy.get('[class*="Planstyles__PlanAccordianWrapper"]'),
|
55
|
+
planPhaseAccordian: () => cy.get('[class*="Planstyles__PlanAccordianWrapper"] [class~="MuiAccordionSummary-root"]'),
|
56
|
+
planPhaseAccordianLabel: () => cy.get('[class*="Planstyles__AccordionLabel"]'),
|
57
|
+
planPhaseSectionDescription: () => cy.get('[class*="Planstyles__PlanAccordianWrapper"] [class*="Planstyles__PlanDescriptionTextWrapper"]'),
|
58
|
+
planStrategySection: () => cy.get('[class*="Planstyles__StrategiesWrapper"]'),
|
59
|
+
planStrategyListHeader: () => cy.get('[class*="Planstyles__StrategiesWrapper"] [class*="Planstyles__HeadingTextWrapper"]'),
|
60
|
+
planStrategyListResetToDefault: () => cy.get('[class*="Planstyles__StrategiesWrapper"] [class*="Planstyles__DefaultResetWrapper"]'),
|
61
|
+
planStrategyAddItemButton: () => cy.get('[class*="Planstyles__StrategiesWrapper"] [class*="ListOptionsComponentstyles__AddItemWrapper"] [role="button"]'),
|
62
|
+
planStrategyCheckbox: () => cy.get('[class*="Planstyles__StrategiesWrapper"] .thinksphere-option-text-field-wrapper [data-ngie-testid*="-checkbox"]'),
|
63
|
+
videoLinkComponent: () => utilities.getNthElement(cy.get('[class*="ListOptionsComponentstyles__UploadVideoWrapper"]'), 0),
|
64
|
+
uploadVideoLinkButton: () => cy.get('[class*="ListOptionsComponentstyles__UploadVideoTextWrapper"]'),
|
65
|
+
planSentenceStarterSection: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"]'),
|
66
|
+
planSentenceStarterListHeader: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] [class*="Planstyles__HeadingTextWrapper"]'),
|
67
|
+
planSentenceStarterListResetToDefault: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] [class*="Planstyles__DefaultResetWrapper"]'),
|
68
|
+
planSentenceStarterAddItemButton: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] [class*="ListOptionsComponentstyles__AddItemWrapper"] [role="button"]'),
|
69
|
+
planSentenceStarterCheckbox : () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] .thinksphere-option-text-field-wrapper [data-ngie-testid*="-checkbox"]'),
|
70
|
+
solvePhaseAccordian: () => cy.get('[class*="Planstyles__SolveAccordianWrapper"] [class~="MuiAccordionSummary-root"] [role="button"]'),
|
71
|
+
solvePhaseAccordianLabel: () => cy.get('[class*="Solvestyles__AccordionLabel"]'),
|
72
|
+
inputTypeVideoFile: () => cy.get('[class*="Planstyles__StrategiesWrapper"] input[type="file"]'),
|
73
|
+
inputTypeFile: () => cy.get('[class*="TabsComponentstyles__ImageUploadComponentWrapper"] input[type="file"]'),
|
74
|
+
warningPopupTitle: () => cy.get('.dialog-title-wrapper'),
|
75
|
+
warningPopupContentText: () => cy.get('.upload-question-preview-popup-error-msg'),
|
76
|
+
warningPopupOkButton: () => cy.get('.upload-question-preview-popup-ok-btn'),
|
77
|
+
editVideoButton: () => cy.get('[aria-label*="Edit video"]'),
|
78
|
+
deleteVideoButton: () => cy.get('[aria-label*="Delete video"]'),
|
79
|
+
listInputField: () => cy.get('.option-component textarea[placeholder]'),
|
80
|
+
deleteButton: () => cy.get('button[aria-label*="Delete item"]'),
|
81
|
+
optionNumeration: () => cy.get('[class*="MuiInputAdornment-positionStart"]'),
|
82
|
+
iconPencil: () => cy.get('div[class*="icon-pencil"]'),
|
83
|
+
iconXCircle: () => cy.get('div[class*="icon-x-circle"]'),
|
84
|
+
dragIcon: () => cy.get('[class*="drag-icon-edit"]'),
|
85
|
+
moreOptionsIcon: () => cy.get('[class*="more-options-icon"]'),
|
86
|
+
ThinkSphereQuestionHeaderPencilIcon: () => utilities.getNthElement(cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-pencil"]'), 0),
|
87
|
+
ThinkSphereMathQuestionHeaderSwapIcon: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-swap"]'),
|
88
|
+
ThinkSphereMathQuestionHeaderPencilIcon: () => utilities.getNthElement(cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-pencil"]'), 1),
|
89
|
+
thinkSphereMathQuestionHeaderDeleteIcon: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-Delete"]'),
|
90
|
+
addCheckMathQuestionButton: () => cy.get('.ngie-btn-typography').contains(`Add 'Check your math' question`),
|
91
|
+
firstAvailableItemLink: () => utilities.getNthElement(cy.get('.browse-item-styled-link'), 0),
|
92
|
+
saveButton: () => cy.get('.ngie-btn-typography').contains('save',{matchCase: false}),
|
93
|
+
AddCheckMathQuestionHeader: () => cy.get('.browse-title-wrapper').contains(`Add 'Check your math' question`),
|
94
|
+
singleOptionTextFieldWrapper: () => cy.get('[class*="SingleOptionstyle__TextFieldWrapper"]'),
|
95
|
+
customizeStampComponent: () => cy.get('[class*="CustomizeStampstyles__CustomizeStampWrapper"]'),
|
96
|
+
customizeStampHeading: () => cy.get('[class*="CustomizeStampstyles__CustomizeStampHeading"]'),
|
97
|
+
customizeStampCard: (ariaLabel) => cy.get(`[class*="CustomizeStampstyles__StampCard"]${ariaLabel ? ('[aria-label="' + ariaLabel + '"]') : ''}`),
|
98
|
+
customizeStampCardImg: (ariaLabel) => cy.get('[class*="CustomizeStampstyles__QuestionImage"]'),
|
99
|
+
questionImage: () => cy.get('img[class*="QuestionImageComponentstyle__QuestionImage"]'),
|
100
|
+
stampsToolButton: () => cy.get('#stamps button[aria-label*="Stamps"]'),
|
101
|
+
imageUploadSectionImageLabel: () => thinkSpherePage.imageUploadSection().find('div[class*="edit-question-image-label"]'),
|
102
|
+
imageUploadSectionUploadFileContent: () => thinkSpherePage.imageUploadSection().find('div[class*="upload-file-content"]'),
|
103
|
+
imageUploadSectionUploadCloudIconWrapper: () => thinkSpherePage.imageUploadSection().find('div[class*="upload-question-upload-cloud-icon-wrapper"]'),
|
104
|
+
imageUploadSectionDragDropFileText: () => thinkSpherePage.imageUploadSection().find('span[class*="drag-and-drop-file-text"]'),
|
105
|
+
imageUploadSectionFileInputLabel: () => thinkSpherePage.imageUploadSection().find('div[class*="file-input-label"]'),
|
106
|
+
imageUploadSectionDeviceIcon: () => thinkSpherePage.imageUploadSection().find('span[class*="icon-Device"]'),
|
107
|
+
imageUploadSectionSupportedFileText: () => thinkSpherePage.imageUploadSection().find('span[class*="supported-file-text"]'),
|
108
|
+
imageUploadSectionSupportedFileIconWrapper: () => thinkSpherePage.imageUploadSection().find('div[class*="supported-file-icon-wrapper"]'),
|
109
|
+
imageUploadSectionMaximumFileSize: () => thinkSpherePage.imageUploadSection().find('div[class*="maximum-file-size"]'),
|
110
|
+
imageUploadSectionFileUploaderWrapper: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__FileUploaderWrapper"]'),
|
111
|
+
imageUploadSectionQuestionImage: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__QuestionImage"]'),
|
112
|
+
imageUploadSectionQuestionImageContainer: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__QuestionImageContainer"]'),
|
113
|
+
imageUploadSectionQuestionImageEditIcon: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__EditIcon"]'),
|
114
|
+
imageUploadSectionQuestionImageCrossIcon: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__CrossIcon"]'),
|
115
|
+
imageRadioButtonParentSvg: () => thinkSpherePage.imageRadioButton().parent().find('svg'),
|
116
|
+
solvePhaseAccordionSvg: () => thinkSpherePage.solvePhaseAccordion().find('svg'),
|
117
|
+
customizeToolsAndControlsSvg: () => thinkSpherePage.customizeToolsAndControls().find('svg'),
|
118
|
+
solvePhaseToolsAndControlsOptionsTilesFeatherCheckIcon: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('[data-name="Icon feather-check"]'),
|
119
|
+
solvePhaseToolsAndControlsOptionsTilesRectangle: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('[data-name*="Rectangle"]'),
|
120
|
+
solvePhaseToolsAndControlsOptionsTilesDragItemFlexWrapperSvg: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('.drag-item-flex-wrapper svg'),
|
121
|
+
solvePhaseToolsAndControlsOptionsTilesTextDragIconSvgPath: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('.drag-icon-button-custom-format svg path'),
|
122
|
+
solvePhaseToolsAndControlsOptionsTilesArrayDragIconSvgPath: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Array').find('.drag-icon-button-custom-format svg path')
|
123
|
+
};
|
124
|
+
|
125
|
+
const steps = {
|
126
|
+
...createQuestionBasePage.steps,
|
127
|
+
...backgroundImageUploadComponent.steps,
|
128
|
+
...questionInstructionsComponent.steps,
|
129
|
+
...scoringSectionBaseEditTab.steps,
|
130
|
+
...commonComponents.steps,
|
131
|
+
...additionalSettingsPanel.steps,
|
132
|
+
...toolSettingsComponent.steps,
|
133
|
+
...studentViewSettingsLabelComponent.tests,
|
134
|
+
...defaultToolDropdown.steps,
|
135
|
+
...optionsWrapperComponent.steps,
|
136
|
+
...essayResponseCommonComponents.steps,
|
137
|
+
...equationEditorFlyout.steps,
|
138
|
+
...equationEditorSectionCommonComponent.steps,
|
139
|
+
...selectQuestionResourceToolPage.steps,
|
140
|
+
...browseItemsPage.steps,
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Navigates to the ThinkSphere create question page.
|
144
|
+
* @param {string} questionType - The type of question to create.
|
145
|
+
*/
|
146
|
+
navigateToThinkSphereCreateQuestion: (questionType) => {
|
147
|
+
cy.visit('/item-engine/thinksphere/create-item');
|
148
|
+
thinkSpherePage.steps.addThinkSphereQuestion();
|
149
|
+
},
|
150
|
+
|
151
|
+
addThinkSphereQuestion: () => {
|
152
|
+
thinkSpherePage.addThinkSphereQuestionButton()
|
153
|
+
.click();
|
154
|
+
},
|
155
|
+
|
156
|
+
/**
|
157
|
+
* Verifies if the accordion is collapsed.
|
158
|
+
* @param {string} accordian - The accordion to verify ('plan' or 'solve').
|
159
|
+
* @param {boolean} isCollapsed - Whether the accordion should be collapsed.
|
160
|
+
*/
|
161
|
+
verifyAccordianCollapsed: (accordian, isCollapsed) => {
|
162
|
+
if (accordian === 'plan') {
|
163
|
+
thinkSpherePage.planPhaseAccordian()
|
164
|
+
.should('have.attr', 'aria-expanded', isCollapsed ? 'false' : 'true');
|
165
|
+
} else if (accordian === 'solve') {
|
166
|
+
thinkSpherePage.solvePhaseAccordian()
|
167
|
+
.should('have.attr', 'aria-expanded', isCollapsed ? 'false' : 'true');
|
168
|
+
}
|
169
|
+
},
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Clicks on the specified accordion.
|
173
|
+
* @param {string} accordian - The accordion to click ('plan' or 'solve').
|
174
|
+
*/
|
175
|
+
clickOnAccordian: (accordian) => {
|
176
|
+
if (accordian === 'plan') {
|
177
|
+
thinkSpherePage.planPhaseAccordian()
|
178
|
+
.click();
|
179
|
+
} else if (accordian === 'solve') {
|
180
|
+
thinkSpherePage.solvePhaseAccordian()
|
181
|
+
.click();
|
182
|
+
}
|
183
|
+
cy.wait(500);
|
184
|
+
},
|
185
|
+
|
186
|
+
clickOnEditThinkSphereItem: () => {
|
187
|
+
browseItemsPage.steps.clickOnItemReferenceId('~zzz item name');
|
188
|
+
utilities.getNthElement(thinkSpherePage.editQuestionPencil(), 0)
|
189
|
+
.click();
|
190
|
+
cy.barsPreLoaderWait();
|
191
|
+
},
|
192
|
+
|
193
|
+
clickOnAddCheckMathQuestionButton: () => {
|
194
|
+
thinkSpherePage.addCheckMathQuestionButton()
|
195
|
+
.click();
|
196
|
+
cy.interceptGraphql('getItems');
|
197
|
+
},
|
198
|
+
|
199
|
+
clickOnFirstAvailableItemLink: () => {
|
200
|
+
thinkSpherePage.firstAvailableItemLink()
|
201
|
+
.click();
|
202
|
+
cy.interceptGraphql('getItems');
|
203
|
+
},
|
204
|
+
|
205
|
+
clickOnSaveButton: () => {
|
206
|
+
cy.interceptGraphql('setItem');
|
207
|
+
thinkSpherePage.saveButton()
|
208
|
+
.click();
|
209
|
+
cy.wait('@setItem');
|
210
|
+
},
|
211
|
+
|
212
|
+
clickOnSwapButton: () => {
|
213
|
+
thinkSpherePage.ThinkSphereMathQuestionHeaderSwapIcon()
|
214
|
+
.click();
|
215
|
+
cy.wait(2000);
|
216
|
+
},
|
217
|
+
|
218
|
+
clickOnDeleteButton: () => {
|
219
|
+
thinkSpherePage.thinkSphereMathQuestionHeaderDeleteIcon()
|
220
|
+
.click();
|
221
|
+
cy.wait(2000);
|
222
|
+
},
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Verifies the question title.
|
226
|
+
* @param {string} questionType - The type of question to verify.
|
227
|
+
*/
|
228
|
+
verifyQuestionTitle: (questionType) => {
|
229
|
+
utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.widgetHeaderQuestionTitle(), 0), questionType);
|
230
|
+
},
|
231
|
+
|
232
|
+
verifyPlanSectionAccessibility: () => {
|
233
|
+
thinkSpherePage.planPhaseSection().find('div[class~="MuiAccordionSummary-root"]')
|
234
|
+
.should('have.attr', 'aria-expanded', 'true')
|
235
|
+
.should('have.attr', 'role', 'button')
|
236
|
+
.should('have.attr', 'tabindex', '0');
|
237
|
+
},
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Uploads a file.
|
241
|
+
* @param {string} file - The file to upload.
|
242
|
+
*/
|
243
|
+
uploadFile: (file) => {
|
244
|
+
thinkSpherePage.inputTypeFile()
|
245
|
+
.attachFile(file);
|
246
|
+
cy.wait(4000);
|
247
|
+
},
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Uploads a video file.
|
251
|
+
* @param {string} file - The file to upload.
|
252
|
+
*/
|
253
|
+
uploadVideoFile: (file) => {
|
254
|
+
thinkSpherePage.inputTypeVideoFile()
|
255
|
+
.attachFile(file);
|
256
|
+
cy.wait(4000);
|
257
|
+
},
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Uploads a file to the whiteboard.
|
261
|
+
* @param {string} file - The file to upload.
|
262
|
+
*/
|
263
|
+
WhiteBoardUploadFile: (file) => {
|
264
|
+
thinkSpherePage.whiteBoardImagePropertiesInputTypeFile()
|
265
|
+
.attachFile(file);
|
266
|
+
cy.wait(4000);
|
267
|
+
},
|
268
|
+
|
269
|
+
navigateToThinkSphereCreateItem: () => {
|
270
|
+
cy.visit('/item-engine/thinksphere/create-item');
|
271
|
+
},
|
272
|
+
|
273
|
+
navigateToReviewItemBank: () => {
|
274
|
+
thinkSpherePage.addReviewQuestionButton().click();
|
275
|
+
},
|
276
|
+
|
277
|
+
clickOnAddThinkSphereQuestion: () => {
|
278
|
+
thinkSpherePage.addThinkSphereQuestionButton()
|
279
|
+
.click();
|
280
|
+
},
|
281
|
+
|
282
|
+
navigateToThinkSphereCreateQuestion: () => {
|
283
|
+
thinkSpherePage.steps.navigateToThinkSphereCreateItem();
|
284
|
+
thinkSpherePage.steps.clickOnAddThinkSphereQuestion();
|
285
|
+
},
|
286
|
+
|
287
|
+
verifyCenterOptionAlignmentIsSelected: () => {
|
288
|
+
thinkSpherePage.centerButton()
|
289
|
+
.should('have.attr', 'aria-pressed', 'true');
|
290
|
+
},
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Verifies the opacity slider value.
|
294
|
+
* @param {string} opacityValue - The expected opacity value.
|
295
|
+
*/
|
296
|
+
verifyOpacitySliderValue: (opacityValue) => {
|
297
|
+
thinkSpherePage.opacitySlider()
|
298
|
+
.find('input')
|
299
|
+
.should('have.value', opacityValue)
|
300
|
+
},
|
301
|
+
|
302
|
+
/**
|
303
|
+
* Verifies the opacity input field value.
|
304
|
+
* @param {string} opacityValue - The expected opacity value.
|
305
|
+
*/
|
306
|
+
verifyOpacityInputFieldValue: (opacityValue) => {
|
307
|
+
thinkSpherePage.opacityInputField()
|
308
|
+
.should('have.value', opacityValue)
|
309
|
+
},
|
310
|
+
|
311
|
+
clickOnOpacitySlider: () => {
|
312
|
+
thinkSpherePage.opacitySlider()
|
313
|
+
.click();
|
314
|
+
},
|
315
|
+
|
316
|
+
/**
|
317
|
+
* Adds input to the opacity input field.
|
318
|
+
* @param {string} value - The value to input.
|
319
|
+
*/
|
320
|
+
addInputToOpacityInputField: (value) => {
|
321
|
+
thinkSpherePage.opacityInputField()
|
322
|
+
.clear()
|
323
|
+
.type(value, { delay: 0 })
|
324
|
+
},
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Verifies the image alternative text input field.
|
328
|
+
* @param {string} imageAlternativeText - The expected alternative text.
|
329
|
+
*/
|
330
|
+
verifyImageAlternativeTextInputField: (imageAlternativeText) => {
|
331
|
+
thinkSpherePage.imageAlternativeTextInputField()
|
332
|
+
.should('have.value', imageAlternativeText);
|
333
|
+
},
|
334
|
+
expandSolvePhaseAccordion: () => {
|
335
|
+
thinkSpherePage.solvePhaseAccordion()
|
336
|
+
.click()
|
337
|
+
.should('have.attr', 'aria-expanded', 'true');
|
338
|
+
},
|
339
|
+
expandCustomizeToolsAndControls: () => {
|
340
|
+
thinkSpherePage.customizeToolsAndControls()
|
341
|
+
.click()
|
342
|
+
.should('have.attr', 'aria-expanded', 'true');
|
343
|
+
},
|
344
|
+
/**
|
345
|
+
* Verifies the tools and controls options.
|
346
|
+
* @param {Array<string>} options - The options to verify.
|
347
|
+
*/
|
348
|
+
verifyToolsAndControlsOptions: (options) => {
|
349
|
+
options.forEach(option => {
|
350
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.solveToolsAndControlsOptionsTiles(option), 'visible');
|
351
|
+
});
|
352
|
+
},
|
353
|
+
/**
|
354
|
+
* Selects an option from tools and controls.
|
355
|
+
* @param {string} option - The option to select.
|
356
|
+
*/
|
357
|
+
selectOptionFromToolsAndControls: (option) => {
|
358
|
+
thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
|
359
|
+
.click();
|
360
|
+
thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
|
361
|
+
.should('have.attr', 'data-aria-pressed', 'true');
|
362
|
+
},
|
363
|
+
/**
|
364
|
+
* Deselects an option from tools and controls.
|
365
|
+
* @param {string} option - The option to deselect.
|
366
|
+
*/
|
367
|
+
deselectOptionFromToolsAndControls: (option) => {
|
368
|
+
thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
|
369
|
+
.click();
|
370
|
+
thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
|
371
|
+
.should('have.attr', 'data-aria-pressed', 'false');
|
372
|
+
},
|
373
|
+
/**
|
374
|
+
* Verifies if an option is selected.
|
375
|
+
* @param {string} option - The option to verify.
|
376
|
+
*/
|
377
|
+
verifyOptionIsSelected: (option) => {
|
378
|
+
thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
|
379
|
+
.should('have.attr', 'data-aria-pressed', 'true');
|
380
|
+
},
|
381
|
+
/**
|
382
|
+
* Verifies if an option is not selected.
|
383
|
+
* @param {string} option - The option to verify.
|
384
|
+
*/
|
385
|
+
verifyOptionIsNotSelected: (option) => {
|
386
|
+
thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
|
387
|
+
.should('have.attr', 'data-aria-pressed', 'false');
|
388
|
+
},
|
389
|
+
navigateToThinkSphereCreateItem: () => {
|
390
|
+
cy.visit('/item-engine/thinksphere/create-item');
|
391
|
+
},
|
392
|
+
clickOnAddThinkSphereQuestion: () => {
|
393
|
+
thinkSpherePage.addThinkSphereQuestionButton()
|
394
|
+
.click();
|
395
|
+
},
|
396
|
+
navigateToThinkSphereCreateQuestion: () => {
|
397
|
+
thinkSpherePage.steps.navigateToThinkSphereCreateItem();
|
398
|
+
thinkSpherePage.steps.clickOnAddThinkSphereQuestion();
|
399
|
+
},
|
400
|
+
/**
|
401
|
+
* Verifies the options contents.
|
402
|
+
* @param {number} index - The index of the option.
|
403
|
+
* @param {string} text - The text to verify.
|
404
|
+
* @param {string} placeholder - The placeholder text to verify.
|
405
|
+
*/
|
406
|
+
verifyOptionsContents: (index, text, placeholder) => {
|
407
|
+
utilities.getNthElement(thinkSpherePage.optionWrapper(), index)
|
408
|
+
.within(() => {
|
409
|
+
utilities.getNthElement(thinkSpherePage.listInputField(), 0)
|
410
|
+
.should('have.attr', 'placeholder', placeholder);
|
411
|
+
utilities.getNthElement(thinkSpherePage.listInputField(), 0)
|
412
|
+
.should('have.value', text);
|
413
|
+
thinkSpherePage.dragHandleButton()
|
414
|
+
.should('exist');
|
415
|
+
thinkSpherePage.deleteButton()
|
416
|
+
.should('be.visible');
|
417
|
+
thinkSpherePage.optionNumeration()
|
418
|
+
.should('have.text', index + 1);
|
419
|
+
});
|
420
|
+
},
|
421
|
+
|
422
|
+
/**
|
423
|
+
* Deletes an option.
|
424
|
+
* @param {number} index - The index of the option to delete.
|
425
|
+
*/
|
426
|
+
deleteOption: (index) => {
|
427
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), index)
|
428
|
+
.click();
|
429
|
+
},
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Verifies the delete option button disabled state.
|
433
|
+
* @param {string} list - The list to verify ('strategy' or other).
|
434
|
+
*/
|
435
|
+
verifyDeleteOptionButtonDisabledState: (list) => {
|
436
|
+
if (list === "strategy") {
|
437
|
+
utilities.getNthElement(thinkSpherePage.optionsSectionWrapper(), 0)
|
438
|
+
.within(() => {
|
439
|
+
thinkSpherePage.deleteButton()
|
440
|
+
.each(($element) => {
|
441
|
+
utilities.verifyElementDisabled(cy.wrap($element))
|
442
|
+
});
|
443
|
+
});
|
444
|
+
} else {
|
445
|
+
utilities.getNthElement(thinkSpherePage.optionsSectionWrapper(), 1)
|
446
|
+
.within(() => {
|
447
|
+
thinkSpherePage.deleteButton()
|
448
|
+
.each(($element) => {
|
449
|
+
utilities.verifyElementDisabled(cy.wrap($element))
|
450
|
+
});
|
451
|
+
});
|
452
|
+
}
|
453
|
+
},
|
454
|
+
|
455
|
+
/**
|
456
|
+
* Verifies the checkbox button disabled state.
|
457
|
+
* @param {string} list - The list to verify ('strategy' or other).
|
458
|
+
* @param {number} optionCount - The number of options to verify.
|
459
|
+
*/
|
460
|
+
verifyCheckboxButtonDisabledState: (list, optionCount) => {
|
461
|
+
if (list === 'strategy') {
|
462
|
+
utilities.getNthElement(utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('span'), 0), optionCount)
|
463
|
+
.should('have.attr', 'aria-disabled', 'true');
|
464
|
+
} else {
|
465
|
+
utilities.getNthElement(utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('span'), 0), optionCount)
|
466
|
+
.should('have.attr', 'aria-disabled', 'true');
|
467
|
+
}
|
468
|
+
},
|
469
|
+
|
470
|
+
/**
|
471
|
+
* Add the option in the list.
|
472
|
+
* @param {string} list - The list to verify ('strategy' or other).
|
473
|
+
*/
|
474
|
+
addOption: (list) => {
|
475
|
+
if (list === 'strategy') {
|
476
|
+
thinkSpherePage.planStrategyAddItemButton()
|
477
|
+
.click();
|
478
|
+
} else {
|
479
|
+
thinkSpherePage.planSentenceStarterAddItemButton()
|
480
|
+
.click();
|
481
|
+
}
|
482
|
+
},
|
483
|
+
|
484
|
+
/**
|
485
|
+
* Selects an option.
|
486
|
+
* @param {string} list - The list to select from ('strategy' or other).
|
487
|
+
* @param {number} optionCount - The number of options to select.
|
488
|
+
*/
|
489
|
+
selectOption: (list, optionCount) => {
|
490
|
+
if (list === 'strategy') {
|
491
|
+
utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), optionCount)
|
492
|
+
.click();
|
493
|
+
} else {
|
494
|
+
utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), optionCount)
|
495
|
+
.click();
|
496
|
+
}
|
497
|
+
},
|
498
|
+
|
499
|
+
/**
|
500
|
+
* Adds text to an option.
|
501
|
+
* @param {string} list - The list to add text to ('strategy' or other).
|
502
|
+
* @param {number} optionCount - The number of options to add text to.
|
503
|
+
* @param {string} text - The text to add.
|
504
|
+
*/
|
505
|
+
addOptionText: (list, optionCount, text) => {
|
506
|
+
if (list === 'strategy') {
|
507
|
+
thinkSpherePage.planStrategySection()
|
508
|
+
.within(() => {
|
509
|
+
utilities.getNthElement(thinkSpherePage.listInputField(), optionCount)
|
510
|
+
.clear()
|
511
|
+
.type(text);
|
512
|
+
});
|
513
|
+
} else {
|
514
|
+
thinkSpherePage.planSentenceStarterSection()
|
515
|
+
.within(() => {
|
516
|
+
utilities.getNthElement(thinkSpherePage.listInputField(), optionCount)
|
517
|
+
.clear()
|
518
|
+
.type(text);
|
519
|
+
});
|
520
|
+
}
|
521
|
+
},
|
522
|
+
|
523
|
+
/**
|
524
|
+
* Verifies the warning popup.
|
525
|
+
* @param {string} heading - The heading of the warning popup.
|
526
|
+
* @param {string} content - The content of the warning popup.
|
527
|
+
*/
|
528
|
+
verifyWarningPopup: (heading, content) => {
|
529
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
530
|
+
dialogBoxBase.dialogBoxTitle().within(() => {
|
531
|
+
utilities.verifyInnerText(thinkSpherePage.warningPopupTitle(), heading);
|
532
|
+
});
|
533
|
+
dialogBoxBase.dialogBoxContent().within(() => {
|
534
|
+
utilities.verifyInnerText(thinkSpherePage.warningPopupContentText(), content);
|
535
|
+
utilities.verifyInnerText(thinkSpherePage.warningPopupOkButton(), 'OK');
|
536
|
+
});
|
537
|
+
},
|
538
|
+
|
539
|
+
verifyCustomizeStampsComponent: () => {
|
540
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampComponent(), 'visible');
|
541
|
+
},
|
542
|
+
|
543
|
+
/**
|
544
|
+
* Verifies the default stamps.
|
545
|
+
* @param {Array<string>} defaultStamps - The default stamps to verify.
|
546
|
+
*/
|
547
|
+
verifyDefaultStamps: (defaultStamps = []) => {
|
548
|
+
thinkSpherePage.customizeStampComponent()
|
549
|
+
.within(() => {
|
550
|
+
thinkSpherePage.customizeStampCard()
|
551
|
+
.should('have.length', defaultStamps.length);
|
552
|
+
defaultStamps.forEach((ele) => {
|
553
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampCard(`${ele} selected`), 'visible');
|
554
|
+
});
|
555
|
+
});
|
556
|
+
},
|
557
|
+
|
558
|
+
/**
|
559
|
+
* Clicks on a customize card.
|
560
|
+
* @param {number} index - The index of the card to click.
|
561
|
+
* @param {string} ariaLabel - The aria-label of the card to click.
|
562
|
+
*/
|
563
|
+
clickOnCustomizeCard: (index, ariaLabel) => {
|
564
|
+
if (ariaLabel) {
|
565
|
+
thinkSpherePage.customizeStampCard(ariaLabel)
|
566
|
+
.click();
|
567
|
+
|
568
|
+
} else {
|
569
|
+
utilities.getNthElement(thinkSpherePage.customizeStampCard(), index)
|
570
|
+
.click();
|
571
|
+
}
|
572
|
+
},
|
573
|
+
|
574
|
+
verifySelectAndUnselectStamps: () => {
|
575
|
+
thinkSpherePage.customizeStampComponent()
|
576
|
+
.within(() => {
|
577
|
+
thinkSpherePage.steps.clickOnCustomizeCard(0);
|
578
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampCard('Stamp 1 not selected'), 'visible');
|
579
|
+
thinkSpherePage.steps.clickOnCustomizeCard(0);
|
580
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampCard('Stamp 1 selected'), 'visible');
|
581
|
+
});
|
582
|
+
},
|
583
|
+
|
584
|
+
clickOnStampsTool: () => {
|
585
|
+
thinkSpherePage.stampsToolButton()
|
586
|
+
.click();
|
587
|
+
},
|
588
|
+
|
589
|
+
verifyQuestionImageCustomStamp: () => {
|
590
|
+
let imgSrc = '';
|
591
|
+
thinkSpherePage.questionImage()
|
592
|
+
.invoke('attr', 'src') // Get the value of the 'src' attribute
|
593
|
+
.then((src) => {
|
594
|
+
imgSrc = src; // Store the value in the imgSrc variable
|
595
|
+
cy.log(imgSrc); // Optional: Log the value to the Cypress console
|
596
|
+
});
|
597
|
+
utilities.verifyCSS(
|
598
|
+
utilities.getNthElement(thinkSpherePage.customizeStampCard(), 0),
|
599
|
+
{
|
600
|
+
border: `1px solid ${css.color.figDefaultComponentBorder}`,
|
601
|
+
},
|
602
|
+
);
|
603
|
+
utilities.getNthElement(thinkSpherePage.customizeStampCard(), 0)
|
604
|
+
.within(() => {
|
605
|
+
thinkSpherePage.customizeStampCardImg()
|
606
|
+
.invoke('attr', 'src') // Get the value of the 'src' attribute
|
607
|
+
.then((src) => {
|
608
|
+
expect(src).to.equal(imgSrc);
|
609
|
+
});
|
610
|
+
});
|
611
|
+
},
|
612
|
+
createReviewQuestion: (questionType = 'Drawing Response') => {
|
613
|
+
thinkSpherePage.steps.clickOnCreateItemButton();
|
614
|
+
thinkSpherePage.steps.selectQuestionType(questionType);
|
615
|
+
thinkSpherePage.steps.clickOnSaveButton();
|
616
|
+
},
|
617
|
+
clickOnImageRadioButton: () => {
|
618
|
+
thinkSpherePage.imageRadioButton()
|
619
|
+
.click();
|
620
|
+
}
|
621
|
+
};
|
622
|
+
|
623
|
+
const tests = {
|
624
|
+
...createQuestionBasePage.tests,
|
625
|
+
...backgroundImageUploadComponent.tests,
|
626
|
+
...questionInstructionsComponent.tests,
|
627
|
+
...commonComponents.tests,
|
628
|
+
...scoringSectionBaseEditTab.tests,
|
629
|
+
...additionalSettingsPanel.tests,
|
630
|
+
...additionalSettingsAccessibilitySectionComponent.tests,
|
631
|
+
...toolSettingsComponent.tests,
|
632
|
+
...studentViewSettingsLabelComponent.tests,
|
633
|
+
...defaultToolDropdown.tests,
|
634
|
+
...optionsWrapperComponent.tests,
|
635
|
+
|
636
|
+
/**
|
637
|
+
* Verifies the ThinkSphere cancel button functionality.
|
638
|
+
* @param {string} questionType - The type of question.
|
639
|
+
*/
|
640
|
+
verifyThinkSphereCancelButton: (questionType) => {
|
641
|
+
it('When user has made no edits and clicks on cancel button, the user should be directed back to the \'Select a Question\' page', () => {
|
642
|
+
createQuestionBasePage.cancelButton()
|
643
|
+
.click();
|
644
|
+
});
|
645
|
+
|
646
|
+
it('When user has made some edits/changes and clicks on cancel button, a popup should be displayed with message \'Are you sure you want to leave this page? Your changes have not been saved.\'', () => {
|
647
|
+
thinkSpherePage.steps.navigateToThinkSphereCreateQuestion();
|
648
|
+
questionInstructionsComponent.steps.addTextInQuestionInstructionsInputField('Edited');
|
649
|
+
if (questionType !== 'feedback scale' && questionType !== 'highlight image' && questionType !== 'think sphere') {
|
650
|
+
scoringSectionBaseEditTab.steps.allotPoints(20);
|
651
|
+
};
|
652
|
+
createQuestionBasePage.cancelButton()
|
653
|
+
.click();
|
654
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
|
655
|
+
utilities.verifyInnerText(dialogBoxBase.dialogBoxContentText(), 'Are you sure you want to leave this page? Your changes have not been saved.');
|
656
|
+
utilities.verifyInnerText(dialogBoxBase.buttonAccept(), 'Yes, I want to leave this page');
|
657
|
+
utilities.verifyInnerText(dialogBoxBase.buttonReject(), 'No, I\'d like to go back');
|
658
|
+
});
|
659
|
+
|
660
|
+
it('CSS of popup', { tags: 'css' }, () => {
|
661
|
+
utilities.verifyCSS(dialogBoxBase.dialogBox(), {
|
662
|
+
'background-color': css.color.defaultBackground
|
663
|
+
})
|
664
|
+
|
665
|
+
utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
|
666
|
+
'color': css.color.sectionHeading,
|
667
|
+
'font-size': css.fontSize.default,
|
668
|
+
'font-weight': css.fontWeight.regular
|
669
|
+
});
|
670
|
+
utilities.verifyCSS(dialogBoxBase.buttonAccept(), {
|
671
|
+
'color': css.color.primaryBtn,
|
672
|
+
'font-size': css.fontSize.default,
|
673
|
+
'font-weight': css.fontWeight.semibold,
|
674
|
+
'background-color': css.color.primaryBtnBg
|
675
|
+
});
|
676
|
+
utilities.verifyCSS(dialogBoxBase.buttonReject(), {
|
677
|
+
'color': css.color.secondaryBtn,
|
678
|
+
'font-size': css.fontSize.default,
|
679
|
+
'font-weight': css.fontWeight.semibold,
|
680
|
+
'background-color': css.color.transparent
|
681
|
+
});
|
682
|
+
});
|
683
|
+
|
684
|
+
it('Accessibility of popup', { tags: 'a11y' }, () => {
|
685
|
+
cy.checkAccessibility(dialogBoxBase.dialogBox());
|
686
|
+
});
|
687
|
+
|
688
|
+
it(`Clicking on \'No, I'd like to go back\' button should close the popup and user should remain on the edit interface of the question`, () => {
|
689
|
+
dialogBoxBase.buttonReject()
|
690
|
+
.click();
|
691
|
+
createQuestionBasePage.editTab()
|
692
|
+
.should('have.attr', 'aria-selected', 'true');
|
693
|
+
utilities.verifyTextContent(questionInstructionsComponent.questionInstructionsInputField(), 'Edited');
|
694
|
+
});
|
695
|
+
|
696
|
+
it(`Clicking on \'Yes, I want to leave this page\' button should should discard all changes and direct the user to the \'Select a question\' page.`, () => {
|
697
|
+
createQuestionBasePage.cancelButton()
|
698
|
+
.click();
|
699
|
+
dialogBoxBase.buttonAccept()
|
700
|
+
.click();
|
701
|
+
});
|
702
|
+
},
|
703
|
+
|
704
|
+
/**
|
705
|
+
* Verifies the disabled delete button tooltip.
|
706
|
+
* @param {number} NthElement - The index of the delete button.
|
707
|
+
* @param {string} disableTooltipText - The tooltip text to verify.
|
708
|
+
*/
|
709
|
+
verifyDisabledDeleteButtonTooltip: (NthElement, disableTooltipText) => {
|
710
|
+
it('When the user hovers over the disabled delete buttons of the options then \'Minimum one option is required\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the delete button', () => {
|
711
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
|
712
|
+
.trigger('mouseover', { force: true });
|
713
|
+
utilities.verifyInnerText(thinkSpherePage.tooltipText(), disableTooltipText);
|
714
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
|
715
|
+
.trigger('mouseout', { force: true });
|
716
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
717
|
+
});
|
718
|
+
|
719
|
+
it('CSS of disabled delete button tooltip', { tags: 'css' }, () => {
|
720
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
|
721
|
+
.trigger('mouseover', { force: true });
|
722
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'visible')
|
723
|
+
utilities.verifyCSS(thinkSpherePage.tooltipText(), {
|
724
|
+
'color': css.color.whiteText,
|
725
|
+
'font-size': css.fontSize.small,
|
726
|
+
'font-weight': css.fontWeight.regular
|
727
|
+
});
|
728
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
|
729
|
+
.trigger('mouseout', { force: true });
|
730
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
731
|
+
});
|
732
|
+
},
|
733
|
+
|
734
|
+
/**
|
735
|
+
* Verifies the add option functionality.
|
736
|
+
* @param {string} list - The list to add the option to ('strategy' or other).
|
737
|
+
* @param {Array<string>} optionList - The list of options.
|
738
|
+
*/
|
739
|
+
verifyAddOptionFunctionality: (list, optionList) => {
|
740
|
+
it('When user adds an option using \'Add Option\' button then the added option input field should be displayed and option numeration should increment', () => {
|
741
|
+
let initialOptionCount;
|
742
|
+
if (list === 'strategy') {
|
743
|
+
thinkSpherePage.planStrategySection()
|
744
|
+
.within(() => {
|
745
|
+
thinkSpherePage.steps.getOptionCount().then((count) => {
|
746
|
+
initialOptionCount = count;
|
747
|
+
});
|
748
|
+
});
|
749
|
+
|
750
|
+
thinkSpherePage.steps.addOption(list);
|
751
|
+
thinkSpherePage.planStrategySection()
|
752
|
+
.within(() => {
|
753
|
+
thinkSpherePage.steps.getOptionCount().should('eq', initialOptionCount + 1);
|
754
|
+
thinkSpherePage.steps.verifyOptionsContents(initialOptionCount, '', 'Enter strategy name');
|
755
|
+
});
|
756
|
+
thinkSpherePage.steps.deleteOption(5);
|
757
|
+
} else {
|
758
|
+
thinkSpherePage.planSentenceStarterSection()
|
759
|
+
.within(() => {
|
760
|
+
thinkSpherePage.steps.getOptionCount().then((count) => {
|
761
|
+
initialOptionCount = count;
|
762
|
+
});
|
763
|
+
});
|
764
|
+
|
765
|
+
thinkSpherePage.steps.addOption(list);
|
766
|
+
thinkSpherePage.planSentenceStarterSection()
|
767
|
+
.within(() => {
|
768
|
+
thinkSpherePage.steps.getOptionCount().should('eq', initialOptionCount + 1);
|
769
|
+
thinkSpherePage.steps.verifyOptionsContents(initialOptionCount, '', 'Enter sentence starter name');
|
770
|
+
});
|
771
|
+
thinkSpherePage.steps.deleteOption(10);
|
772
|
+
}
|
773
|
+
});
|
774
|
+
},
|
775
|
+
|
776
|
+
/**
|
777
|
+
* Verifies the contents and styling of the 'Options' section.
|
778
|
+
* @param {Object} params - The parameters for the function.
|
779
|
+
* @param {number} params.optionFieldsCount - The expected number of option input fields.
|
780
|
+
* @param {Array<string>} params.optionList - The list of options.
|
781
|
+
* @param {string} params.placeholder - The placeholder text.
|
782
|
+
* @param {string} params.list - The list to verify ('strategy' or other).
|
783
|
+
*/
|
784
|
+
verifyListSectionContents: ({
|
785
|
+
optionFieldsCount,
|
786
|
+
optionList,
|
787
|
+
placeholder,
|
788
|
+
list,
|
789
|
+
}) => {
|
790
|
+
it(`By default ${optionFieldsCount} option input fields with placeholder text, drag handle and delete option icon buttons should be displayed`, () => {
|
791
|
+
for (let index = 0; index < optionFieldsCount; index++) {
|
792
|
+
if (list === 'strategy') {
|
793
|
+
thinkSpherePage.planStrategySection()
|
794
|
+
.within(() => {
|
795
|
+
cy.log(optionList, optionList[index])
|
796
|
+
thinkSpherePage.steps.verifyOptionsContents(index, optionList[index], placeholder);
|
797
|
+
})
|
798
|
+
} else {
|
799
|
+
thinkSpherePage.planSentenceStarterSection()
|
800
|
+
.within(() => {
|
801
|
+
cy.log(optionList, optionList[index])
|
802
|
+
thinkSpherePage.steps.verifyOptionsContents(index, optionList[index], placeholder);
|
803
|
+
})
|
804
|
+
}
|
805
|
+
};
|
806
|
+
});
|
807
|
+
|
808
|
+
it('\'Add Option\' button should be present', () => {
|
809
|
+
if (list === 'strategy') {
|
810
|
+
utilities.verifyInnerText(thinkSpherePage.planStrategyAddItemButton().find('p'), 'Add strategy');
|
811
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.planStrategyAddItemButton(), 'visible');
|
812
|
+
} else {
|
813
|
+
utilities.verifyInnerText(thinkSpherePage.planSentenceStarterAddItemButton().find('p'), 'Add sentence starter');
|
814
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.planSentenceStarterAddItemButton(), 'visible');
|
815
|
+
}
|
816
|
+
});
|
817
|
+
|
818
|
+
it('CSS of Options section', { tags: 'css' }, () => {
|
819
|
+
const withinComponent = (list === 'strategy') ? thinkSpherePage.planStrategySection() : thinkSpherePage.planSentenceStarterSection();
|
820
|
+
|
821
|
+
withinComponent.within(() => {
|
822
|
+
utilities.verifyCSS(thinkSpherePage.dragHandleButton().find('path'), {
|
823
|
+
'fill': css.color.secondaryBtnActive
|
824
|
+
});
|
825
|
+
thinkSpherePage.deleteButton()
|
826
|
+
.verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
|
827
|
+
utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.listInputField(), 0), {
|
828
|
+
'color': css.color.text,
|
829
|
+
'font-size': css.fontSize.default,
|
830
|
+
'font-weight': css.fontWeight.regular
|
831
|
+
});
|
832
|
+
});
|
833
|
+
|
834
|
+
if (list === 'strategy') {
|
835
|
+
utilities.verifyCSS(thinkSpherePage.planStrategyAddItemButton().find('p'), {
|
836
|
+
'color': css.color.secondaryBtnActive,
|
837
|
+
'font-size': css.fontSize.default,
|
838
|
+
'font-weight': css.fontWeight.regular
|
839
|
+
});
|
840
|
+
} else {
|
841
|
+
utilities.verifyCSS(thinkSpherePage.planSentenceStarterAddItemButton().find('p'), {
|
842
|
+
'color': css.color.secondaryBtnActive,
|
843
|
+
'font-size': css.fontSize.default,
|
844
|
+
'font-weight': css.fontWeight.regular
|
845
|
+
});
|
846
|
+
}
|
847
|
+
});
|
848
|
+
},
|
849
|
+
|
850
|
+
/**
|
851
|
+
* Verifies the drag handle tooltip.
|
852
|
+
* @param {number} NthElement - The index of the drag handle.
|
853
|
+
*/
|
854
|
+
verifyDragHandleTooltip: (NthElement) => {
|
855
|
+
it('On hovering over the drag handle of the options, \'Drag to reorder\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the drag handle', () => {
|
856
|
+
utilities.triggerMouseover(utilities.getNthElement(thinkSpherePage.dragHandleButton(), NthElement));
|
857
|
+
utilities.verifyInnerText(thinkSpherePage.tooltipText(), 'Drag to reorder');
|
858
|
+
utilities.triggerMouseout(utilities.getNthElement(thinkSpherePage.dragHandleButton(), NthElement));
|
859
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
860
|
+
});
|
861
|
+
|
862
|
+
it('CSS of drag handle tooltip', { tags: 'css' }, () => {
|
863
|
+
utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
|
864
|
+
.within(() => {
|
865
|
+
utilities.triggerMouseover(thinkSpherePage.dragHandleButton());
|
866
|
+
});
|
867
|
+
utilities.verifyCSS(thinkSpherePage.tooltipText(), {
|
868
|
+
'color': css.color.whiteText,
|
869
|
+
'font-size': css.fontSize.small,
|
870
|
+
'font-weight': css.fontWeight.regular
|
871
|
+
});
|
872
|
+
utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
|
873
|
+
.within(() => {
|
874
|
+
utilities.triggerMouseout(thinkSpherePage.dragHandleButton())
|
875
|
+
});
|
876
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
877
|
+
});
|
878
|
+
|
879
|
+
it('Accessibility of drag handle tooltip', { tags: 'a11y' }, () => {
|
880
|
+
utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
|
881
|
+
.within(() => {
|
882
|
+
utilities.triggerMouseover(thinkSpherePage.dragHandleButton());
|
883
|
+
});
|
884
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'visible');
|
885
|
+
utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
|
886
|
+
.within(() => {
|
887
|
+
utilities.triggerMouseout(thinkSpherePage.dragHandleButton())
|
888
|
+
});
|
889
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
890
|
+
});
|
891
|
+
},
|
892
|
+
|
893
|
+
/**
|
894
|
+
* Verifies the enabled delete button and tooltip.
|
895
|
+
* @param {string} list - The list to verify ('strategy' or other).
|
896
|
+
* @param {number} NthElement - The index of the delete button.
|
897
|
+
*/
|
898
|
+
verifyEnabledDeleteButtonAndTooltip: (list, NthElement) => {
|
899
|
+
it('When the number of options are greater than 1 and both the options are selected then the \'Delete\' icon buttons should get enabled', () => {
|
900
|
+
thinkSpherePage.steps.selectOption(list, 1);
|
901
|
+
thinkSpherePage.deleteButton()
|
902
|
+
.should('be.enabled');
|
903
|
+
});
|
904
|
+
|
905
|
+
it('CSS of enabled \'Delete\' option button', { tags: 'css' }, () => {
|
906
|
+
utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement), {
|
907
|
+
'opacity': '1'
|
908
|
+
});
|
909
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
|
910
|
+
.verifyPseudoClassBeforeProperty('color', css.color.deleteIcon)
|
911
|
+
});
|
912
|
+
|
913
|
+
it('Accessibility of enabled \'Delete\' option button', { tags: 'a11y' }, () => {
|
914
|
+
cy.checkAccessibility(thinkSpherePage.deleteButton());
|
915
|
+
});
|
916
|
+
|
917
|
+
it('when the user hovers over the enabled \'Delete\' icon buttons, then \'Delete option\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the \'Delete\' icon button', () => {
|
918
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
|
919
|
+
.verifyTooltip('Delete item for item 1');
|
920
|
+
});
|
921
|
+
|
922
|
+
it('CSS of enabled delete button tooltip', { tags: 'css' }, () => {
|
923
|
+
utilities.triggerMouseover(utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement));
|
924
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'visible')
|
925
|
+
utilities.verifyCSS(thinkSpherePage.tooltipText(), {
|
926
|
+
'color': css.color.whiteText,
|
927
|
+
'font-size': css.fontSize.small,
|
928
|
+
'font-weight': css.fontWeight.regular
|
929
|
+
});
|
930
|
+
utilities.triggerMouseout(utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement));
|
931
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
932
|
+
});
|
933
|
+
},
|
934
|
+
|
935
|
+
/**
|
936
|
+
* Verifies the options checkbox component.
|
937
|
+
* @param {string} list - The list to verify ('strategy' or other).
|
938
|
+
*/
|
939
|
+
verifyOptionsCheckboxComponent: (list) => {
|
940
|
+
it('Option checkbox button should be present', () => {
|
941
|
+
if (list === 'strategy') {
|
942
|
+
utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 0)
|
943
|
+
.find('input')
|
944
|
+
.should('have.attr', 'type', 'checkbox')
|
945
|
+
.should('have.attr', 'checked');
|
946
|
+
} else {
|
947
|
+
utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 0)
|
948
|
+
.find('input')
|
949
|
+
.should('have.attr', 'type', 'checkbox')
|
950
|
+
.should('have.attr', 'checked');
|
951
|
+
}
|
952
|
+
});
|
953
|
+
|
954
|
+
it('CSS of checked checkbox button', { tags: 'css' }, () => {
|
955
|
+
if (list === 'strategy') {
|
956
|
+
utilities.verifyCSS(
|
957
|
+
utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('svg g g'), 0), {
|
958
|
+
'fill': css.color.primaryBtnBg,
|
959
|
+
});
|
960
|
+
utilities.verifyCSS(
|
961
|
+
utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('svg'), 0), {
|
962
|
+
'width': '12px',
|
963
|
+
'height': '12px',
|
964
|
+
});
|
965
|
+
} else {
|
966
|
+
utilities.verifyCSS(
|
967
|
+
utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('svg g g'), 0), {
|
968
|
+
'fill': css.color.primaryBtnBg,
|
969
|
+
});
|
970
|
+
utilities.verifyCSS(
|
971
|
+
utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('svg'), 0), {
|
972
|
+
'width': '12px',
|
973
|
+
'height': '12px',
|
974
|
+
});
|
975
|
+
}
|
976
|
+
});
|
977
|
+
|
978
|
+
it('When user clicks on the checkbox button then the checkbox should get unchecked', () => {
|
979
|
+
if (list === 'strategy') {
|
980
|
+
thinkSpherePage.steps.selectOption(list, 0);
|
981
|
+
utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 0)
|
982
|
+
.find('input')
|
983
|
+
.should('not.be.checked');
|
984
|
+
thinkSpherePage.steps.selectOption(list, 0);
|
985
|
+
} else {
|
986
|
+
thinkSpherePage.steps.selectOption(list, 0);
|
987
|
+
utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 0)
|
988
|
+
.find('input')
|
989
|
+
.should('not.be.checked');
|
990
|
+
thinkSpherePage.steps.selectOption(list, 0);
|
991
|
+
}
|
992
|
+
});
|
993
|
+
|
994
|
+
it('CSS of unchecked checkbox button', { tags: 'css' }, () => {
|
995
|
+
if (list === 'strategy') {
|
996
|
+
thinkSpherePage.steps.selectOption(list, 1);
|
997
|
+
utilities.verifyCSS(
|
998
|
+
utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('svg'), 1), {
|
999
|
+
'fill': css.color.uncheckedCheckbox,
|
1000
|
+
'width': '12px',
|
1001
|
+
'height': '12px',
|
1002
|
+
});
|
1003
|
+
} else {
|
1004
|
+
thinkSpherePage.steps.selectOption(list, 1);
|
1005
|
+
utilities.verifyCSS(
|
1006
|
+
utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('svg'), 1), {
|
1007
|
+
'fill': css.color.uncheckedCheckbox,
|
1008
|
+
'width': '12px',
|
1009
|
+
'height': '12px',
|
1010
|
+
});
|
1011
|
+
}
|
1012
|
+
});
|
1013
|
+
|
1014
|
+
it('Accessibility of checked \'Checkbox\' button', { tags: 'a11y' }, () => {
|
1015
|
+
if (list === 'strategy') {
|
1016
|
+
cy.checkAccessibility(thinkSpherePage.planStrategyCheckbox());
|
1017
|
+
} else {
|
1018
|
+
cy.checkAccessibility(thinkSpherePage.planSentenceStarterCheckbox());
|
1019
|
+
}
|
1020
|
+
});
|
1021
|
+
},
|
1022
|
+
|
1023
|
+
/**
|
1024
|
+
* Verifies the CSS of the 'Option' input field.
|
1025
|
+
* @param {string} list - The list type ('strategy' or other).
|
1026
|
+
*/
|
1027
|
+
verifyOptionsInput: (list) => {
|
1028
|
+
it('CSS of \'Option\' input field', () => {
|
1029
|
+
if (list === 'strategy') {
|
1030
|
+
utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.listInputField().parent(), 0), {
|
1031
|
+
'border': `1px solid ${css.color.figDefaultComponentBorder}`,
|
1032
|
+
'border-radius': '8px',
|
1033
|
+
'font-size': css.fontSize.default,
|
1034
|
+
'font-weight': css.fontWeight.regular,
|
1035
|
+
});
|
1036
|
+
} else {
|
1037
|
+
utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.listInputField().parent(), 5), {
|
1038
|
+
'border': `1px solid ${css.color.figDefaultComponentBorder}`,
|
1039
|
+
'border-radius': '8px',
|
1040
|
+
'font-size': css.fontSize.default,
|
1041
|
+
'font-weight': css.fontWeight.regular,
|
1042
|
+
});
|
1043
|
+
}
|
1044
|
+
});
|
1045
|
+
},
|
1046
|
+
|
1047
|
+
/**
|
1048
|
+
* Verifies that at least one option is required.
|
1049
|
+
* @param {string} list - The list type ('strategy' or other).
|
1050
|
+
* @param {Array<string>} listOptions - The list of options.
|
1051
|
+
* @param {string} disableTooltipText - The tooltip text to display when the delete button is disabled.
|
1052
|
+
*/
|
1053
|
+
verifyAtleastOneOptionIsRequired: (list, listOptions, disableTooltipText) => {
|
1054
|
+
const optionsToBeDeleted = listOptions.filter((el) => el !== listOptions[0]);
|
1055
|
+
|
1056
|
+
it('When the user deletes the last option, then the \'Delete\' icon button should get disabled', () => {
|
1057
|
+
optionsToBeDeleted.forEach(() => { thinkSpherePage.steps.deleteOption(list === 'strategy' ? 1 : 6) });
|
1058
|
+
thinkSpherePage.steps.verifyDeleteOptionButtonDisabledState(list);
|
1059
|
+
optionsToBeDeleted.forEach(() => { thinkSpherePage.steps.addOption(list) });
|
1060
|
+
listOptions.forEach((inputFieldText, optionIndex) => {
|
1061
|
+
thinkSpherePage.steps.addOptionText(list, optionIndex, inputFieldText);
|
1062
|
+
});
|
1063
|
+
});
|
1064
|
+
|
1065
|
+
it('When the user hovers over the disabled delete buttons of the options then \'Minimum one option is required\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the delete button', () => {
|
1066
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), list === 'strategy' ? 0 : 5)
|
1067
|
+
.trigger('mouseover', { force: true });
|
1068
|
+
utilities.verifyInnerText(thinkSpherePage.tooltipText(), disableTooltipText);
|
1069
|
+
utilities.getNthElement(thinkSpherePage.deleteButton(), list === 'strategy' ? 0 : 5)
|
1070
|
+
.trigger('mouseout', { force: true });
|
1071
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
|
1072
|
+
});
|
1073
|
+
|
1074
|
+
it('When the user uncheck the last option, then the \'Checkbox\' icon button should get disabled', () => {
|
1075
|
+
thinkSpherePage.steps.verifyCheckboxButtonDisabledState(list, 0);
|
1076
|
+
});
|
1077
|
+
},
|
1078
|
+
|
1079
|
+
verifyUploadImageSectionContentWithCSSAndA11y: () => {
|
1080
|
+
it('\'Upload\' label and \'Choose file\' button should be displayed', () => {
|
1081
|
+
utilities.verifyInnerText(backgroundImageUploadComponent.uploadLabel(), 'Upload');
|
1082
|
+
utilities.verifyElementVisibilityState(backgroundImageUploadComponent.uploadLabel(), 'visible');
|
1083
|
+
utilities.verifyInnerText(backgroundImageUploadComponent.chooseFileButton(), 'Choose file');
|
1084
|
+
utilities.verifyElementVisibilityState(backgroundImageUploadComponent.chooseFileButton(), 'visible');
|
1085
|
+
});
|
1086
|
+
|
1087
|
+
it('\'File name\' label should be displayed and by default \'No file chosen\' text should be displayed below the \'File name\' label.', () => {
|
1088
|
+
utilities.verifyInnerText(backgroundImageUploadComponent.fileNameLabel(), 'File name');
|
1089
|
+
utilities.verifyElementVisibilityState(backgroundImageUploadComponent.fileNameLabel(), 'visible');
|
1090
|
+
utilities.verifyInnerText(backgroundImageUploadComponent.noFileChosenLabel(), 'No file chosen');
|
1091
|
+
utilities.verifyElementVisibilityState(backgroundImageUploadComponent.noFileChosenLabel(), 'visible');
|
1092
|
+
});
|
1093
|
+
|
1094
|
+
backgroundImageUploadComponent.tests.verifyCSSAndA11yBeforeUpload();
|
1095
|
+
|
1096
|
+
backgroundImageUploadComponent.tests.verifyImageUploadFunctionality('thinkSphere');
|
1097
|
+
},
|
1098
|
+
|
1099
|
+
verifyQuestionInstructionsInputFieldThinkSpherePreviewTab: () => {
|
1100
|
+
it('When user has not entered any text in the Question instructions input field in the \'Edit\' tab then nothing should be displayed in the \'Preview\' tab', () => {
|
1101
|
+
createQuestionBasePage.steps.switchToPreviewTab();
|
1102
|
+
//Failing due to https://redmine.zeuslearning.com/issues/553382
|
1103
|
+
utilities.verifyElementVisibilityState(questionInstructionsComponent.questionInstructionsText(), 'notExist')
|
1104
|
+
});
|
1105
|
+
|
1106
|
+
it('When the user specifies question instructions, then the added question instructions should be displayed in the \'Preview\' tab', () => {
|
1107
|
+
createQuestionBasePage.steps.switchToEditTab();
|
1108
|
+
questionInstructionsComponent.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
1109
|
+
// UNCOMMENT BELOW CODE WHEN PREVIEW TAB IS AVAILABLE FOR THINKSPHERE
|
1110
|
+
// createQuestionBasePage.steps.switchToPreviewTab();
|
1111
|
+
// utilities.verifyTextContent(questionInstructionsComponent.questionInstructionsTextPreviewTab(), 'Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
|
1112
|
+
});
|
1113
|
+
},
|
1114
|
+
|
1115
|
+
verifyResetToDefaultFunctionality: (optionList, listType) => {
|
1116
|
+
if (listType === 'strategy') {
|
1117
|
+
it('When user clicks on \'Reset to default\' button then the strategy list should be reset to default', () => {
|
1118
|
+
thinkSpherePage.planStrategyListResetToDefault()
|
1119
|
+
.click();
|
1120
|
+
optionList.forEach((option, index) => {
|
1121
|
+
thinkSpherePage.steps.verifyOptionsContents(index, option, 'Enter strategy name');
|
1122
|
+
});
|
1123
|
+
});
|
1124
|
+
} else {
|
1125
|
+
it('When user clicks on \'Reset to default\' button then the sentence starter list should be reset to default', () => {
|
1126
|
+
thinkSpherePage.planSentenceStarterListResetToDefault()
|
1127
|
+
.click();
|
1128
|
+
optionList.forEach((option, index) => {
|
1129
|
+
thinkSpherePage.steps.verifyOptionsContents(index, option, 'Enter sentence starter name');
|
1130
|
+
});
|
1131
|
+
});
|
1132
|
+
}
|
1133
|
+
},
|
1134
|
+
|
1135
|
+
verifyVideoLinkComponent: () => {
|
1136
|
+
it('Video link component should be displayed', () => {
|
1137
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.videoLinkComponent(), 'visible');
|
1138
|
+
utilities.verifyInnerText(thinkSpherePage.videoLinkComponent(), 'Upload video');
|
1139
|
+
});
|
1140
|
+
|
1141
|
+
it('CSS of video link component', { tags: 'css' }, () => {
|
1142
|
+
thinkSpherePage.videoLinkComponent()
|
1143
|
+
.within(() => {
|
1144
|
+
utilities.verifyCSS(thinkSpherePage.uploadVideoLinkButton(), {
|
1145
|
+
'color': css.color.linkText,
|
1146
|
+
'font-size': css.fontSize.default,
|
1147
|
+
'font-weight': css.fontWeight.regular,
|
1148
|
+
'font-family': '"Nunito Sans"',
|
1149
|
+
'text-decoration-line': 'underline',
|
1150
|
+
});
|
1151
|
+
|
1152
|
+
cy.log('CSS of video link component on hover state');
|
1153
|
+
utilities.hoverOverElement(thinkSpherePage.uploadVideoLinkButton());
|
1154
|
+
utilities.verifyCSS(thinkSpherePage.uploadVideoLinkButton(), {
|
1155
|
+
'text-decoration-line': 'none',
|
1156
|
+
});
|
1157
|
+
});
|
1158
|
+
});
|
1159
|
+
|
1160
|
+
it('When user upload a file whose extension is not supported then an error message should be displayed', () => {
|
1161
|
+
thinkSpherePage.videoLinkComponent()
|
1162
|
+
.within(() => {
|
1163
|
+
thinkSpherePage.uploadVideoLinkButton()
|
1164
|
+
.click();
|
1165
|
+
});
|
1166
|
+
thinkSpherePage.steps.uploadVideoFile('uploads/image.png');
|
1167
|
+
thinkSpherePage.steps.verifyWarningPopup('File upload error', 'The file type is not supported. Please upload files with the following supported formats: mov, avi, mp4, webm, wmv.');
|
1168
|
+
});
|
1169
|
+
|
1170
|
+
it('CSS of warning popup', { tags: 'css' }, () => {
|
1171
|
+
utilities.verifyCSS(dialogBoxBase.dialogBox(), {
|
1172
|
+
'border': `1px solid ${css.color.secondaryBtnBorder}`,
|
1173
|
+
'border-radius': '8px',
|
1174
|
+
'background-color': css.color.primaryBtn,
|
1175
|
+
'box-shadow': `${css.color.dialogBoxBoxShadow} 0px 0px 10px 0px`,
|
1176
|
+
});
|
1177
|
+
|
1178
|
+
dialogBoxBase.dialogBoxTitle().within(() => {
|
1179
|
+
utilities.verifyCSS(thinkSpherePage.warningPopupTitle(), {
|
1180
|
+
'color': css.color.secondaryBtn,
|
1181
|
+
'font-size': css.fontSize.heading,
|
1182
|
+
'font-weight': css.fontWeight.bold
|
1183
|
+
});
|
1184
|
+
});
|
1185
|
+
|
1186
|
+
dialogBoxBase.dialogBoxContent().within(() => {
|
1187
|
+
utilities.verifyCSS(thinkSpherePage.warningPopupContentText(), {
|
1188
|
+
'color': css.color.sectionHeading,
|
1189
|
+
'font-size': css.fontSize.default,
|
1190
|
+
'font-weight': css.fontWeight.regular,
|
1191
|
+
'font-family': 'Inter'
|
1192
|
+
});
|
1193
|
+
|
1194
|
+
utilities.verifyCSS(thinkSpherePage.warningPopupOkButton(), {
|
1195
|
+
'background-color': css.color.primaryBtnBg,
|
1196
|
+
'border': `1px solid ${css.color.primaryBtnBorder}`,
|
1197
|
+
'color': css.color.primaryBtn,
|
1198
|
+
'border-radius': '8px',
|
1199
|
+
'font-size': css.fontSize.default,
|
1200
|
+
'font-weight': css.fontWeight.semibold,
|
1201
|
+
'font-family': '"Nunito Sans"',
|
1202
|
+
'box-shadow': `${css.color.primaryBtnBorder} 0px 5px 0px 0px`
|
1203
|
+
});
|
1204
|
+
});
|
1205
|
+
});
|
1206
|
+
|
1207
|
+
it('When user click on OK button of warning popup then the popup should be closed', () => {
|
1208
|
+
dialogBoxBase.dialogBoxContent().within(() => {
|
1209
|
+
thinkSpherePage.warningPopupOkButton()
|
1210
|
+
.click();
|
1211
|
+
});
|
1212
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
|
1213
|
+
});
|
1214
|
+
|
1215
|
+
it('When user upload a file of size more than 10MB then an error message should be displayed', () => {
|
1216
|
+
thinkSpherePage.videoLinkComponent()
|
1217
|
+
.within(() => {
|
1218
|
+
thinkSpherePage.uploadVideoLinkButton()
|
1219
|
+
.click();
|
1220
|
+
});
|
1221
|
+
thinkSpherePage.steps.uploadVideoFile('uploads/sample20MB.mp4');
|
1222
|
+
thinkSpherePage.steps.verifyWarningPopup('File upload error', 'The file could not be uploaded. The file is 37 MB exceeding the maximum size of 10 MB.');
|
1223
|
+
});
|
1224
|
+
|
1225
|
+
it('When user click on OK button of warning popup then the popup should be closed', () => {
|
1226
|
+
dialogBoxBase.dialogBoxContent().within(() => {
|
1227
|
+
thinkSpherePage.warningPopupOkButton()
|
1228
|
+
.click();
|
1229
|
+
});
|
1230
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
|
1231
|
+
});
|
1232
|
+
|
1233
|
+
it('When user upload a file of size less than 10MB then no error message should be displayed and video uploaded successfully', () => {
|
1234
|
+
thinkSpherePage.videoLinkComponent()
|
1235
|
+
.within(() => {
|
1236
|
+
thinkSpherePage.uploadVideoLinkButton()
|
1237
|
+
.click();
|
1238
|
+
});
|
1239
|
+
thinkSpherePage.steps.uploadVideoFile('uploads/sample2MB.mp4');
|
1240
|
+
cy.interceptGraphql('getFileScanStatus');
|
1241
|
+
cy.wait(5000);
|
1242
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
|
1243
|
+
});
|
1244
|
+
|
1245
|
+
it('When user upload correct file then uploaded file name, edit video button along with delete video button should present', () => {
|
1246
|
+
thinkSpherePage.videoLinkComponent().within(() => {
|
1247
|
+
utilities.verifyInnerText(thinkSpherePage.uploadVideoLinkButton(), 'sample2MB.mp4');
|
1248
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.editVideoButton(), 'visible');
|
1249
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.deleteVideoButton(), 'visible');
|
1250
|
+
});
|
1251
|
+
});
|
1252
|
+
|
1253
|
+
it('CSS of edit video button and delete video button', { tags: 'css' }, () => {
|
1254
|
+
thinkSpherePage.videoLinkComponent().within(() => {
|
1255
|
+
utilities.verifyCSS(thinkSpherePage.editVideoButton(), {
|
1256
|
+
'width': '24px',
|
1257
|
+
'height': '24px',
|
1258
|
+
'background-color': css.color.transparent,
|
1259
|
+
});
|
1260
|
+
utilities.verifyCSS(thinkSpherePage.deleteVideoButton(), {
|
1261
|
+
'width': '24px',
|
1262
|
+
'height': '24px',
|
1263
|
+
'background-color': css.color.transparent,
|
1264
|
+
});
|
1265
|
+
});
|
1266
|
+
});
|
1267
|
+
|
1268
|
+
it('When user upload another file size less than 10MB then no error message should be displayed and video uploaded successfully', () => {
|
1269
|
+
thinkSpherePage.videoLinkComponent()
|
1270
|
+
.within(() => {
|
1271
|
+
thinkSpherePage.editVideoButton()
|
1272
|
+
.click();
|
1273
|
+
});
|
1274
|
+
thinkSpherePage.steps.uploadVideoFile('uploads/sample2MB_2.mp4');
|
1275
|
+
cy.interceptGraphql('getFileScanStatus');
|
1276
|
+
cy.wait(5000);
|
1277
|
+
utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
|
1278
|
+
});
|
1279
|
+
|
1280
|
+
it('When user upload another correct file then uploaded file name, edit video button along with delete video button should present', () => {
|
1281
|
+
thinkSpherePage.videoLinkComponent().within(() => {
|
1282
|
+
utilities.verifyInnerText(thinkSpherePage.uploadVideoLinkButton(), 'sample2MB_2.mp4');
|
1283
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.editVideoButton(), 'visible');
|
1284
|
+
utilities.verifyElementVisibilityState(thinkSpherePage.deleteVideoButton(), 'visible');
|
1285
|
+
});
|
1286
|
+
});
|
1287
|
+
|
1288
|
+
it('When user click on delete video button then the video should be deleted', () => {
|
1289
|
+
thinkSpherePage.videoLinkComponent()
|
1290
|
+
.within(() => {
|
1291
|
+
thinkSpherePage.deleteVideoButton()
|
1292
|
+
.click();
|
1293
|
+
});
|
1294
|
+
utilities.verifyInnerText(thinkSpherePage.videoLinkComponent(), 'Upload video');
|
1295
|
+
});
|
1296
|
+
|
1297
|
+
it('Accessibility of video link component', { tags: 'a11y' }, () => {
|
1298
|
+
cy.checkAccessibility(thinkSpherePage.singleOptionTextFieldWrapper());
|
1299
|
+
});
|
1300
|
+
},
|
1301
|
+
};
|
1302
|
+
|
1303
|
+
export const thinkSpherePage = {
|
1304
|
+
...selectors,
|
1305
|
+
steps,
|
1306
|
+
tests
|
1307
|
+
};
|