From f7cae430080eb3f725a130dd3a4075a108c1d691 Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Wed, 5 Dec 2018 10:28:28 -0500 Subject: [PATCH 01/14] =?UTF-8?q?rename=20=E2=80=98command:end=E2=80=99=20?= =?UTF-8?q?to=20=E2=80=98internal:commandEnd=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/types/index.d.ts | 2 +- cli/types/tests/actions.ts | 2 +- packages/driver/src/cypress.coffee | 6 +++--- packages/driver/src/cypress/cy.coffee | 2 +- packages/driver/src/cypress/events.coffee | 1 + .../cypress/integration/commands/actions/type_spec.coffee | 2 +- .../test/cypress/integration/commands/querying_spec.coffee | 2 +- .../cypress/integration/commands/traversals_spec.coffee | 2 +- .../driver/test/cypress/integration/e2e/events_spec.coffee | 1 + .../background-driver-events/cypress/background/index.js | 4 ++-- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cli/types/index.d.ts b/cli/types/index.d.ts index edeadc88c28e..9d2ad68cbdcf 100644 --- a/cli/types/index.d.ts +++ b/cli/types/index.d.ts @@ -3768,7 +3768,7 @@ declare namespace Cypress { * Fires when cy finishes running and executing your command. Useful for debugging and understanding how commands are handled. * @see https://on.cypress.io/catalog-of-events#App-Events */ - (action: 'command:end', fn: (command: CommandQueue) => void): void + (action: 'internal:commandEnd', fn: (command: CommandQueue) => void): void /** * Fires whenever a command begins its retrying routines. This is called on the trailing edge after Cypress has internally waited for the retry interval. Useful to understand **why** a command is retrying, and generally includes the actual error causing the retry to happen. When commands fail the final error is the one that actually bubbles up to fail the test. This event is essentially to debug why Cypress is failing. * @see https://on.cypress.io/catalog-of-events#App-Events diff --git a/cli/types/tests/actions.ts b/cli/types/tests/actions.ts index 5fd9d3181b50..1bd6a04ca6f8 100644 --- a/cli/types/tests/actions.ts +++ b/cli/types/tests/actions.ts @@ -52,7 +52,7 @@ Cypress.on('command:start', (command) => { command // $ExpectType CommandQueue }) -Cypress.on('command:end', (command) => { +Cypress.on('internal:commandEnd', (command) => { command // $ExpectType CommandQueue }) diff --git a/packages/driver/src/cypress.coffee b/packages/driver/src/cypress.coffee index f804629ca960..99f1d46558dc 100644 --- a/packages/driver/src/cypress.coffee +++ b/packages/driver/src/cypress.coffee @@ -364,9 +364,9 @@ class $Cypress @emitToBackend("command:start", serializeCommand(args[0])) @emit("command:start", args...) - when "cy:command:end" - @emitToBackend("command:end", serializeCommand(args[0])) - @emit("command:end", args...) + when "cy:internal:commandEnd" + @emitToBackend("internal:commandEnd", serializeCommand(args[0])) + @emit("internal:commandEnd", args...) when "cy:command:retry" @emitToBackend("command:retry", serializeRetry(args[0])) diff --git a/packages/driver/src/cypress/cy.coffee b/packages/driver/src/cypress/cy.coffee index 76577b81a654..306a0af243ec 100644 --- a/packages/driver/src/cypress/cy.coffee +++ b/packages/driver/src/cypress/cy.coffee @@ -390,7 +390,7 @@ create = (specWindow, Cypress, Cookies, state, config, log) -> ## over at 0 state("index", index += 1) - Cypress.action("cy:command:end", command) + Cypress.action("cy:internal:commandEnd", command) if fn = state("onPaused") new Promise (resolve) -> diff --git a/packages/driver/src/cypress/events.coffee b/packages/driver/src/cypress/events.coffee index f491844121c2..aa022283b6b2 100644 --- a/packages/driver/src/cypress/events.coffee +++ b/packages/driver/src/cypress/events.coffee @@ -112,6 +112,7 @@ module.exports = { throwOnRenamedEvent: (eventEmitter, name) -> renamedEvents = { + "command:end": "internal:commandEnd" "command:queue:before:end": "before:command:queue:end" "fail": "test:fail" "runnable:after:run:async": "after:runnable:run:async" diff --git a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee index 73fb8b33c07e..8cf48f2838f5 100644 --- a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee @@ -2283,7 +2283,7 @@ describe "src/cy/commands/actions/type", -> events.push "#{log.get('name')}:log:#{state}" - cy.on "command:end", (cmd) -> + cy.on "internal:commandEnd", (cmd) -> events.push "#{cmd.get('name')}:end" cy.get("#single-input input").type("f{enter}").then -> diff --git a/packages/driver/test/cypress/integration/commands/querying_spec.coffee b/packages/driver/test/cypress/integration/commands/querying_spec.coffee index 47b0ea7f668d..9e62d10f890e 100644 --- a/packages/driver/test/cypress/integration/commands/querying_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/querying_spec.coffee @@ -345,7 +345,7 @@ describe "src/cy/commands/querying", -> cy.get("body").within(value) it "throws when subject is not in the document", (done) -> - cy.on "command:end", => + cy.on "internal:commandEnd", => cy.$$("#list").remove() cy.on "test:fail", (err) -> diff --git a/packages/driver/test/cypress/integration/commands/traversals_spec.coffee b/packages/driver/test/cypress/integration/commands/traversals_spec.coffee index 5fe505d89450..bd85b2b4d755 100644 --- a/packages/driver/test/cypress/integration/commands/traversals_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/traversals_spec.coffee @@ -76,7 +76,7 @@ describe "src/cy/commands/traversals", -> cy.noop({})[name](arg) it "throws when subject is not in the document", (done) -> - cy.on "command:end", => + cy.on "internal:commandEnd", => cy.$$("#list").remove() cy.on "test:fail", (err) -> diff --git a/packages/driver/test/cypress/integration/e2e/events_spec.coffee b/packages/driver/test/cypress/integration/e2e/events_spec.coffee index d013587f4c75..18b07fb2e25c 100644 --- a/packages/driver/test/cypress/integration/e2e/events_spec.coffee +++ b/packages/driver/test/cypress/integration/e2e/events_spec.coffee @@ -3,6 +3,7 @@ _ = Cypress._ describe "events", -> describe "renamed events", -> renamedEvents = { + "command:end": "internal:commandEnd" "command:queue:before:end": "before:command:queue:end" "fail": "test:fail" "runnable:after:run:async": "after:runnable:run:async" diff --git a/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js b/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js index 88cd82c50422..9013fd643023 100644 --- a/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js +++ b/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js @@ -24,8 +24,8 @@ module.exports = (on) => { console.log('command:retry:', retry.name, retry.error.message) }) - on('command:end', (command) => { - console.log('command:end:', command.name, command.args.join(', ')) + on('internal:commandEnd', (command) => { + console.log('internal:commandEnd:', command.name, command.args.join(', ')) }) on('test:run:end', (test) => { From 852afeb19a19bab5b281d9403486322e54b59a3c Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Wed, 5 Dec 2018 10:35:33 -0500 Subject: [PATCH 02/14] =?UTF-8?q?reanme=20=E2=80=98command:enqueued?= =?UTF-8?q?=E2=80=99=20to=20=E2=80=98internal:commandEnqueue=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/types/index.d.ts | 2 +- cli/types/tests/actions.ts | 2 +- packages/driver/src/cy/commands/connectors.coffee | 4 ++-- packages/driver/src/cypress.coffee | 6 +++--- packages/driver/src/cypress/cy.coffee | 6 +++--- packages/driver/src/cypress/events.coffee | 1 + .../cypress/integration/commands/connectors_spec.coffee | 6 +++--- .../driver/test/cypress/integration/e2e/events_spec.coffee | 1 + .../background-driver-events/cypress/background/index.js | 4 ++-- 9 files changed, 17 insertions(+), 15 deletions(-) diff --git a/cli/types/index.d.ts b/cli/types/index.d.ts index 9d2ad68cbdcf..78812ee40b24 100644 --- a/cli/types/index.d.ts +++ b/cli/types/index.d.ts @@ -3758,7 +3758,7 @@ declare namespace Cypress { * Fires when a cy command is first invoked and enqueued to be run later. Useful for debugging purposes if you're confused about the order in which commands will execute. * @see https://on.cypress.io/catalog-of-events#App-Events */ - (action: 'command:enqueued', fn: (command: EnqueuedCommand) => void): void + (action: 'internal:commandEnqueue', fn: (command: EnqueuedCommand) => void): void /** * Fires when cy begins actually running and executing your command. Useful for debugging and understanding how the command queue is async. * @see https://on.cypress.io/catalog-of-events#App-Events diff --git a/cli/types/tests/actions.ts b/cli/types/tests/actions.ts index 1bd6a04ca6f8..606dd6b4fcbb 100644 --- a/cli/types/tests/actions.ts +++ b/cli/types/tests/actions.ts @@ -44,7 +44,7 @@ Cypress.on('internal:scrolled', ($el) => { $el // $ExpectType JQuery }) -Cypress.on('command:enqueued', (command) => { +Cypress.on('internal:commandEnqueue', (command) => { command // $ExpectType EnqueuedCommand }) diff --git a/packages/driver/src/cy/commands/connectors.coffee b/packages/driver/src/cy/commands/connectors.coffee index b5d6894549d1..711666d29489 100644 --- a/packages/driver/src/cy/commands/connectors.coffee +++ b/packages/driver/src/cy/commands/connectors.coffee @@ -48,7 +48,7 @@ module.exports = (Commands, Cypress, cy, state, config) -> cleanup = -> state("onInjectCommand", undefined) - cy.removeListener("command:enqueued", enqueuedCommand) + cy.removeListener("internal:commandEnqueue", enqueuedCommand) return null invokedCyCommand = false @@ -58,7 +58,7 @@ module.exports = (Commands, Cypress, cy, state, config) -> state("onInjectCommand", returnFalseIfThenable) - cy.once("command:enqueued", enqueuedCommand) + cy.once("internal:commandEnqueue", enqueuedCommand) ## this code helps juggle subjects forward ## the same way that promises work diff --git a/packages/driver/src/cypress.coffee b/packages/driver/src/cypress.coffee index 99f1d46558dc..e4e5375d803a 100644 --- a/packages/driver/src/cypress.coffee +++ b/packages/driver/src/cypress.coffee @@ -372,9 +372,9 @@ class $Cypress @emitToBackend("command:retry", serializeRetry(args[0])) @emit("command:retry", args...) - when "cy:command:enqueued" - @emitToBackend("command:enqueued", serializeCommand(args[0])) - @emit("command:enqueued", args[0]) + when "cy:internal:commandEnqueue" + @emitToBackend("internal:commandEnqueue", serializeCommand(args[0])) + @emit("internal:commandEnqueue", args[0]) when "cy:before:command:queue:end" @emit("before:command:queue:end") diff --git a/packages/driver/src/cypress/cy.coffee b/packages/driver/src/cypress/cy.coffee index 306a0af243ec..6af3cc756bcf 100644 --- a/packages/driver/src/cypress/cy.coffee +++ b/packages/driver/src/cypress/cy.coffee @@ -189,7 +189,7 @@ create = (specWindow, Cypress, Cookies, state, config, log) -> queue.splice(index, 0, obj) - Cypress.action("cy:command:enqueued", obj) + Cypress.action("cy:internal:commandEnqueue", obj) getCommandsUntilFirstParentOrValidSubject = (command, memo = []) -> return null if not command @@ -239,7 +239,7 @@ create = (specWindow, Cypress, Cookies, state, config, log) -> ## since they return promises and queue more ## new commands if noArgsAreAFunction(args) - Cypress.once("command:enqueued", commandEnqueued) + Cypress.once("internal:commandEnqueue", commandEnqueued) ## run the command's fn with runnable's context try @@ -248,7 +248,7 @@ create = (specWindow, Cypress, Cookies, state, config, log) -> throw err finally ## always remove this listener - Cypress.removeListener("command:enqueued", commandEnqueued) + Cypress.removeListener("internal:commandEnqueue", commandEnqueued) state("commandIntermediateValue", ret) diff --git a/packages/driver/src/cypress/events.coffee b/packages/driver/src/cypress/events.coffee index aa022283b6b2..c8cfb8e2f50f 100644 --- a/packages/driver/src/cypress/events.coffee +++ b/packages/driver/src/cypress/events.coffee @@ -113,6 +113,7 @@ module.exports = { throwOnRenamedEvent: (eventEmitter, name) -> renamedEvents = { "command:end": "internal:commandEnd" + "command:enqueued": "internal:commandEnqueued" "command:queue:before:end": "before:command:queue:end" "fail": "test:fail" "runnable:after:run:async": "after:runnable:run:async" diff --git a/packages/driver/test/cypress/integration/commands/connectors_spec.coffee b/packages/driver/test/cypress/integration/commands/connectors_spec.coffee index 953f7829bde2..29c8b1937826 100644 --- a/packages/driver/test/cypress/integration/commands/connectors_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/connectors_spec.coffee @@ -204,18 +204,18 @@ describe "src/cy/commands/connectors", -> return "foo" - it "unbinds command:enqueued in the case of an error thrown", (done) -> + it "unbinds internal:commandEnqueue in the case of an error thrown", (done) -> listeners = [] cy.on "test:fail", (err) => - listeners.push(cy.listeners("command:enqueued").length) + listeners.push(cy.listeners("internal:commandEnqueue").length) expect(@logs.length).to.eq(1) expect(listeners).to.deep.eq([1, 0]) done() cy.then -> - listeners.push(cy.listeners("command:enqueued").length) + listeners.push(cy.listeners("internal:commandEnqueue").length) throw new Error("foo") diff --git a/packages/driver/test/cypress/integration/e2e/events_spec.coffee b/packages/driver/test/cypress/integration/e2e/events_spec.coffee index 18b07fb2e25c..c404f4b6d0b7 100644 --- a/packages/driver/test/cypress/integration/e2e/events_spec.coffee +++ b/packages/driver/test/cypress/integration/e2e/events_spec.coffee @@ -4,6 +4,7 @@ describe "events", -> describe "renamed events", -> renamedEvents = { "command:end": "internal:commandEnd" + "command:enqueued": "internal:commandEnqueued" "command:queue:before:end": "before:command:queue:end" "fail": "test:fail" "runnable:after:run:async": "after:runnable:run:async" diff --git a/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js b/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js index 9013fd643023..b0a99e7fb93e 100644 --- a/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js +++ b/packages/server/test/support/fixtures/projects/background-driver-events/cypress/background/index.js @@ -6,8 +6,8 @@ module.exports = (on) => { throw new Error('Error thrown synchronously from "test:run:start". Should be ignored.') }) - on('command:enqueued', (command) => { - console.log('command:enqueued:', command.name, command.args.join(', ')) + on('internal:commandEnqueue', (command) => { + console.log('internal:commandEnqueue:', command.name, command.args.join(', ')) }) on('command:start', (command) => { From 9ec1df1539d65663a3e571b84f4d6cf38e89124d Mon Sep 17 00:00:00 2001 From: Chris Breiding Date: Wed, 5 Dec 2018 10:37:00 -0500 Subject: [PATCH 03/14] =?UTF-8?q?rename=20=E2=80=98command:retry=E2=80=99?= =?UTF-8?q?=20to=20=E2=80=98internal:commandRetry=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/types/index.d.ts | 2 +- cli/types/tests/actions.ts | 2 +- packages/driver/src/cy/retries.coffee | 2 +- packages/driver/src/cypress.coffee | 6 +-- packages/driver/src/cypress/events.coffee | 1 + .../commands/actions/check_spec.coffee | 8 ++-- .../commands/actions/click_spec.coffee | 10 ++-- .../commands/actions/scroll_spec.coffee | 8 ++-- .../commands/actions/select_spec.coffee | 8 ++-- .../commands/actions/trigger_spec.coffee | 12 ++--- .../commands/actions/type_spec.coffee | 12 ++--- .../integration/commands/agents_spec.coffee | 2 +- .../integration/commands/aliasing_spec.coffee | 2 +- .../integration/commands/angular_spec.coffee | 12 ++--- .../commands/assertions_spec.coffee | 22 ++++----- .../commands/connectors_spec.coffee | 4 +- .../integration/commands/files_spec.coffee | 4 +- .../integration/commands/location_spec.coffee | 6 +-- .../integration/commands/misc_spec.coffee | 2 +- .../commands/navigation_spec.coffee | 6 +-- .../integration/commands/querying_spec.coffee | 46 +++++++++---------- .../commands/traversals_spec.coffee | 12 ++--- .../integration/commands/waiting_spec.coffee | 46 +++++++++---------- .../integration/commands/window_spec.coffee | 10 ++-- .../integration/commands/xhr_spec.coffee | 2 +- .../integration/e2e/events_spec.coffee | 1 + .../cypress/background/index.js | 4 +- 27 files changed, 127 insertions(+), 125 deletions(-) diff --git a/cli/types/index.d.ts b/cli/types/index.d.ts index 78812ee40b24..9efd692c901d 100644 --- a/cli/types/index.d.ts +++ b/cli/types/index.d.ts @@ -3773,7 +3773,7 @@ declare namespace Cypress { * Fires whenever a command begins its retrying routines. This is called on the trailing edge after Cypress has internally waited for the retry interval. Useful to understand **why** a command is retrying, and generally includes the actual error causing the retry to happen. When commands fail the final error is the one that actually bubbles up to fail the test. This event is essentially to debug why Cypress is failing. * @see https://on.cypress.io/catalog-of-events#App-Events */ - (action: 'command:retry', fn: (command: CommandQueue) => void): void + (action: 'internal:commandRetry', fn: (command: CommandQueue) => void): void /** * Fires whenever a command emits this event so it can be displayed in the Command Log. Useful to see how internal cypress commands utilize the {% url 'Cypress.log()' cypress-log %} API. * @see https://on.cypress.io/catalog-of-events#App-Events diff --git a/cli/types/tests/actions.ts b/cli/types/tests/actions.ts index 606dd6b4fcbb..e4cca6ebe1e3 100644 --- a/cli/types/tests/actions.ts +++ b/cli/types/tests/actions.ts @@ -56,7 +56,7 @@ Cypress.on('internal:commandEnd', (command) => { command // $ExpectType CommandQueue }) -Cypress.on('command:retry', (command) => { +Cypress.on('internal:commandRetry', (command) => { command // $ExpectType CommandQueue }) diff --git a/packages/driver/src/cy/retries.coffee b/packages/driver/src/cy/retries.coffee index f7740911947f..41830edce260 100644 --- a/packages/driver/src/cy/retries.coffee +++ b/packages/driver/src/cy/retries.coffee @@ -87,7 +87,7 @@ create = (Cypress, state, timeout, clearTimeout, whenStable, finishAssertions) - .then -> return if ended() - Cypress.action("cy:command:retry", options) + Cypress.action("cy:internal:commandRetry", options) return if ended() diff --git a/packages/driver/src/cypress.coffee b/packages/driver/src/cypress.coffee index e4e5375d803a..b324f8c3c1c6 100644 --- a/packages/driver/src/cypress.coffee +++ b/packages/driver/src/cypress.coffee @@ -368,9 +368,9 @@ class $Cypress @emitToBackend("internal:commandEnd", serializeCommand(args[0])) @emit("internal:commandEnd", args...) - when "cy:command:retry" - @emitToBackend("command:retry", serializeRetry(args[0])) - @emit("command:retry", args...) + when "cy:internal:commandRetry" + @emitToBackend("internal:commandRetry", serializeRetry(args[0])) + @emit("internal:commandRetry", args...) when "cy:internal:commandEnqueue" @emitToBackend("internal:commandEnqueue", serializeCommand(args[0])) diff --git a/packages/driver/src/cypress/events.coffee b/packages/driver/src/cypress/events.coffee index c8cfb8e2f50f..bcc7838b7897 100644 --- a/packages/driver/src/cypress/events.coffee +++ b/packages/driver/src/cypress/events.coffee @@ -115,6 +115,7 @@ module.exports = { "command:end": "internal:commandEnd" "command:enqueued": "internal:commandEnqueued" "command:queue:before:end": "before:command:queue:end" + "command:retry": "internal:commandRetry" "fail": "test:fail" "runnable:after:run:async": "after:runnable:run:async" "scrolled": "internal:scrolled" diff --git a/packages/driver/test/cypress/integration/commands/actions/check_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/check_spec.coffee index 8ac39427a3c2..453cd1c06244 100644 --- a/packages/driver/test/cypress/integration/commands/actions/check_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/check_spec.coffee @@ -126,7 +126,7 @@ describe "src/cy/commands/actions/check", -> }) .prependTo($("body")) - cy.on "command:retry", _.once (options) -> + cy.on "internal:commandRetry", _.once (options) -> expect(options.timeout).to.eq 1000 expect(options.interval).to.eq 60 done() @@ -142,7 +142,7 @@ describe "src/cy/commands/actions/check", -> chk.on "click", -> clicks += 1 - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> chk.prop("disabled", false) retried = true @@ -577,7 +577,7 @@ describe "src/cy/commands/actions/check", -> checkbox = $("").attr("id", "checkbox-covered-in-span").prop("checked", true).prependTo($("body")) span = $("span on checkbox").css(position: "absolute", left: checkbox.offset().left, top: checkbox.offset().top, padding: 5, display: "inline-block", backgroundColor: "yellow").prependTo($("body")) - cy.on "command:retry", (options) -> + cy.on "internal:commandRetry", (options) -> expect(options.timeout).to.eq 1000 expect(options.interval).to.eq 60 done() @@ -593,7 +593,7 @@ describe "src/cy/commands/actions/check", -> chk.on "click", -> clicks += 1 - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> chk.prop("disabled", false) retried = true diff --git a/packages/driver/test/cypress/integration/commands/actions/click_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/click_spec.coffee index 7ffcac0cda63..305f05e8f40e 100644 --- a/packages/driver/test/cypress/integration/commands/actions/click_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/click_spec.coffee @@ -547,7 +547,7 @@ describe "src/cy/commands/actions/click", -> cy.on "internal:scrolled", ($el, type) -> scrolled.push(type) - cy.on "command:retry", ($el, type) -> + cy.on "internal:commandRetry", ($el, type) -> retried = true $btn.on "click", -> @@ -578,7 +578,7 @@ describe "src/cy/commands/actions/click", -> cy.on "internal:scrolled", ($el, type) -> scrolled.push(type) - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $span.hide() retried = true @@ -711,7 +711,7 @@ describe "src/cy/commands/actions/click", -> retried = false - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $btn.show() retried = true @@ -727,7 +727,7 @@ describe "src/cy/commands/actions/click", -> $btn.on "click", -> clicks += 1 - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $btn.prop("disabled", false) retried = true @@ -738,7 +738,7 @@ describe "src/cy/commands/actions/click", -> it "waits until element stops animating", -> retries = 0 - cy.on "command:retry", (obj) -> + cy.on "internal:commandRetry", (obj) -> retries += 1 cy.stub(cy, "ensureElementIsNotAnimating") diff --git a/packages/driver/test/cypress/integration/commands/actions/scroll_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/scroll_spec.coffee index e5f5d3e2b9b9..f09bd9ca1f8e 100644 --- a/packages/driver/test/cypress/integration/commands/actions/scroll_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/scroll_spec.coffee @@ -268,7 +268,7 @@ describe "src/cy/commands/actions/scroll", -> retried = false - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> $container.css("overflow", "scroll") retried = true @@ -286,7 +286,7 @@ describe "src/cy/commands/actions/scroll", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> cy.$$("#scroll-into-view-horizontal").addClass("scrolled") cy @@ -303,7 +303,7 @@ describe "src/cy/commands/actions/scroll", -> cy.stub(cy, "ensureScrollability") .onFirstCall().throws(new Error) - cy.on "command:retry", -> + cy.on "internal:commandRetry", -> cy.ensureScrollability.returns() cy @@ -597,7 +597,7 @@ describe "src/cy/commands/actions/scroll", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> cy.$$("#scroll-into-view-win-vertical div").addClass("scrolled") cy diff --git a/packages/driver/test/cypress/integration/commands/actions/select_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/select_spec.coffee index ec41f2c91d0c..9cae54ac9b27 100644 --- a/packages/driver/test/cypress/integration/commands/actions/select_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/select_spec.coffee @@ -99,7 +99,7 @@ describe "src/cy/commands/actions/select", -> select = $(" is no longer disabled", -> select = cy.$$("select[name=disabled]") - cy.on "command:retry", _.once => + cy.on "internal:commandRetry", _.once => select.prop("disabled", false) cy.get("select[name=disabled]").select("foo") @@ -132,7 +132,7 @@ describe "src/cy/commands/actions/select", -> it "retries until are no longer disabled", -> select = cy.$$("select[name=opt-disabled]") - cy.on "command:retry", _.once => + cy.on "internal:commandRetry", _.once => select.find("option").prop("disabled", false) cy.get("select[name=opt-disabled]").select("bar") diff --git a/packages/driver/test/cypress/integration/commands/actions/trigger_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/trigger_spec.coffee index e6182aa9ff9b..f71894b64534 100644 --- a/packages/driver/test/cypress/integration/commands/actions/trigger_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/trigger_spec.coffee @@ -190,7 +190,7 @@ describe "src/cy/commands/actions/trigger", -> cy.on "internal:scrolled", ($el, type) -> scrolled.push(type) - cy.on "command:retry", ($el, type) -> + cy.on "internal:commandRetry", ($el, type) -> retried = true $btn.on "tap", -> @@ -221,7 +221,7 @@ describe "src/cy/commands/actions/trigger", -> cy.on "internal:scrolled", ($el, type) -> scrolled.push(type) - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $span.hide() retried = true @@ -374,7 +374,7 @@ describe "src/cy/commands/actions/trigger", -> retried = false - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $btn.show() retried = true @@ -390,7 +390,7 @@ describe "src/cy/commands/actions/trigger", -> $btn.on "mouseover", -> mouseovers += 1 - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $btn.prop("disabled", false) retried = true @@ -401,7 +401,7 @@ describe "src/cy/commands/actions/trigger", -> it "waits until element stops animating", -> retries = 0 - cy.on "command:retry", (obj) -> + cy.on "internal:commandRetry", (obj) -> retries += 1 cy.stub(cy, "ensureElementIsNotAnimating") @@ -469,7 +469,7 @@ describe "src/cy/commands/actions/trigger", -> it "eventually passes the assertion", -> $btn = cy.$$("button:first") - cy.on "command:retry", _.once -> + cy.on "internal:commandRetry", _.once -> $btn.addClass("moused-over") cy.get("button:first").trigger("mouseover").should("have.class", "moused-over").then -> diff --git a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee index 8cf48f2838f5..6873ec871ce6 100644 --- a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee @@ -157,7 +157,7 @@ describe "src/cy/commands/actions/type", -> retried = false - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $txt.show() retried = true @@ -173,7 +173,7 @@ describe "src/cy/commands/actions/type", -> $txt.on "click", -> clicks += 1 - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> $txt.prop("disabled", false) retried = true @@ -184,7 +184,7 @@ describe "src/cy/commands/actions/type", -> it "waits until element stops animating", -> retries = 0 - cy.on "command:retry", (obj) -> + cy.on "internal:commandRetry", (obj) -> retries += 1 cy.stub(cy, "ensureElementIsNotAnimating") @@ -1839,7 +1839,7 @@ describe "src/cy/commands/actions/type", -> } .prependTo cy.$$("body") - cy.on "command:retry", (options) -> + cy.on "internal:commandRetry", (options) -> expect(options.timeout).to.eq 1000 expect(options.interval).to.eq 60 done() @@ -2994,7 +2994,7 @@ describe "src/cy/commands/actions/type", -> textarea.on "click", -> clicks += 1 - cy.on "command:retry", _.after 3, -> + cy.on "internal:commandRetry", _.after 3, -> textarea.prop("disabled", false) retried = true @@ -3030,7 +3030,7 @@ describe "src/cy/commands/actions/type", -> input = $("").attr("id", "input-covered-in-span").prependTo(cy.$$("body")) span = $("span on input").css(position: "absolute", left: input.offset().left, top: input.offset().top, padding: 5, display: "inline-block", backgroundColor: "yellow").prependTo(cy.$$("body")) - cy.on "command:retry", (options) -> + cy.on "internal:commandRetry", (options) -> expect(options.timeout).to.eq 1000 expect(options.interval).to.eq 60 done() diff --git a/packages/driver/test/cypress/integration/commands/agents_spec.coffee b/packages/driver/test/cypress/integration/commands/agents_spec.coffee index 819d893bbdc1..9a426edb0321 100644 --- a/packages/driver/test/cypress/integration/commands/agents_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/agents_spec.coffee @@ -238,7 +238,7 @@ describe "src/cy/commands/agents", -> expect(@myStub).to.eq(@stub) it "retries until assertions pass", -> - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => @myStub("foo") cy.get("@myStub").should("be.calledWith", "foo") diff --git a/packages/driver/test/cypress/integration/commands/aliasing_spec.coffee b/packages/driver/test/cypress/integration/commands/aliasing_spec.coffee index 9a1912aba8e7..239c850eb077 100644 --- a/packages/driver/test/cypress/integration/commands/aliasing_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/aliasing_spec.coffee @@ -44,7 +44,7 @@ describe "src/cy/commands/aliasing", -> it "retries primitives and assertions", -> obj = {} - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> obj.foo = "bar" cy.wrap(obj).as("obj") diff --git a/packages/driver/test/cypress/integration/commands/angular_spec.coffee b/packages/driver/test/cypress/integration/commands/angular_spec.coffee index c46ca2ec317e..76b20f57c7b7 100644 --- a/packages/driver/test/cypress/integration/commands/angular_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/angular_spec.coffee @@ -46,7 +46,7 @@ describe "src/cy/commands/angular", -> retry = _.after 2, => Cypress.stop() - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.on "test:fail", (err) -> done(err) @@ -85,7 +85,7 @@ describe "src/cy/commands/angular", -> ## wait until we're ALMOST about to time out before ## appending the missingInput - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => cy.$$("body").append(missingLi) cy.ng("repeater", "li in lis").then ($li) -> @@ -113,7 +113,7 @@ describe "src/cy/commands/angular", -> retry = _.after 2, => Cypress.stop() - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.on "test:fail", (err) -> done(err) @@ -181,7 +181,7 @@ describe "src/cy/commands/angular", -> ## wait until we're ALMOST about to time out before ## appending the missingInput - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> cy.$$("body").append(missingInput) cy.ng("model", "missing-input").then ($input) -> @@ -192,7 +192,7 @@ describe "src/cy/commands/angular", -> missingInput = $("", "data-ng-model": "missing-input") - cy.on "command:retry", _.after 6, _.once => + cy.on "internal:commandRetry", _.after 6, _.once => cy.$$("body").append(missingInput) ## we want to make sure that the ng promises do not continue @@ -226,7 +226,7 @@ describe "src/cy/commands/angular", -> retry = _.after 2, => Cypress.stop() - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.on "test:fail", (err) -> done(err) diff --git a/packages/driver/test/cypress/integration/commands/assertions_spec.coffee b/packages/driver/test/cypress/integration/commands/assertions_spec.coffee index 277af58e6d53..7e7c8c04afcc 100644 --- a/packages/driver/test/cypress/integration/commands/assertions_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/assertions_spec.coffee @@ -49,19 +49,19 @@ describe "src/cy/commands/assertions", -> .should("have.property", "length", 1) it "skips over utility commands", -> - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => cy.$$("div:first").addClass("foo") - cy.on "command:retry", _.after 4, => + cy.on "internal:commandRetry", _.after 4, => cy.$$("div:first").attr("id", "bar") cy.get("div:first").should("have.class", "foo").debug().and("have.id", "bar") it "skips over aliasing", -> - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => cy.$$("div:first").addClass("foo") - cy.on "command:retry", _.after 4, => + cy.on "internal:commandRetry", _.after 4, => cy.$$("div:first").attr("id", "bar") cy.get("div:first").as("div").should("have.class", "foo").debug().and("have.id", "bar") @@ -107,7 +107,7 @@ describe "src/cy/commands/assertions", -> it "waits until function is true", -> button = cy.$$("button:first") - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => button.addClass("ready") cy.get("button:first").should ($button) -> @@ -116,7 +116,7 @@ describe "src/cy/commands/assertions", -> it "works with regular objects", -> obj = {} - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => obj.foo = "bar" cy.wrap(obj).should (o) -> @@ -188,7 +188,7 @@ describe "src/cy/commands/assertions", -> it "resolves eventually not exist", -> button = cy.$$("button:first") - cy.on "command:retry", _.after 2, _.once -> + cy.on "internal:commandRetry", _.after 2, _.once -> button.remove() cy.get("button:first").click().should("not.exist") @@ -266,7 +266,7 @@ describe "src/cy/commands/assertions", -> describe "have.class", -> it "snapshots and ends the assertion after retrying", -> - cy.on "command:retry", _.after 3, => + cy.on "internal:commandRetry", _.after 3, => cy.$$("#foo").addClass("active") cy.contains("foo").should("have.class", "active").then -> @@ -284,7 +284,7 @@ describe "src/cy/commands/assertions", -> retry = _.after 3, -> button.addClass("new-class") - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.get("button:first").should("have.class", "new-class") @@ -357,7 +357,7 @@ describe "src/cy/commands/assertions", -> button = cy.$$("button:first") - cy.on "command:retry", _.after 2, _.once -> + cy.on "internal:commandRetry", _.after 2, _.once -> button.addClass("foo").remove() cy.on "test:fail", (err) => @@ -837,7 +837,7 @@ describe "src/cy/commands/assertions", -> length = buttons.length - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => cy.$$("button:last").remove() cy.wrap(buttons).should("have.length", length - 1) diff --git a/packages/driver/test/cypress/integration/commands/connectors_spec.coffee b/packages/driver/test/cypress/integration/commands/connectors_spec.coffee index 29c8b1937826..efb9cc06b68d 100644 --- a/packages/driver/test/cypress/integration/commands/connectors_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/connectors_spec.coffee @@ -260,7 +260,7 @@ describe "src/cy/commands/connectors", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => @remoteWindow.$.fn.foo = -> "foo" cy.get("div:first").invoke("foo").should("eq", "foo").then -> @@ -271,7 +271,7 @@ describe "src/cy/commands/connectors", -> expect(lastLog.get("ended")).to.be.true it "eventually fails the assertion", (done) -> - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => @remoteWindow.$.fn.foo = -> "foo" cy.on "test:fail", (err) => diff --git a/packages/driver/test/cypress/integration/commands/files_spec.coffee b/packages/driver/test/cypress/integration/commands/files_spec.coffee index 9914df6320cd..b63dd5967491 100644 --- a/packages/driver/test/cypress/integration/commands/files_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/files_spec.coffee @@ -43,7 +43,7 @@ describe "src/cy/commands/files", -> retries = 0 - cy.on "command:retry", -> + cy.on "internal:commandRetry", -> retries += 1 Cypress.backend.withArgs("read:file") @@ -58,7 +58,7 @@ describe "src/cy/commands/files", -> it "retries assertions until they pass", -> retries = 0 - cy.on "command:retry", -> + cy.on "internal:commandRetry", -> retries += 1 Cypress.backend.withArgs("read:file") diff --git a/packages/driver/test/cypress/integration/commands/location_spec.coffee b/packages/driver/test/cypress/integration/commands/location_spec.coffee index 205a7878e0a1..a4e547a93b9c 100644 --- a/packages/driver/test/cypress/integration/commands/location_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/location_spec.coffee @@ -34,7 +34,7 @@ describe "src/cy/commands/location", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, _.once => + cy.on "internal:commandRetry", _.after 2, _.once => win = cy.state("window") win.location.href = "/foo/bar/baz.html" @@ -149,7 +149,7 @@ describe "src/cy/commands/location", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, => + cy.on "internal:commandRetry", _.after 2, => win = cy.state("window") win.location.hash = "users/1" @@ -268,7 +268,7 @@ describe "src/cy/commands/location", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, _.once => + cy.on "internal:commandRetry", _.after 2, _.once => win = cy.state("window") win.location.pathname = "users/1" diff --git a/packages/driver/test/cypress/integration/commands/misc_spec.coffee b/packages/driver/test/cypress/integration/commands/misc_spec.coffee index 179ff20fbf29..1eec5de8eedf 100644 --- a/packages/driver/test/cypress/integration/commands/misc_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/misc_spec.coffee @@ -77,7 +77,7 @@ describe "src/cy/commands/misc", -> $("
  • appended
  • ").appendTo cy.$$("#list") , 50 - cy.on "command:retry", _.after(2, _.once(append)) + cy.on "internal:commandRetry", _.after(2, _.once(append)) cy.get("#list").then ($ul) -> diff --git a/packages/driver/test/cypress/integration/commands/navigation_spec.coffee b/packages/driver/test/cypress/integration/commands/navigation_spec.coffee index 7917b023d927..622bb8d55bda 100644 --- a/packages/driver/test/cypress/integration/commands/navigation_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/navigation_spec.coffee @@ -1409,7 +1409,7 @@ describe "src/cy/commands/navigation", -> it "does not time out current commands until stability is reached", -> ## on the first retry cause a page load event synchronously - cy.on "command:retry", (options) -> + cy.on "internal:commandRetry", (options) -> switch options._retries when 1 win = cy.state("window") @@ -1495,7 +1495,7 @@ describe "src/cy/commands/navigation", -> log.get("name") is name cy.on "test:fail", (err) -> - cy.on "command:retry", -> + cy.on "internal:commandRetry", -> throw new Error("should not have retried twice") expect(err.message).to.include("Expected to find element") @@ -1513,7 +1513,7 @@ describe "src/cy/commands/navigation", -> start = null ## on the first retry cause a page load event synchronously - cy.on "command:retry", (options) -> + cy.on "internal:commandRetry", (options) -> switch options._retries when 1 ## hold a ref to this diff --git a/packages/driver/test/cypress/integration/commands/querying_spec.coffee b/packages/driver/test/cypress/integration/commands/querying_spec.coffee index 9e62d10f890e..9522499e566f 100644 --- a/packages/driver/test/cypress/integration/commands/querying_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/querying_spec.coffee @@ -41,7 +41,7 @@ describe "src/cy/commands/querying", -> return null it "eventually passes the assertion", -> - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> cy.$$(":text:first").addClass("focused").focus() cy.focused().should("have.class", "focused").then -> @@ -55,7 +55,7 @@ describe "src/cy/commands/querying", -> it "retries on an elements value", -> $input = cy.$$("input:first") - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> $input.val("1234") $input.get(0).focus() @@ -447,7 +447,7 @@ describe "src/cy/commands/querying", -> ## wait until we're ALMOST about to time out before ## appending the missingEl - cy.on "command:retry", (options) => + cy.on "internal:commandRetry", (options) => if options.total + (options._interval * 4) > options._runnableTimeout cy.$$("body").append(missingEl) @@ -457,7 +457,7 @@ describe "src/cy/commands/querying", -> it "can increase the timeout", -> missingEl = $("
    ", id: "missing-el") - cy.on "command:retry", _.after 2, (options) -> + cy.on "internal:commandRetry", _.after 2, (options) -> ## make sure runnableTimeout is 10secs expect(options._runnableTimeout).to.eq 10000 @@ -469,7 +469,7 @@ describe "src/cy/commands/querying", -> it "does not factor in the total time the test has been running", -> missingEl = $("
    ", id: "missing-el") - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> cy.$$("body").append(missingEl) ## in this example our test has been running 200ms @@ -498,7 +498,7 @@ describe "src/cy/commands/querying", -> done() , 100 - cy.on "command:retry", -> + cy.on "internal:commandRetry", -> retrys += 1 stop() @@ -533,7 +533,7 @@ describe "src/cy/commands/querying", -> Cypress.config("defaultCommandTimeout", 1000) it "waits until button exists", -> - cy.on "command:retry", _.after 3, => + cy.on "internal:commandRetry", _.after 3, => cy.$$("body").append $("
    missing el
    ") cy.get("#missing-el").should("exist") @@ -542,7 +542,7 @@ describe "src/cy/commands/querying", -> it "waits until button does not exist", -> cy.timeout(500, true) - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> cy.$$("#button").remove() cy.get("#button").should("not.exist") @@ -558,7 +558,7 @@ describe "src/cy/commands/querying", -> retry = _.after 3, => cy.$$("#list li:last").remove() - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.get("#list li:last").should("not.exist").then ($el) -> expect($el).to.be.null @@ -589,7 +589,7 @@ describe "src/cy/commands/querying", -> retry = _.after 3, => button = cy.$$("#button").hide() - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.get("#button").should("not.be.visible").then ($button) -> expect($button.get(0)).to.eq button.get(0) @@ -610,7 +610,7 @@ describe "src/cy/commands/querying", -> retry = _.after 3, => button.show() - cy.on "command:retry", retry + cy.on "internal:commandRetry", retry cy.get("#button").should("be.visible").then ($button) -> expect($button.get(0)).to.eq button.get(0) @@ -630,7 +630,7 @@ describe "src/cy/commands/querying", -> length = buttons.length - 2 - cy.on "command:retry", _.after 2, -> + cy.on "internal:commandRetry", _.after 2, -> buttons.last().remove() buttons = cy.$$("button") @@ -647,7 +647,7 @@ describe "src/cy/commands/querying", -> length = buttons.length + 1 ## add another button after 2 retries, once - cy.on "command:retry", _.after 2, _.once => + cy.on "internal:commandRetry", _.after 2, _.once => $("