In my beforeEach I have
cy.intercept('GET', '**/api/v2/invoices**').as('getPaidInvoices');
I have some tests where I use getPaidInvoices with exactle same path. But then I have different test
cy.intercept('GET', '**/api/v2/invoices**').as('getInvoices');
cy.wait('@getInvoices').then((xhr) => {
expect(xhr.response.statusCode).to.equal(200);
Then I have cy with each loop for options in drop-down menu. By clicking on each option inside, I await request different for each option. The address is almost the same, except the last two ** will get different arguments.
The problem seems Cypress doesn't like to share the value of getPaidInvoices with GetInvoices. On the line with
cy.intercept('GET', '**/api/v2/invoices**').as('getInvoices');
it says "This request matched: cy.intercept() spy with alias @getPaidInvoices
Is there any workaround? I need "/api/v2/invoices" to be used my multiple aliases. Or is there option to do it without aliases?
Thank you