-
Notifications
You must be signed in to change notification settings - Fork 7
/
audit-info-form.cy.js
71 lines (63 loc) · 2.27 KB
/
audit-info-form.cy.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
/*
Tests for the audit information form page.
INCOMPLETE. Awaiting login.gov to work with Cypress.
*/
describe('Audit Information Form', () => {
beforeEach(() => {
cy.visit('/audit/audit-info/2022JAN0001000006');
});
function answerAllQuestions() {
// Select everything for the GAAP multiple choice checkboxes.
cy.get('[id^=gaap_results--]').each((item) => {
cy.get(item).click();
});
// Answer 'Yes' to all Yes/No questions.
cy.get('[id$=--true]').each((item) => {
cy.get(item).click();
});
// Enter 750000 into the dollar theshold number field.
cy.get('#dollar_threshold').type('750000');
cy.get('#dollar_threshold').blur();
// Select 0 and 1 for the multiple select agencies field.
cy.get('#agencies').select(['00', '01']);
cy.get('#agencies').blur();
}
it('Page loads successfully', () => {
cy.url().should('include', '/audit-info/');
});
it('Submit button is disabled on empty form', () => {
cy.get('continue').should('be.disabled');
});
it.only('Submit button is enabled after filling out all fields.', () => {
answerAllQuestions();
cy.get('continue').should('be.enabled');
});
it.only('Sucessful submit redirects to the audit checklist.', () => {
answerAllQuestions();
cy.get('continue').should('be.enabled').click();
cy.url().should('include', '/submission-progress/');
});
describe('Number Field', () => {
it('Cannot type non-int values (only allows numbers and [+-.e])', () => {
cy.get('#dollar_threshold').clear();
cy.get('#dollar_threshold').type(
`abcdfghigklmnopqrstuvwxyz=[];',/!@#$%^&*()_{}|:"<>?~`
);
cy.get('#dollar_threshold').should('have.value', '');
});
it('Negative values are disallowed', () => {
answerAllQuestions(); // Enable submit button.
cy.get('#dollar_threshold').clear();
cy.get('#dollar_threshold').type(`-2`);
cy.get('#continue').click();
cy.url().should('include', '/audit-info/');
});
it('Decimal values are disallowed', () => {
answerAllQuestions(); // Enable submit button.
cy.get('#dollar_threshold').clear();
cy.get('#dollar_threshold').type(`777.77`);
cy.get('#continue').click();
cy.url().should('include', '/audit-info/');
});
});
});