From ee1394ea61296a2f8a9f177b0afe1f65211e44f4 Mon Sep 17 00:00:00 2001 From: Mike Gunn Date: Thu, 27 Apr 2023 14:32:00 -0400 Subject: [PATCH] test(cypress): improve intercept assertions --- web/client/cypress/e2e/validator.cy.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/web/client/cypress/e2e/validator.cy.js b/web/client/cypress/e2e/validator.cy.js index 32b84ce2e6..6648090dd2 100644 --- a/web/client/cypress/e2e/validator.cy.js +++ b/web/client/cypress/e2e/validator.cy.js @@ -67,16 +67,30 @@ context('GTFS Validator - Core Workflow', () => { .click(); // Wait for create job 200 response - cy.wait('@createJob').its('response.statusCode').should('eq', 200); + cy.wait('@createJob').should((xhr) => { + expect(xhr.response.statusCode).to.eq(200); + }); // Wait for 404 - cy.wait('@awaitJob').its('response.statusCode').should('eq', 404); + cy.wait('@awaitJob').should((xhr) => { + expect(xhr.response.statusCode).to.eq(404); + expect(xhr.request.url).to.contain('_waiting_'); + expect(xhr.request.url).to.not.contain(jobId); + }); // Wait for 404 - cy.wait('@awaitJob').its('response.statusCode').should('eq', 404); + cy.wait('@awaitJob').should((xhr) => { + expect(xhr.response.statusCode).to.eq(404); + expect(xhr.request.url).to.contain(jobId); + expect(xhr.request.url).to.not.contain('_waiting_'); + }); // Wait for 200 - cy.wait('@awaitJob').its('response.statusCode').should('eq', 200); + cy.wait('@awaitJob').should((xhr) => { + expect(xhr.response.statusCode).to.eq(200); + expect(xhr.request.url).to.contain(jobId); + expect(xhr.request.url).to.not.contain('_waiting_'); + }); // Confirm "report ready" cy.get('dialog')