I am trying to write a test script using Cypress and in this scenario, there is an actual 500 server error in the system. But when I try to automate this using Cypress it does not give me any error and works fine. Is it because I am using fixtures? Could anyone tell me what is the procedure for handling these kinds of situations in Cypress?
Finally, I want cypress to throw an error if there is an actual error in the system and once it was fixed it should work fine again and the test should pass.
it('Add less than 400 (314) characters to value added service', function (){
cy.intercept("POST", "**/api/update_profile/overview", {
fixture: "supplier_profile_company_overview.json",
}).as('submitCompanyOverview');
cy.intercept("POST", "**/api/login/select_supplier_role", {
fixture: "supplier_profile_submit_select_supplier_role.json",
}).as('selectSupplierRole');
cy.fixture('supplier_profile_sample_characters_314.json')
.then((data)=> {
cy.xpath('(//div[@class=\'v-input__slot\'])[5]')
.type(data.description);
});
cy.xpath('//button[@class=\'md-button save-btn md-theme-default\']')
.click();
cy.contains('Company Information Updated').should('be.visible');
cy.wait('@submitCompanyOverview').then(({response}) =>{
expect(response.statusCode).to.eq(200);
});
cy.wait('@selectSupplierRole').then(({response}) =>{
expect(response.statusCode).to.eq(200);
});
});