From 24265a0a01f5ed234ad4285b8db4e36f1fbdc9ea Mon Sep 17 00:00:00 2001 From: Przemek Suchodolski Date: Fri, 7 Aug 2020 10:08:30 +0200 Subject: [PATCH] fix(driver) - Fix for introduced regression in cy.route by loading a fixture inside the route command --- packages/driver/cypress/integration/commands/xhr_spec.js | 4 +++- packages/driver/src/cy/commands/xhr.js | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/driver/cypress/integration/commands/xhr_spec.js b/packages/driver/cypress/integration/commands/xhr_spec.js index a29bec5ccaab..db63d1d22d04 100644 --- a/packages/driver/cypress/integration/commands/xhr_spec.js +++ b/packages/driver/cypress/integration/commands/xhr_spec.js @@ -2158,10 +2158,12 @@ describe('src/cy/commands/xhr', () => { done() }) - cy.route(/foo/, 'fx:NOT_EXISTING_FILE_FIXTURE') + cy.route(/foo/, 'fx:NOT_EXISTING_FILE_FIXTURE').as('stub') cy.window().then((win) => { win.$.get('/foo') }) + + cy.wait('@stub') }) }) diff --git a/packages/driver/src/cy/commands/xhr.js b/packages/driver/src/cy/commands/xhr.js index b2a26ac7bb15..e15d0721308f 100644 --- a/packages/driver/src/cy/commands/xhr.js +++ b/packages/driver/src/cy/commands/xhr.js @@ -471,15 +471,6 @@ module.exports = (Commands, Cypress, cy, state, config) => { }) } - // look ahead to see if fixture exists - const fixturesRe = /^(fx:|fixture:)/ - - if (hasResponse && fixturesRe.test(options.response)) { - const fixtureName = options.response.replace(fixturesRe, '') - - return cy.now('fixture', fixtureName).then(() => route()) - } - return route() }