diff --git a/packages/driver/test/cypress/integration/commands/xhr_spec.coffee b/packages/driver/test/cypress/integration/commands/xhr_spec.coffee index f15cd21a6db8..144c6d634b42 100644 --- a/packages/driver/test/cypress/integration/commands/xhr_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/xhr_spec.coffee @@ -1915,13 +1915,16 @@ describe "src/cy/commands/xhr", -> xhr.foo = "bar" resolve(xhr) xhr.send() - .should (xhr) -> - ## ensure this is set to prevent accidental - ## race conditions down the road if something - ## goes wrong - expect(xhr.foo).to.eq("bar") - expect(xhr.aborted).not.to.be.true - expect(log.get("state")).to.eq("passed") + .then (xhr) -> + cy + .wrap(null) + .should -> + ## ensure this is set to prevent accidental + ## race conditions down the road if something + ## goes wrong + expect(xhr.foo).to.eq("bar") + expect(xhr.aborted).not.to.be.true + expect(log.get("state")).to.eq("passed") context "Cypress.on(window:unload)", -> it "aborts all open XHR's", -> diff --git a/packages/driver/test/cypress/integration/cy/timers_spec.js b/packages/driver/test/cypress/integration/cy/timers_spec.js index 0cd966239670..ad98993f790f 100644 --- a/packages/driver/test/cypress/integration/cy/timers_spec.js +++ b/packages/driver/test/cypress/integration/cy/timers_spec.js @@ -387,12 +387,17 @@ describe('driver/src/cy/timers', () => { .then((win) => { const stub1 = cy.stub() - win.setTimeout(stub1, 200) + // we're setting setTimeout to 500ms because + // there were times where the driver's webserver + // was sending bytes after 200ms (TTFB) that caused + // this test to be flaky. + win.setTimeout(stub1, 500) + // force the window to sync reload win.location.reload() cy - .wait(400) + .wait(800) .then(() => { expect(stub1).not.to.be.called })