-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathloadCallbacks.ts
More file actions
29 lines (23 loc) · 811 Bytes
/
loadCallbacks.ts
File metadata and controls
29 lines (23 loc) · 811 Bytes
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
/// <reference types="cypress" />
describe('onLoad/onLoadFailed', () => {
it('should call onLoad when successful', () => {
cy.intercept('https://widget.intercom.io/widget/jcabc7e3', (request) => {
request.continue((response) => {
response.headers['cache-control'] = 'no-cache';
});
});
cy.visit('/useIntercomWithLoadCallbacks');
cy.get('[data-cy=call]').should(($p) =>
expect($p).to.have.text('onLoad was called!'),
);
});
it('should call onLoadFailed when not successful', () => {
cy.intercept('https://widget.intercom.io/widget/jcabc7e3', {
forceNetworkError: true,
});
cy.visit('/useIntercomWithLoadCallbacks');
cy.get('[data-cy=call]').should(($p) =>
expect($p).to.have.text('onLoadFailed was called!'),
);
});
});