From e3caaae82149e2882885c4cf9f46d477a8671573 Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 2 May 2019 17:13:05 -0400 Subject: [PATCH 1/3] add test that performance getEntries return arrays --- .../test/cypress/integration/commands/clock_spec.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/driver/test/cypress/integration/commands/clock_spec.coffee b/packages/driver/test/cypress/integration/commands/clock_spec.coffee index fab76cc2ac14..3130d6a4f934 100644 --- a/packages/driver/test/cypress/integration/commands/clock_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/clock_spec.coffee @@ -72,6 +72,13 @@ describe "src/cy/commands/clock", -> expect(new win.Date()).to.be.an.instanceof(win.Date) expect(new win.Date() instanceof win.Date).to.be.true + it "doesn't override window.performance members", -> + cy.clock() + cy.window().then (win) -> + expect(win.performance.getEntriesByType("foo")).to.deep.eq([]) + expect(win.performance.getEntriesByName("foo")).to.deep.eq([]) + expect(win.performance.getEntries("foo")).to.deep.eq([]) + context "errors", -> it "throws if now is not a number (or options object)", (done) -> cy.on "fail", (err) -> From 59b337f3a8411a2dd5796de836caaf6415ef0248 Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Fri, 3 May 2019 09:43:31 -0400 Subject: [PATCH 2/3] add test for clock.restore, add custom lolex version --- packages/driver/package.json | 2 +- .../integration/commands/clock_spec.coffee | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/driver/package.json b/packages/driver/package.json index e2e28a89bd49..d212f96806dc 100644 --- a/packages/driver/package.json +++ b/packages/driver/package.json @@ -44,7 +44,7 @@ "js-cookie": "2.2.0", "jsdom": "13.2.0", "lodash": "4.17.11", - "lolex": "3.1.0", + "lolex": "flotwig/lolex#775312f1c5d657f45f3414e24db81be0b30c5bcd", "methods": "1.1.2", "method-override": "2.3.10", "minimatch": "3.0.4", diff --git a/packages/driver/test/cypress/integration/commands/clock_spec.coffee b/packages/driver/test/cypress/integration/commands/clock_spec.coffee index 3130d6a4f934..fac42ee4020c 100644 --- a/packages/driver/test/cypress/integration/commands/clock_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/clock_spec.coffee @@ -74,10 +74,17 @@ describe "src/cy/commands/clock", -> it "doesn't override window.performance members", -> cy.clock() - cy.window().then (win) -> - expect(win.performance.getEntriesByType("foo")).to.deep.eq([]) - expect(win.performance.getEntriesByName("foo")).to.deep.eq([]) - expect(win.performance.getEntries("foo")).to.deep.eq([]) + .then (clock) -> + cy.window().then (win) -> + expect(win.performance.getEntriesByType("paint")).to.deep.eq([]) + expect(win.performance.getEntriesByName("first-paint")).to.deep.eq([]) + expect(win.performance.getEntries()).to.deep.eq([]) + + clock.restore() + + expect(win.performance.getEntriesByType("paint").length).to.be.at.least(1) + expect(win.performance.getEntriesByName("first-paint").length).to.be.at.least(1) + expect(win.performance.getEntries().length).to.be.at.least(1) context "errors", -> it "throws if now is not a number (or options object)", (done) -> From 16b776f98141f7d5ac69cb93e485a4769e7f198f Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Tue, 4 Jun 2019 14:51:29 -0400 Subject: [PATCH 3/3] use lolex 4.1.0, with fix --- packages/driver/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/driver/package.json b/packages/driver/package.json index d212f96806dc..943c68cfb91b 100644 --- a/packages/driver/package.json +++ b/packages/driver/package.json @@ -44,7 +44,7 @@ "js-cookie": "2.2.0", "jsdom": "13.2.0", "lodash": "4.17.11", - "lolex": "flotwig/lolex#775312f1c5d657f45f3414e24db81be0b30c5bcd", + "lolex": "4.1.0", "methods": "1.1.2", "method-override": "2.3.10", "minimatch": "3.0.4",