-
Notifications
You must be signed in to change notification settings - Fork 125
/
accessibility.cypress.spec.js
71 lines (65 loc) · 2.04 KB
/
accessibility.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
import mockRepresentativeData from '../../constants/mock-representative-data.json';
import mockGeocodingData from '../../constants/mock-geocoding-data.json';
import { generateFeatureToggles } from '../../mocks/feature-toggles';
describe('Accessibility', () => {
beforeEach(() => {
cy.viewport(1200, 700);
cy.intercept('GET', '/v0/feature_toggles*', {
data: {
features: [{ name: 'find_a_representative_enabled', value: true }],
},
});
cy.intercept('GET', '/v0/maintenance_windows', []);
cy.intercept(
'GET',
'/services/veteran/v0/other_accredited_representatives',
mockRepresentativeData,
);
cy.intercept('GET', '/geocoding/**/*', mockGeocodingData);
});
it('traverses form controls via keyboard input', () => {
cy.visit('/get-help-from-accredited-representative/find-rep/');
generateFeatureToggles();
cy.injectAxe();
cy.axeCheck();
// Verify focused on input location
cy.get('#representative-search-controls').trigger('mousedown');
cy.tab();
cy.get(
'va-additional-info[trigger="What does an accredited VSO do?"]',
).focused();
cy.tab();
cy.get(
'va-additional-info[trigger="What does an accredited attorney do?"]',
).focused();
cy.tab();
cy.get(
'va-additional-info[trigger="What does an accredited claims agent do?"]',
).focused();
cy.tab();
cy.get('va-radio').trigger('keydown', {
keyCode: 9,
which: 9,
});
cy.tab();
cy.get('input[name="Address, city, state, or postal code"]').focus();
cy.get('input[name="Address, city, state, or postal code"]').trigger(
'keydown',
{
keyCode: 9,
which: 9,
},
);
// Verify focused on name input
cy.get('input[name="Name of accredited representative"]').focused();
cy.get('input[name="Name of accredited representative"]').trigger(
'keydown',
{
keyCode: 9,
which: 9,
},
);
// Verify focused on Search button
cy.get('va-button[text="Search"]').focused();
});
});