itemengine-cypress-automation 1.0.373-IEI-5907-b092308.0 → 1.0.373-IEI-5907-gradingViewPlanPhase-298efc8.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.
@@ -222,6 +222,8 @@ const selectors = {
222
222
  gradingViewRadioButton: () => cy.get('label[aria-label="Grading View"]'),
223
223
  studentViewRadioButton: () => cy.get('label[aria-label="Student View"]'),
224
224
  correctAnswerLabelWrapper: () => cy.get('div[class*="CorrectAnswerLabelWrapper"]'),
225
+ submitButton: () => cy.get('button[aria-label="Submit"]'),
226
+ goToGradingViewButton: () => cy.contains('button', 'GO TO GRADING VIEW'),
225
227
  };
226
228
 
227
229
  const steps = {
@@ -1218,12 +1220,15 @@ const steps = {
1218
1220
  });
1219
1221
  },
1220
1222
 
1221
- verifyProblemAskingMicSection: () => {
1223
+ verifyProblemAskingMicSection: (isGrading=false) => {
1222
1224
  thinkSpherePage.problemAskingWrapper()
1223
1225
  .within(() => {
1224
1226
  utilities.verifyElementVisibilityState(thinkSpherePage.micIconWrapper(), 'visible');
1225
1227
  utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'role', 'button');
1226
1228
  utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'aria-label', 'Mic button');
1229
+ if(isGrading) {
1230
+ utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'tabindex', -1);
1231
+ }
1227
1232
  });
1228
1233
  },
1229
1234
 
@@ -1259,13 +1264,16 @@ const steps = {
1259
1264
  });
1260
1265
  },
1261
1266
 
1262
- verifyWritePlanMicSection: () => {
1267
+ verifyWritePlanMicSection: (isGrading=false) => {
1263
1268
  thinkSpherePage.writePlanWrapper()
1264
- .within(() => {
1265
- utilities.verifyElementVisibilityState(thinkSpherePage.micIconWrapper(), 'visible');
1266
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'role', 'button');
1267
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'aria-label', 'Mic button');
1268
- });
1269
+ .within(() => {
1270
+ utilities.verifyElementVisibilityState(thinkSpherePage.micIconWrapper(), 'visible');
1271
+ utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'role', 'button');
1272
+ utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'aria-label', 'Mic button');
1273
+ if(isGrading) {
1274
+ utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'tabindex', -1);
1275
+ }
1276
+ });
1269
1277
  },
1270
1278
 
