itemengine-cypress-automation 1.0.20 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,80 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { audioResponsePage, dialogBoxBase } from "../../../pages";
3
+ import { commonComponents } from "../../../pages/components";
4
+
5
+ describe('Create question page - Audio Response: Header section and Saving question', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Header section contents', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
14
+ });
15
+
16
+ audioResponsePage.tests.verifyCreateQuestionPageQuestionTypeHeader('Audio response');
17
+ });
18
+
19
+ describe('Tabs section', () => {
20
+ abortEarlySetup();
21
+ before(() => {
22
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
23
+ });
24
+
25
+ audioResponsePage.tests.verifyTabsSection();
26
+ });
27
+
28
+ describe('Cancel button', () => {
29
+ abortEarlySetup();
30
+ before(() => {
31
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
32
+ });
33
+
34
+ audioResponsePage.tests.verifyCancelButton('audio response');
35
+ });
36
+
37
+ describe('Save Question button', () => {
38
+ abortEarlySetup();
39
+ before(() => {
40
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
41
+ cy.barsPreLoaderWait();
42
+ });
43
+
44
+ describe('Validation error messages', () => {
45
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
46
+
47
+ it('Validation error messages should be displayed below required input fields', () => {
48
+ audioResponsePage.questionInstructionsLabelEditTab()
49
+ .parents('.edit-question-instruction-wrapper')
50
+ .within(() => {
51
+ commonComponents.errorMessage()
52
+ .verifyInnerText('Error: Question instructions are required.')
53
+ .and('be.visible');
54
+ });
55
+ audioResponsePage.pleaseEnterPointsErrorMessage()
56
+ .verifyInnerText('Error: Please enter points.');
57
+ });
58
+
59
+ it('Validation error messages should disappear when required input fields are filled', () => {
60
+ audioResponsePage.steps.addQuestionInstructions();
61
+ audioResponsePage.questionInstructionsLabelEditTab()
62
+ .parents('.edit-question-instruction-wrapper')
63
+ .within(() => {
64
+ commonComponents.errorMessage()
65
+ .should('not.exist');
66
+ });
67
+ audioResponsePage.steps.allotPoints(20);
68
+ audioResponsePage.pleaseEnterPointsErrorMessage()
69
+ .should('not.exist');
70
+ });
71
+ });
72
+
73
+ describe('Saving a question', () => {
74
+ 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', () => {
75
+ audioResponsePage.steps.saveAQuestionAndVerifySnackbar();
76
+ });
77
+ audioResponsePage.tests.verifySavedSuccessfullySnackbarCSSanda11y();
78
+ });
79
+ });
80
+ });