itemengine-cypress-automation 1.0.37 → 1.0.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,346 @@
1
+ import { colorPopupComponent } from "../../../pages/components";
2
+ import { feedbackScalePage } from "../../../pages/feedbackScalePage";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ import utilities from "../../../support/helpers/utilities";
5
+ const css = Cypress.env('css');
6
+
7
+ describe('Create item page: Feedback scale: Edit tab - Question instructions, Feedback layout style dropdown, Default state of option accordions, Option accordion contents for \'Button\' and \'Star\' layout styles, Add, delete option accordion', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Question instructions input field - Edit tab', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ cy.log('Navigate to Feedback scale question type');
16
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
17
+ cy.barsPreLoaderWait();
18
+ });
19
+
20
+ feedbackScalePage.tests.verifyQuestionInstructionsInputFieldEditTab();
21
+ });
22
+
23
+ describe('Question instructions input field - Preview tab', () => {
24
+ abortEarlySetup();
25
+ before(() => {
26
+ cy.log('Navigate to Feedback scale question type');
27
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
28
+ cy.barsPreLoaderWait();
29
+ });
30
+
31
+ feedbackScalePage.tests.verifyQuestionInstructionsInputFieldPreviewTab();
32
+ });
33
+
34
+ describe('Feedback layout style dropdown', () => {
35
+ abortEarlySetup();
36
+ before(() => {
37
+ cy.log('Navigate to Feedback scale question type');
38
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
39
+ cy.barsPreLoaderWait();
40
+ });
41
+
42
+ it('\'Feedback layout style\' label and dropdown should be displayed and in the \'Feedback layout style\' dropdown, \'Button\' option should be selected by default', () => {
43
+ utilities.verifyInnerText(feedbackScalePage.feedbackLayoutStyleLabel(), 'Feedback layout style');
44
+ utilities.verifyElementVisibilityState(feedbackScalePage.feedbackLayoutStyleLabel(), 'visible');
45
+ utilities.verifyInnerText(feedbackScalePage.feedbackLayoutStyleDropdown(), 'Button');
46
+ utilities.verifyElementVisibilityState(feedbackScalePage.feedbackLayoutStyleDropdown(), 'visible');
47
+ });
48
+
49
+ it('CSS of \'Feedback layout style\' label and \'Feedback layout style\' dropdown in default state', { tags: 'css' }, () => {
50
+ utilities.verifyCSS(feedbackScalePage.feedbackLayoutStyleLabel(), {
51
+ 'color': css.color.labels,
52
+ 'font-size': css.fontSize.normal,
53
+ 'font-weight': css.fontWeight.semibold
54
+ });
55
+ utilities.verifyCSS(feedbackScalePage.feedbackLayoutStyleDropdown(), {
56
+ 'background-color': css.color.secondaryBtnBg,
57
+ 'border': `1px solid ${css.color.defaultDropdownBorder}`
58
+ });
59
+ utilities.verifyCSS(feedbackScalePage.feedbackLayoutStyleDropdown().find('.dropdown-label-text'), {
60
+ 'color': css.color.liText,
61
+ 'font-size': css.fontSize.default,
62
+ 'font-weight': css.fontWeight.regular
63
+ });
64
+ });
65
+
66
+ it('Accessibility of \'Feedback layout style\' label and \'Feedback layout style\' dropdown in default state', { tags: 'a11y' }, () => {
67
+ cy.checkAccessibility(feedbackScalePage.feedbackLayoutStyleLabel().parents('[arialabel="feedback layout style"]'));
68
+ });
69
+
70
+ it('When the user clicks on \'Feedback layout style\' dropdown, a list of 2 layout options should open - \'Button\', \'Star\'', () => {
71
+ let dropdownOptions = ['Button', 'Star'];
72
+ feedbackScalePage.steps.clickOnFeedbackStyleLayoutDropdown();
73
+ utilities.verifyElementVisibilityState(feedbackScalePage.feedbackLayoutStyleDropdownOptions(), 'visible');
74
+ feedbackScalePage.steps.verifyFeedbackStyleLayoutOptions(dropdownOptions);
75
+ });
76
+
77
+ it('CSS of \'Feedback layout style\' label and \'Feedback layout style\' dropdown in active state', { tags: 'css' }, () => {
78
+ utilities.verifyCSS(feedbackScalePage.feedbackLayoutStyleDropdown(), {
79
+ 'background-color': css.color.secondaryBtnBg,
80
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
81
+ });
82
+ utilities.verifyCSS(feedbackScalePage.feedbackLayoutStyleDropdownOptions('Button'), {
83
+ 'color': css.color.liText,
84
+ 'font-size': css.fontSize.default,
85
+ 'font-weight': css.fontWeight.regular,
86
+ 'background-color': css.color.liTextSelectedBg,
87
+ });
88
+ utilities.verifyCSS(feedbackScalePage.feedbackLayoutStyleDropdownOptions('Star'), {
89
+ 'color': css.color.liText,
90
+ 'font-size': css.fontSize.default,
91
+ 'font-weight': css.fontWeight.regular,
92
+ 'background-color': css.color.transparent,
93
+ });
94
+ });
95
+
96
+ it('Accessibility of \'Feedback layout style\' label and \'Feedback layout style\' dropdown in active state', { tags: 'a11y' }, () => {
97
+ cy.checkAccessibility(feedbackScalePage.feedbackLayoutStyleLabel().parents('[arialabel="feedback layout style"]'));
98
+ cy.checkAccessibility(feedbackScalePage.feedbackLayoutStyleDropdownOptions().parents('.dropdown-list-ul'));
99
+ });
100
+ });
101
+
102
+ describe('Feedback scale - Default state of option accordions, add image, bold text in tooltip and description input fields', () => {
103
+ abortEarlySetup();
104
+ before(() => {
105
+ cy.log('Navigate to Feedback scale question type');
106
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
107
+ cy.barsPreLoaderWait();
108
+ });
109
+
110
+ it('\'Feedback scale\' label should be displayed', () => {
111
+ utilities.verifyInnerText(feedbackScalePage.feedbackScaleLabel(), 'Feedback scale');
112
+ utilities.verifyElementVisibilityState(feedbackScalePage.feedbackScaleLabel(), 'visible');
113
+ });
114
+
115
+ //Failing due to https://redmine.zeuslearning.com/issues/531554
116
+ it('By default, 3 option accordions should be displayed for \'Button\' layout style and \'Option 1\' accordion should be in expanded state and all other accordions should be in collapsed state', () => {
117
+ utilities.verifyElementCount(feedbackScalePage.optionAccordion(), 3);
118
+ feedbackScalePage.steps.verifyOptionAccordionInExpandedState(0);
119
+ feedbackScalePage.steps.verifyOptionAccordionInCollapsedState(1);
120
+ feedbackScalePage.steps.verifyOptionAccordionInCollapsedState(2);
121
+ });
122
+
123
+ it('All accordions should have an \'Option #\' label, \'delete option\' button and a chevron icon', () => {
124
+ for (let index = 0; index < 3; index++) {
125
+ feedbackScalePage.steps.verifyOptionAccordionPanelContents(index, `Option ${index + 1}`);
126
+ }
127
+ });
128
+
129
+ it('\'Label\' label and input field should be displayed', () => {
130
+ utilities.verifyInnerText(feedbackScalePage.labelsLabel(), 'Label');
131
+ utilities.verifyElementVisibilityState(feedbackScalePage.labelsLabel(), 'visible');
132
+ utilities.verifyElementVisibilityState(feedbackScalePage.labelsInputField(), 'visible');
133
+ });
134
+
135
+ it('\'Color\' label and a color block with pre filled color should be displayed', () => {
136
+ utilities.verifyInnerText(feedbackScalePage.colorLabel(), 'Color');
137
+ utilities.verifyElementVisibilityState(feedbackScalePage.colorLabel(), 'visible');
138
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorBlock(), 'visible');
139
+ });
140
+
141
+ it('\'Tooltip\' label and input field should be displayed', () => {
142
+ utilities.verifyInnerText(feedbackScalePage.tooltipLabel(), 'Tooltip');
143
+ utilities.verifyElementVisibilityState(feedbackScalePage.tooltipLabel(), 'visible');
144
+ utilities.verifyElementVisibilityState(feedbackScalePage.tooltipInputField(), 'visible');
145
+ });
146
+
147
+ it('\'Description\' label and input field should be displayed', () => {
148
+ utilities.verifyInnerText(feedbackScalePage.descriptionLabel(), 'Description');
149
+ utilities.verifyElementVisibilityState(feedbackScalePage.descriptionLabel(), 'visible');
150
+ utilities.verifyElementVisibilityState(feedbackScalePage.descriptionInputField(), 'visible');
151
+ });
152
+
153
+ it('CSS of option accordion contents', { tags: 'css' }, () => {
154
+ const labels = [feedbackScalePage.labelsLabel, feedbackScalePage.colorLabel, feedbackScalePage.tooltipLabel, feedbackScalePage.descriptionLabel];
155
+ const inputFields = [feedbackScalePage.labelsInputField, feedbackScalePage.tooltipInputField, feedbackScalePage.descriptionInputField];
156
+ utilities.verifyCSS(feedbackScalePage.feedbackScaleLabel(), {
157
+ 'color': css.color.labels,
158
+ 'font-size': css.fontSize.default,
159
+ 'font-weight': css.fontWeight.semibold
160
+ });
161
+ utilities.verifyCSS(feedbackScalePage.optionAccordionLabel(), {
162
+ 'color': css.color.panelLabel,
163
+ 'font-size': css.fontSize.default,
164
+ 'font-weight': css.fontWeight.bold
165
+ });
166
+ feedbackScalePage.deleteOptionAccordionButton()
167
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
168
+ labels.forEach((label) => {
169
+ utilities.verifyCSS(label(), {
170
+ 'color': css.color.labels,
171
+ 'font-size': css.fontSize.normal,
172
+ 'font-weight': css.fontWeight.semibold
173
+ });
174
+ });
175
+ inputFields.forEach((inputField) => {
176
+ utilities.verifyCSS(inputField(), {
177
+ 'color': css.color.text,
178
+ 'font-size': css.fontSize.default,
179
+ 'font-weight': css.fontWeight.regular
180
+ });
181
+ });
182
+ });
183
+
184
+ //Failing due to https://redmine.zeuslearning.com/issues/541472
185
+ it('Accessibility of option accordion contents', { tags: 'a11y' }, () => {
186
+ cy.checkAccessibility(feedbackScalePage.feedbackScaleLabel());
187
+ cy.checkAccessibility(feedbackScalePage.optionAccordion().parents('.feedback-scale-panel'));
188
+ });
189
+
190
+ it('When the user expands another option accordion, \'Option 1\' accordion should still be in expanded state', () => {
191
+ feedbackScalePage.steps.expandOptionAccordion(1);
192
+ feedbackScalePage.steps.verifyOptionAccordionInExpandedState(0);
193
+ feedbackScalePage.steps.verifyOptionAccordionInExpandedState(1);
194
+ });
195
+
196
+ it('The user should be able to collapse an option accordion and state of another accordions should not change', () => {
197
+ feedbackScalePage.steps.collapseOptionAccordion(0);
198
+ feedbackScalePage.steps.verifyOptionAccordionInCollapsedState(0);
199
+ feedbackScalePage.steps.verifyOptionAccordionInExpandedState(1);
200
+ feedbackScalePage.steps.verifyOptionAccordionInCollapsedState(2);
201
+ });
202
+
203
+ it('\'Add option\' button should be present', () => {
204
+ utilities.verifyInnerText(feedbackScalePage.addOptionButton(), 'Add option');
205
+ utilities.verifyElementVisibilityState(feedbackScalePage.addOptionButton(), 'visible');
206
+ });
207
+
208
+ it('When user adds an image to the tooltip input field then it should be displayed in the tooltip input field', () => {
209
+ feedbackScalePage.steps.focusInTooltipInputField(1);
210
+ feedbackScalePage.steps.selectImageOptionFromCKEditorToolbar();
211
+ feedbackScalePage.steps.addImageToInputField();
212
+ feedbackScalePage.steps.verifyImageAndAltTextInTooltipInputField(1);
213
+ });
214
+
215
+ it('When user adds \'Bold\' text to the description input field then it should be displayed in the description input field', () => {
216
+ feedbackScalePage.steps.expandOptionAccordion(2);
217
+ feedbackScalePage.steps.focusInDescriptionInputField(1);
218
+ feedbackScalePage.steps.selectBoldOptionFromCKEditorToolbar();
219
+ feedbackScalePage.steps.addInputToDescriptionInputField(1, 'I\'m very comfortable with the learning target');
220
+ feedbackScalePage.steps.verifyBoldTextInDescriptionInputField(1, '​​​​​​​I\'m very comfortable with the learning target');
221
+ });
222
+ });
223
+
224
+ describe('Feedback scale - Option accordion contents for \'Button\' layout style', () => {
225
+ const options = ['Option 1', 'Option 2', 'Option 3'];
226
+ const optionsContent = [
227
+ {
228
+ 'labels': 'Uncomfortable',
229
+ 'color': 'rgb(229, 76, 25)',
230
+ 'tooltip': 'Made me uneasy and unsettled.',
231
+ 'description': 'I am uncomfortable with the learning target.'
232
+ },
233
+ {
234
+ 'labels': 'Somewhat comfortable',
235
+ 'color': 'rgb(255, 240, 25)',
236
+ 'tooltip': 'I would like some help.',
237
+ 'description': 'I am somewhat comfortable with the learning target.'
238
+ },
239
+ {
240
+ 'labels': 'Comfortable',
241
+ 'color': 'rgb(9, 179, 33)',
242
+ 'tooltip': 'I\'m feeling confident.',
243
+ 'description': 'I am comfortable with the learning target.'
244
+ }
245
+ ];
246
+ abortEarlySetup();
247
+ before(() => {
248
+ cy.log('Navigate to Feedback scale question type');
249
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
250
+ cy.barsPreLoaderWait();
251
+ });
252
+
253
+ options.forEach((option, optionIndex) => {
254
+ it(`Option accordion contents for \'${option}\' - \'Button\' layout style`, () => {
255
+ feedbackScalePage.steps.verifyOptionAccordionInputFieldContents(optionIndex, optionsContent[optionIndex]);
256
+ });
257
+ });
258
+ });
259
+
260
+ describe('Feedback scale - Option accordion contents for \'Star\' layout style', () => {
261
+ const options = ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5'];
262
+ const optionsContent = [
263
+ {
264
+ 'labels': '20%',
265
+ 'color': 'rgb(226, 121, 0)',
266
+ 'tooltip': 'Needs improvement',
267
+ 'description': 'Your attempt could be better. Keep practicing!'
268
+ },
269
+ {
270
+ 'labels': '40%',
271
+ 'color': 'rgb(226, 121, 0)',
272
+ 'tooltip': 'Getting there',
273
+ 'description': 'You\'ve made progress, but more effort is needed to pass.'
274
+ },
275
+ {
276
+ 'labels': '60%',
277
+ 'color': 'rgb(226, 121, 0)',
278
+ 'tooltip': 'Good job',
279
+ 'description': 'You tried well and made a good attempt.'
280
+ },
281
+ {
282
+ 'labels': '80%',
283
+ 'color': 'rgb(226, 121, 0)',
284
+ 'tooltip': 'Great work',
285
+ 'description': 'You did an outstanding job and answered all questions correctly!'
286
+ },
287
+ {
288
+ 'labels': '100%',
289
+ 'color': 'rgb(226, 121, 0)',
290
+ 'tooltip': 'Excellent',
291
+ 'description': 'Exceptional job! All answers are perfect. You\'re doing amazing!'
292
+ }
293
+ ];
294
+ abortEarlySetup();
295
+ before(() => {
296
+ cy.log('Navigate to Feedback scale question type');
297
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
298
+ cy.barsPreLoaderWait();
299
+ feedbackScalePage.steps.clickOnFeedbackStyleLayoutDropdown();
300
+ feedbackScalePage.steps.selectFeedbackStyleLayoutDropdown('Star');
301
+ });
302
+
303
+ it('By default, 5 option accordions should be displayed for \'Star\' layout style and \'Option 1\' accordion should be in expanded state and all other accordions should be in collapsed state', () => {
304
+ utilities.verifyElementCount(feedbackScalePage.optionAccordion(), 5);
305
+ feedbackScalePage.steps.verifyOptionAccordionInExpandedState(0);
306
+ for (let index = 1; index < 4; index++) {
307
+ feedbackScalePage.steps.verifyOptionAccordionInCollapsedState(index);
308
+ };
309
+ });
310
+
311
+ //Failing due to https://redmine.zeuslearning.com/issues/541449
312
+ options.forEach((option, optionIndex) => {
313
+ it(`Option accordion contents for \'${option}\' - \'Star\' layout style`, () => {
314
+ feedbackScalePage.steps.verifyOptionAccordionInputFieldContents(optionIndex, optionsContent[optionIndex]);
315
+ });
316
+ });
317
+ });
318
+
319
+ describe('Feedback scale - Add, delete option accordion - edit tab', () => {
320
+ abortEarlySetup();
321
+ before(() => {
322
+ cy.log('Navigate to Feedback scale question type');
323
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale');
324
+ cy.barsPreLoaderWait();
325
+ });
326
+
327
+ it('When the user clicks on \'Add option\' button, a new option accordion should get added and the added option accordion should be in collapsed state', () => {
328
+ feedbackScalePage.steps.addOption();
329
+ utilities.verifyElementCount(feedbackScalePage.optionAccordion(), 4);
330
+ utilities.verifyElementVisibilityState(feedbackScalePage.optionAccordion(), 'visible');
331
+ feedbackScalePage.steps.verifyOptionAccordionInCollapsedState(3);
332
+ });
333
+
334
+ it('By default all input fields of the newly added option should be empty and default color in color block should be #00007C', () => {
335
+ feedbackScalePage.steps.verifyOptionAccordionInputFieldContents(3, { 'labels': '', 'color': 'rgb(0, 0, 124)', 'tooltip': '', 'description': '' });
336
+ });
337
+
338
+ it('When the user deletes an option accordion, the option accordion should get removed and labels of existing option accordions should get updated accordingly', () => {
339
+ feedbackScalePage.steps.deleteOptionAccordion(1);
340
+ utilities.verifyElementCount(feedbackScalePage.optionAccordion(), 3);
341
+ for (let index = 0; index < 3; index++) {
342
+ feedbackScalePage.steps.verifyOptionAccordionPanelContents(index, `Option ${index + 1}`);
343
+ };
344
+ });
345
+ });
346
+ });
@@ -0,0 +1,72 @@
1
+ import { dialogBoxBase } from "../../../pages";
2
+ import { feedbackScalePage } from "../../../pages/feedbackScalePage";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+
5
+ describe('Create question page - Feedback scale: Header section and Saving question', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Header section contents', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ cy.log('Navigating to feedback scale question type');
14
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale')
15
+ });
16
+
17
+ feedbackScalePage.tests.verifyCreateQuestionPageQuestionTypeHeader('Feedback scale');
18
+ });
19
+
20
+ describe('Tabs section', () => {
21
+ abortEarlySetup();
22
+ before(() => {
23
+ cy.log('Navigating to feedback scale question type');
24
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale')
25
+ });
26
+
27
+ feedbackScalePage.tests.verifyTabsSection();
28
+ });
29
+
30
+ describe('Cancel button', () => {
31
+ abortEarlySetup();
32
+ before(() => {
33
+ cy.log('Navigating to feedback scale question type');
34
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale')
35
+ });
36
+
37
+ feedbackScalePage.tests.verifyCancelButton('feedback scale');
38
+ });
39
+
40
+ describe('Save Question button', () => {
41
+ abortEarlySetup();
42
+ before(() => {
43
+ cy.log('Navigating to feedback scale question type');
44
+ feedbackScalePage.steps.navigateToCreateQuestion('feedback scale')
45
+ cy.barsPreLoaderWait();
46
+ });
47
+
48
+
49
+ describe('Validation error messages', () => {
50
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
51
+
52
+ it('Validation error messages should be displayed below required input fields', () => {
53
+ feedbackScalePage.steps.verifyQuestionInstructionsErrorMessage()
54
+ });
55
+
56
+ it('Validation error messages should disappear when required input fields are filled', () => {
57
+ feedbackScalePage.steps.addQuestionInstructions();
58
+ feedbackScalePage.steps.verifyQuestionInstructionsErrorMessageIsNotDisplayed();
59
+ });
60
+
61
+ // Failing due to https://redmine.zeuslearning.com/issues/541472
62
+ feedbackScalePage.tests.verifya11yOfCreateItemWrapperContents();
63
+ });
64
+
65
+ describe('Saving a question', () => {
66
+ it('When user has filled all the mandatory fields then on clicking on Save question button the question should get saved and a snackbar with text \'Saved successfully!\' should be displayed', () => {
67
+ feedbackScalePage.steps.saveAQuestionAndVerifySnackbar();
68
+ });
69
+ feedbackScalePage.tests.verifySavedSuccessfullySnackbarCSSanda11y();
70
+ });
71
+ });
72
+ });