1271
1279
  verifyWritePlanTextAreaFunctionality: (planTextToEnter) => {
@@ -1343,6 +1351,53 @@ const steps = {
1343
1351
  cy.wait(2000);
1344
1352
  },
1345
1353
 
1354
+ stepsBeforeGradingView: () => {
1355
+ thinkSpherePage.steps.expandChooseStarterDropdown();
1356
+ utilities.getNthElement(thinkSpherePage.chooseStartersListOptions(), 1).click();
1357
+ thinkSpherePage.problemAskingWrapper().first()
1358
+ .within(() => {
1359
+ thinkSpherePage.contentEditableDiv().type('This is a test text for the problem.');
1360
+ });
1361
+ thinkSpherePage.strategyChip().click();
1362
+ thinkSpherePage.submitButton().click();
1363
+ thinkSpherePage.goToGradingViewButton().click();
1364
+ },
1365
+
1366
+ verifyAddStrategiesButtonDisabled: () => {
1367
+ thinkSpherePage.addNewStrategyButton().should('have.attr', 'tabindex', '-1');
1368
+ thinkSpherePage.addNewStrategyButton().click({ force: true });
1369
+ utilities.verifyElementVisibilityState(thinkSpherePage.popupTitle(), 'notExist');
1370
+ },
1371
+
1372
+ verifyStrategiesListButtonDisabled: () => {
1373
+ utilities.getNthElement(thinkSpherePage.strategiesPreviewListLI(), 0).should('have.attr', 'tabindex', '-1');
1374
+ utilities.getNthElement(thinkSpherePage.strategiesPreviewListLI(), 0).should('have.attr', 'aria-disabled', 'true');
1375
+ },
1376
+
1377
+ verifySentenceStarterDropDownDisabled: () => {
1378
+ thinkSpherePage.chooseStarterDropdown().should('have.attr', 'aria-disabled', 'true');
1379
+ },
1380
+
1381
+ verifyDisabledProblemTextContainer: (textToEnter) => {
1382
+ thinkSpherePage.problemAskingWrapper()
1383
+ .within(() => {
1384
+ thinkSpherePage.contentEditableDiv().should('have.attr', 'readonly');
1385
+ thinkSpherePage.contentEditableDiv().should('have.value', textToEnter);
1386
+ });
1387
+ },
1388
+
1389
+ verifyDisabledWriteYourPlanTextContainer: (textToEnter) => {
1390
+ thinkSpherePage.writePlanWrapper()
1391
+ .within(() => {
1392
+ thinkSpherePage.contentEditableDiv().should('have.attr', 'readonly');
1393
+ thinkSpherePage.contentEditableDiv().should('have.value', textToEnter);
1394
+ });
1395
+ },
1396
+
1397
+ verifyDisabledStrategyChip: () => {
1398
+ thinkSpherePage.strategyChip().should('have.attr', 'tabindex', -1);
1399
+ },
1400
+
1346
1401
  verifyQuestionInstructionPreviewTexWrapperVisibility: (instructionText) => {
1347
1402
  utilities.verifyElementVisibilityState(thinkSpherePage.questionInstructionPreviewTexWrapper(), 'visible');
1348
1403
  utilities.verifyInnerText(thinkSpherePage.questionInstructionPreviewTexWrapper(), instructionText);
@@ -2137,2247 +2192,7 @@ const tests = {
2137
2192
  editedSentenceStarters.forEach((sentenceStarter, index) => {
2138
2193
  thinkSpherePage.steps.addOptionText('sentenceStarter', index, sentenceStarter);
2139
2194
  });
2140
- thinkSpherePage.steps.saveAQuestionAndimport utilities from "../support/helpers/utilities";
2141
- import { browseItemsPage } from "../pages/components/browseItemsPage";
2142
- import { editCategoryFlyout } from "../pages/components/editCategoryFlyout";
2143
- import { dialogBoxBase } from "../pages/dialogBoxBase";
2144
- import { backgroundImageUploadComponent, createQuestionBasePage, scoringSectionBaseEditTab, commonComponents, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, toolSettingsComponent, questionInstructionsComponent, studentViewSettingsLabelComponent, defaultToolDropdown, essayResponseCommonComponents, equationEditorSectionCommonComponent, equationEditorFlyout, createCustomCategoryFlyout } from "./components"
2145
- import { drawingResponsePage } from "./drawingResponsePage";
2146
- import { optionsWrapperComponent } from "../pages/components/optionsWrapperComponent";
2147
- import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
2148
- import { videoResponsePage } from "./videoResponsePage";
2149
- import { singleSelectionPage } from "./singleSelectionPage";
2150
- import { essayResponsePage } from "./essayResponsePage";
2151
- import { equationEditorCategoriesAndSymbols } from "../fixtures/equationEditorCategoriesAndSymbols ";
2152
- const css = Cypress.env('css');
2153
-
2154
- const selectors = {
2155
- ...essayResponsePage,
2156
- ...backgroundImageUploadComponent,
2157
- ...questionInstructionsComponent,
2158
- ...commonComponents,
2159
- ...scoringSectionBaseEditTab,
2160
- ...additionalSettingsPanel,
2161
- ...drawingResponsePage,
2162
- ...defaultToolDropdown,
2163
- ...optionsWrapperComponent,
2164
- ...essayResponseCommonComponents,
2165
- ...equationEditorSectionCommonComponent,
2166
- ...selectQuestionResourceToolPage,
2167
- ...browseItemsPage,
2168
- ...videoResponsePage,
2169
- ...dialogBoxBase,
2170
- ...editCategoryFlyout,
2171
- ...createCustomCategoryFlyout,
2172
- ...createQuestionBasePage,
2173
-
2174
- editQuestionPencil: () => cy.get('[class*="Widgetstyles__HeaderContainer"] button.icon-pencil'),
2175
- widgetHeaderQuestionTitle: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="Widgetstyles__QuestionTypeText"]'),
2176
- imageUploadSection: () => cy.get('[class*="TabsComponentstyles__ImageUploadComponentWrapper"]'),
2177
- addThinkSphereQuestionButton: () => cy.get('.ngie-btn-contained').contains('add ThinkSphere question'),
2178
- whiteBoardCanvasAndControls: () => cy.get('[class*="WhiteboardPagesstyles__WhiteboardPagesWrapper"]'),
2179
- whiteBoardImageProperties: () => cy.get('[class*="WhiteBoardImagePropertiesstyles__ImagePropertiesWrapper"]'),
2180
- whiteBoardImagePropertiesInputTypeFile: () => cy.get('[class*="WhiteBoardImagePropertiesstyles__ImagePropertiesWrapper"] input[type="file"]'),
2181
- topLeftButton: () => utilities.getNthElement(cy.get('button[class*="WhiteBoardImagePropertiesstyles__StyledButton"]'), 0),
2182
- centerButton: () => utilities.getNthElement(cy.get('button[class*="WhiteBoardImagePropertiesstyles__StyledButton"]'), 1),
2183
- topRightButton: () => utilities.getNthElement(cy.get('button[class*="WhiteBoardImagePropertiesstyles__StyledButton"]'), 2),
2184
- opacityLabel: () => utilities.getNthElement(cy.get('h2[class*="WhiteBoardImagePropertiesstyles__LayoutLabel"]'), 1),
2185
- imageAlternativeTextLabel: () => cy.get('div[class*="InlineTextFieldWithDebouncestyles__PropertyLabel"]'),
2186
- imageAlternativeTextInputField: () => cy.get('input.text-field'),
2187
- imageRadioButton: () => cy.get('div[data-value="image"]'),
2188
- manageWhiteBoardTitle: () => cy.get('[class*="WhiteboardPagesstyles__HeadingLabel"]'),
2189
- whiteBoardPreviousButton: () => cy.get('[class*="whiteboard-pagination-prev-button"]'),
2190
- whiteBoardPageLabel: () => cy.get('[class*="WhiteboardPagesstyles__PageLabel"]'),
2191
- whiteBoardPageCounter: () => cy.get('[class*="WhiteboardPagesstyles__PageCounter"]'),
2192
- whiteBoardNextButton: () => cy.get('[class*="whiteboard-pagination-next-button"]'),
2193
- whiteBoardDeleteButton: () => cy.get('[class*="whiteboard-delete-page-button"]'),
2194
- whiteBoardAddNewPageButton: () => cy.get('[class*="whiteboard-add-new-page-button"]'),
2195
- imageRadioInput: () => cy.get('div[data-value="image"] input[type="radio"]'),
2196
- pageImageTitle: () => cy.get('div[class*="WhiteBoardImagePropertiesstyles__PageImageTitle"]'),
2197
- radioGroupWrapper: () => cy.get('div[class*="ngie-radio-group-wrapper"]'),
2198
- blankCanvasRadioInput: () => cy.get('div[data-value="blankCanvas"] input[type="radio"]'),
2199
- imageUploadSectionWrapper: () => cy.get('div[class*="UploadImagestyles__BackgroundImageWrapper"]'),
2200
- pageImagePropertiesTitle: () => cy.get('div[class*="WhiteBoardImagePropertiesstyles__PageImagePropertiesTitle"]'),
2201
- layoutLabel: () => cy.get('h2[class*="WhiteBoardImagePropertiesstyles__LayoutLabel"]'),
2202
- alignmentOptions: () => cy.get('ul[class*="WhiteBoardImagePropertiesstyles__AlignmentOptions"]'),
2203
- solvePhaseAccordion: () => utilities.getNthElement(cy.get('[class*="Solvestyles__SolvePhaseAccordionWrapper"] .ngie-accordion-summary'), 0),
2204
- solvePhaseAccordionLabel: () => utilities.getNthElement(cy.get('.thinksphere-author-phases-accordion [class*="Solvestyles__HeadingLabel"]'), 0),
2205
- solvePhaseAccordionExpandIcon: () => utilities.getNthElement(cy.get('.thinksphere-author-phases-accordion [class*="expandIconWrapper"]'), 0),
2206
- solveToolsAndControlsOptionsTiles: (formattingOption) => cy.get(`.icon-button-custom-format[aria-label*="${formattingOption}"]`),
2207
- solvePhaseAccordionContentWrapper: () => cy.get('.thinksphere-author-phases-accordion [class*="Solvestyles__ContentWrapper"]'),
2208
- customizeToolsAndControls: () => cy.get('.thinksphere-author-phases-accordion .customize-tools-and-controls-wrapper .ngie-accordion-summary'),
2209
- customizeToolsAndControlsIcon: () => cy.get('.thinksphere-author-phases-accordion .customize-tools-and-controls-wrapper [class*="expandIconWrapper"]'),
2210
- customizeToolsAndControlsLabel: () => cy.get('.thinksphere-author-phases-accordion .customize-tools-and-controls-wrapper [class*="Solvestyles__HeadingLabel"]'),
2211
- phasesSection: () => cy.get('[class*="Phasesstyles__PhasesWrapper"]'),
2212
- phasesSectionTitle: () => cy.get('[class*="Phasesstyles__PhasesTextWrapper"]'),
2213
- planPhaseSection: () => cy.get('[class*="Planstyles__PlanAccordianWrapper"]'),
2214
- planPhaseAccordian: () => cy.get('[class*="Planstyles__PlanAccordianWrapper"] [class~="MuiAccordionSummary-root"]'),
2215
- planPhaseAccordianLabel: () => cy.get('[class*="Planstyles__AccordionLabel"]'),
2216
- planPhaseSectionDescription: () => cy.get('[class*="Planstyles__PlanAccordianWrapper"] [class*="Planstyles__PlanDescriptionTextWrapper"]'),
2217
- planStrategySection: () => cy.get('[class*="Planstyles__StrategiesWrapper"]'),
2218
- planStrategyListHeader: () => cy.get('[class*="Planstyles__StrategiesWrapper"] [class*="Planstyles__HeadingTextWrapper"]'),
2219
- planStrategyListResetToDefault: () => cy.get('[class*="Planstyles__StrategiesWrapper"] [class*="Planstyles__DefaultResetWrapper"]'),
2220
- planStrategyAddItemButton: () => cy.get('[class*="Planstyles__StrategiesWrapper"] [class*="ListOptionsComponentstyles__AddItemWrapper"] [role="button"]'),
2221
- planStrategyCheckbox: () => cy.get('[class*="Planstyles__StrategiesWrapper"] .thinksphere-option-text-field-wrapper [data-ngie-testid*="-checkbox"]'),
2222
- videoLinkComponent: (nthElement = 0) => utilities.getNthElement(cy.get('[class*="ListOptionsComponentstyles__UploadVideoWrapper"]'), nthElement),
2223
- uploadVideoLinkButton: () => cy.get('[class*="ListOptionsComponentstyles__UploadVideoTextWrapper"]'),
2224
- planSentenceStarterSection: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"]'),
2225
- planSentenceStarterListHeader: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] [class*="Planstyles__HeadingTextWrapper"]'),
2226
- planSentenceStarterListResetToDefault: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] [class*="Planstyles__DefaultResetWrapper"]'),
2227
- planSentenceStarterAddItemButton: () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] [class*="ListOptionsComponentstyles__AddItemWrapper"] [role="button"]'),
2228
- planSentenceStarterCheckbox : () => cy.get('[class*="Planstyles__SentenceFramesWrapper"] .thinksphere-option-text-field-wrapper [data-ngie-testid*="-checkbox"]'),
2229
- solvePhaseAccordian: () => cy.get('[class*="Planstyles__SolveAccordianWrapper"] [class~="MuiAccordionSummary-root"] [role="button"]'),
2230
- solvePhaseAccordianLabel: () => cy.get('[class*="Solvestyles__AccordionLabel"]'),
2231
- inputTypeVideoFile: () => cy.get('[class*="Planstyles__StrategiesWrapper"] input[type="file"]'),
2232
- inputTypeFile: () => cy.get('[class*="TabsComponentstyles__ImageUploadComponentWrapper"] input[type="file"]'),
2233
- whiteBoardInputTypeFile: () => cy.get('[class*="UploadImagestyles__UploadWrapper"] input[type="file"]'),
2234
- warningPopupTitle: () => cy.get('.dialog-title-wrapper'),
2235
- warningPopupContentText: () => cy.get('.upload-question-preview-popup-error-msg'),
2236
- warningPopupOkButton: () => cy.get('.upload-question-preview-popup-ok-btn'),
2237
- editVideoButton: () => cy.get('[aria-label*="Change video"]'),
2238
- deleteVideoButton: () => cy.get('[aria-label*="Delete video"]'),
2239
- listInputField: () => cy.get('.option-component textarea[placeholder]'),
2240
- deleteButton: () => cy.get('button[aria-label*="Delete"].ngie-icon-btn-cls'),
2241
- optionNumeration: () => cy.get('[class*="MuiInputAdornment-positionStart"]'),
2242
- iconPencil: () => cy.get('div[class*="icon-pencil"]'),
2243
- iconXCircle: () => cy.get('div[class*="icon-x-circle"]'),
2244
- dragIcon: () => cy.get('[class*="drag-icon-edit"]'),
2245
- moreOptionsIcon: () => cy.get('[class*="more-options-icon"]'),
2246
- ThinkSphereQuestionHeaderPencilIcon: () => utilities.getNthElement(cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-pencil"]'), 0),
2247
- ThinkSphereMathQuestionHeaderSwapIcon: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-swap"]'),
2248
- ThinkSphereMathQuestionHeaderPencilIcon: () => utilities.getNthElement(cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-pencil"]'), 1),
2249
- thinkSphereMathQuestionHeaderDeleteIcon: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="icon-Delete"]'),
2250
- addCheckMathQuestionButton: () => cy.get('.ngie-btn-typography').contains(`Add 'Check your math' question`),
2251
- firstAvailableItemLink: () => utilities.getNthElement(cy.get('.browse-item-styled-link'), 0),
2252
- saveButton: () => cy.get('.ngie-btn-typography').contains('save',{matchCase: false}),
2253
- cancelButton: () => cy.get('.ngie-btn-typography').contains('cancel',{matchCase: false}),
2254
- AddCheckMathQuestionHeader: () => cy.get('.browse-title-wrapper').contains(`Add 'Check your math' question`),
2255
- singleOptionTextFieldWrapper: () => cy.get('[class*="SingleOptionstyle__TextFieldWrapper"]'),
2256
- customizeStampComponent: () => cy.get('[class*="CustomizeStampstyles__CustomizeStampWrapper"]'),
2257
- customizeStampHeading: () => cy.get('[class*="CustomizeStampstyles__CustomizeStampHeading"]'),
2258
- customizeStampCard: (ariaLabel, checked) => cy.get(`[class*="CustomizeStampstyles__StampCard"]${ariaLabel ? ('[aria-label="' + ariaLabel + '"]') : ''}${checked ? ('[aria-checked="' + checked + '"]') : ''}`),
2259
- customizeStampCardImg: (ariaLabel) => cy.get('[class*="CustomizeStampstyles__QuestionImage"]'),
2260
- questionImage: () => cy.get('img[class*="QuestionImageComponentstyle__QuestionImage"]'),
2261
- stampsToolButton: () => cy.get('#stamps button[aria-label*="Stamps"]'),
2262
- imageUploadSectionImageLabel: () => thinkSpherePage.imageUploadSection().find('div[class*="edit-question-image-label"]'),
2263
- imageUploadSectionUploadFileContent: () => thinkSpherePage.imageUploadSection().find('div[class*="upload-file-content"]'),
2264
- imageUploadSectionUploadCloudIconWrapper: () => thinkSpherePage.imageUploadSection().find('div[class*="upload-question-upload-cloud-icon-wrapper"]'),
2265
- imageUploadSectionDragDropFileText: () => thinkSpherePage.imageUploadSection().find('span[class*="drag-and-drop-file-text"]'),
2266
- imageUploadSectionFileInputLabel: () => thinkSpherePage.imageUploadSection().find('div[class*="file-input-label"]'),
2267
- imageUploadSectionDeviceIcon: () => thinkSpherePage.imageUploadSection().find('span[class*="icon-Device"]'),
2268
- imageUploadSectionSupportedFileText: () => thinkSpherePage.imageUploadSection().find('span[class*="supported-file-text"]'),
2269
- imageUploadSectionSupportedFileIconWrapper: () => thinkSpherePage.imageUploadSection().find('div[class*="supported-file-icon-wrapper"]'),
2270
- imageUploadSectionMaximumFileSize: () => thinkSpherePage.imageUploadSection().find('div[class*="maximum-file-size"]'),
2271
- imageUploadSectionFileUploaderWrapper: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__FileUploaderWrapper"]'),
2272
- imageUploadSectionQuestionImage: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__QuestionImage"]'),
2273
- imageUploadSectionQuestionImageContainer: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__QuestionImageContainer"]'),
2274
- imageUploadSectionQuestionImageEditIcon: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__EditIcon"]'),
2275
- imageUploadSectionQuestionImageCrossIcon: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__CrossIcon"]'),
2276
- imageRadioButtonParentSvg: () => thinkSpherePage.imageRadioButton().parent().find('svg'),
2277
- solvePhaseAccordionSvg: () => thinkSpherePage.solvePhaseAccordion().find('svg'),
2278
- customizeToolsAndControlsPath: () => thinkSpherePage.customizeToolsAndControls().find('path'),
2279
- solvePhaseToolsAndControlsOptionsTilesFeatherCheckIcon: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('[data-name="Icon feather-check"]'),
2280
- solvePhaseToolsAndControlsOptionsTilesRectangle: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('[data-name*="Rectangle"]'),
2281
- solvePhaseToolsAndControlsOptionsTilesDragItemFlexWrapperSvg: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('.drag-item-flex-wrapper svg'),
2282
- solvePhaseToolsAndControlsOptionsTilesTextDragIconSvgPath: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('.drag-icon-button-custom-format svg path'),
2283
- solvePhaseToolsAndControlsOptionsTilesArrayDragIconSvgPath: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Array').find('.drag-icon-button-custom-format svg path'),
2284
- playerTimer: () => cy.get('[class*="VideoPlayerstyles__PlayerTimerWrapper"]'),
2285
- strategiesPreviewHeader: () => cy.get('[class*="StrategiesPreviewstyles__HeadingWrapper"]'),
2286
- addNewStrategyButton: () => cy.get('[class*="StrategiesPreviewstyles__AddStrategyButton"]'),
2287
- strategiesInputBoxEditTab: () => cy.get('.video-upload-support-wrapper .edit-mcq-option-wrapper'),
2288
- strategiesBoxPreviewTab: () => cy.get('[class*="StrategiesPreviewstyles__ListWrapper"]'),
2289
- popupTitle: () => cy.get('[class*="dialog-title-wrapper"]'),
2290
- strategyNameLabel: () => cy.get('[class*="ThinkSpherePreviewstyles__StrategyNameTextWrapper"]'),
2291
- strategyNameInputField: () => cy.get('[class*="new-strategy-name-field"]'),
2292
- addStrategyPopupCancelButton: () =>
2293
- cy.get('.dialog-content').contains('Cancel'),
2294
- addStrategyPopupSaveButton: () =>
2295
- cy.get('.dialog-content').contains('Save'),
2296
- // preview tab plan section selection
2297
- questionInstructionPreviewTexWrapper: () => cy.get('.question-instruction.question-text-wrapper'),
2298
- questionInstructionPreviewImageWrapper: () => cy.get('[class*="ThinkSpherePreviewstyles__ImageWrapper"]'),
2299
- questionInstructionPreviewImageExpandButton: () => cy.get('[class*="ThinkSpherePreviewstyles__ExpandImageIconWrapper"]'),
2300
- questionInstructionImagePopup: () => cy.get('[class*="QuestionTextstyle__ImagePopupDiv"]'),
2301
- closeExpandImagePopupButton: () => cy.get('.close-popup-btn'),
2302
- PlanningPreviewWrapper : () => cy.get('[class*="PlanningPreviewstyles__PlanningPreviewWrapper"]'),
2303
- planningPreviewHeading: () => cy.get('[class*="PlanningPreviewstyles__HeadingWrapper"]'),
2304
- planningWriteWrapper : () => cy.get('[class*="PlanningPreviewstyles__WriteWrapper"]'),
2305
- problemAskingWrapper: () => cy.get('[class*="PlanningPreviewstyles__ProblemAskingWrapper"]'),
2306
- contentEditableDiv: () => cy.get('[class*="PlanningPreviewstyles__ContentEditableDiv"]'),
2307
- micIconWrapper: () => cy.get('[class*="PlanningPreviewstyles__MicIconWrapper"]'),
2308
- strategiesToPlanWrapper: () => cy.get('[class*="PlanningPreviewstyles__StrategiesToPlanWrapper"]'),
2309
- subheadingWrapper: () => cy.get('[class*="PlanningPreviewstyles__SubHeadingWrapper"]'),
2310
- writePlanWrapper: () => cy.get('[class*="PlanningPreviewstyles__WritePlanWrapper"]'),
2311
- strategyChipWrapper: () => cy.get('[class*="PlanningPreviewstyles__StrategyChipWrapper"]'),
2312
- strategyChip: () => cy.get('[class*="PlanningPreviewstyles__StrategyChip-"]'),
2313
- strategiesPreviewListLI: () => cy.get('[class*="StrategiesPreviewstyles__ListLI"]'),
2314
- chooseStarterLabel: () => cy.get('[class*="ThinkSpherePreviewstyles__DropDownLabel"]'),
2315
- chooseStarterDropdown: () => cy.get('[class*="drop-down-parent"]'),
2316
- chooseStarterTextIconWrapper: () => cy.get('[class*="DropDownstyles__StarterTextIconWrapper"]'),
2317
- chooseStartersListOptions: () => cy.get('.ngie-popover-container.dropdown-list-container li[role="option"]'),
2318
- chooseStartersListOptionLabels: () => cy.get('.ngie-popover-container.dropdown-list-container li[role="option"] .dropdown-label-text'),
2319
- starterTextWrapper: () => cy.get('.starter-text-wrapper'),
2320
- starterIocn: () => cy.get('[class*="DropDownstyles__StarterIconWrapper"]'),
2321
- addNewStrategyTextWrapper: () => cy.get('[class*="StrategiesPreviewstyles__AddStrategyTextWrapper"]'),
2322
- strategyTextWrapper: () => cy.get('[class*="StrategiesPreviewstyles__StrategyTextWrapper"]'),
2323
- videoIconWrapper: () => cy.get('[class*="StrategiesPreviewstyles__VideoIconWrapper"]'),
2324
- whiteBoardCanvas: () => cy.get('[class*="WhiteboardPagesstyles__Canvas"]'),
2325
- whiteBoardImage: () => cy.get('[class*="WhiteboardPagesstyles__BackgroundImage"]'),
2326
- videoPopupTitle: () => cy.get('[class*="dialog-title-wrapper"]'),
2327
- videoPopupCloseButton: () => cy.get('[class*="dialog-close-button"]'),
2328
- videoPreviewPopup: () => cy.get('[class*="video-preview-popup"]'),
2329
- gridItemsWrapper: (number) => cy.get('[class*="DragAndDropGridstyles__GridItemsWrapper"]').eq(number),
2330
- dragButton: (number) => cy.get('[type="button"]').eq(number),
2331
- customizeStampsButton: (customizeStampPosition) => cy.get(`button[aria-label="Stamp ${customizeStampPosition}"]`),
2332
- buttonSave: () => cy.get('.action-btn-wrapper button').eq(1),
2333
- buttonCancel: () => cy.get('.action-btn-wrapper button').eq(0),
2334
- nextGenThinkSphereCreateItemWrapper: () => cy.get('#nextgen-thinkshpere-create-item'),
2335
- equationEditorSectionTitle: () => cy.get('.equation-editor-text-title'),
2336
- referenceIdWrapper: () => cy.get('.edit-item-reference-id-wrapper'),
2337
- editBoxWrapper: () => cy.get('.edit-box-wrapper'),
2338
- editBoxText: () => cy.get('.edit-box-text'),
2339
- editBoxTextInput: () => thinkSpherePage.editBoxWrapper().find('input'),
2340
- editIconPencil: () => cy.get('.icon-pencil'),
2341
- thinkSphereQuestionHeader: () => cy.get('.edit-question-header-title'),
2342
- filterSectionQuestionTypesAccordion: () => cy.get('.filter-section-expansion-panel-summary-root'),
2343
- filterSectionQuestionAccordion: () => cy.get('.expansion-item-expansion-panel-summary-content'),
2344
- checkBox: () => cy.get('.MuiCheckbox-root'),
2345
- browseItemQuestionItem: () => cy.get('.browse-item-question-item'),
2346
- ErrorMessageContainer: () => cy.get('.ErrorMessageContainer'),
2347
- categoriesDropDown: () => cy.get('.dropdown-form-control[label="Categories"]'),
2348
- categoriesDropDownLabelText: () => cy.get('.dropdown-label-text'),
2349
- categoriesDropDownMenuItem: () => cy.get('.dropdown-menu-item .dropdown-label-text'),
2350
- categoriesDropDownParent: () => cy.get('.drop-down-parent'),
2351
- cardWrapper: () => cy.get('.card-wrapper'),
2352
- cardLabel: () => cy.get('.widget-card-label'),
2353
- thinkSphereQuestionInstructionCKEditor: () => cy.get('div.cke_editable[contenteditable="true"]'),
2354
- reviewTab: () => cy.get('div[aria-label="Review tab"]'),
2355
- planTab: () => cy.get('div[aria-label="Plan tab"]'),
2356
- checkYourMathHeading: () => utilities.getNthElement(cy.get('div[class*="ReviewTabstyles__CheckYourMathTextWrapper"]'), 0),
2357
- problemAskingToMeTextWrapper: () => utilities.getNthElement(cy.get('div[class*="ReviewTabstyles__ProblemAskingToMeTextWrapper"]'), 0),
2358
- reviewQuestionWrapper: () => utilities.getNthElement(cy.get('div[class*="ReviewTabstyles__QuestionWrapper"]'), 0),
2359
- reviewComponentWrapper: () => utilities.getNthElement(cy.get('div[class*="ReviewTabstyles__ComponentWrapper"]'), 0),
2360
- problemStatementWrapper: () => utilities.getNthElement(cy.get('div[class*="ReviewTabstyles__ProblemStatementWrapper"]'), 0),
2361
- gradingViewRadioButton: () => cy.get('label[aria-label="Grading View"]'),
2362
- studentViewRadioButton: () => cy.get('label[aria-label="Student View"]'),
2363
- correctAnswerLabelWrapper: () => cy.get('div[class*="CorrectAnswerLabelWrapper"]'),
2364
- submitButton: () => cy.get('button[aria-label="Submit"]'),
2365
- goToGradingViewButton: () => cy.contains('button', 'GO TO GRADING VIEW'),
2366
- };
2367
-
2368
- const steps = {
2369
- ...essayResponsePage.steps,
2370
- ...backgroundImageUploadComponent.steps,
2371
- ...questionInstructionsComponent.steps,
2372
- ...scoringSectionBaseEditTab.steps,
2373
- ...commonComponents.steps,
2374
- ...additionalSettingsPanel.steps,
2375
- ...toolSettingsComponent.steps,
2376
- ...studentViewSettingsLabelComponent.tests,
2377
- ...defaultToolDropdown.steps,
2378
- ...optionsWrapperComponent.steps,
2379
- ...essayResponseCommonComponents.steps,
2380
- ...equationEditorFlyout.steps,
2381
- ...equationEditorSectionCommonComponent.steps,
2382
- ...selectQuestionResourceToolPage.steps,
2383
- ...browseItemsPage.steps,
2384
- ...videoResponsePage.steps,
2385
- ...createQuestionBasePage.steps,
2386
- ...createCustomCategoryFlyout.steps,
2387
-
2388
- /**
2389
- * Navigates to the ThinkSphere create question page.
2390
- * @param {string} questionType - The type of question to create.
2391
- */
2392
- navigateToThinkSphereCreateQuestion: (questionType) => {
2393
- cy.visit('/item-engine/thinksphere/create-item');
2394
- thinkSpherePage.steps.addThinkSphereQuestion();
2395
- },
2396
-
2397
- addThinkSphereQuestion: () => {
2398
- thinkSpherePage.addThinkSphereQuestionButton()
2399
- .click();
2400
- },
2401
-
2402
- /**
2403
- * Verifies if the accordion is collapsed.
2404
- * @param {string} accordian - The accordion to verify ('plan' or 'solve').
2405
- * @param {boolean} isCollapsed - Whether the accordion should be collapsed.
2406
- */
2407
- verifyAccordianCollapsed: (accordian, isCollapsed) => {
2408
- if (accordian === 'plan') {
2409
- thinkSpherePage.planPhaseAccordian()
2410
- .should('have.attr', 'aria-expanded', isCollapsed ? 'false' : 'true');
2411
- } else if (accordian === 'solve') {
2412
- thinkSpherePage.solvePhaseAccordian()
2413
- .should('have.attr', 'aria-expanded', isCollapsed ? 'false' : 'true');
2414
- }
2415
- },
2416
-
2417
- /**
2418
- * Clicks on the specified accordion.
2419
- * @param {string} accordian - The accordion to click ('plan' or 'solve').
2420
- */
2421
- clickOnAccordian: (accordian) => {
2422
- if (accordian === 'plan') {
2423
- thinkSpherePage.planPhaseAccordian()
2424
- .click();
2425
- } else if (accordian === 'solve') {
2426
- thinkSpherePage.solvePhaseAccordian()
2427
- .click();
2428
- }
2429
- cy.wait(500);
2430
- },
2431
-
2432
- clickOnEditThinkSphereItem: () => {
2433
- browseItemsPage.steps.clickOnItemReferenceId('~zzz item name');
2434
- utilities.getNthElement(thinkSpherePage.editQuestionPencil(), 0)
2435
- .click();
2436
- cy.barsPreLoaderWait();
2437
- },
2438
-
2439
- clickOnAddCheckMathQuestionButton: () => {
2440
- thinkSpherePage.addCheckMathQuestionButton()
2441
- .click();
2442
- cy.interceptGraphql('getItems');
2443
- },
2444
-
2445
- clickOnFirstAvailableItemLink: () => {
2446
- thinkSpherePage.firstAvailableItemLink()
2447
- .click();
2448
- cy.interceptGraphql('getItems');
2449
- },
2450
-
2451
- clickOnSaveButton: () => {
2452
- cy.interceptGraphql('setItem');
2453
- thinkSpherePage.saveButton()
2454
- .click();
2455
- cy.wait('@setItem');
2456
- },
2457
-
2458
- clickOnCancelButton: () => {
2459
- cy.interceptGraphql('setItem');
2460
- thinkSpherePage.cancelButton()
2461
- .click();
2462
- },
2463
-
2464
- clickOnSwapButton: () => {
2465
- thinkSpherePage.ThinkSphereMathQuestionHeaderSwapIcon()
2466
- .click();
2467
- cy.wait(2000);
2468
- },
2469
-
2470
- clickOnEditButton: () => {
2471
- thinkSpherePage.ThinkSphereMathQuestionHeaderPencilIcon()
2472
- .click();
2473
- cy.wait(2000);
2474
- },
2475
-
2476
- clickOnDeleteButton: () => {
2477
- thinkSpherePage.thinkSphereMathQuestionHeaderDeleteIcon()
2478
- .click();
2479
- cy.wait(2000);
2480
- },
2481
-
2482
- /**
2483
- * Verifies the question title.
2484
- * @param {string} questionType - The type of question to verify.
2485
- */
2486
- verifyQuestionTitle: (questionType) => {
2487
- utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.widgetHeaderQuestionTitle(), 0), questionType);
2488
- },
2489
-
2490
- verifyPlanSectionAccessibility: () => {
2491
- thinkSpherePage.planPhaseSection().find('div[class~="MuiAccordionSummary-root"]')
2492
- .should('have.attr', 'aria-expanded', 'true')
2493
- .should('have.attr', 'role', 'button')
2494
- .should('have.attr', 'tabindex', '0');
2495
- },
2496
-
2497
- /**
2498
- * Uploads a file.
2499
- * @param {string} file - The file to upload.
2500
- */
2501
- uploadFile: (file) => {
2502
- thinkSpherePage.inputTypeFile()
2503
- .attachFile(file);
2504
- cy.wait(4000);
2505
- },
2506
-
2507
- uploadWhiteBoardImage: (file) => {
2508
- thinkSpherePage.whiteBoardInputTypeFile()
2509
- .attachFile(file);
2510
- cy.wait(4000);
2511
- },
2512
-
2513
- /**
2514
- * Uploads a video file.
2515
- * @param {string} file - The file to upload.
2516
- */
2517
- uploadVideoFile: (file) => {
2518
- const fileName = file.split('/').pop(); // Extracts only 'sample.mp4'
2519
-
2520
- cy.fixture(file, 'binary') // Read the file as binary
2521
- .then(Cypress.Blob.binaryStringToBlob)
2522
- .then((blob) => {
2523
- const fileObj = new File([blob], fileName, { type: 'video/mp4' });
2524
- const dataTransfer = new DataTransfer();
2525
- dataTransfer.items.add(fileObj);
2526
-
2527
- thinkSpherePage.inputTypeVideoFile().then(($input) => {
2528
- $input[0].files = dataTransfer.files;
2529
- cy.wrap($input).trigger('change', { force: true });
2530
- });
2531
- });
2532
-
2533
- cy.wait(4000);
2534
- },
2535
-
2536
- /**
2537
- * Uploads a file to the whiteboard.
2538
- * @param {string} file - The file to upload.
2539
- */
2540
- WhiteBoardUploadFile: (file) => {
2541
- thinkSpherePage.whiteBoardImagePropertiesInputTypeFile()
2542
- .attachFile(file);
2543
- cy.wait(4000);
2544
- },
2545
-
2546
- navigateToThinkSphereCreateItem: () => {
2547
- cy.visit('/item-engine/thinksphere/create-item');
2548
- },
2549
-
2550
- navigateToReviewItemBank: () => {
2551
- thinkSpherePage.addReviewQuestionButton().click();
2552
- },
2553
-
2554
- clickOnAddThinkSphereQuestion: () => {
2555
- thinkSpherePage.addThinkSphereQuestionButton()
2556
- .click();
2557
- },
2558
-
2559
- verifyCenterOptionAlignmentIsSelected: () => {
2560
- thinkSpherePage.centerButton()
2561
- .should('have.attr', 'aria-pressed', 'true');
2562
- },
2563
-
2564
- /**
2565
- * Verifies the opacity slider value.
2566
- * @param {string} opacityValue - The expected opacity value.
2567
- */
2568
- verifyOpacitySliderValue: (opacityValue) => {
2569
- thinkSpherePage.opacitySlider()
2570
- .find('input')
2571
- .should('have.value', opacityValue)
2572
- },
2573
-
2574
- /**
2575
- * Verifies the opacity input field value.
2576
- * @param {string} opacityValue - The expected opacity value.
2577
- */
2578
- verifyOpacityInputFieldValue: (opacityValue) => {
2579
- thinkSpherePage.opacityInputField()
2580
- .should('have.value', opacityValue)
2581
- },
2582
-
2583
- clickOnOpacitySlider: () => {
2584
- thinkSpherePage.opacitySlider()
2585
- .click();
2586
- },
2587
-
2588
- /**
2589
- * Adds input to the opacity input field.
2590
- * @param {string} value - The value to input.
2591
- */
2592
- addInputToOpacityInputField: (value) => {
2593
- thinkSpherePage.opacityInputField()
2594
- .clear()
2595
- .type(value, { delay: 0 })
2596
- },
2597
-
2598
- /**
2599
- * Verifies the image alternative text input field.
2600
- * @param {string} imageAlternativeText - The expected alternative text.
2601
- */
2602
- verifyImageAlternativeTextInputField: (imageAlternativeText) => {
2603
- thinkSpherePage.imageAlternativeTextInputField()
2604
- .should('have.value', imageAlternativeText);
2605
- },
2606
- expandSolvePhaseAccordion: () => {
2607
- thinkSpherePage.solvePhaseAccordion()
2608
- .click()
2609
- .should('have.attr', 'aria-expanded', 'true');
2610
- },
2611
- expandCustomizeToolsAndControls: () => {
2612
- thinkSpherePage.customizeToolsAndControls()
2613
- .click()
2614
- .should('have.attr', 'aria-expanded', 'true');
2615
- },
2616
- /**
2617
- * Verifies the tools and controls options.
2618
- * @param {Array<string>} options - The options to verify.
2619
- */
2620
- verifyToolsAndControlsOptions: (options) => {
2621
- options.forEach(option => {
2622
- utilities.verifyElementVisibilityState(thinkSpherePage.solveToolsAndControlsOptionsTiles(option), 'visible');
2623
- });
2624
- },
2625
- /**
2626
- * Selects an option from tools and controls.
2627
- * @param {string} option - The option to select.
2628
- */
2629
- selectOptionFromToolsAndControls: (option) => {
2630
- thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
2631
- .click();
2632
- thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
2633
- .should('have.attr', 'data-aria-pressed', 'true');
2634
- },
2635
- /**
2636
- * Deselects an option from tools and controls.
2637
- * @param {string} option - The option to deselect.
2638
- */
2639
- deselectOptionFromToolsAndControls: (option) => {
2640
- thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
2641
- .click();
2642
- thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
2643
- .should('have.attr', 'data-aria-pressed', 'false');
2644
- },
2645
- /**
2646
- * Verifies if an option is selected.
2647
- * @param {string} option - The option to verify.
2648
- */
2649
- verifyOptionIsSelected: (option) => {
2650
- thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
2651
- .should('have.attr', 'data-aria-pressed', 'true');
2652
- },
2653
- /**
2654
- * Verifies if an option is not selected.
2655
- * @param {string} option - The option to verify.
2656
- */
2657
- verifyOptionIsNotSelected: (option) => {
2658
- thinkSpherePage.solveToolsAndControlsOptionsTiles(option)
2659
- .should('have.attr', 'data-aria-pressed', 'false');
2660
- },
2661
-
2662
- /**
2663
- * Verifies the options contents.
2664
- * @param {number} index - The index of the option.
2665
- * @param {string} text - The text to verify.
2666
- * @param {string} placeholder - The placeholder text to verify.
2667
- */
2668
- verifyOptionsContents: (index, text, placeholder) => {
2669
- utilities.getNthElement(thinkSpherePage.optionWrapper(), index)
2670
- .within(() => {
2671
- utilities.getNthElement(thinkSpherePage.listInputField(), 0)
2672
- .should('have.attr', 'placeholder', placeholder);
2673
- utilities.getNthElement(thinkSpherePage.listInputField(), 0)
2674
- .should('have.value', text);
2675
- thinkSpherePage.dragHandleButton()
2676
- .should('exist');
2677
- thinkSpherePage.deleteButton()
2678
- .should('be.visible');
2679
- thinkSpherePage.optionNumeration()
2680
- .should('have.text', index + 1);
2681
- });
2682
- },
2683
-
2684
- /**
2685
- * Deletes an option.
2686
- * @param {number} index - The index of the option to delete.
2687
- */
2688
- deleteOption: (index) => {
2689
- utilities.getNthElement(thinkSpherePage.deleteButton(), index)
2690
- .click();
2691
- },
2692
-
2693
- /**
2694
- * Verifies the delete option button disabled state.
2695
- * @param {string} list - The list to verify ('strategy' or other).
2696
- */
2697
- verifyDeleteOptionButtonDisabledState: (list) => {
2698
- if (list === "strategy") {
2699
- utilities.getNthElement(thinkSpherePage.optionsSectionWrapper(), 0)
2700
- .within(() => {
2701
- thinkSpherePage.deleteButton()
2702
- .each(($element) => {
2703
- utilities.verifyElementDisabled(cy.wrap($element))
2704
- });
2705
- });
2706
- } else {
2707
- utilities.getNthElement(thinkSpherePage.optionsSectionWrapper(), 1)
2708
- .within(() => {
2709
- thinkSpherePage.deleteButton()
2710
- .each(($element) => {
2711
- utilities.verifyElementDisabled(cy.wrap($element))
2712
- });
2713
- });
2714
- }
2715
- },
2716
-
2717
- /**
2718
- * Verifies the checkbox button disabled state.
2719
- * @param {string} list - The list to verify ('strategy' or other).
2720
- * @param {number} optionCount - The number of options to verify.
2721
- */
2722
- verifyCheckboxButtonDisabledState: (list, optionCount) => {
2723
- if (list === 'strategy') {
2724
- utilities.getNthElement(utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('span'), 0), optionCount)
2725
- .should('have.attr', 'aria-disabled', 'true');
2726
- } else {
2727
- utilities.getNthElement(utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('span'), 0), optionCount)
2728
- .should('have.attr', 'aria-disabled', 'true');
2729
- }
2730
- },
2731
-
2732
- /**
2733
- * Add the option in the list.
2734
- * @param {string} list - The list to verify ('strategy' or other).
2735
- */
2736
- addOption: (list) => {
2737
- if (list === 'strategy') {
2738
- thinkSpherePage.planStrategyAddItemButton()
2739
- .click();
2740
- } else {
2741
- thinkSpherePage.planSentenceStarterAddItemButton()
2742
- .click()
2743
- .trigger('mouseout', { force: true });
2744
- }
2745
- },
2746
-
2747
- /**
2748
- * Selects an option.
2749
- * @param {string} list - The list to select from ('strategy' or other).
2750
- * @param {number} optionCount - The number of options to select.
2751
- */
2752
- selectOption: (list, optionCount) => {
2753
- if (list === 'strategy') {
2754
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), optionCount)
2755
- .click();
2756
- } else {
2757
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), optionCount)
2758
- .click();
2759
- }
2760
- },
2761
-
2762
- /**
2763
- * Adds text to an option.
2764
- * @param {string} list - The list to add text to ('strategy' or other).
2765
- * @param {number} optionCount - The number of options to add text to.
2766
- * @param {string} text - The text to add.
2767
- */
2768
- addOptionText: (list, optionCount, text) => {
2769
- if (list === 'strategy') {
2770
- thinkSpherePage.planStrategySection()
2771
- .within(() => {
2772
- utilities.getNthElement(thinkSpherePage.listInputField(), optionCount)
2773
- .clear()
2774
- .type(text, { delay: 500 });
2775
- });
2776
- } else {
2777
- thinkSpherePage.planSentenceStarterSection()
2778
- .within(() => {
2779
- utilities.getNthElement(thinkSpherePage.listInputField(), optionCount)
2780
- .clear()
2781
- .type(text, { delay: 500 });
2782
- });
2783
- }
2784
- },
2785
-
2786
- /**
2787
- * Verifies the warning popup.
2788
- * @param {string} heading - The heading of the warning popup.
2789
- * @param {string} content - The content of the warning popup.
2790
- */
2791
- verifyWarningPopup: (heading, content) => {
2792
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
2793
- dialogBoxBase.dialogBoxTitle().within(() => {
2794
- utilities.verifyInnerText(thinkSpherePage.warningPopupTitle(), heading);
2795
- });
2796
- dialogBoxBase.dialogBoxContent().within(() => {
2797
- utilities.verifyInnerText(thinkSpherePage.warningPopupContentText(), content);
2798
- utilities.verifyInnerText(thinkSpherePage.warningPopupOkButton(), 'OK');
2799
- });
2800
- },
2801
-
2802
- verifyCustomizeStampsComponent: () => {
2803
- utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampComponent(), 'visible');
2804
- },
2805
-
2806
- /**
2807
- * Verifies the default stamps.
2808
- * @param {Array<string>} defaultStamps - The default stamps to verify.
2809
- */
2810
- verifyDefaultStamps: (defaultStamps = []) => {
2811
- thinkSpherePage.customizeStampComponent()
2812
- .within(() => {
2813
- thinkSpherePage.customizeStampCard()
2814
- .should('have.length', defaultStamps.length);
2815
- defaultStamps.forEach((ele) => {
2816
- utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampCard(ele, 'true'), 'visible');
2817
- });
2818
- });
2819
- },
2820
-
2821
- /**
2822
- * Clicks on a customize card.
2823
- * @param {number} index - The index of the card to click.
2824
- * @param {string} ariaLabel - The aria-label of the card to click.
2825
- */
2826
- clickOnCustomizeCard: (index, ariaLabel) => {
2827
- if (ariaLabel) {
2828
- thinkSpherePage.customizeStampCard(ariaLabel)
2829
- .click();
2830
-
2831
- } else {
2832
- utilities.getNthElement(thinkSpherePage.customizeStampCard(), index)
2833
- .click();
2834
- }
2835
- },
2836
-
2837
- verifySelectAndUnselectStamps: () => {
2838
- thinkSpherePage.customizeStampComponent()
2839
- .within(() => {
2840
- thinkSpherePage.steps.clickOnCustomizeCard(0);
2841
- utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampCard('Stamp 1', 'false'), 'visible');
2842
- thinkSpherePage.steps.clickOnCustomizeCard(0);
2843
- utilities.verifyElementVisibilityState(thinkSpherePage.customizeStampCard('Stamp 1', 'true'), 'visible');
2844
- });
2845
- },
2846
-
2847
- clickOnStampsTool: () => {
2848
- thinkSpherePage.stampsToolButton()
2849
- .click();
2850
- },
2851
-
2852
- verifyQuestionImageCustomStamp: () => {
2853
- let imgSrc = '';
2854
- thinkSpherePage.questionImage()
2855
- .invoke('attr', 'src') // Get the value of the 'src' attribute
2856
- .then((src) => {
2857
- imgSrc = src; // Store the value in the imgSrc variable
2858
- cy.log(imgSrc); // Optional: Log the value to the Cypress console
2859
- });
2860
- utilities.verifyCSS(
2861
- utilities.getNthElement(thinkSpherePage.customizeStampCard(), 0),
2862
- {
2863
- border: `1px solid ${css.color.secondaryBtnDisabled}`,
2864
- },
2865
- );
2866
- utilities.getNthElement(thinkSpherePage.customizeStampCard(), 0)
2867
- .within(() => {
2868
- thinkSpherePage.customizeStampCardImg()
2869
- .invoke('attr', 'src') // Get the value of the 'src' attribute
2870
- .then((src) => {
2871
- expect(src).to.equal(imgSrc);
2872
- });
2873
- });
2874
- },
2875
- createReviewQuestion: () => {
2876
- const questionType = 'single selection'
2877
- const options = ['Animal', 'Vehicle', 'Birds', 'Insects'];
2878
- thinkSpherePage.steps.clickOnCreateItemButton();
2879
- thinkSpherePage.steps.selectQuestionType(questionType);
2880
- singleSelectionPage.steps.addQuestionInstructions();
2881
- singleSelectionPage.steps.addInputToOptionsInputField(options);
2882
- singleSelectionPage.steps.allotPoints(20);
2883
- singleSelectionPage.steps.checkOptionInSpecifyCorrectAnswerSection(1);
2884
- thinkSpherePage.steps.clickOnSaveButton();
2885
- },
2886
-
2887
- clickOnVideoLink: () => {
2888
- thinkSpherePage.videoLinkComponent()
2889
- .click();
2890
- },
2891
-
2892
- verifyVideoPlaybackTimer: (elapsedTime, totalTime) => {
2893
- thinkSpherePage.playerTimer()
2894
- .should('have.text', `${elapsedTime}/${totalTime}`);
2895
- },
2896
-
2897
- waitForPlaybackToBegin: () => {
2898
- thinkSpherePage.playerTimer()
2899
- .should('contain', '0:01/');
2900
- },
2901
-
2902
- expandChooseStarterDropdown: () => {
2903
- thinkSpherePage.chooseStarterDropdown()
2904
- .click();
2905
- },
2906
-
2907
- verifyOptionAlignmentIsSelected: (direction) => {
2908
- if(direction === 'topLeft') {
2909
- thinkSpherePage.whiteBoardCanvas()
2910
- .should('not.have.css', 'justify-content', 'start');
2911
- } else {
2912
- thinkSpherePage.whiteBoardCanvas()
2913
- .should('have.css', 'justify-content', (direction === 'center' || direction === 'flex-end') ? 'normal' : direction);
2914
- if (direction === 'center') {
2915
- thinkSpherePage.whiteBoardCanvas()
2916
- .should('have.css', 'align-items', 'normal');
2917
- }
2918
- }
2919
- },
2920
-
2921
- clickOnImageRadioButton: () => {
2922
- thinkSpherePage.imageRadioButton()
2923
- .click();
2924
- },
2925
-
2926
- clickOnEditQuestionIcon: () => {
2927
- utilities.getNthElement(thinkSpherePage.editQuestionPencil(), 0)
2928
- .click();
2929
- cy.wait(1000);
2930
- },
2931
-
2932
- clickOnQuestionInstructionExpandImageButton: () => {
2933
- utilities.getNthElement(thinkSpherePage.questionInstructionPreviewImageExpandButton(), 0)
2934
- .click();
2935
- },
2936
-
2937
- clickOnCloseExpandImagePopupButton: () => {
2938
- thinkSpherePage.dialogBoxRoot()
2939
- .within(() => {
2940
- thinkSpherePage.closeExpandImagePopupButton()
2941
- .click();
2942
- });
2943
- },
2944
-
2945
- clickOnStrategiesPreviewListLI: () => {
2946
- utilities.getNthElement(thinkSpherePage.strategiesPreviewListLI(), 1)
2947
- .click();
2948
- },
2949
-
2950
- clickOnVideoIcon: () => {
2951
- utilities.getNthElement(thinkSpherePage.videoIconWrapper(), 0)
2952
- .click();
2953
- },
2954
-
2955
- closeVideoPopup: () => {
2956
- thinkSpherePage.dialogBoxRoot()
2957
- .within(() => {
2958
- thinkSpherePage.buttonClose()
2959
- .click();
2960
- });
2961
- },
2962
-
2963
- hoverOnVolumeControlButton: () => {
2964
- thinkSpherePage.volumeControlButton()
2965
- .realHover({ position: 'bottom' });
2966
- },
2967
-
2968
- verifyPlaybackElapsedTime: (time) => {
2969
- const playbackTimeElement = thinkSpherePage.playerTimer();
2970
- playbackTimeElement
2971
- .invoke('text')
2972
- .then((text) => {
2973
- let elapsedTime = text.split('/')[0];
2974
- let currentElapsedTimerMinutes = Number(elapsedTime.split(':')[0]);
2975
- let currentElapsedTimerSeconds = Number(elapsedTime.split(':')[1]);
2976
- let currentTotalElapsedTimerSeconds = currentElapsedTimerMinutes * 60 + currentElapsedTimerSeconds;
2977
- expect(currentTotalElapsedTimerSeconds).to.eq(time);
2978
- });
2979
- },
2980
-
2981
- getToolbarOptionCount: (number) => {
2982
- return thinkSpherePage.gridItemsWrapper(number).find('button').its('length');
2983
- },
2984
-
2985
- selectTools: (array, number) => {
2986
- thinkSpherePage.steps.getToolbarOptionCount(number).then((count) => {
2987
- thinkSpherePage.gridItemsWrapper(number).within(() => {
2988
- for (let i = 0; i < count; i++) {
2989
- thinkSpherePage.dragButton(i)
2990
- .invoke('attr', 'aria-label')
2991
- .then((attr) => {
2992
- if (attr.includes('not-selected')) {
2993
- const toolName = attr.split(' ').slice(0, -1).join(' ');
2994
- if (array.includes(toolName)) {
2995
- thinkSpherePage.dragButton(i)
2996
- .click();
2997
- }
2998
- } else {
2999
- const toolName = attr.split(' ').slice(0, -1).join(' ');
3000
- if (!array.includes(toolName)) {
3001
- thinkSpherePage.dragButton(i)
3002
- .click();
3003
- }
3004
- }
3005
- })
3006
- }
3007
- });
3008
- });
3009
- },
3010
-
3011
- verifySelectTools: (array, number) => {
3012
- thinkSpherePage.steps.getToolbarOptionCount(number).then((count) => {
3013
- thinkSpherePage.gridItemsWrapper(number).within(() => {
3014
- for (let i = 0; i < count; i++) {
3015
- thinkSpherePage.dragButton(i)
3016
- .invoke('attr', 'aria-label')
3017
- .then((attr) => {
3018
- const toolName = attr.split(' ').slice(0, -1).join(' ');
3019
- if (array.includes(toolName)) {
3020
- thinkSpherePage.dragButton(i)
3021
- .invoke('attr', 'aria-label')
3022
- .should('contain', ' selected');
3023
- } else {
3024
- thinkSpherePage.dragButton(i)
3025
- .invoke('attr', 'aria-label')
3026
- .should('contain', ' not-selected');
3027
- }
3028
- })
3029
- }
3030
- });
3031
- });
3032
- },
3033
-
3034
- verifyUploadedImage: () => {
3035
- thinkSpherePage.whiteBoardImage()
3036
- .should('exist')
3037
- .and('have.attr', 'src')
3038
- .and('not.be.empty');
3039
- },
3040
-
3041
- visitThinksphereBrowseItemsPage: () => {
3042
- cy.visit('/item-engine/thinksphere/browse-items');
3043
- cy.interceptGraphql('getItems');
3044
- cy.wait('@getItems');
3045
- },
3046
-
3047
- clickOnCustomizeStamp: (customizeStampPosition) => {
3048
- thinkSpherePage.customizeStampsButton(customizeStampPosition)
3049
- .click();
3050
- cy.wait(1000);
3051
- },
3052
-
3053
- verifyCustomizeStampSelectedUnselected: (selected, customizeStampPosition) => {
3054
- utilities.verifyElementAttribute(thinkSpherePage.customizeStampsButton(customizeStampPosition), 'aria-checked', selected ? 'true' : 'false');
3055
- },
3056
-
3057
- saveCustomCategory: () => {
3058
- thinkSpherePage.buttonSave()
3059
- .click();
3060
- },
3061
-
3062
- cancelCustomCategory: () => {
3063
- thinkSpherePage.buttonCancel()
3064
- .click();
3065
- },
3066
-
3067
- createCustomCategoryWithMultipleCategoryCharacters: () => {
3068
- cy.log('Creating a custom category by selecting \'Keypad\' category, partially selecting \'Basic\' and \'Greek\' categories')
3069
- createCustomCategoryFlyout.steps.openCreateCustomCategoryFlyout();
3070
- createCustomCategoryFlyout.steps.checkCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['primary'].displayName}`);
3071
- cy.wait(2000);
3072
- createCustomCategoryFlyout.steps.verifyPartiallyCheckedStateOfCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['matrices'].displayName}`);
3073
- createCustomCategoryFlyout.steps.expandCategoryAccordion(`Greek Symbols`);
3074
- createCustomCategoryFlyout.steps.selectASymbolInCreateCustomCategoryFlyout(`${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols.greek.symbols.gamma.ariaLabel}`);
3075
- createCustomCategoryFlyout.steps.selectASymbolInCreateCustomCategoryFlyout(`${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols.greek.symbols.delta.ariaLabel}`);
3076
- createCustomCategoryFlyout.steps.addInputToCustomCategoryNameInputField('Custom category with name.');
3077
- thinkSpherePage.steps.saveCustomCategory();
3078
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
3079
- },
3080
-
3081
- createCustomCategoryWithNameAndIcon: () => {
3082
- cy.log('Creating a category by selecting \'Arrows\' category')
3083
- createCustomCategoryFlyout.steps.openCreateCustomCategoryFlyout();
3084
- createCustomCategoryFlyout.steps.checkCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['geo'].displayName}`);
3085
- createCustomCategoryFlyout.steps.addInputToCustomCategoryNameInputField('Custom category with name and icon.');
3086
- createCustomCategoryFlyout.steps.addInputToCategoryIconInputField('#');
3087
- thinkSpherePage.steps.saveCustomCategory();
3088
- },
3089
-
3090
- verifyCategoryCharactersAndUnSelectedState: (arrayOfSymbolsAriaLabel) => {
3091
- thinkSpherePage.categoryCharacters()
3092
- .then(($symbols) => {
3093
- for (let index = 10; index < $symbols.length - 1; index++) {
3094
- editCategoryFlyout.categoryCharacters()
3095
- .eq(index)
3096
- .should('not.have.class', 'Mui-selected')
3097
- .invoke('attr', 'aria-label')
3098
- .then((ariaLabel) => {
3099
- const tooltipText = ariaLabel.split(' ').slice(0, -1).join(' ');
3100
- editCategoryFlyout.categoryCharacters()
3101
- .eq(index)
3102
- .verifyTooltip(tooltipText);
3103
- });
3104
- }
3105
- });
3106
- },
3107
-
3108
- verifyCategoryCharactersAndSelectedState: (arrayOfSymbolsAriaLabel) => {
3109
- editCategoryFlyout.categoryCharacters()
3110
- .then(($symbols) => {
3111
- for (let index = 0; index < arrayOfSymbolsAriaLabel.length - 1; index++) {
3112
- editCategoryFlyout.categoryCharacters()
3113
- .eq(index)
3114
- .should('have.class', 'Mui-selected')
3115
- .invoke('attr', 'aria-label')
3116
- .then((ariaLabel) => {
3117
- const tooltipText = ariaLabel.split(' ').slice(0, -1).join(' ');
3118
- editCategoryFlyout.categoryCharacters()
3119
- .eq(index)
3120
- .verifyTooltip(tooltipText);
3121
- });
3122
- }
3123
- });
3124
- },
3125
-
3126
- expandDropdown: () => {
3127
- thinkSpherePage.categoriesDropDownParent()
3128
- .click();
3129
- },
3130
-
3131
- verifyDropdownOptions: (dropDownListArray) => {
3132
- thinkSpherePage.categoriesDropDownMenuItem().should('have.length', dropDownListArray.length).each(($item) => {
3133
- cy.wrap($item)
3134
- .invoke('text')
3135
- .then((text) => {
3136
- const trimmedText = text.trim();
3137
- expect(dropDownListArray).to.include(trimmedText);
3138
- });
3139
- });
3140
- },
3141
-
3142
- clickOnDropDownCategory: (index) => {
3143
- thinkSpherePage.categoriesDropDownMenuItem().eq(index).click();
3144
- },
3145
-
3146
- clickOnQuestionTypesAccordion: () => {
3147
- thinkSpherePage.filterSectionQuestionTypesAccordion()
3148
- .click()
3149
- },
3150
-
3151
- typeInSearchBar: (input) => {
3152
- thinkSpherePage.searchBar()
3153
- .clear()
3154
- .type(input)
3155
- .should('have.value', input);
3156
- },
3157
-
3158
- searchInSearchBar: (input) => {
3159
- thinkSpherePage.searchBar()
3160
- .clear()
3161
- .type(input)
3162
- .should('have.value', input)
3163
- .type('{enter}');
3164
- },
3165
-
3166
- clickOnSolvePhaseAccordionIcon: (element) => {
3167
- thinkSpherePage.solvePhaseAccordionExpandIcon()
3168
- .click();
3169
- },
3170
-
3171
- verifyElementDoesNotHaveExpandedClass: (element) => {
3172
- element.should('not.have.class', 'Mui-expanded');
3173
- },
3174
-
3175
- verifyElementDoesNotHaveCheckedClass: (element) => {
3176
- element.should('not.have.class', 'Mui-checked');
3177
- },
3178
-
3179
- verifyThinkSphereSearchBarPlaceholder: () => {
3180
- thinkSpherePage.searchBar().should('have.attr', 'placeholder', 'Search by title, tags and content');
3181
- },
3182
-
3183
- verifyReviewItemSearchBarPlaceholder: () => {
3184
- thinkSpherePage.searchBar().should('have.attr', 'placeholder', 'Search by question type');
3185
- },
3186
-
3187
- verifyEquationEditorSectionCategoryNotPressed: () => {
3188
- thinkSpherePage.equationEditorSectionCategories().eq(1).should('have.attr', 'data-aria-pressed', 'false');
3189
- },
3190
-
3191
- verifyEquationEditorSectionCategoryIsPressed: () => {
3192
- thinkSpherePage.equationEditorSectionCategories().eq(10).should('have.attr', 'data-aria-pressed', 'true');
3193
- },
3194
-
3195
- verifyTypeCheckBoxStrategy: () => {
3196
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 5)
3197
- .find('input').should('have.attr', 'type', 'checkbox');
3198
- },
3199
-
3200
- verifyTypeCheckBoxSentenceStarter: () => {
3201
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 5)
3202
- .find('input').should('have.attr', 'type', 'checkbox');
3203
- },
3204
-
3205
- verifyStrategyCheckBoxNotChecked: () => {
3206
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 5)
3207
- .find('input').should('not.have.attr', 'checked');
3208
- },
3209
-
3210
- verifySentenceStrategyCheckBoxNotChecked: () => {
3211
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 5)
3212
- .find('input').should('not.have.attr', 'checked');
3213
- },
3214
-
3215
- verifyTextIsNotEmpty: (element) => {
3216
- element.invoke('text')
3217
- .should('not.be.empty');
3218
- },
3219
-
3220
- verifyLength: (element, length) => {
3221
- element.should('have.length', length);
3222
- },
3223
-
3224
- verifyFilterSectionExpanded: () => {
3225
- thinkSpherePage.filterSectionQuestionTypesAccordion().should('have.class', 'Mui-expanded');
3226
- },
3227
-
3228
- verifyFilterSectionCollapsed: () => {
3229
- thinkSpherePage.filterSectionQuestionTypesAccordion().should('not.have.class', 'Mui-expanded');
3230
- },
3231
-
3232
- verifySolvePhaseAccordionExpanded: () => {
3233
- thinkSpherePage.solvePhaseAccordionExpandIcon().should('have.class', 'Mui-expanded');
3234
- },
3235
-
3236
- verifySolvePhaseAccordionCollapsed: () => {
3237
- thinkSpherePage.solvePhaseAccordionExpandIcon().should('not.have.class', 'Mui-expanded');
3238
- },
3239
-
3240
- addQuestionInstructionInnerHTML: (innerHTML) => {
3241
- thinkSpherePage.thinkSphereQuestionInstructionCKEditor()
3242
- .invoke('html', innerHTML);
3243
- },
3244
-
3245
- verifyQuestionInstructionIncreasedHeightAndScrollBar: () => {
3246
- thinkSpherePage.thinkSphereQuestionInstructionCKEditor()
3247
- .invoke('height') // Get the height of the element
3248
- .should('be.gt', 198);
3249
-
3250
- thinkSpherePage.thinkSphereQuestionInstructionCKEditor()
3251
- .should(($el) => {
3252
- const scrollWidth = $el[0].scrollWidth;
3253
- const clientWidth = $el[0].clientWidth;
3254
-
3255
- // Assert that horizontal scroll is present
3256
- expect(scrollWidth).to.be.greaterThan(clientWidth);
3257
- });
3258
- },
3259
-
3260
- verifyQuestionImagePopup: () => {
3261
- thinkSpherePage.dialogBoxRoot()
3262
- .within(() => {
3263
- utilities.verifyElementVisibilityState(thinkSpherePage.questionInstructionImagePopup(), 'visible');
3264
- utilities.verifyElementVisibilityState(thinkSpherePage.closeExpandImagePopupButton(), 'visible');
3265
- });
3266
- },
3267
-
3268
- verifyAddNewStrategyPopupCloseFunctionality: () => {
3269
- let countBeforeOpeningPopup, countAfterClosingPopup;
3270
- cy.get(thinkSpherePage.strategiesBoxPreviewTab())
3271
- .its('length')
3272
- .then((count) => {
3273
- countBeforeOpeningPopup = count;
3274
- cy.log('Count before opening popup:', countBeforeOpeningPopup);
3275
- });
3276
- thinkSpherePage.addNewStrategyButton().click();
3277
- thinkSpherePage.addStrategyPopupCancelButton().click();
3278
- cy.get(thinkSpherePage.strategiesBoxPreviewTab())
3279
- .its('length')
3280
- .then((count) => {
3281
- countAfterClosingPopup = count;
3282
- cy.log('Count after closing popup:', countAfterClosingPopup);
3283
- expect(countAfterClosingPopup).to.equal(countBeforeOpeningPopup);
3284
- });
3285
- },
3286
-
3287
- verifyAddNewStrategyPopupSaveFunctionality: () => {
3288
- let countBeforeOpeningPopup, countAfterClosingPopup;
3289
- thinkSpherePage.strategiesBoxPreviewTab()
3290
- .its('length')
3291
- .then((count) => {
3292
- countBeforeOpeningPopup = count;
3293
- cy.log('Count before opening popup:', countBeforeOpeningPopup);
3294
- });
3295
- thinkSpherePage.addNewStrategyButton().click();
3296
- thinkSpherePage.strategyNameInputField().type('Test Strategy');
3297
- thinkSpherePage.addStrategyPopupSaveButton().click();
3298
- thinkSpherePage.strategiesBoxPreviewTab()
3299
- .its('length')
3300
- .then((count) => {
3301
- countAfterClosingPopup = count;
3302
- cy.log('Count after closing popup:', countAfterClosingPopup);
3303
- expect(countAfterClosingPopup).to.equal(countBeforeOpeningPopup + 1);
3304
- });
3305
- },
3306
-
3307
- verifyVideoPopupDialogBox: () => {
3308
- thinkSpherePage.dialogBoxRoot()
3309
- .within(() => {
3310
- utilities.verifyElementVisibilityState(thinkSpherePage.dialogBoxTitle(), 'visible');
3311
- utilities.verifyInnerText(thinkSpherePage.dialogBoxTitle(), 'Create_a_model');
3312
- utilities.verifyElementVisibilityState(thinkSpherePage.buttonClose(), 'visible');
3313
- });
3314
- },
3315
-
3316
- verifySentenceStartersDropdown: () => {
3317
- thinkSpherePage.chooseStarterTextIconWrapper()
3318
- .within(() => {
3319
- utilities.verifyElementVisibilityState(thinkSpherePage.starterIocn(), 'visible');
3320
- utilities.verifyInnerText(thinkSpherePage.starterTextWrapper(), 'Starters');
3321
- });
3322
- thinkSpherePage.chooseStarterDropdown()
3323
- .verifyPseudoClassBeforeProperty('content', '""');
3324
- },
3325
-
3326
- verifySentenceStartersDropdownOptions: (sentenceStartersTextDefault) => {
3327
- sentenceStartersTextDefault.forEach((label, index) => {
3328
- utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.chooseStartersListOptionLabels(), index), label);
3329
- });
3330
- },
3331
-
3332
- verifySentenceStartersDropdownFunctionality: () => {
3333
- thinkSpherePage.writePlanWrapper()
3334
- .within(() => {
3335
- thinkSpherePage.contentEditableDiv().clear();
3336
- });
3337
- thinkSpherePage.steps.expandChooseStarterDropdown();
3338
- utilities.getNthElement(thinkSpherePage.chooseStartersListOptions(), 1).click();
3339
- thinkSpherePage.writePlanWrapper()
3340
- .within(() => {
3341
- thinkSpherePage.contentEditableDiv().should('have.value', 'First, I will ');
3342
- thinkSpherePage.contentEditableDiv().clear();
3343
- });
3344
- },
3345
-
3346
- verifyProblemAskingHeading: () => {
3347
- thinkSpherePage.problemAskingWrapper()
3348
- .within(() => {
3349
- utilities.verifyInnerText(thinkSpherePage.subheadingWrapper(), 'The problem is asking me to');
3350
- utilities.verifyElementVisibilityState(thinkSpherePage.subheadingWrapper(), 'visible');
3351
- });
3352
- },
3353
-
3354
- verifyProblemAskingTextArea: () => {
3355
- thinkSpherePage.problemAskingWrapper()
3356
- .within(() => {
3357
- utilities.verifyElementVisibilityState(thinkSpherePage.contentEditableDiv(), 'visible');
3358
- utilities.verifyElementAttribute(thinkSpherePage.contentEditableDiv(), 'placeholder', 'Enter your text here');
3359
- });
3360
- },
3361
-
3362
- verifyProblemAskingMicSection: (isGrading=false) => {
3363
- thinkSpherePage.problemAskingWrapper()
3364
- .within(() => {
3365
- utilities.verifyElementVisibilityState(thinkSpherePage.micIconWrapper(), 'visible');
3366
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'role', 'button');
3367
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'aria-label', 'Mic button');
3368
- if(isGrading) {
3369
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'tabindex', -1);
3370
- }
3371
- });
3372
- },
3373
-
3374
- verifyProblemAskingTextAreaFunctionality: (textToEnter) => {
3375
- thinkSpherePage.problemAskingWrapper()
3376
- .within(() => {
3377
- thinkSpherePage.contentEditableDiv().type(textToEnter);
3378
- thinkSpherePage.contentEditableDiv().should('have.value', textToEnter);
3379
- });
3380
- },
3381
-
3382
- verifyStrategiesToPlanHeading: () => {
3383
- thinkSpherePage.strategiesToPlanWrapper()
3384
- .within(() => {
3385
- utilities.verifyInnerText(thinkSpherePage.subheadingWrapper(), 'Add strategies to plan');
3386
- utilities.verifyElementVisibilityState(thinkSpherePage.subheadingWrapper(), 'visible');
3387
- });
3388
- },
3389
-
3390
- verifyWritePlanHeading: () => {
3391
- thinkSpherePage.writePlanWrapper()
3392
- .within(() => {
3393
- utilities.verifyInnerText(thinkSpherePage.subheadingWrapper(), 'Write your plan');
3394
- utilities.verifyElementVisibilityState(thinkSpherePage.subheadingWrapper(), 'visible');
3395
- });
3396
- },
3397
-
3398
- verifyWritePlanTextArea: () => {
3399
- thinkSpherePage.writePlanWrapper()
3400
- .within(() => {
3401
- utilities.verifyElementVisibilityState(thinkSpherePage.contentEditableDiv(), 'visible');
3402
- utilities.verifyElementAttribute(thinkSpherePage.contentEditableDiv(), 'placeholder', 'Enter your plan here');
3403
- });
3404
- },
3405
-
3406
- verifyWritePlanMicSection: (isGrading=false) => {
3407
- thinkSpherePage.writePlanWrapper()
3408
- .within(() => {
3409
- utilities.verifyElementVisibilityState(thinkSpherePage.micIconWrapper(), 'visible');
3410
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'role', 'button');
3411
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'aria-label', 'Mic button');
3412
- if(isGrading) {
3413
- utilities.verifyElementAttribute(thinkSpherePage.micIconWrapper(), 'tabindex', -1);
3414
- }
3415
- });
3416
- },
3417
-
3418
- verifyWritePlanTextAreaFunctionality: (planTextToEnter) => {
3419
- thinkSpherePage.writePlanWrapper()
3420
- .within(() => {
3421
- thinkSpherePage.contentEditableDiv().type(planTextToEnter);
3422
- thinkSpherePage.contentEditableDiv().should('have.value', planTextToEnter);
3423
- thinkSpherePage.contentEditableDiv().clear();
3424
- });
3425
- },
3426
-
3427
- verifyStrategyChipClickFunctionality: () => {
3428
- thinkSpherePage.writePlanWrapper()
3429
- .within(() => {
3430
- thinkSpherePage.contentEditableDiv().clear();
3431
- });
3432
- thinkSpherePage.strategyChip().click();
3433
- thinkSpherePage.writePlanWrapper()
3434
- .within(() => {
3435
- thinkSpherePage.contentEditableDiv().should('have.value', 'look for a pattern ');
3436
- });
3437
- },
3438
- clickUploadVideoButton: () => {
3439
- thinkSpherePage.uploadVideoLinkButton()
3440
- .click();
3441
- },
3442
-
3443
- verifyPreAuthoredVideoTitles: (defaultStrategyTexts) => {
3444
- defaultStrategyTexts.forEach((text,index) => {
3445
- thinkSpherePage.videoLinkComponent(index)
3446
- .within(() => {
3447
- utilities.verifyInnerText(thinkSpherePage.uploadVideoLinkButton(), text);
3448
- })
3449
- });
3450
- },
3451
-
3452
- verifyPreAuthoredVideos: (preAuthoredVideos) => {
3453
- preAuthoredVideos.forEach(({duration}, optionIndex) => {
3454
- thinkSpherePage.videoLinkComponent(optionIndex)
3455
- .within(thinkSpherePage.steps.clickUploadVideoButton);
3456
- thinkSpherePage.steps.startPlayback();
3457
- thinkSpherePage.steps.waitForPlaybackToBegin();
3458
- thinkSpherePage.playerTimer()
3459
- .should('contain', `/${duration}`);
3460
- thinkSpherePage.steps.closeVideoPopup();
3461
- })
3462
- },
3463
-
3464
- clickOnReviewTab: () => {
3465
- thinkSpherePage.reviewTab()
3466
- .click();
3467
- },
3468
-
3469
- clickOnPlanTab: () => {
3470
- thinkSpherePage.planTab()
3471
- .click();
3472
- },
3473
-
3474
- switchToGradingView: () => {
3475
- thinkSpherePage.gradingViewRadioButton()
3476
- .click();
3477
- },
3478
-
3479
- switchToStudentView: () => {
3480
- thinkSpherePage.studentViewRadioButton()
3481
- .click();
3482
- },
3483
-
3484
- verifyCorrectAnswerLabel: () => {
3485
- utilities.verifyElementVisibilityState(thinkSpherePage.correctAnswerLabelWrapper(), 'visible');
3486
- },
3487
-
3488
- addImageAlternativeTextInputFieldText: (alternateTextForImage) => {
3489
- thinkSpherePage.imageAlternativeTextInputField().type(alternateTextForImage);
3490
- cy.wait(2000);
3491
- },
3492
-
3493
- stepsBeforeGradingView: () => {
3494
- thinkSpherePage.steps.expandChooseStarterDropdown();
3495
- utilities.getNthElement(thinkSpherePage.chooseStartersListOptions(), 1).click();
3496
- thinkSpherePage.problemAskingWrapper().first()
3497
- .within(() => {
3498
- thinkSpherePage.contentEditableDiv().type('This is a test text for the problem.');
3499
- });
3500
- thinkSpherePage.strategyChip().click();
3501
- thinkSpherePage.submitButton().click();
3502
- thinkSpherePage.goToGradingViewButton().click();
3503
- },
3504
-
3505
- verifyAddStrategiesButtonDisabled: () => {
3506
- thinkSpherePage.addNewStrategyButton().should('have.attr', 'tabindex', '-1');
3507
- thinkSpherePage.addNewStrategyButton().click({ force: true });
3508
- utilities.verifyElementVisibilityState(thinkSpherePage.popupTitle(), 'notExist');
3509
- },
3510
-
3511
- verifyStrategiesListButtonDisabled: () => {
3512
- utilities.getNthElement(thinkSpherePage.strategiesPreviewListLI(), 0).should('have.attr', 'tabindex', '-1');
3513
- utilities.getNthElement(thinkSpherePage.strategiesPreviewListLI(), 0).should('have.attr', 'aria-disabled', 'true');
3514
- },
3515
-
3516
- verifySentenceStarterDropDownDisabled: () => {
3517
- thinkSpherePage.chooseStarterDropdown().should('have.attr', 'aria-disabled', 'true');
3518
- },
3519
-
3520
- verifyDisabledProblemTextContainer: (textToEnter) => {
3521
- thinkSpherePage.problemAskingWrapper()
3522
- .within(() => {
3523
- thinkSpherePage.contentEditableDiv().should('have.attr', 'readonly');
3524
- thinkSpherePage.contentEditableDiv().should('have.value', textToEnter);
3525
- });
3526
- },
3527
-
3528
- verifyDisabledWriteYourPlanTextContainer: (textToEnter) => {
3529
- thinkSpherePage.writePlanWrapper()
3530
- .within(() => {
3531
- thinkSpherePage.contentEditableDiv().should('have.attr', 'readonly');
3532
- thinkSpherePage.contentEditableDiv().should('have.value', textToEnter);
3533
- });
3534
- },
3535
-
3536
- verifyDisabledStrategyChip: () => {
3537
- thinkSpherePage.strategyChip().should('have.attr', 'tabindex', -1);
3538
- },
3539
-
3540
- verifyQuestionInstructionPreviewTexWrapperVisibility: (instructionText) => {
3541
- utilities.verifyElementVisibilityState(thinkSpherePage.questionInstructionPreviewTexWrapper(), 'visible');
3542
- utilities.verifyInnerText(thinkSpherePage.questionInstructionPreviewTexWrapper(), instructionText);
3543
- },
3544
-
3545
- verifyQuestionInstructionPreviewImageWrapperVisibility: () => {
3546
- utilities.verifyElementVisibilityState(thinkSpherePage.questionInstructionPreviewImageWrapper(), 'visible');
3547
- utilities.verifyElementVisibilityState(thinkSpherePage.questionInstructionPreviewImageExpandButton(), 'visible');
3548
- },
3549
- };
3550
-
3551
- const tests = {
3552
- ...essayResponsePage.tests,
3553
- ...createQuestionBasePage.tests,
3554
- ...backgroundImageUploadComponent.tests,
3555
- ...questionInstructionsComponent.tests,
3556
- ...commonComponents.tests,
3557
- ...scoringSectionBaseEditTab.tests,
3558
- ...additionalSettingsPanel.tests,
3559
- ...additionalSettingsAccessibilitySectionComponent.tests,
3560
- ...toolSettingsComponent.tests,
3561
- ...studentViewSettingsLabelComponent.tests,
3562
- ...defaultToolDropdown.tests,
3563
- ...optionsWrapperComponent.tests,
3564
- ...equationEditorFlyout.tests,
3565
-
3566
- /**
3567
- * Verifies the ThinkSphere cancel button functionality.
3568
- * @param {string} questionType - The type of question.
3569
- */
3570
- verifyThinkSphereCancelButton: (questionType) => {
3571
- it('When user has made no edits and clicks on cancel button, the user should be directed back to the \'Select a Question\' page', () => {
3572
- createQuestionBasePage.cancelButton()
3573
- .click();
3574
- });
3575
-
3576
- 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.\'', () => {
3577
- thinkSpherePage.steps.navigateToThinkSphereCreateQuestion();
3578
- questionInstructionsComponent.steps.addTextInQuestionInstructionsInputField('Edited');
3579
- if (questionType !== 'feedback scale' && questionType !== 'highlight image' && questionType !== 'think sphere') {
3580
- scoringSectionBaseEditTab.steps.allotPoints(20);
3581
- };
3582
- createQuestionBasePage.cancelButton()
3583
- .click();
3584
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
3585
- utilities.verifyInnerText(dialogBoxBase.dialogBoxContentText(), 'Are you sure you want to leave this page? Your changes have not been saved.');
3586
- utilities.verifyInnerText(dialogBoxBase.buttonAccept(), 'Yes, I want to leave this page');
3587
- utilities.verifyInnerText(dialogBoxBase.buttonReject(), 'No, I\'d like to go back');
3588
- });
3589
-
3590
- it('CSS of popup', { tags: 'css' }, () => {
3591
- utilities.verifyCSS(dialogBoxBase.dialogBox(), {
3592
- 'background-color': css.color.defaultBackground
3593
- })
3594
-
3595
- utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
3596
- 'color': css.color.sectionHeading,
3597
- 'font-size': css.fontSize.default,
3598
- 'font-weight': css.fontWeight.regular
3599
- });
3600
- utilities.verifyCSS(dialogBoxBase.buttonAccept(), {
3601
- 'color': css.color.primaryBtn,
3602
- 'font-size': css.fontSize.default,
3603
- 'font-weight': css.fontWeight.semibold,
3604
- 'background-color': css.color.primaryBtnBg
3605
- });
3606
- utilities.verifyCSS(dialogBoxBase.buttonReject(), {
3607
- 'color': css.color.secondaryBtn,
3608
- 'font-size': css.fontSize.default,
3609
- 'font-weight': css.fontWeight.semibold,
3610
- 'background-color': css.color.transparent
3611
- });
3612
- });
3613
-
3614
- it('Accessibility of popup', { tags: 'a11y' }, () => {
3615
- cy.checkAccessibility(dialogBoxBase.dialogBox());
3616
- });
3617
-
3618
- 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`, () => {
3619
- dialogBoxBase.buttonReject()
3620
- .click();
3621
- createQuestionBasePage.editTab()
3622
- .should('have.attr', 'aria-selected', 'true');
3623
- utilities.verifyTextContent(questionInstructionsComponent.questionInstructionsInputField(), 'Edited');
3624
- });
3625
-
3626
- 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.`, () => {
3627
- createQuestionBasePage.cancelButton()
3628
- .click();
3629
- dialogBoxBase.buttonAccept()
3630
- .click();
3631
- });
3632
- },
3633
-
3634
- /**
3635
- * Verifies the disabled delete button tooltip.
3636
- * @param {number} NthElement - The index of the delete button.
3637
- * @param {string} disableTooltipText - The tooltip text to verify.
3638
- */
3639
- verifyDisabledDeleteButtonTooltip: (NthElement, disableTooltipText) => {
3640
- 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', () => {
3641
- utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
3642
- .trigger('mouseover', { force: true });
3643
- utilities.verifyInnerText(thinkSpherePage.tooltipText(), disableTooltipText);
3644
- utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
3645
- .trigger('mouseout', { force: true });
3646
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
3647
- });
3648
-
3649
- it('CSS of disabled delete button tooltip', { tags: 'css' }, () => {
3650
- utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
3651
- .trigger('mouseover', { force: true });
3652
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'visible')
3653
- utilities.verifyCSS(thinkSpherePage.tooltipText(), {
3654
- 'color': css.color.whiteText,
3655
- 'font-size': css.fontSize.small,
3656
- 'font-weight': css.fontWeight.regular
3657
- });
3658
- utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
3659
- .trigger('mouseout', { force: true });
3660
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
3661
- });
3662
- },
3663
-
3664
- /**
3665
- * Verifies the add option functionality.
3666
- * @param {string} list - The list to add the option to ('strategy' or other).
3667
- * @param {Array<string>} optionList - The list of options.
3668
- */
3669
- verifyAddOptionFunctionality: (list, optionList) => {
3670
- it('When user adds an option using \'Add Option\' button then the added option input field should be displayed and option numeration should increment', () => {
3671
- let initialOptionCount;
3672
- if (list === 'strategy') {
3673
- thinkSpherePage.planStrategySection()
3674
- .within(() => {
3675
- thinkSpherePage.steps.getOptionCount().then((count) => {
3676
- initialOptionCount = count;
3677
- });
3678
- });
3679
-
3680
- thinkSpherePage.steps.addOption(list);
3681
- thinkSpherePage.planStrategySection()
3682
- .within(() => {
3683
- thinkSpherePage.steps.getOptionCount().should('eq', initialOptionCount + 1);
3684
- thinkSpherePage.steps.verifyOptionsContents(initialOptionCount, '', 'Enter strategy name');
3685
- });
3686
- thinkSpherePage.steps.deleteOption(5);
3687
- } else {
3688
- thinkSpherePage.planSentenceStarterSection()
3689
- .within(() => {
3690
- thinkSpherePage.steps.getOptionCount().then((count) => {
3691
- initialOptionCount = count;
3692
- });
3693
- });
3694
-
3695
- thinkSpherePage.steps.addOption(list);
3696
- thinkSpherePage.planSentenceStarterSection()
3697
- .within(() => {
3698
- thinkSpherePage.steps.getOptionCount().should('eq', initialOptionCount + 1);
3699
- thinkSpherePage.steps.verifyOptionsContents(initialOptionCount, '', 'Enter sentence starter name');
3700
- });
3701
- thinkSpherePage.steps.deleteOption(10);
3702
- }
3703
- });
3704
- },
3705
-
3706
- /**
3707
- * Verifies the contents and styling of the 'Options' section.
3708
- * @param {Object} params - The parameters for the function.
3709
- * @param {number} params.optionFieldsCount - The expected number of option input fields.
3710
- * @param {Array<string>} params.optionList - The list of options.
3711
- * @param {string} params.placeholder - The placeholder text.
3712
- * @param {string} params.list - The list to verify ('strategy' or other).
3713
- */
3714
- verifyListSectionContents: ({
3715
- optionFieldsCount,
3716
- optionList,
3717
- placeholder,
3718
- list,
3719
- }) => {
3720
- it(`By default ${optionFieldsCount} option input fields with placeholder text, drag handle and delete option icon buttons should be displayed`, () => {
3721
- for (let index = 0; index < optionFieldsCount; index++) {
3722
- if (list === 'strategy') {
3723
- thinkSpherePage.planStrategySection()
3724
- .within(() => {
3725
- cy.log(optionList, optionList[index])
3726
- thinkSpherePage.steps.verifyOptionsContents(index, optionList[index], placeholder);
3727
- })
3728
- } else {
3729
- thinkSpherePage.planSentenceStarterSection()
3730
- .within(() => {
3731
- cy.log(optionList, optionList[index])
3732
- thinkSpherePage.steps.verifyOptionsContents(index, optionList[index], placeholder);
3733
- })
3734
- }
3735
- };
3736
- });
3737
-
3738
- it('\'Add Option\' button should be present', () => {
3739
- if (list === 'strategy') {
3740
- utilities.verifyInnerText(thinkSpherePage.planStrategyAddItemButton().find('p'), 'Add strategy');
3741
- utilities.verifyElementVisibilityState(thinkSpherePage.planStrategyAddItemButton(), 'visible');
3742
- } else {
3743
- utilities.verifyInnerText(thinkSpherePage.planSentenceStarterAddItemButton().find('p'), 'Add sentence starter');
3744
- utilities.verifyElementVisibilityState(thinkSpherePage.planSentenceStarterAddItemButton(), 'visible');
3745
- }
3746
- });
3747
-
3748
- it('CSS of Options section', { tags: 'css' }, () => {
3749
- const withinComponent = (list === 'strategy') ? thinkSpherePage.planStrategySection() : thinkSpherePage.planSentenceStarterSection();
3750
-
3751
- withinComponent.within(() => {
3752
- utilities.verifyCSS(thinkSpherePage.dragHandleButton().find('path'), {
3753
- 'fill': css.color.secondaryBtnActive
3754
- });
3755
- thinkSpherePage.deleteButton()
3756
- .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
3757
- utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.listInputField(), 0), {
3758
- 'color': css.color.text,
3759
- 'font-size': css.fontSize.default,
3760
- 'font-weight': css.fontWeight.regular
3761
- });
3762
- });
3763
-
3764
- if (list === 'strategy') {
3765
- utilities.verifyCSS(thinkSpherePage.planStrategyAddItemButton().find('p'), {
3766
- 'color': css.color.secondaryBtnActive,
3767
- 'font-size': css.fontSize.default,
3768
- 'font-weight': css.fontWeight.regular
3769
- });
3770
- } else {
3771
- utilities.verifyCSS(thinkSpherePage.planSentenceStarterAddItemButton().find('p'), {
3772
- 'color': css.color.secondaryBtnActive,
3773
- 'font-size': css.fontSize.default,
3774
- 'font-weight': css.fontWeight.regular
3775
- });
3776
- }
3777
- });
3778
- },
3779
-
3780
- /**
3781
- * Verifies the drag handle tooltip.
3782
- * @param {number} NthElement - The index of the drag handle.
3783
- */
3784
- verifyDragHandleTooltip: (NthElement) => {
3785
- 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', () => {
3786
- utilities.triggerMouseover(utilities.getNthElement(thinkSpherePage.dragHandleButton(), NthElement));
3787
- utilities.verifyInnerText(thinkSpherePage.tooltipText(), 'Drag to reorder');
3788
- utilities.triggerMouseout(utilities.getNthElement(thinkSpherePage.dragHandleButton(), NthElement));
3789
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
3790
- });
3791
-
3792
- it('CSS of drag handle tooltip', { tags: 'css' }, () => {
3793
- utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
3794
- .within(() => {
3795
- utilities.triggerMouseover(thinkSpherePage.dragHandleButton());
3796
- });
3797
- utilities.verifyCSS(thinkSpherePage.tooltipText(), {
3798
- 'color': css.color.whiteText,
3799
- 'font-size': css.fontSize.small,
3800
- 'font-weight': css.fontWeight.regular
3801
- });
3802
- utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
3803
- .within(() => {
3804
- utilities.triggerMouseout(thinkSpherePage.dragHandleButton())
3805
- });
3806
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
3807
- });
3808
-
3809
- it('Accessibility of drag handle tooltip', { tags: 'a11y' }, () => {
3810
- utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
3811
- .within(() => {
3812
- utilities.triggerMouseover(thinkSpherePage.dragHandleButton());
3813
- });
3814
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'visible');
3815
- utilities.getNthElement(thinkSpherePage.optionWrapper(), NthElement)
3816
- .within(() => {
3817
- utilities.triggerMouseout(thinkSpherePage.dragHandleButton())
3818
- });
3819
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
3820
- });
3821
- },
3822
-
3823
- /**
3824
- * Verifies the enabled delete button and tooltip.
3825
- * @param {string} list - The list to verify ('strategy' or other).
3826
- * @param {number} NthElement - The index of the delete button.
3827
- */
3828
- verifyEnabledDeleteButtonAndTooltip: (list, NthElement) => {
3829
- it('When the number of options are greater than 1 and both the options are selected then the \'Delete\' icon buttons should get enabled', () => {
3830
- thinkSpherePage.steps.selectOption(list, 1);
3831
- thinkSpherePage.deleteButton()
3832
- .should('be.enabled');
3833
- });
3834
-
3835
- it('CSS of enabled \'Delete\' option button', { tags: 'css' }, () => {
3836
- utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement), {
3837
- 'opacity': '1'
3838
- });
3839
- utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
3840
- .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon)
3841
- });
3842
-
3843
- it('Accessibility of enabled \'Delete\' option button', { tags: 'a11y' }, () => {
3844
- cy.checkAccessibility(thinkSpherePage.deleteButton());
3845
- });
3846
-
3847
- 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', () => {
3848
- utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement)
3849
- .verifyTooltip(list === 'strategy' ? 'Delete strategy' : 'Delete sentence starter');
3850
- });
3851
-
3852
- it('CSS of enabled delete button tooltip', { tags: 'css' }, () => {
3853
- utilities.triggerMouseover(utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement));
3854
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'visible')
3855
- utilities.verifyCSS(thinkSpherePage.tooltipText(), {
3856
- 'color': css.color.whiteText,
3857
- 'font-size': css.fontSize.small,
3858
- 'font-weight': css.fontWeight.regular
3859
- });
3860
- utilities.triggerMouseout(utilities.getNthElement(thinkSpherePage.deleteButton(), NthElement));
3861
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
3862
- });
3863
- },
3864
-
3865
- /**
3866
- * Verifies the options checkbox component.
3867
- * @param {string} list - The list to verify ('strategy' or other).
3868
- */
3869
- verifyOptionsCheckboxComponent: (list) => {
3870
- it('Option checkbox button should be present', () => {
3871
- if (list === 'strategy') {
3872
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 0)
3873
- .find('input')
3874
- .should('have.attr', 'type', 'checkbox')
3875
- .should('have.attr', 'checked');
3876
- } else {
3877
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 0)
3878
- .find('input')
3879
- .should('have.attr', 'type', 'checkbox')
3880
- .should('have.attr', 'checked');
3881
- }
3882
- });
3883
-
3884
- it('CSS of checked checkbox button', { tags: 'css' }, () => {
3885
- if (list === 'strategy') {
3886
- utilities.verifyCSS(
3887
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('svg g g'), 0), {
3888
- 'fill': css.color.primaryBtnBg,
3889
- });
3890
- utilities.verifyCSS(
3891
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('svg'), 0), {
3892
- 'width': '12px',
3893
- 'height': '12px',
3894
- });
3895
- } else {
3896
- utilities.verifyCSS(
3897
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('svg g g'), 0), {
3898
- 'fill': css.color.primaryBtnBg,
3899
- });
3900
- utilities.verifyCSS(
3901
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('svg'), 0), {
3902
- 'width': '12px',
3903
- 'height': '12px',
3904
- });
3905
- }
3906
- });
3907
-
3908
- it('When user clicks on the checkbox button then the checkbox should get unchecked', () => {
3909
- if (list === 'strategy') {
3910
- thinkSpherePage.steps.selectOption(list, 0);
3911
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 0)
3912
- .find('input')
3913
- .should('not.be.checked');
3914
- thinkSpherePage.steps.selectOption(list, 0);
3915
- } else {
3916
- thinkSpherePage.steps.selectOption(list, 0);
3917
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 0)
3918
- .find('input')
3919
- .should('not.be.checked');
3920
- thinkSpherePage.steps.selectOption(list, 0);
3921
- }
3922
- });
3923
-
3924
- it('CSS of unchecked checkbox button', { tags: 'css' }, () => {
3925
- if (list === 'strategy') {
3926
- thinkSpherePage.steps.selectOption(list, 1);
3927
- utilities.verifyCSS(
3928
- utilities.getNthElement(thinkSpherePage.planStrategyCheckbox().find('svg'), 1), {
3929
- 'fill': css.color.uncheckedCheckbox,
3930
- 'width': '12px',
3931
- 'height': '12px',
3932
- });
3933
- } else {
3934
- thinkSpherePage.steps.selectOption(list, 1);
3935
- utilities.verifyCSS(
3936
- utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox().find('svg'), 1), {
3937
- 'fill': css.color.uncheckedCheckbox,
3938
- 'width': '12px',
3939
- 'height': '12px',
3940
- });
3941
- }
3942
- });
3943
-
3944
- it('Accessibility of checked \'Checkbox\' button', { tags: 'a11y' }, () => {
3945
- if (list === 'strategy') {
3946
- cy.checkAccessibility(thinkSpherePage.planStrategyCheckbox());
3947
- } else {
3948
- cy.checkAccessibility(thinkSpherePage.planSentenceStarterCheckbox());
3949
- }
3950
- });
3951
- },
3952
-
3953
- /**
3954
- * Verifies the CSS of the 'Option' input field.
3955
- * @param {string} list - The list type ('strategy' or other).
3956
- */
3957
- verifyOptionsInput: (list) => {
3958
- it('CSS of \'Option\' input field', () => {
3959
- if (list === 'strategy') {
3960
- utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.listInputField().parent(), 0), {
3961
- 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
3962
- 'border-radius': '8px',
3963
- 'font-size': css.fontSize.default,
3964
- 'font-weight': css.fontWeight.regular,
3965
- });
3966
- } else {
3967
- utilities.verifyCSS(utilities.getNthElement(thinkSpherePage.listInputField().parent(), 5), {
3968
- 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
3969
- 'border-radius': '8px',
3970
- 'font-size': css.fontSize.default,
3971
- 'font-weight': css.fontWeight.regular,
3972
- });
3973
- }
3974
- });
3975
- },
3976
-
3977
- /**
3978
- * Verifies that at least one option is required.
3979
- * @param {string} list - The list type ('strategy' or other).
3980
- * @param {Array<string>} listOptions - The list of options.
3981
- * @param {string} disableTooltipText - The tooltip text to display when the delete button is disabled.
3982
- */
3983
- verifyAtleastOneOptionIsRequired: (list, listOptions, disableTooltipText) => {
3984
- const optionsToBeDeleted = listOptions.filter((el) => el !== listOptions[0]);
3985
-
3986
- it('When the user deletes the last option, then the \'Delete\' icon button should get disabled', () => {
3987
- optionsToBeDeleted.forEach(() => { thinkSpherePage.steps.deleteOption(list === 'strategy' ? 1 : 6) });
3988
- thinkSpherePage.steps.verifyDeleteOptionButtonDisabledState(list);
3989
- optionsToBeDeleted.forEach(() => { thinkSpherePage.steps.addOption(list) });
3990
- listOptions.forEach((inputFieldText, optionIndex) => {
3991
- thinkSpherePage.steps.addOptionText(list, optionIndex, inputFieldText);
3992
- });
3993
- });
3994
-
3995
- 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', () => {
3996
- utilities.getNthElement(thinkSpherePage.deleteButton(), list === 'strategy' ? 0 : 5)
3997
- .trigger('mouseover', { force: true });
3998
- utilities.verifyInnerText(thinkSpherePage.tooltipText(), disableTooltipText);
3999
- utilities.getNthElement(thinkSpherePage.deleteButton(), list === 'strategy' ? 0 : 5)
4000
- .trigger('mouseout', { force: true });
4001
- utilities.verifyElementVisibilityState(thinkSpherePage.tooltipText(), 'notExist');
4002
- });
4003
-
4004
- it('When the user uncheck the last option, then the \'Checkbox\' icon button should get disabled', () => {
4005
- thinkSpherePage.steps.verifyCheckboxButtonDisabledState(list, 0);
4006
- });
4007
- },
4008
-
4009
- verifyUploadImageSectionContentWithCSSAndA11y: () => {
4010
- it('\'Upload\' label and \'Choose file\' button should be displayed', () => {
4011
- utilities.verifyInnerText(backgroundImageUploadComponent.uploadLabel(), 'Upload');
4012
- utilities.verifyElementVisibilityState(backgroundImageUploadComponent.uploadLabel(), 'visible');
4013
- utilities.verifyInnerText(backgroundImageUploadComponent.chooseFileButton(), 'Choose file');
4014
- utilities.verifyElementVisibilityState(backgroundImageUploadComponent.chooseFileButton(), 'visible');
4015
- });
4016
-
4017
- it('\'File name\' label should be displayed and by default \'No file chosen\' text should be displayed below the \'File name\' label.', () => {
4018
- utilities.verifyInnerText(backgroundImageUploadComponent.fileNameLabel(), 'File name');
4019
- utilities.verifyElementVisibilityState(backgroundImageUploadComponent.fileNameLabel(), 'visible');
4020
- utilities.verifyInnerText(backgroundImageUploadComponent.noFileChosenLabel(), 'No file chosen');
4021
- utilities.verifyElementVisibilityState(backgroundImageUploadComponent.noFileChosenLabel(), 'visible');
4022
- });
4023
-
4024
- backgroundImageUploadComponent.tests.verifyCSSAndA11yBeforeUpload();
4025
-
4026
- backgroundImageUploadComponent.tests.verifyImageUploadFunctionality('thinkSphere');
4027
- },
4028
-
4029
- verifyQuestionInstructionsInputFieldThinkSpherePreviewTab: () => {
4030
- 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', () => {
4031
- createQuestionBasePage.steps.switchToPreviewTab();
4032
- //Failing due to https://redmine.zeuslearning.com/issues/553382
4033
- utilities.verifyElementVisibilityState(questionInstructionsComponent.questionInstructionsText(), 'notExist')
4034
- });
4035
-
4036
- it('When the user specifies question instructions, then the added question instructions should be displayed in the \'Preview\' tab', () => {
4037
- createQuestionBasePage.steps.switchToEditTab();
4038
- 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.');
4039
- // UNCOMMENT BELOW CODE WHEN PREVIEW TAB IS AVAILABLE FOR THINKSPHERE
4040
- // createQuestionBasePage.steps.switchToPreviewTab();
4041
- // 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.');
4042
- });
4043
- },
4044
-
4045
- verifyResetToDefaultFunctionality: (optionList, listType) => {
4046
- if (listType === 'strategy') {
4047
- it('When user clicks on \'Reset to default\' button then the strategy list should be reset to default', () => {
4048
- thinkSpherePage.planStrategyListResetToDefault()
4049
- .click();
4050
- optionList.forEach((option, index) => {
4051
- thinkSpherePage.steps.verifyOptionsContents(index, option, 'Enter strategy name');
4052
- });
4053
- });
4054
- } else {
4055
- it('When user clicks on \'Reset to default\' button then the sentence starter list should be reset to default', () => {
4056
- thinkSpherePage.planSentenceStarterListResetToDefault()
4057
- .click();
4058
- thinkSpherePage.planSentenceStarterSection()
4059
- .within(() => {
4060
- optionList.forEach((option, index) => {
4061
- thinkSpherePage.steps.verifyOptionsContents(index, option, 'Enter sentence starter name');
4062
- });
4063
- })
4064
- });
4065
- }
4066
- },
4067
-
4068
- verifyVideoLinkComponent: () => {
4069
- it('Video link component should be displayed', () => {
4070
- utilities.verifyElementVisibilityState(thinkSpherePage.videoLinkComponent(), 'visible');
4071
- utilities.verifyInnerText(thinkSpherePage.videoLinkComponent(), 'Upload video');
4072
- });
4073
-
4074
- it('CSS of video link component', { tags: 'css' }, () => {
4075
- thinkSpherePage.videoLinkComponent()
4076
- .within(() => {
4077
- utilities.verifyCSS(thinkSpherePage.uploadVideoLinkButton(), {
4078
- 'color': css.color.linkText,
4079
- 'font-size': css.fontSize.default,
4080
- 'font-weight': css.fontWeight.regular,
4081
- 'font-family': '"Nunito Sans"',
4082
- 'text-decoration-line': 'underline',
4083
- });
4084
-
4085
- cy.log('CSS of video link component on hover state');
4086
- utilities.hoverOverElement(thinkSpherePage.uploadVideoLinkButton());
4087
- utilities.verifyCSS(thinkSpherePage.uploadVideoLinkButton(), {
4088
- 'text-decoration-line': 'none',
4089
- });
4090
- });
4091
- });
4092
-
4093
- it('When user upload a file whose extension is not supported then an error message should be displayed', () => {
4094
- thinkSpherePage.videoLinkComponent()
4095
- .within(() => {
4096
- thinkSpherePage.uploadVideoLinkButton()
4097
- .click();
4098
- });
4099
- thinkSpherePage.steps.uploadVideoFile('uploads/sample.wmv');
4100
- thinkSpherePage.steps.verifyWarningPopup('File upload error', 'The file type is not supported. Please upload files with the following supported formats: mp4, webm.');
4101
- });
4102
-
4103
- it('CSS of warning popup', { tags: 'css' }, () => {
4104
- utilities.verifyCSS(dialogBoxBase.dialogBox(), {
4105
- 'border': `1px solid ${css.color.secondaryBtnBorder}`,
4106
- 'border-radius': '8px',
4107
- 'background-color': css.color.primaryBtn,
4108
- 'box-shadow': `${css.color.dialogBoxBoxShadow} 0px 0px 10px 0px`,
4109
- });
4110
-
4111
- dialogBoxBase.dialogBoxTitle().within(() => {
4112
- utilities.verifyCSS(thinkSpherePage.warningPopupTitle(), {
4113
- 'color': css.color.secondaryBtn,
4114
- 'font-size': css.fontSize.heading,
4115
- 'font-weight': css.fontWeight.bold
4116
- });
4117
- });
4118
-
4119
- dialogBoxBase.dialogBoxContent().within(() => {
4120
- utilities.verifyCSS(thinkSpherePage.warningPopupContentText(), {
4121
- 'color': css.color.sectionHeading,
4122
- 'font-size': css.fontSize.default,
4123
- 'font-weight': css.fontWeight.regular,
4124
- 'font-family': 'Inter'
4125
- });
4126
-
4127
- utilities.verifyCSS(thinkSpherePage.warningPopupOkButton(), {
4128
- 'background-color': css.color.primaryBtnBg,
4129
- 'border': `1px solid ${css.color.primaryBtnBorder}`,
4130
- 'color': css.color.primaryBtn,
4131
- 'border-radius': '8px',
4132
- 'font-size': css.fontSize.default,
4133
- 'font-weight': css.fontWeight.semibold,
4134
- 'font-family': '"Nunito Sans"',
4135
- 'box-shadow': `${css.color.primaryBtnBorder} 0px 5px 0px 0px`
4136
- });
4137
- });
4138
- });
4139
-
4140
- it('When user click on OK button of warning popup then the popup should be closed', () => {
4141
- dialogBoxBase.dialogBoxContent().within(() => {
4142
- thinkSpherePage.warningPopupOkButton()
4143
- .click();
4144
- });
4145
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
4146
- });
4147
-
4148
- it('When user upload a file whose extension is supported then no error message should be displayed', () => {
4149
- thinkSpherePage.videoLinkComponent()
4150
- .within(() => {
4151
- thinkSpherePage.uploadVideoLinkButton()
4152
- .click();
4153
- });
4154
- thinkSpherePage.steps.uploadVideoFile('uploads/sample.webm');
4155
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
4156
- thinkSpherePage.videoLinkComponent()
4157
- .within(() => {
4158
- thinkSpherePage.deleteVideoButton()
4159
- .click();
4160
- });
4161
- });
4162
-
4163
- it('When user upload a file of size more than 25MB then an error message should be displayed', () => {
4164
- thinkSpherePage.videoLinkComponent()
4165
- .within(() => {
4166
- thinkSpherePage.uploadVideoLinkButton()
4167
- .click();
4168
- });
4169
- thinkSpherePage.steps.uploadVideoFile('uploads/sample30MB.mp4');
4170
- thinkSpherePage.steps.verifyWarningPopup('File upload error', 'The file could not be uploaded. The file is 31 MB exceeding the maximum size of 25 MB.');
4171
- });
4172
-
4173
- it('When user click on OK button of warning popup then the popup should be closed', () => {
4174
- dialogBoxBase.dialogBoxContent().within(() => {
4175
- thinkSpherePage.warningPopupOkButton()
4176
- .click();
4177
- });
4178
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
4179
- });
4180
-
4181
- it('When user upload a file of size less than 25MB then no error message should be displayed and video uploaded successfully', () => {
4182
- thinkSpherePage.videoLinkComponent()
4183
- .within(() => {
4184
- thinkSpherePage.uploadVideoLinkButton()
4185
- .click();
4186
- });
4187
- thinkSpherePage.steps.uploadVideoFile('uploads/sample2MB.mp4');
4188
- cy.interceptGraphql('getFileScanStatus');
4189
- cy.wait(5000);
4190
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
4191
- });
4192
-
4193
- it('When user upload correct file then uploaded file name, edit video button along with delete video button should present', () => {
4194
- thinkSpherePage.videoLinkComponent().within(() => {
4195
- utilities.verifyInnerText(thinkSpherePage.uploadVideoLinkButton(), 'sample2MB.mp4');
4196
- utilities.verifyElementVisibilityState(thinkSpherePage.editVideoButton(), 'visible');
4197
- utilities.verifyElementVisibilityState(thinkSpherePage.deleteVideoButton(), 'visible');
4198
- });
4199
- });
4200
-
4201
- it('CSS of edit video button and delete video button', { tags: 'css' }, () => {
4202
- thinkSpherePage.videoLinkComponent().within(() => {
4203
- utilities.verifyCSS(thinkSpherePage.editVideoButton(), {
4204
- 'width': '24px',
4205
- 'height': '24px',
4206
- 'background-color': css.color.transparent,
4207
- });
4208
- utilities.verifyCSS(thinkSpherePage.deleteVideoButton(), {
4209
- 'width': '24px',
4210
- 'height': '24px',
4211
- 'background-color': css.color.transparent,
4212
- });
4213
- });
4214
- });
4215
-
4216
- it('When user upload another file size less than 25MB then no error message should be displayed and video uploaded successfully', () => {
4217
- thinkSpherePage.videoLinkComponent()
4218
- .within(() => {
4219
- thinkSpherePage.editVideoButton()
4220
- .click();
4221
- });
4222
- thinkSpherePage.steps.uploadVideoFile('uploads/sample2MB_2.mp4');
4223
- cy.interceptGraphql('getFileScanStatus');
4224
- cy.wait(5000);
4225
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
4226
- });
4227
-
4228
- it('When user upload another correct file then uploaded file name, edit video button along with delete video button should present', () => {
4229
- thinkSpherePage.videoLinkComponent().within(() => {
4230
- utilities.verifyInnerText(thinkSpherePage.uploadVideoLinkButton(), 'sample2MB_2.mp4');
4231
- utilities.verifyElementVisibilityState(thinkSpherePage.editVideoButton(), 'visible');
4232
- utilities.verifyElementVisibilityState(thinkSpherePage.deleteVideoButton(), 'visible');
4233
- });
4234
- });
4235
-
4236
- it('When user click on delete video button then the video should be deleted', () => {
4237
- thinkSpherePage.videoLinkComponent()
4238
- .within(() => {
4239
- thinkSpherePage.deleteVideoButton()
4240
- .click();
4241
- });
4242
- utilities.verifyInnerText(thinkSpherePage.videoLinkComponent(), 'Upload video');
4243
- });
4244
-
4245
- it('Accessibility of video link component', { tags: 'a11y' }, () => {
4246
- cy.checkAccessibility(thinkSpherePage.singleOptionTextFieldWrapper());
4247
- });
4248
- },
4249
-
4250
- verifyErrorMessageCSSAndA11y: () => {
4251
- it('CSS of error message', { tags: 'css' }, () => {
4252
- utilities.verifyCSS(commonComponents.errorMessage(), {
4253
- 'color': css.color.errorText,
4254
- 'font-size': css.fontSize.small,
4255
- 'font-weight': css.fontWeight.regular
4256
- });
4257
- });
4258
-
4259
- it('Accessibility of error message', { tags: 'a11y' }, () => {
4260
- cy.checkAccessibility(thinkSpherePage.nextGenThinkSphereCreateItemWrapper());
4261
- });
4262
- },
4263
-
4264
- verifyQuestionAccordion: () => {
4265
- it('Author should be able to expand and collapse the question accordion by clicking on the expand icon', () => {
4266
- thinkSpherePage.filterSectionQuestionAccordion().each(($accordion) => {
4267
- cy.wrap($accordion).find('.expansion-item-icon-wrapper').click();
4268
- cy.wrap($accordion).should('have.class', 'Mui-expanded');
4269
- });
4270
-
4271
- thinkSpherePage.filterSectionQuestionAccordion().each(($accordion) => {
4272
- cy.wrap($accordion).find('.expansion-item-icon-wrapper').click();
4273
- cy.wrap($accordion).should('not.have.class', 'Mui-expanded');
4274
- });
4275
- });
4276
- },
4277
-
4278
- verifyCreateItemHeaderSection: () => {
4279
- it('The page displays a unique Reference ID at the top left corner in the format "Ref ID:"', () => {
4280
- utilities.verifyElementVisibilityState(thinkSpherePage.referenceIdWrapper(), 'visible');
4281
- utilities.verifyInnerText(thinkSpherePage.referenceIdWrapper().children('div').first(), 'Ref ID:\u00A0');
4282
- const initialRefId = thinkSpherePage.referenceIdWrapper().children('div').eq(1).invoke('text');
4283
- initialRefId.then((refId) => {
4284
- expect(refId).to.be.a('string').and.not.be.empty;
4285
- cy.reload();
4286
- thinkSpherePage.referenceIdWrapper().children('div').eq(1).invoke('text').should((newRefId) => {
4287
- expect(newRefId).to.be.a('string').and.not.be.empty;
4288
- expect(newRefId).to.not.equal(refId);
4289
- });
4290
- });
4291
- });
4292
-
4293
- it('Edit text box and edit icon pencil should exist, and on clicking the edit input field with placeholder \'Enter title\ should allow the user to add title' , () => {
4294
- utilities.verifyElementVisibilityState(thinkSpherePage.editBoxTextInput(), 'visible');
4295
- thinkSpherePage.editBoxTextInput().blur();
4296
- utilities.verifyElementVisibilityState(thinkSpherePage.editIconPencil(), 'visible');
4297
- thinkSpherePage.editIconPencil().click();
4298
- thinkSpherePage.editBoxTextInput().should('have.attr', 'placeholder', 'Enter title');
4299
- thinkSpherePage.editBoxTextInput().type('Test Title');
4300
- thinkSpherePage.editBoxTextInput().blur();
4301
- utilities.verifyInnerText(thinkSpherePage.editBoxText(),'Test Title');
4302
- });
4303
- },
4304
-
4305
- verifyDefaultTab: () => {
4306
- it('By default edit tab should be selected', () => {
4307
- thinkSpherePage.editTab().should('have.class', 'Mui-selected');
4308
- });
4309
- },
4310
-
4311
- /**
4312
- * Verifies the functionality of editing, selecting, and unselecting strategies and sentence starters.
4313
- * Ensures that changes are saved successfully and reflected in the preview section.
4314
- *
4315
- * @param {Object} sentenceStartersObject - The object containing strategies and sentence starters data.
4316
- * @param {Array<string>} sentenceStartersObject.editedStrategies - The list of edited strategies to verify.
4317
- * @param {Array<string>} sentenceStartersObject.editedSentenceStarters - The list of edited sentence starters to verify.
4318
- * @param {Array<string>} sentenceStartersObject.selectStrategies - The list of strategies to select and verify.
4319
- * @param {Array<string>} sentenceStartersObject.selectSentenceStarters - The list of sentence starters to select and verify.
4320
- */
4321
- verifyStrategiesAndSentenceStartersSection: (sentenceStartersObject) => {
4322
- const {
4323
- editedStrategies, editedSentenceStarters, selectStrategies, selectSentenceStarters
4324
- } = sentenceStartersObject || {};
4325
- it('When user edits the strategies and sentence starers, then the changes should be saved successfully and edited strategies and sentence starers should get displayed in preview side', () => {
4326
- thinkSpherePage.steps.switchToEditTab();
4327
- thinkSpherePage.steps.clickOnEditQuestionIcon();
4328
- editedStrategies.forEach((strategy, index) => {
4329
- thinkSpherePage.steps.addOptionText('strategy', index, strategy);
4330
- });
4331
- editedSentenceStarters.forEach((sentenceStarter, index) => {
4332
- thinkSpherePage.steps.addOptionText('sentenceStarter', index, sentenceStarter);
4333
- });
4334
- thinkSpherePage.steps.saveAQuestionAndVerifySnackbar();
4335
- thinkSpherePage.steps.switchToPreviewTab();
4336
- editedStrategies.forEach((label, index) => {
4337
- utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.strategyTextWrapper(), index), label);
4338
- });
4339
- thinkSpherePage.steps.expandChooseStarterDropdown();
4340
- editedSentenceStarters.forEach((label, index) => {
4341
- utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.chooseStartersListOptionLabels(), index), label);
4342
- });
4343
- utilities.clickOnBody();
4344
- });
4345
-
4346
- it('When user select unselect the strategies and sentence starers, then the changes should be saved successfully and selected strategies and sentence starers should get displayed in preview side', () => {
4347
- thinkSpherePage.steps.switchToEditTab();
4348
- thinkSpherePage.steps.clickOnEditQuestionIcon();
4349
- editedStrategies.forEach((strategy, index) => {
4350
- if(!selectStrategies.includes(strategy)){
4351
- thinkSpherePage.steps.selectOption('strategy', index);
4352
- }
4353
- });
4354
- cy.wait(2000);
4355
- editedSentenceStarters.forEach((sentenceStarter, index) => {
4356
- if(!selectSentenceStarters.includes(sentenceStarter)){
4357
- thinkSpherePage.steps.selectOption('sentenceStarter', index);
4358
- }
4359
- });
4360
- cy.wait(2000);
4361
- thinkSpherePage.steps.saveAQuestionAndVerifySnackbar();
4362
- thinkSpherePage.steps.switchToPreviewTab();
4363
- selectStrategies.forEach((label, index) => {
4364
- utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.strategyTextWrapper(), index), label);
4365
- });
4366
- thinkSpherePage.steps.expandChooseStarterDropdown();
4367
- selectSentenceStarters.forEach((label, index) => {
4368
- utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.chooseStartersListOptionLabels(), index), label);
4369
- });
4370
- utilities.clickOnBody();
4371
- });
4372
- },
4373
- };
4374
-
4375
- export const thinkSpherePage = {
4376
- ...selectors,
4377
- steps,
4378
- tests
4379
- };
4380
- VerifySnackbar();
2195
+ thinkSpherePage.steps.saveAQuestionAndVerifySnackbar();
4381
2196
  thinkSpherePage.steps.switchToPreviewTab();
4382
2197
  editedStrategies.forEach((label, index) => {
4383
2198
  utilities.verifyInnerText(utilities.getNthElement(thinkSpherePage.strategyTextWrapper(), index), label);