Cypress
Cypress Integration
Q: How do I integrate Stoobly with Cypress tests?
import Stoobly from 'stoobly';
import { RecordPolicy, RecordOrder, RecordStrategy } from 'stoobly/constants';
const stoobly = new Stoobly();
const interceptor = stoobly.cypressInterceptor({
scenarioKey: '<SCENARIO-KEY>',
urls: [new RegExp('https://api.example.com/.*')],
});
describe('My Tests', () => {
beforeEach(() => {
// Apply interceptor in beforeEach
interceptor.apply();
});
it('can fetch data', () => {
cy.visit('https://example.com');
// Your test code here
});
});Q: Why must I call apply() in beforeEach for Cypress?
apply() in beforeEach for Cypress?Q: How do I record requests in Cypress tests?
Q: What's the warning about synchronous requests in Cypress?
Last updated