-
Notifications
You must be signed in to change notification settings - Fork 126
/
00.feedback-tool.cypress.spec.js
143 lines (114 loc) · 4.89 KB
/
00.feedback-tool.cypress.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import Timeouts from 'platform/testing/e2e/timeouts';
import mockFeedbackPost from './fixtures/mocks/feedback-post.json';
import mockFeedbackGet from './fixtures/mocks/feedback-1234.json';
import testData from './schema/maximal-test.json';
describe('Feedback Tool Test', () => {
it('Fills the form and navigates accordingly', () => {
cy.intercept('POST', '/v0/gi_bill_feedbacks', { body: mockFeedbackPost });
cy.intercept('GET', '/v0/gi_bill_feedbacks/1234', mockFeedbackGet);
cy.visit('/education/submit-school-feedback');
cy.get('body').should('be.visible');
cy.get('.schemaform-title').should('be.visible', {
timeout: Timeouts.slow,
});
cy.get('.schemaform-start-button')
.first()
.click();
cy.url().should('not.contain', '/introduction');
// Applicant relationship
cy.get('input[name="root_onBehalfOf"][value="Myself"]').should('exist');
cy.injectAxeThenAxeCheck();
cy.selectRadio('root_onBehalfOf', testData.data.onBehalfOf);
cy.get('.usa-alert.usa-alert-info.background-color-only', {
timeout: Timeouts.slow,
}).should('be.visible');
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/applicant-relationship');
// Applicant information
cy.get('input[name="root_fullName_first').should('exist');
cy.axeCheck();
cy.fillName('root_fullName', testData.data.fullName);
cy.get('#root_serviceAffiliation').select(testData.data.serviceAffiliation);
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/applicant-information');
// Service Information
cy.get('select[name="root_serviceBranch"]').should('exist');
cy.axeCheck();
cy.fillDate(
'root_serviceDateRange_from',
testData.data.serviceDateRange.from,
);
cy.fillDate('root_serviceDateRange_to', testData.data.serviceDateRange.to);
cy.get('#root_serviceBranch').select(testData.data.serviceBranch);
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/service-information');
// Contact information
cy.get('select[name="root_address_country"]').should('exist');
cy.axeCheck();
cy.fillAddress('root_address', testData.data.address);
cy.fill('input[name="root_applicantEmail"]', testData.data.applicantEmail);
cy.fill(
'input[name="root_view:applicantEmailConfirmation"]',
testData.data['view:applicantEmailConfirmation'],
);
cy.fill('input[name="root_phone"]', testData.data.phone);
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/contact-information');
// Benefit information
cy.get('input[name="root_educationDetails_programs_chapter33"]').should(
'exist',
);
cy.axeCheck();
cy.get('#root_educationDetails_programs_chapter33').click();
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/benefits-information');
// School information
cy.get('input[type="checkbox"]').should('exist');
cy.axeCheck();
// checkbox to enter information manually
cy.get('label[id="option-label"]').click();
cy.get('label[id="option-label"]').click();
cy.get(
'input[name="root_educationDetails_school_view:manualSchoolEntry_name"]',
{ timeout: Timeouts.slow },
);
cy.fill(
'input[name="root_educationDetails_school_view:manualSchoolEntry_name"]',
testData.data.educationDetails.school['view:manualSchoolEntry'].name,
);
cy.fillAddress(
'root_educationDetails_school_view\\:manualSchoolEntry_address',
testData.data.educationDetails.school['view:manualSchoolEntry'].address,
);
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/school-information');
// Feedback information
cy.get('input[name="root_issue_recruiting"]').should('exist');
cy.axeCheck();
cy.get('#root_issue_other').click();
cy.get('textarea[id="root_issueDescription"]').type(
testData.data.issueDescription,
);
cy.get('textarea[id="root_issueResolution"]').type(
testData.data.issueResolution,
);
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.url().should('not.contain', '/feedback-information');
// Review and submit page
cy.get('[name="privacyAgreementAccepted"]')
.find('label[for="checkbox-element"]')
.should('be.visible');
cy.get('[name="privacyAgreementAccepted"]')
.find('[type="checkbox"]')
.check({
force: true,
});
cy.axeCheck();
cy.get('.form-progress-buttons .usa-button-primary').click();
cy.get('.js-test-location', { timeout: Timeouts.submission })
.invoke('attr', 'data-location')
.should('not.contain', '/review-and-submit');
cy.get('.confirmation-page-title').should('be.visible');
cy.axeCheck();
});
});