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

cy.route() doesn't intercept calls during 303 redirect #2621

Closed
chris-perts opened this issue Oct 16, 2018 · 2 comments
Closed

cy.route() doesn't intercept calls during 303 redirect #2621

chris-perts opened this issue Oct 16, 2018 · 2 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@chris-perts
Copy link

chris-perts commented Oct 16, 2018

Current behavior:

  1. Set up a route stub with cy.route().
  2. Test a page where an xhr gets redirected to the mocked route via a 303
  3. The second xhr goes through and does not reach the stub

screen shot 2018-10-16 at 1 29 51 pm

Desired behavior:

The stub should intercept the redirected xhr.

Steps to reproduce:

const weasleTheWoozle = {
  name: 'Weasle',
};

it.only('stubs 303', () => {
  cy.server();

  // Test against any page that makes this call.
  cy.route({
    method: 'POST',
    url: '/woozles',
    status: 303,
    headers: {
      Location: '/woozles/5',
    },
    response: '',
  });

  // Want to mock this:
  cy.route({
    method: 'GET',
    url: '/woozles/5',
    response: weasleTheWoozle,
  }).as('get');

  cy.visit('/');
  cy.wait(['@get']); // times out, stub does not intercept
});

Versions

3.1.0, MacOS, Electron 59

@jennifer-shehane
Copy link
Member

Yes, this likely is a situation that's not being taken into account with stubbing routes. Thanks for opening this issue.

@jennifer-shehane jennifer-shehane added type: bug stage: ready for work The issue is reproducible and in scope labels Oct 17, 2018
@jennifer-shehane
Copy link
Member

Duplicate of #3190

@jennifer-shehane jennifer-shehane marked this as a duplicate of #3190 Jan 23, 2019
@jennifer-shehane jennifer-shehane added type: duplicate This issue or pull request already exists and removed stage: ready for work The issue is reproducible and in scope type: bug labels Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants