Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate intercepts #16

Open
DanielHabenicht opened this issue Jun 7, 2023 · 0 comments
Open

Validate intercepts #16

DanielHabenicht opened this issue Jun 7, 2023 · 0 comments

Comments

@DanielHabenicht
Copy link

Hi and thanks for the nice plugin!
I wanted to share an idea of validating intercepts with the openapi schema.

Kind of like:

beforeEach(() => {
    cy.intercept('*', req => {
        req.continue(res => {
            cy.task('validateSwaggerSchema', {
                file: './../swagger.json',
                endpoint: req.url,
                method: req.method,
                statusCode: res.statusCode,
                responseSchema: res.body,
                verbose: true // optional, default: false
            }).should('equal', null);
        });
    });
});

This example does not work because of cypress-io/cypress#7667

This would ensure fixtures (e.g. cy.intercept('GET', '/api/identity', { fixture: 'identity/sys-admin.json'})) are still adhering to the schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant