itemengine-cypress-automation 1.0.378 → 1.0.379-IEI-5744-25232c0.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.
@@ -1,15 +1,19 @@
1
1
  import utilities from "../support/helpers/utilities";
2
2
  import { browseItemsPage } from "../pages/components/browseItemsPage";
3
+ import { editCategoryFlyout } from "../pages/components/editCategoryFlyout";
3
4
  import { dialogBoxBase } from "../pages/dialogBoxBase";
4
- import { backgroundImageUploadComponent, createQuestionBasePage, scoringSectionBaseEditTab, commonComponents, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, toolSettingsComponent, questionInstructionsComponent, studentViewSettingsLabelComponent, defaultToolDropdown, essayResponseCommonComponents, equationEditorSectionCommonComponent, equationEditorFlyout } from "./components"
5
+ import { backgroundImageUploadComponent, createQuestionBasePage, scoringSectionBaseEditTab, commonComponents, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, toolSettingsComponent, questionInstructionsComponent, studentViewSettingsLabelComponent, defaultToolDropdown, essayResponseCommonComponents, equationEditorSectionCommonComponent, equationEditorFlyout, createCustomCategoryFlyout } from "./components"
5
6
  import { drawingResponsePage } from "./drawingResponsePage";
6
7
  import { optionsWrapperComponent } from "../pages/components/optionsWrapperComponent";
7
8
  import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
8
9
  import { videoResponsePage } from "./videoResponsePage";
9
10
  import { singleSelectionPage } from "./singleSelectionPage";
11
+ import { essayResponsePage } from "./essayResponsePage";
12
+ import { equationEditorCategoriesAndSymbols } from "../fixtures/equationEditorCategoriesAndSymbols ";
10
13
  const css = Cypress.env('css');
11
14
 
