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

Intercept matching wrong url when array are used in query #16686

Closed
cifren opened this issue May 26, 2021 · 6 comments
Closed

Intercept matching wrong url when array are used in query #16686

cifren opened this issue May 26, 2021 · 6 comments
Labels
stage: needs information Not enough info to reproduce the issue stale no activity on this issue for a long period

Comments

@cifren
Copy link

cifren commented May 26, 2021

Current behavior

When trying to intercept this URL http://localhost/api/line?id=5&store[0]=5&store[1]=6 the command

cy.intercept(
        {
          url: '/api/line*',
          method: 'GET',
          query: {
            id: '5',
            'store[0]': '5',
            'store[1]': '9'
          },
        },
        {fixture: 'lines.json'}
      ).as('request')

is matching

Desired behavior

That intercept should not match at all

Test code to reproduce

See above

Versions

Cypress: 7.4.0
Browser: Chrome 90 (headless)

@jennifer-shehane
Copy link
Member

@cifren It looks like you didn't indicate the 'wrong' url that it is matching on. Can you provide the wrong url that this is matching on that you don't think it should match? Thanks.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label May 26, 2021
@cifren
Copy link
Author

cifren commented May 31, 2021

@IvanTC95
Copy link

IvanTC95 commented Jul 21, 2021

It's happening in version 8.0.0

@cifren
Copy link
Author

cifren commented Jan 20, 2022

And I noted as well an issue with that, I usually run it with GUI and if I don't close and open the test instance, the intercept method keeps old version of my code. I need to instanciate a new test window in order to make my code understood by the test.

For example, I will write :

beforeEach(() => {
    // this url doesn't exist on my running test app
    cy.intercept('GET', '/api/translations/wrong_url.json', { fixture: 'en.json' }).as('all');
  });

I run my test, It won't intercept anything, because it does not exist, it is normal, I wrote something wrong in purpose.

I will correct it after seeing my mistake :

beforeEach(() => {
    // this url exist
    cy.intercept('GET', '/api/translations/corrected_url.json', { fixture: 'en.json' }).as('all');
  });

It won't work if I don't close and open the window, the hot-reload does not refresh intercept method or something like that.

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 17, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

4 participants