Skip to content

Commit

Permalink
test: cover the case with the request issued by cy.request()
Browse files Browse the repository at this point in the history
relates-to #59
  • Loading branch information
derevnjuk committed Feb 7, 2023
1 parent d1b6f6b commit fb9c01a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cypress/e2e/record-har.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ describe('Record HAR', () => {
});
});

// ADHOC: cy.request() sends requests to actual endpoints, bypassing the interceptor
// For details please refer to the documentation at
// https://docs.cypress.io/api/commands/request#cyrequest-sends-requests-to-actual-endpoints-bypassing-those-defined-using-cyintercept
it.skip('records a request made by Cypress (not the tested app)', () => {
cy.recordHar();

cy.request('/api/products');

cy.saveHar({ waitForIdle: true });

cy.findHar()
.its('log.entries')
.should('contain.something.like', {
request: {
url: /\/api\/products$/
}
});
});

// ADHOC: .mjs files are excluded as Cypress forces ts-node to use the 'commonjs' module format. Covered by unit tests.
// For details please refer to https://github.com/cypress-io/cypress/blob/e6b2466f7b219a86da46c1ac720432ef75193ca4/packages/server/lib/plugins/child/ts_node.js#L25
['.js', '.ts', '.cjs'].forEach(ext =>
Expand Down

0 comments on commit fb9c01a

Please sign in to comment.