chilly-quill-34099
09/12/2022, 7:29 AMcy.get(...). My API, which I would like to intercept is on a different host (e.g. https://example-api.azurewebsites.net/something/something2/MyFunction/something3/something4), than my website host http://localhost:4200.
I tried cy.intercept with an alias. But either I get an authorization error (when using https://... for hostname) or my cy.wait(@getMyFunction) runs into a timeout.
ts
it('...test', () =>{
cy.intercept({
method: 'GET',
url: '**/MyFunction/*',
hostname: 'https://example-api.azurewebsites.net',
}).as('getMyFunction');
cy.visit('/').wait('@getMyFunction', { timeout: 30000 })
cy.get('some-content');
});
Cypress finds the alias, the intercept is not correctly configured. But I have no idea, what to change, to make it work.
Does anyone know, what I am doing wrong in this procedure?