-
Notifications
You must be signed in to change notification settings - Fork 125
/
cdp-alert.cypress.spec.js
139 lines (131 loc) · 4.99 KB
/
cdp-alert.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
import mockFeatureToggles from './fixtures/mocks/feature-toggles.json';
import mockDebts from './fixtures/mocks/debts.json';
import mockUser from './fixtures/mocks/mock-user.json';
import mockCopays from './fixtures/mocks/copays.json';
describe('Debt Letters - CDP Alerts', () => {
const mockZeroDebt = {
debts: [],
};
const mockZeroCopay = {
data: [],
};
// Has both VBA and VHA balances
it('displays the current debts section and Your Other VA section', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', mockDebts).as('debts');
cy.intercept('GET', '/v0/medical_copays', mockCopays);
cy.visit('/');
cy.visit('/manage-va-debt/your-debt');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
cy.findByTestId('other-va-copay-body').should('exist');
cy.injectAxeThenAxeCheck();
});
// Has VBA and VHA 404
it('displays the current debts section and alert in Your Other VA section', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', mockDebts).as('debts');
cy.intercept('GET', '/v0/medical_copays', req => {
req.reply(404, {});
});
cy.visit('/manage-va-debt/your-debt/');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
cy.findByTestId('error-copay-alert').should('exist');
cy.injectAxeThenAxeCheck();
});
// VHA && VBA 404
it('should display alert error message for VBA & VHA 404 responses', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', req => {
req.reply(404, {});
}).as('debts');
cy.intercept('GET', '/v0/medical_copays', req => {
req.reply(404, {});
});
cy.visit('/manage-va-debt/your-debt/');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
// Alerts
cy.findByTestId('all-error-alert').should('exist');
cy.findByTestId('other-va-copay-body').should('not.exist');
cy.injectAxeThenAxeCheck();
});
// VBA 404 & VHA balance
it('should display alert error message for VBA 404 response and Your Other VA section', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', req => {
req.reply(404, {});
}).as('debts');
cy.intercept('GET', '/v0/medical_copays', mockCopays);
cy.visit('/manage-va-debt/your-debt/');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
// Alerts
cy.findByTestId('error-debt-alert').should('exist');
cy.findByTestId('other-va-copay-body').should('exist');
cy.injectAxeThenAxeCheck();
});
// VBA 404 & VHA 0 balance
it('should display alert error message for VBA 404 response and no Your Other VA section', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', req => {
req.reply(404, {});
}).as('debts');
cy.intercept('GET', '/v0/medical_copays', mockZeroCopay);
cy.visit('/manage-va-debt/your-debt/');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
// Alerts
cy.findByTestId('error-debt-alert').should('exist');
cy.findByTestId('other-va-copay-body').should('not.exist');
cy.injectAxeThenAxeCheck();
});
// VBA 0 balance & VHA balance
it('should display alert info message for 0 VBA balance and Your Other VA secion', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', mockZeroDebt).as('debts');
cy.intercept('GET', '/v0/medical_copays', mockCopays);
cy.visit('/manage-va-debt/your-debt/');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
// Alerts
cy.findByTestId('zero-debt-alert').should('exist');
cy.findByTestId('other-va-copay-body').should('exist');
cy.injectAxeThenAxeCheck();
});
// VBA & VHA 0 balance
it('should display alert info message for 0 VBA balance and no Your Other VA secion', () => {
cy.login(mockUser);
cy.intercept('GET', '/v0/feature_toggles*', mockFeatureToggles).as(
'features',
);
cy.intercept('GET', '/v0/debts', mockZeroDebt).as('debts');
cy.intercept('GET', '/v0/medical_copays', mockZeroCopay);
cy.visit('/manage-va-debt/your-debt/');
cy.wait(['@features', '@debts']);
cy.findByTestId('summary-page-title').should('exist');
// Alerts
cy.findByTestId('zero-debt-alert').should('exist');
cy.findByTestId('other-va-copay-body').should('not.exist');
cy.injectAxeThenAxeCheck();
});
});