Home > Back-end >  Can't fetch data from json server when try to testing e2e form login page - React typescript
Can't fetch data from json server when try to testing e2e form login page - React typescript

Time:01-22

I get an error when try to test login page

describe('Login form', () => {
    beforeEach(() => {
        cy.visit('/login', { timeout: 9000000000000 });
    });
    it('Should submit the form with correct email and password', () => {
        cy.get('input[type="text"]').type('[email protected]');
        cy.get('input[type="password"]').type('123');
        cy.get('button[data-cy="submit"]').click();
        cy.url().should('include', 'home'); /*error*/
    });
});

I got (xhr)GET http://localhost:4000/users but data never received from server, the data I have provide in the test is correct

I am try to test login but data not received from server to compare with user data who try to login after compare data then will redirect user to home page page link \home

CodePudding user response:

This problem solved after replace local API and using deployed API

  • Related