cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.69k stars 3.16k forks source link

Intercepted requests are shown as pending, console log as if not stubbed #18810

Open Tatsianacs opened 2 years ago

Tatsianacs commented 2 years ago

Current behavior

Angular app with installed Cypress: Intercepted requests are shown as Pending (50/50, when you refresh or re-open tests, different requests are marked as pending/completed) When you click the request to inspect, the console log shows that the request did go to the origin whereas in command log in shows that the same requests did NOT go. image

image

Desired behavior

Stubbed requests are not shown as Pending, went to origin is correct

Test code to reproduce

  1. Electron 93, Cypress 8.7

  2. Generate any angular app, add cypress schematic

  3. AppComponent

    constructor(private http: HttpClient) {
    }
    
    ngOnInit(): void {
    this.singleRequest();
    this.singleRequest2();
    }
    
    public singleRequest() {
    this.http.get(' https://www.test-site.net/HUB/ApplicationServices/GetResource?applicationName=login-app').subscribe();
    }
    
    public singleRequest2() {
    this.http.get(' https://www.test-site.net/HUB/ApplicationServices2/GetUsers?applicationName=login-app').subscribe();
    }
  4. Cypress test (only 1 spec file with 1 test):

    describe('My First Test', () => {
    it('Visits the initial project page', () => {
    cy.intercept('GET', '**/ApplicationServices/GetResource*', {}).as('getAllUsers');
    cy.intercept('GET', '**/ApplicationServices2/GetUsers*', {}).as('getAllUsers2');
    cy.visit('http://localhost:4200');
    cy.wait('@getAllUsers');
    cy.wait('@getAllUsers2');
    })
    })

    If initial load is successful and requests are shown as completed, refresh or reopen the test file

Cypress Version

8.7.0

Other

No response

adarnon commented 2 years ago

I can confirm this is also happening in my project, Next.js-React and Cypress 9.0.

cypress-app-bot commented 1 year ago

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 commented 1 year ago

This issue has been closed due to inactivity.

clintonmedbery commented 3 months ago

Did you fix this? What did you see? 😂

stellarskye commented 3 months ago

lol I havent looked at this for several months but the only answer I found was "learn to live with it"