12
15
  const selectors = {
16
+ ...essayResponsePage,
13
17
  ...backgroundImageUploadComponent,
14
18
  ...questionInstructionsComponent,
15
19
  ...commonComponents,
@@ -24,6 +28,10 @@ const selectors = {
24
28
  ...browseItemsPage,
25
29
  ...videoResponsePage,
26
30
  ...dialogBoxBase,
31
+ ...editCategoryFlyout,
32
+ ...createCustomCategoryFlyout,
33
+ ...createQuestionBasePage,
34
+
27
35
  editQuestionPencil: () => cy.get('[class*="Widgetstyles__HeaderContainer"] button.icon-pencil'),
28
36
  widgetHeaderQuestionTitle: () => cy.get('[class*="Widgetstyles__HeaderContainer"] [class*="Widgetstyles__QuestionTypeText"]'),
29
37
  imageUploadSection: () => cy.get('[class*="TabsComponentstyles__ImageUploadComponentWrapper"]'),
@@ -103,6 +111,7 @@ const selectors = {
103
111
  addCheckMathQuestionButton: () => cy.get('.ngie-btn-typography').contains(`Add 'Check your math' question`),
104
112
  firstAvailableItemLink: () => utilities.getNthElement(cy.get('.browse-item-styled-link'), 0),
105
113
  saveButton: () => cy.get('.ngie-btn-typography').contains('save',{matchCase: false}),
114
+ cancelButton: () => cy.get('.ngie-btn-typography').contains('cancel',{matchCase: false}),
106
115
  AddCheckMathQuestionHeader: () => cy.get('.browse-title-wrapper').contains(`Add 'Check your math' question`),
107
116
  singleOptionTextFieldWrapper: () => cy.get('[class*="SingleOptionstyle__TextFieldWrapper"]'),
108
117
  customizeStampComponent: () => cy.get('[class*="CustomizeStampstyles__CustomizeStampWrapper"]'),
@@ -127,7 +136,7 @@ const selectors = {
127
136
  imageUploadSectionQuestionImageCrossIcon: () => thinkSpherePage.imageUploadSection().find('div[class*="QuestionImageComponentstyle__CrossIcon"]'),
128
137
  imageRadioButtonParentSvg: () => thinkSpherePage.imageRadioButton().parent().find('svg'),
129
138
  solvePhaseAccordionSvg: () => thinkSpherePage.solvePhaseAccordion().find('svg'),
130
- customizeToolsAndControlsSvg: () => thinkSpherePage.customizeToolsAndControls().find('svg'),
139
+ customizeToolsAndControlsSvg: () => thinkSpherePage.customizeToolsAndControls().find('path'),
131
140
  solvePhaseToolsAndControlsOptionsTilesFeatherCheckIcon: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('[data-name="Icon feather-check"]'),
132
141
  solvePhaseToolsAndControlsOptionsTilesRectangle: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('[data-name*="Rectangle"]'),
133
142
  solvePhaseToolsAndControlsOptionsTilesDragItemFlexWrapperSvg: () => thinkSpherePage.solveToolsAndControlsOptionsTiles('Text').find('.drag-item-flex-wrapper svg'),
@@ -181,9 +190,31 @@ const selectors = {
181
190
  gridItemsWrapper: (number) => cy.get('[class*="DragAndDropGridstyles__GridItemsWrapper"]').eq(number),
182
191
  dragButton: (number) => cy.get('[type="button"]').eq(number),
183
192
  customizeStampsButton: (customizeStampPosition) => cy.get(`button[aria-label="Stamp ${customizeStampPosition}"]`),
193
+ buttonSave: () => cy.get('.action-btn-wrapper button').eq(1),
194
+ buttonCancel: () => cy.get('.action-btn-wrapper button').eq(0),
195
+ nextGenThinkSphereCreateItemWrapper: () => cy.get('#nextgen-thinkshpere-create-item'),
196
+ equationEditorSectionTitle: () => cy.get('.equation-editor-text-title'),
197
+ referenceIdWrapper: () => cy.get('.edit-item-reference-id-wrapper'),
198
+ editBoxWrapper: () => cy.get('.edit-box-wrapper'),
199
+ editBoxText: () => cy.get('.edit-box-text'),
200
+ editBoxTextInput: () => thinkSpherePage.editBoxWrapper().find('input'),
201
+ editIconPencil: () => cy.get('.icon-pencil'),
202
+ thinkSphereQuestionHeader: () => cy.get('.edit-question-header-title'),
203
+ filterSectionQuestionTypesAccordion: () => cy.get('.filter-section-expansion-panel-summary-root'),
204
+ filterSectionQuestionAccordion: () => cy.get('.expansion-item-expansion-panel-summary-content'),
205
+ checkBox: () => cy.get('.MuiCheckbox-root'),
206
+ browseItemQuestionItem: () => cy.get('.browse-item-question-item'),
207
+ ErrorMessageContainer: () => cy.get('.ErrorMessageContainer'),
208
+ categoriesDropDown: () => cy.get('.dropdown-form-control[label="Categories"]'),
209
+ categoriesDropDownLabelText: () => cy.get('.dropdown-label-text'),
210
+ categoriesDropDownMenuItem: () => cy.get('.dropdown-menu-item .dropdown-label-text'),
211
+ categoriesDropDownParent: () => cy.get('.drop-down-parent'),
212
+ cardWrapper: () => cy.get('.card-wrapper'),
213
+ cardLabel: () => cy.get('.widget-card-label'),
184
214
  };
185
215
 
186
216
  const steps = {
217
+ ...essayResponsePage.steps,
187
218
  ...backgroundImageUploadComponent.steps,
188
219
  ...questionInstructionsComponent.steps,
189
220
  ...scoringSectionBaseEditTab.steps,
@@ -200,6 +231,7 @@ const steps = {
200
231
  ...browseItemsPage.steps,
201
232
  ...videoResponsePage.steps,
202
233
  ...createQuestionBasePage.steps,
234
+ ...createCustomCategoryFlyout.steps,
203
235
 
204
236
  /**
205
237
  * Navigates to the ThinkSphere create question page.
@@ -271,12 +303,24 @@ const steps = {
271
303
  cy.wait('@setItem');
272
304
  },
273
305
 
306
+ clickOnCancelButton: () => {
307
+ cy.interceptGraphql('setItem');
308
+ thinkSpherePage.cancelButton()
309
+ .click();
310
+ },
311
+
274
312
  clickOnSwapButton: () => {
275
313
  thinkSpherePage.ThinkSphereMathQuestionHeaderSwapIcon()
276
314
  .click();
277
315
  cy.wait(2000);
278
316
  },
279
317
 
318
+ clickOnEditButton: () => {
319
+ thinkSpherePage.ThinkSphereMathQuestionHeaderPencilIcon()
320
+ .click();
321
+ cy.wait(2000);
322
+ },
323
+
280
324
  clickOnDeleteButton: () => {
281
325
  thinkSpherePage.thinkSphereMathQuestionHeaderDeleteIcon()
282
326
  .click();
@@ -543,7 +587,8 @@ const steps = {
543
587
  .click();
544
588
  } else {
545
589
  thinkSpherePage.planSentenceStarterAddItemButton()
546
- .click();
590
+ .click()
591
+ .trigger('mouseout', { force: true });
547
592
  }
548
593
  },
549
594
 
@@ -855,9 +900,193 @@ const steps = {
855
900
  verifyCustomizeStampSelectedUnselected: (selected, customizeStampPosition) => {
856
901
  utilities.verifyElementAttribute(thinkSpherePage.customizeStampsButton(customizeStampPosition), 'aria-checked', selected ? 'true' : 'false');
857
902
  },
903
+
904
+ saveCustomCategory: () => {
905
+ thinkSpherePage.buttonSave()
906
+ .click();
907
+ },
908
+
909
+ cancelCustomCategory: () => {
910
+ thinkSpherePage.buttonCancel()
911
+ .click();
912
+ },
913
+
914
+ createCustomCategoryWithMultipleCategoryCharacters: () => {
915
+ cy.log('Creating a custom category by selecting \'Keypad\' category, partially selecting \'Basic\' and \'Greek\' categories')
916
+ createCustomCategoryFlyout.steps.openCreateCustomCategoryFlyout();
917
+ createCustomCategoryFlyout.steps.checkCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['primary'].displayName}`);
918
+ cy.wait(2000);
919
+ createCustomCategoryFlyout.steps.verifyPartiallyCheckedStateOfCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['matrices'].displayName}`);
920
+ createCustomCategoryFlyout.steps.expandCategoryAccordion(`Greek Symbols`);
921
+ createCustomCategoryFlyout.steps.selectASymbolInCreateCustomCategoryFlyout(`${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols.greek.symbols.gamma.ariaLabel}`);
922
+ createCustomCategoryFlyout.steps.selectASymbolInCreateCustomCategoryFlyout(`${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols.greek.symbols.delta.ariaLabel}`);
923
+ createCustomCategoryFlyout.steps.addInputToCustomCategoryNameInputField('Custom category with name.');
924
+ thinkSpherePage.steps.saveCustomCategory();
925
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
926
+ },
927
+
928
+ createCustomCategoryWithNameAndIcon: () => {
929
+ cy.log('Creating a category by selecting \'Arrows\' category')
930
+ createCustomCategoryFlyout.steps.openCreateCustomCategoryFlyout();
931
+ createCustomCategoryFlyout.steps.checkCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['geo'].displayName}`);
932
+ createCustomCategoryFlyout.steps.addInputToCustomCategoryNameInputField('Custom category with name and icon.');
933
+ createCustomCategoryFlyout.steps.addInputToCategoryIconInputField('#');
934
+ thinkSpherePage.steps.saveCustomCategory();
935
+ },
936
+
937
+ verifyCategoryCharactersAndUnSelectedState: (arrayOfSymbolsAriaLabel) => {
938
+ thinkSpherePage.categoryCharacters()
939
+ .then(($symbols) => {
940
+ for (let index = 10; index < $symbols.length - 1; index++) {
941
+ editCategoryFlyout.categoryCharacters()
942
+ .eq(index)
943
+ .should('not.have.class', 'Mui-selected')
944
+ .invoke('attr', 'aria-label')
945
+ .then((ariaLabel) => {
946
+ const tooltipText = ariaLabel.split(' ').slice(0, -1).join(' ');
947
+ editCategoryFlyout.categoryCharacters()
948
+ .eq(index)
949
+ .verifyTooltip(tooltipText);
950
+ });
951
+ }
952
+ });
953
+ },
954
+
955
+ verifyCategoryCharactersAndSelectedState: (arrayOfSymbolsAriaLabel) => {
956
+ editCategoryFlyout.categoryCharacters()
957
+ .then(($symbols) => {
958
+ for (let index = 0; index < arrayOfSymbolsAriaLabel.length - 1; index++) {
959
+ editCategoryFlyout.categoryCharacters()
960
+ .eq(index)
961
+ .should('have.class', 'Mui-selected')
962
+ .invoke('attr', 'aria-label')
963
+ .then((ariaLabel) => {
964
+ const tooltipText = ariaLabel.split(' ').slice(0, -1).join(' ');
965
+ editCategoryFlyout.categoryCharacters()
966
+ .eq(index)
967
+ .verifyTooltip(tooltipText);
968
+ });
969
+ }
970
+ });
971
+ },
972
+
973
+ expandDropdown: () => {
974
+ thinkSpherePage.categoriesDropDownParent()
975
+ .click();
976
+ },
977
+
978
+ verifyDropdownOptions: (dropDownListArray) => {
979
+ thinkSpherePage.categoriesDropDownMenuItem().should('have.length', dropDownListArray.length).each(($item) => {
980
+ cy.wrap($item)
981
+ .invoke('text')
982
+ .then((text) => {
983
+ const trimmedText = text.trim();
984
+ expect(dropDownListArray).to.include(trimmedText);
985
+ });
986
+ });
987
+ },
988
+
989
+ clickOnDropDownCategory: (index) => {
990
+ thinkSpherePage.categoriesDropDownMenuItem().eq(index).click();
991
+ },
992
+
993
+ clickOnQuestionTypesAccordion: () => {
994
+ thinkSpherePage.filterSectionQuestionTypesAccordion()
995
+ .click()
996
+ },
997
+
998
+ typeInSearchBar: (input) => {
999
+ thinkSpherePage.searchBar()
1000
+ .clear()
1001
+ .type(input)
1002
+ .should('have.value', input);
1003
+ },
1004
+
1005
+ searchInSearchBar: (input) => {
1006
+ thinkSpherePage.searchBar()
1007
+ .clear()
1008
+ .type(input)
1009
+ .should('have.value', input)
1010
+ .type('{enter}');
1011
+ },
1012
+
1013
+ clickOnSolvePhaseAccordionIcon: (element) => {
1014
+ thinkSpherePage.solvePhaseAccordionExpandIcon()
1015
+ .click();
1016
+ },
1017
+
1018
+ verifyElementDoesNotHaveExpandedClass: (element) => {
1019
+ element.should('not.have.class', 'Mui-expanded');
1020
+ },
1021
+
1022
+ verifyElementDoesNotHaveCheckedClass: (element) => {
1023
+ element.should('not.have.class', 'Mui-checked');
1024
+ },
1025
+
1026
+ verifyThinkSphereSearchBarPlaceholder: () => {
1027
+ thinkSpherePage.searchBar().should('have.attr', 'placeholder', 'Search by title, tags and content');
1028
+ },
1029
+
1030
+ verifyReviewItemSearchBarPlaceholder: () => {
1031
+ thinkSpherePage.searchBar().should('have.attr', 'placeholder', 'Search by question type');
1032
+ },
1033
+
1034
+ verifyEquationEditorSectionCategoryNotPressed: () => {
1035
+ thinkSpherePage.equationEditorSectionCategories().eq(1).should('have.attr', 'data-aria-pressed', 'false');
1036
+ },
1037
+
1038
+ verifyEquationEditorSectionCategoryIsPressed: () => {
1039
+ thinkSpherePage.equationEditorSectionCategories().eq(10).should('have.attr', 'data-aria-pressed', 'true');
1040
+ },
1041
+
1042
+ verifyTypeCheckBoxStrategy: () => {
1043
+ utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 5)
1044
+ .find('input').should('have.attr', 'type', 'checkbox');
1045
+ },
1046
+
1047
+ verifyTypeCheckBoxSentenceStarter: () => {
1048
+ utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 5)
1049
+ .find('input').should('have.attr', 'type', 'checkbox');
1050
+ },
1051
+
1052
+ verifyStrategyCheckBoxNotChecked: () => {
1053
+ utilities.getNthElement(thinkSpherePage.planStrategyCheckbox(), 5)
1054
+ .find('input').should('not.have.attr', 'checked');
1055
+ },
1056
+
1057
+ verifySentenceStrategyCheckBoxNotChecked: () => {
1058
+ utilities.getNthElement(thinkSpherePage.planSentenceStarterCheckbox(), 5)
1059
+ .find('input').should('not.have.attr', 'checked');
1060
+ },
1061
+
1062
+ verifyTextIsNotEmpty: (element) => {
1063
+ element.invoke('text')
1064
+ .should('not.be.empty');
1065
+ },
1066
+
1067
+ verifyLength: (element, length) => {
1068
+ element.should('have.length', length);
1069
+ },
1070
+
1071
+ verifyFilterSectionExpanded: () => {
1072
+ thinkSpherePage.filterSectionQuestionTypesAccordion().should('have.class', 'Mui-expanded');
1073
+ },
1074
+
1075
+ verifyFilterSectionCollapsed: () => {
1076
+ thinkSpherePage.filterSectionQuestionTypesAccordion().should('not.have.class', 'Mui-expanded');
1077
+ },
1078
+
1079
+ verifySolvePhaseAccordionExpanded: () => {
1080
+ thinkSpherePage.solvePhaseAccordionExpandIcon().should('have.class', 'Mui-expanded');
1081
+ },
1082
+
1083
+ verifySolvePhaseAccordionCollapsed: () => {
1084
+ thinkSpherePage.solvePhaseAccordionExpandIcon().should('not.have.class', 'Mui-expanded');
1085
+ },
858
1086
  };
859
1087
 
860
1088
  const tests = {
1089
+ ...essayResponsePage.tests,
861
1090
  ...createQuestionBasePage.tests,
862
1091
  ...backgroundImageUploadComponent.tests,
863
1092
  ...questionInstructionsComponent.tests,
@@ -869,6 +1098,7 @@ const tests = {
869
1098
  ...studentViewSettingsLabelComponent.tests,
870
1099
  ...defaultToolDropdown.tests,
871
1100
  ...optionsWrapperComponent.tests,
1101
+ ...equationEditorFlyout.tests,
872
1102
 
873
1103
  /**
874
1104
  * Verifies the ThinkSphere cancel button functionality.
@@ -1362,9 +1592,12 @@ const tests = {
1362
1592
  it('When user clicks on \'Reset to default\' button then the sentence starter list should be reset to default', () => {
1363
1593
  thinkSpherePage.planSentenceStarterListResetToDefault()
1364
1594
  .click();
1365
- optionList.forEach((option, index) => {
1366
- thinkSpherePage.steps.verifyOptionsContents(index, option, 'Enter sentence starter name');
1367
- });
1595
+ thinkSpherePage.planSentenceStarterSection()
1596
+ .within(() => {
1597
+ optionList.forEach((option, index) => {
1598
+ thinkSpherePage.steps.verifyOptionsContents(index, option, 'Enter sentence starter name');
1599
+ });
1600
+ })
1368
1601
  });
1369
1602
  }
1370
1603
  },
@@ -1550,6 +1783,67 @@ const tests = {
1550
1783
  cy.checkAccessibility(thinkSpherePage.singleOptionTextFieldWrapper());
1551
1784
  });
1552
1785
  },
1786
+
1787
+ verifyErrorMessageCSSAndA11y: () => {
1788
+ it('CSS of error message', { tags: 'css' }, () => {
1789
+ utilities.verifyCSS(commonComponents.errorMessage(), {
1790
+ 'color': css.color.errorText,
1791
+ 'font-size': css.fontSize.small,
1792
+ 'font-weight': css.fontWeight.regular
1793
+ });
1794
+ });
1795
+
1796
+ it('Accessibility of error message', { tags: 'a11y' }, () => {
1797
+ cy.checkAccessibility(thinkSpherePage.nextGenThinkSphereCreateItemWrapper());
1798
+ });
1799
+ },
1800
+
1801
+ verifyQuestionAccordion: () => {
1802
+ it('Author should be able to expand and collapse the question accordion by clicking on the expand icon', () => {
1803
+ thinkSpherePage.filterSectionQuestionAccordion().each(($accordion) => {
1804
+ cy.wrap($accordion).find('.expansion-item-icon-wrapper').click();
1805
+ cy.wrap($accordion).should('have.class', 'Mui-expanded');
1806
+ });
1807
+
1808
+ thinkSpherePage.filterSectionQuestionAccordion().each(($accordion) => {
1809
+ cy.wrap($accordion).find('.expansion-item-icon-wrapper').click();
1810
+ cy.wrap($accordion).should('not.have.class', 'Mui-expanded');
1811
+ });
1812
+ });
1813
+ },
1814
+
1815
+ verifyCreateItemHeaderSection: () => {
1816
+ it('The page displays a unique Reference ID at the top left corner in the format "Ref ID:"', () => {
1817
+ utilities.verifyElementVisibilityState(thinkSpherePage.referenceIdWrapper(), 'visible');
1818
+ utilities.verifyInnerText(thinkSpherePage.referenceIdWrapper().children('div').first(), 'Ref ID:\u00A0');
1819
+ const initialRefId = thinkSpherePage.referenceIdWrapper().children('div').eq(1).invoke('text');
1820
+ initialRefId.then((refId) => {
1821
+ expect(refId).to.be.a('string').and.not.be.empty;
1822
+ cy.reload();
1823
+ thinkSpherePage.referenceIdWrapper().children('div').eq(1).invoke('text').should((newRefId) => {
1824
+ expect(newRefId).to.be.a('string').and.not.be.empty;
1825
+ expect(newRefId).to.not.equal(refId);
1826
+ });
1827
+ });
1828
+ });
1829
+
1830
+ 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' , () => {
1831
+ utilities.verifyElementVisibilityState(thinkSpherePage.editBoxTextInput(), 'visible');
1832
+ thinkSpherePage.editBoxTextInput().blur();
1833
+ utilities.verifyElementVisibilityState(thinkSpherePage.editIconPencil(), 'visible');
1834
+ thinkSpherePage.editIconPencil().click();
1835
+ thinkSpherePage.editBoxTextInput().should('have.attr', 'placeholder', 'Enter title');
1836
+ thinkSpherePage.editBoxTextInput().type('Test Title');
1837
+ thinkSpherePage.editBoxTextInput().blur();
1838
+ utilities.verifyInnerText(thinkSpherePage.editBoxText(),'Test Title');
1839
+ });
1840
+ },
1841
+
1842
+ verifyDefaultTab: () => {
1843
+ it('By default edit tab should be selected', () => {
1844
+ thinkSpherePage.editTab().should('have.class', 'Mui-selected');
1845
+ });
1846
+ },
1553
1847
  };
1554
1848
 
1555
1849
  export const thinkSpherePage = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.378",
3
+ "version": "1.0.379-IEI-5744-25232c0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -52,4 +52,4 @@
52
52
  "devDependencies": {
53
53
  "@applitools/eyes-cypress": "^3.47.0"
54
54
  }
55
- }
55
+ }