From f86b461a1bb7c2e24a99e64034a3ad1f4fb35a32 Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 10:46:52 -0400 Subject: [PATCH 01/16] switch to cypress/browsers:node8.15.1-chrome73 docker image --- circle.yml | 2 +- scripts/run-docker-local.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 939df8bf9466..5b9e993bb369 100644 --- a/circle.yml +++ b/circle.yml @@ -23,7 +23,7 @@ executors: # the Docker image with Cypress dependencies and Chrome browser cy-doc: docker: - - image: cypress/browsers:chrome64 + - image: cypress/browsers:node8.15.1-chrome73 environment: PLATFORM: linux diff --git a/scripts/run-docker-local.sh b/scripts/run-docker-local.sh index c84ffcf8983b..68a51568d9fd 100755 --- a/scripts/run-docker-local.sh +++ b/scripts/run-docker-local.sh @@ -2,7 +2,7 @@ set e+x echo "This script should be run from cypress's root" -name=cypress/browsers:chrome64 +name=cypress/browsers:node8.15.1-chrome73 echo "Pulling CI container $name" docker pull $name From 9174bb749d465e7cfb88b11f585ff3cd66a7ac4c Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 11:08:18 -0400 Subject: [PATCH 02/16] re-enable HTTPS proxy perf test --- packages/server/test/performance/proxy_performance.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/server/test/performance/proxy_performance.js b/packages/server/test/performance/proxy_performance.js index 57d7ca76b404..20354742ff04 100644 --- a/packages/server/test/performance/proxy_performance.js +++ b/packages/server/test/performance/proxy_performance.js @@ -21,9 +21,7 @@ const { _getArgs } = require('../../lib/browsers/chrome') const CHROME_PATH = 'google-chrome' const URLS_UNDER_TEST = [ - // TODO: disabling for now because the https tests are - // running too fast - // 'https://test-page-speed.cypress.io/index1000.html', + 'https://test-page-speed.cypress.io/index1000.html', 'http://test-page-speed.cypress.io/index1000.html', ] From aa1d52b8b5b51985a83514343dbb90ec8703cac0 Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 11:12:55 -0400 Subject: [PATCH 03/16] just use chrome73 for perf tests --- circle.yml | 23 +++++++++++++---------- scripts/run-docker-local.sh | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/circle.yml b/circle.yml index 5b9e993bb369..6b7f2ed4a73b 100644 --- a/circle.yml +++ b/circle.yml @@ -23,7 +23,7 @@ executors: # the Docker image with Cypress dependencies and Chrome browser cy-doc: docker: - - image: cypress/browsers:node8.15.1-chrome73 + - image: cypress/browsers:chrome64 environment: PLATFORM: linux @@ -272,15 +272,18 @@ jobs: path: /tmp/cypress "server-performance-tests": - <<: *defaults - steps: - - attach_workspace: - at: ~/ - - run: DEBUG=test:proxy-performance npm run all test-performance -- --package server - - store_test_results: - path: /tmp/cypress - - store_artifacts: - path: /tmp/artifacts + <<: *defaults + docker: + image: # needs an updated Chrome image for certain flags to work + - cypress/browsers:node8.15.1-chrome73 + steps: + - attach_workspace: + at: ~/ + - run: DEBUG=test:proxy-performance npm run all test-performance -- --package server + - store_test_results: + path: /tmp/cypress + - store_artifacts: + path: /tmp/artifacts "server-e2e-tests-1": <<: *defaults diff --git a/scripts/run-docker-local.sh b/scripts/run-docker-local.sh index 68a51568d9fd..c84ffcf8983b 100755 --- a/scripts/run-docker-local.sh +++ b/scripts/run-docker-local.sh @@ -2,7 +2,7 @@ set e+x echo "This script should be run from cypress's root" -name=cypress/browsers:node8.15.1-chrome73 +name=cypress/browsers:chrome64 echo "Pulling CI container $name" docker pull $name From e5ba42f50fc5e13a990f2061349dcd0c531184e6 Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 13:32:51 -0400 Subject: [PATCH 04/16] store hars for both urls --- packages/server/test/performance/proxy_performance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/test/performance/proxy_performance.js b/packages/server/test/performance/proxy_performance.js index 20354742ff04..3fca5088e04b 100644 --- a/packages/server/test/performance/proxy_performance.js +++ b/packages/server/test/performance/proxy_performance.js @@ -258,7 +258,7 @@ const runBrowserTest = (urlUnderTest, testCase) => { const runtime = Number(testCase['Total'].replace('ms', '')) - return storeHar(testCase.name, har) + return storeHar(`${urlUnderTest} - ${testCase.name}`, har) .return(runtime) }) .catch({ code: 'ECONNREFUSED' }, (err) => { From cb89e38d2489a14ba0f3296c69323996e1c6583f Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 13:36:13 -0400 Subject: [PATCH 05/16] Revert "just use chrome73 for perf tests" This reverts commit aa1d52b8b5b51985a83514343dbb90ec8703cac0. --- circle.yml | 23 ++++++++++------------- scripts/run-docker-local.sh | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/circle.yml b/circle.yml index 6b7f2ed4a73b..5b9e993bb369 100644 --- a/circle.yml +++ b/circle.yml @@ -23,7 +23,7 @@ executors: # the Docker image with Cypress dependencies and Chrome browser cy-doc: docker: - - image: cypress/browsers:chrome64 + - image: cypress/browsers:node8.15.1-chrome73 environment: PLATFORM: linux @@ -272,18 +272,15 @@ jobs: path: /tmp/cypress "server-performance-tests": - <<: *defaults - docker: - image: # needs an updated Chrome image for certain flags to work - - cypress/browsers:node8.15.1-chrome73 - steps: - - attach_workspace: - at: ~/ - - run: DEBUG=test:proxy-performance npm run all test-performance -- --package server - - store_test_results: - path: /tmp/cypress - - store_artifacts: - path: /tmp/artifacts + <<: *defaults + steps: + - attach_workspace: + at: ~/ + - run: DEBUG=test:proxy-performance npm run all test-performance -- --package server + - store_test_results: + path: /tmp/cypress + - store_artifacts: + path: /tmp/artifacts "server-e2e-tests-1": <<: *defaults diff --git a/scripts/run-docker-local.sh b/scripts/run-docker-local.sh index c84ffcf8983b..68a51568d9fd 100755 --- a/scripts/run-docker-local.sh +++ b/scripts/run-docker-local.sh @@ -2,7 +2,7 @@ set e+x echo "This script should be run from cypress's root" -name=cypress/browsers:chrome64 +name=cypress/browsers:node8.15.1-chrome73 echo "Pulling CI container $name" docker pull $name From 5f3415045e544e8b05552ee67196278e888115aa Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 13:36:39 -0400 Subject: [PATCH 06/16] fix indentation --- circle.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/circle.yml b/circle.yml index 5b9e993bb369..099531299972 100644 --- a/circle.yml +++ b/circle.yml @@ -272,15 +272,15 @@ jobs: path: /tmp/cypress "server-performance-tests": - <<: *defaults - steps: - - attach_workspace: - at: ~/ - - run: DEBUG=test:proxy-performance npm run all test-performance -- --package server - - store_test_results: - path: /tmp/cypress - - store_artifacts: - path: /tmp/artifacts + <<: *defaults + steps: + - attach_workspace: + at: ~/ + - run: DEBUG=test:proxy-performance npm run all test-performance -- --package server + - store_test_results: + path: /tmp/cypress + - store_artifacts: + path: /tmp/artifacts "server-e2e-tests-1": <<: *defaults From a4e3da0859c88c56b39d101dd3e0ab45051f6ab2 Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Thu, 4 Apr 2019 16:25:30 -0400 Subject: [PATCH 07/16] server: correct failing tests --- packages/server/test/integration/http_requests_spec.coffee | 2 -- packages/server/test/integration/server_spec.coffee | 1 - 2 files changed, 3 deletions(-) diff --git a/packages/server/test/integration/http_requests_spec.coffee b/packages/server/test/integration/http_requests_spec.coffee index c920db6dc1f8..2906005b9114 100644 --- a/packages/server/test/integration/http_requests_spec.coffee +++ b/packages/server/test/integration/http_requests_spec.coffee @@ -1250,7 +1250,6 @@ describe "Routes", -> expect(res.body).to.include("The error was:") expect(res.body).to.include("connect ECONNREFUSED 127.0.0.1:64644") expect(res.body).to.include("The stack trace was:") - expect(res.body).to.include("_exceptionWithHostPort") expect(res.body).to.include("TCPConnectWrap.afterConnect") expect(res.body).to.include("\n ") @@ -1270,7 +1269,6 @@ describe "Routes", -> expect(res.body).to.include("The error was:") expect(res.body).to.include("connect ECONNREFUSED 127.0.0.1:64644") expect(res.body).to.include("The stack trace was:") - expect(res.body).to.include("_exceptionWithHostPort") expect(res.body).to.include("TCPConnectWrap.afterConnect") expect(res.body).not.to.include("\n ") diff --git a/packages/server/test/integration/server_spec.coffee b/packages/server/test/integration/server_spec.coffee index ab8612303773..d5a61fb09eff 100644 --- a/packages/server/test/integration/server_spec.coffee +++ b/packages/server/test/integration/server_spec.coffee @@ -547,7 +547,6 @@ describe "Server", -> @server._onResolveUrl("http://localhost:64646", {}, @automationRequest) .catch (err) -> expect(err.message).to.eq("connect ECONNREFUSED 127.0.0.1:64646") - expect(err.stack).to.include("._errnoException") expect(err.port).to.eq(64646) expect(err.code).to.eq("ECONNREFUSED") From d1781240aaa66a62458465b3172d225d93f7cdbe Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:46:10 -0400 Subject: [PATCH 08/16] try fix big cookie test --- packages/server/test/integration/http_requests_spec.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server/test/integration/http_requests_spec.coffee b/packages/server/test/integration/http_requests_spec.coffee index 2906005b9114..ca021f6bb6de 100644 --- a/packages/server/test/integration/http_requests_spec.coffee +++ b/packages/server/test/integration/http_requests_spec.coffee @@ -3252,7 +3252,8 @@ describe "Routes", -> expect(res.body).to.eq("OK") - it "does not fail on a big cookie", -> + it.only "does not fail on a big cookie", -> + @timeout(30000) nock(@server._remoteOrigin) .post("/login") .reply(200) From 0b5bb62b4e917d562569d71e46c73e9e1d41556e Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:50:56 -0400 Subject: [PATCH 09/16] Revert "try fix big cookie test" This reverts commit d1781240aaa66a62458465b3172d225d93f7cdbe. --- packages/server/test/integration/http_requests_spec.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/server/test/integration/http_requests_spec.coffee b/packages/server/test/integration/http_requests_spec.coffee index ca021f6bb6de..2906005b9114 100644 --- a/packages/server/test/integration/http_requests_spec.coffee +++ b/packages/server/test/integration/http_requests_spec.coffee @@ -3252,8 +3252,7 @@ describe "Routes", -> expect(res.body).to.eq("OK") - it.only "does not fail on a big cookie", -> - @timeout(30000) + it "does not fail on a big cookie", -> nock(@server._remoteOrigin) .post("/login") .reply(200) From fe55454b16c5210f52e750006334b9ac11cfd633 Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Thu, 4 Apr 2019 16:55:43 -0400 Subject: [PATCH 10/16] fix variable newlines in type_spec --- .../commands/actions/type_spec.coffee | 86 +++++++++++++------ 1 file changed, 58 insertions(+), 28 deletions(-) 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 ca101ce878a8..4a1ca67b413c 100644 --- a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee @@ -4,6 +4,12 @@ Keyboard = Cypress.Keyboard Promise = Cypress.Promise $selection = require("../../../../../src/dom/selection") +## trim new lines at the end of innerText +## due to changing browser versions implementing +## this differently +trimInnerText = ($el) -> + _.trimEnd($el.get(0).innerText, "\n") + describe "src/cy/commands/actions/type", -> before -> cy @@ -11,6 +17,31 @@ describe "src/cy/commands/actions/type", -> .then (win) -> @body = win.document.body.outerHTML + el = cy.$$('[contenteditable]:first').get(0) + + innerHtml = el.innerHTML + + ## by default... the last new line by itself + ## will only ever count as a single new line... + ## but new lines above it will count as 2 new lines... + ## so by adding "3" new lines, the last counts as 1 + ## and the first 2 count as 2... + el.innerHTML = '

'.repeat(3) + + ## browsers changed their implementation + ## of the number of newlines that

+ ## create. newer versions of chrome set 2 new lines + ## per set - whereas older ones create only 1 new line. + ## so we grab the current sets for the assertion later + ## so this test is browser version agnostic + newLines = el.innerText + + ## disregard the last new line, and divide by 2... + ## this tells us how many multiples of new lines + ## the browser inserts for new lines other than + ## the last new line + @multiplierNumNewLines = (newLines.length - 1) / 2 + beforeEach -> doc = cy.state("document") @@ -1038,7 +1069,7 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
foo
' cy.get("[contenteditable]:first") .type("bar").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\n") + expect(trimInnerText($div)).to.eql("foobar") expect($div.get(0).textContent).to.eql("foobar") expect($div.get(0).innerHTML).to.eql("
foobar
") @@ -1046,7 +1077,7 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '

foo

' cy.get("[contenteditable]:first") .type("bar").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\n\n") + expect(trimInnerText($div)).to.eql("foobar") expect($div.get(0).textContent).to.eql("foobar") expect($div.get(0).innerHTML).to.eql("

foobar

") @@ -1054,13 +1085,13 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
bar
' cy.get("[contenteditable]:first") .type("{selectall}{leftarrow}foo").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\n") + expect(trimInnerText($div)).to.eql("foobar") it "collapses selection to end on {rightarrow}", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
bar
' cy.get("[contenteditable]:first") .type("{selectall}{leftarrow}foo{selectall}{rightarrow}baz").then ($div) -> - expect($div.get(0).innerText).to.eql("foobarbaz\n") + expect(trimInnerText($div)).to.eql("foobarbaz") it "can remove a placeholder
", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '

' @@ -1540,7 +1571,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{leftarrow}{leftarrow}{uparrow}11{uparrow}22{downarrow}{downarrow}33").then ($div) -> - expect($div.get(0).innerText).to.eql("foo22\nb11ar\nbaz33\n") + expect(trimInnerText($div)).to.eql("foo22\nb11ar\nbaz33") it "uparrow ignores current selection", -> ce = cy.$$('[contenteditable]:first').get(0) @@ -1556,7 +1587,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{uparrow}11").then ($div) -> - expect($div.get(0).innerText).to.eql("11foo\nbar\nbaz\n") + expect(trimInnerText($div)).to.eql("11foo\nbar\nbaz") it "up and down arrow on textarea", -> cy.$$('textarea:first').get(0).value = 'foo\nbar\nbaz' @@ -1570,7 +1601,6 @@ describe "src/cy/commands/actions/type", -> .type('{uparrow}{uparrow}') .should('have.value', '14') - context "{downarrow}", -> beforeEach -> cy.$$("#comments").val("foo\nbar\nbaz") @@ -1626,7 +1656,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{downarrow}22").then ($div) -> - expect($div.get(0).innerText).to.eql("foo\n22bar\nbaz\n") + expect(trimInnerText($div)).to.eql("foo\n22bar\nbaz") context "{selectall}{del}", -> it "can select all the text and delete", -> @@ -1688,18 +1718,19 @@ describe "src/cy/commands/actions/type", -> it "inserts new line into [contenteditable] ", -> cy.get("#input-types [contenteditable]:first").invoke("text", "foo") .type("bar{enter}baz{enter}{enter}{enter}quux").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\nbaz\n\n\nquux\n") + conditionalNewLines = "\n\n".repeat(@multiplierNumNewLines) + + expect(trimInnerText($div)).to.eql("foobar\nbaz#{conditionalNewLines}\nquux") expect($div.get(0).textContent).to.eql("foobarbazquux") expect($div.get(0).innerHTML).to.eql("foobar
baz


quux
") it "inserts new line into [contenteditable] from midline", -> cy.get("#input-types [contenteditable]:first").invoke("text", "foo") .type("bar{leftarrow}{enter}baz{leftarrow}{enter}quux").then ($div) -> - expect($div.get(0).innerText).to.eql("fooba\nba\nquuxzr\n") + expect(trimInnerText($div)).to.eql("fooba\nba\nquuxzr") expect($div.get(0).textContent).to.eql("foobabaquuxzr") expect($div.get(0).innerHTML).to.eql("fooba
ba
quuxzr
") - describe "modifiers", -> describe "activating modifiers", -> @@ -2211,7 +2242,6 @@ describe "src/cy/commands/actions/type", -> .then -> expect(changed).to.eql 0 - describe "caret position", -> it "respects being formatted by input event handlers" @@ -2279,32 +2309,35 @@ describe "src/cy/commands/actions/type", -> el.innerHTML = 'start'+ '
middle
'+ '
end
' + cy.get('[contenteditable]:first') ## move cursor to beginning of div .type('{selectall}{leftarrow}') - .type('{rightarrow}'.repeat(14)+'[_I_]').then -> - expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('start\nmiddle\ne[_I_]nd\n') + .type('{rightarrow}'.repeat(14)+'[_I_]').then ($el) -> + expect(trimInnerText($el)).to.eql('start\nmiddle\ne[_I_]nd') it "can wrap cursor to prev line in [contenteditable] with {leftarrow}", -> $el = cy.$$('[contenteditable]:first') el = $el.get(0) + el.innerHTML = 'start'+ '
middle
'+ '
end
' - cy.get('[contenteditable]:first').type('{leftarrow}'.repeat(12)+'[_I_]').then -> - expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('star[_I_]t\nmiddle\nend\n') + cy.get('[contenteditable]:first').type('{leftarrow}'.repeat(12)+'[_I_]').then ($el) -> + expect(trimInnerText($el)).to.eql('star[_I_]t\nmiddle\nend') it "can wrap cursor to next line in [contenteditable] with {rightarrow} and empty lines", -> $el = cy.$$('[contenteditable]:first') el = $el.get(0) - el.innerHTML = '

'.repeat(4)+ - '
end
' + el.innerHTML = '

'.repeat(4) + '
end
' + + newLines = "\n\n\n".repeat(@multiplierNumNewLines) cy.get('[contenteditable]:first') .type('{selectall}{leftarrow}') - # .type('foobar'+'{rightarrow}'.repeat(6)+'[_I_]').then -> - # expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('foobar\n\n\n\nen[_I_]d\n') + .type('foobar'+'{rightarrow}'.repeat(6)+'[_I_]').then -> + expect(trimInnerText($el)).to.eql("foobar#{newLines}\nen[_I_]d") it "can use {rightarrow} and nested elements", -> $el = cy.$$('[contenteditable]:first') @@ -2314,19 +2347,19 @@ describe "src/cy/commands/actions/type", -> cy.get('[contenteditable]:first') .type('{selectall}{leftarrow}') .type('{rightarrow}'.repeat(3)+'[_I_]').then -> - expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('sta[_I_]rt\n') + expect(trimInnerText($el)).to.eql('sta[_I_]rt') it "enter and \\n should act the same for [contenteditable]", -> - cleanseText = (text) -> - text.replace(/ /g, ' ') + ## non breaking white space + text.split('\u00a0').join(' ') expectMatchInnerText = ($el , innerText) -> - expect(cleanseText($el.get(0).innerText)).to.eql(innerText) + expect(cleanseText(trimInnerText($el))).to.eql(innerText) ## NOTE: this may only pass in Chrome since the whitespace may be different in other browsers ## even if actual and expected appear the same. - expected = "{\n foo: 1\n bar: 2\n baz: 3\n}\n" + expected = "{\n foo: 1\n bar: 2\n baz: 3\n}" cy.get('[contenteditable]:first') .invoke('html', '

') .type('{{}{enter} foo: 1{enter} bar: 2{enter} baz: 3{enter}}') @@ -2337,7 +2370,6 @@ describe "src/cy/commands/actions/type", -> .should ($el) -> expectMatchInnerText($el, expected) - it "enter and \\n should act the same for textarea", -> expected = "{\n foo: 1\n bar: 2\n baz: 3\n}" cy.get('textarea:first') @@ -2348,8 +2380,6 @@ describe "src/cy/commands/actions/type", -> .type('{{}\n foo: 1\n bar: 2\n baz: 3\n}') .should('have.prop', 'value', expected) - - describe "{enter}", -> beforeEach -> @$forms = cy.$$("#form-submits") From 9a00b1c63f2d907b98bbc98ee9d09aeefaa81fbb Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Thu, 4 Apr 2019 17:27:28 -0400 Subject: [PATCH 11/16] Revert "fix variable newlines in type_spec" This reverts commit fe55454b16c5210f52e750006334b9ac11cfd633. --- .../commands/actions/type_spec.coffee | 86 ++++++------------- 1 file changed, 28 insertions(+), 58 deletions(-) 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 4a1ca67b413c..ca101ce878a8 100644 --- a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee @@ -4,12 +4,6 @@ Keyboard = Cypress.Keyboard Promise = Cypress.Promise $selection = require("../../../../../src/dom/selection") -## trim new lines at the end of innerText -## due to changing browser versions implementing -## this differently -trimInnerText = ($el) -> - _.trimEnd($el.get(0).innerText, "\n") - describe "src/cy/commands/actions/type", -> before -> cy @@ -17,31 +11,6 @@ describe "src/cy/commands/actions/type", -> .then (win) -> @body = win.document.body.outerHTML - el = cy.$$('[contenteditable]:first').get(0) - - innerHtml = el.innerHTML - - ## by default... the last new line by itself - ## will only ever count as a single new line... - ## but new lines above it will count as 2 new lines... - ## so by adding "3" new lines, the last counts as 1 - ## and the first 2 count as 2... - el.innerHTML = '

'.repeat(3) - - ## browsers changed their implementation - ## of the number of newlines that

- ## create. newer versions of chrome set 2 new lines - ## per set - whereas older ones create only 1 new line. - ## so we grab the current sets for the assertion later - ## so this test is browser version agnostic - newLines = el.innerText - - ## disregard the last new line, and divide by 2... - ## this tells us how many multiples of new lines - ## the browser inserts for new lines other than - ## the last new line - @multiplierNumNewLines = (newLines.length - 1) / 2 - beforeEach -> doc = cy.state("document") @@ -1069,7 +1038,7 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
foo
' cy.get("[contenteditable]:first") .type("bar").then ($div) -> - expect(trimInnerText($div)).to.eql("foobar") + expect($div.get(0).innerText).to.eql("foobar\n") expect($div.get(0).textContent).to.eql("foobar") expect($div.get(0).innerHTML).to.eql("
foobar
") @@ -1077,7 +1046,7 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '

foo

' cy.get("[contenteditable]:first") .type("bar").then ($div) -> - expect(trimInnerText($div)).to.eql("foobar") + expect($div.get(0).innerText).to.eql("foobar\n\n") expect($div.get(0).textContent).to.eql("foobar") expect($div.get(0).innerHTML).to.eql("

foobar

") @@ -1085,13 +1054,13 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
bar
' cy.get("[contenteditable]:first") .type("{selectall}{leftarrow}foo").then ($div) -> - expect(trimInnerText($div)).to.eql("foobar") + expect($div.get(0).innerText).to.eql("foobar\n") it "collapses selection to end on {rightarrow}", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
bar
' cy.get("[contenteditable]:first") .type("{selectall}{leftarrow}foo{selectall}{rightarrow}baz").then ($div) -> - expect(trimInnerText($div)).to.eql("foobarbaz") + expect($div.get(0).innerText).to.eql("foobarbaz\n") it "can remove a placeholder
", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '

' @@ -1571,7 +1540,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{leftarrow}{leftarrow}{uparrow}11{uparrow}22{downarrow}{downarrow}33").then ($div) -> - expect(trimInnerText($div)).to.eql("foo22\nb11ar\nbaz33") + expect($div.get(0).innerText).to.eql("foo22\nb11ar\nbaz33\n") it "uparrow ignores current selection", -> ce = cy.$$('[contenteditable]:first').get(0) @@ -1587,7 +1556,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{uparrow}11").then ($div) -> - expect(trimInnerText($div)).to.eql("11foo\nbar\nbaz") + expect($div.get(0).innerText).to.eql("11foo\nbar\nbaz\n") it "up and down arrow on textarea", -> cy.$$('textarea:first').get(0).value = 'foo\nbar\nbaz' @@ -1601,6 +1570,7 @@ describe "src/cy/commands/actions/type", -> .type('{uparrow}{uparrow}') .should('have.value', '14') + context "{downarrow}", -> beforeEach -> cy.$$("#comments").val("foo\nbar\nbaz") @@ -1656,7 +1626,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{downarrow}22").then ($div) -> - expect(trimInnerText($div)).to.eql("foo\n22bar\nbaz") + expect($div.get(0).innerText).to.eql("foo\n22bar\nbaz\n") context "{selectall}{del}", -> it "can select all the text and delete", -> @@ -1718,19 +1688,18 @@ describe "src/cy/commands/actions/type", -> it "inserts new line into [contenteditable] ", -> cy.get("#input-types [contenteditable]:first").invoke("text", "foo") .type("bar{enter}baz{enter}{enter}{enter}quux").then ($div) -> - conditionalNewLines = "\n\n".repeat(@multiplierNumNewLines) - - expect(trimInnerText($div)).to.eql("foobar\nbaz#{conditionalNewLines}\nquux") + expect($div.get(0).innerText).to.eql("foobar\nbaz\n\n\nquux\n") expect($div.get(0).textContent).to.eql("foobarbazquux") expect($div.get(0).innerHTML).to.eql("foobar
baz


quux
") it "inserts new line into [contenteditable] from midline", -> cy.get("#input-types [contenteditable]:first").invoke("text", "foo") .type("bar{leftarrow}{enter}baz{leftarrow}{enter}quux").then ($div) -> - expect(trimInnerText($div)).to.eql("fooba\nba\nquuxzr") + expect($div.get(0).innerText).to.eql("fooba\nba\nquuxzr\n") expect($div.get(0).textContent).to.eql("foobabaquuxzr") expect($div.get(0).innerHTML).to.eql("fooba
ba
quuxzr
") + describe "modifiers", -> describe "activating modifiers", -> @@ -2242,6 +2211,7 @@ describe "src/cy/commands/actions/type", -> .then -> expect(changed).to.eql 0 + describe "caret position", -> it "respects being formatted by input event handlers" @@ -2309,35 +2279,32 @@ describe "src/cy/commands/actions/type", -> el.innerHTML = 'start'+ '
middle
'+ '
end
' - cy.get('[contenteditable]:first') ## move cursor to beginning of div .type('{selectall}{leftarrow}') - .type('{rightarrow}'.repeat(14)+'[_I_]').then ($el) -> - expect(trimInnerText($el)).to.eql('start\nmiddle\ne[_I_]nd') + .type('{rightarrow}'.repeat(14)+'[_I_]').then -> + expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('start\nmiddle\ne[_I_]nd\n') it "can wrap cursor to prev line in [contenteditable] with {leftarrow}", -> $el = cy.$$('[contenteditable]:first') el = $el.get(0) - el.innerHTML = 'start'+ '
middle
'+ '
end
' + cy.get('[contenteditable]:first').type('{leftarrow}'.repeat(12)+'[_I_]').then -> + expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('star[_I_]t\nmiddle\nend\n') - cy.get('[contenteditable]:first').type('{leftarrow}'.repeat(12)+'[_I_]').then ($el) -> - expect(trimInnerText($el)).to.eql('star[_I_]t\nmiddle\nend') it "can wrap cursor to next line in [contenteditable] with {rightarrow} and empty lines", -> $el = cy.$$('[contenteditable]:first') el = $el.get(0) - el.innerHTML = '

'.repeat(4) + '
end
' - - newLines = "\n\n\n".repeat(@multiplierNumNewLines) + el.innerHTML = '

'.repeat(4)+ + '
end
' cy.get('[contenteditable]:first') .type('{selectall}{leftarrow}') - .type('foobar'+'{rightarrow}'.repeat(6)+'[_I_]').then -> - expect(trimInnerText($el)).to.eql("foobar#{newLines}\nen[_I_]d") + # .type('foobar'+'{rightarrow}'.repeat(6)+'[_I_]').then -> + # expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('foobar\n\n\n\nen[_I_]d\n') it "can use {rightarrow} and nested elements", -> $el = cy.$$('[contenteditable]:first') @@ -2347,19 +2314,19 @@ describe "src/cy/commands/actions/type", -> cy.get('[contenteditable]:first') .type('{selectall}{leftarrow}') .type('{rightarrow}'.repeat(3)+'[_I_]').then -> - expect(trimInnerText($el)).to.eql('sta[_I_]rt') + expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('sta[_I_]rt\n') it "enter and \\n should act the same for [contenteditable]", -> + cleanseText = (text) -> - ## non breaking white space - text.split('\u00a0').join(' ') + text.replace(/ /g, ' ') expectMatchInnerText = ($el , innerText) -> - expect(cleanseText(trimInnerText($el))).to.eql(innerText) + expect(cleanseText($el.get(0).innerText)).to.eql(innerText) ## NOTE: this may only pass in Chrome since the whitespace may be different in other browsers ## even if actual and expected appear the same. - expected = "{\n foo: 1\n bar: 2\n baz: 3\n}" + expected = "{\n foo: 1\n bar: 2\n baz: 3\n}\n" cy.get('[contenteditable]:first') .invoke('html', '

') .type('{{}{enter} foo: 1{enter} bar: 2{enter} baz: 3{enter}}') @@ -2370,6 +2337,7 @@ describe "src/cy/commands/actions/type", -> .should ($el) -> expectMatchInnerText($el, expected) + it "enter and \\n should act the same for textarea", -> expected = "{\n foo: 1\n bar: 2\n baz: 3\n}" cy.get('textarea:first') @@ -2380,6 +2348,8 @@ describe "src/cy/commands/actions/type", -> .type('{{}\n foo: 1\n bar: 2\n baz: 3\n}') .should('have.prop', 'value', expected) + + describe "{enter}", -> beforeEach -> @$forms = cy.$$("#form-submits") From 3f1d38862aa1456309167b5c7bfdd9c7544f08b2 Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Thu, 4 Apr 2019 17:26:26 -0400 Subject: [PATCH 12/16] =?UTF-8?q?fix=20type=5Fspec=20trimmed=20newlines=20?= =?UTF-8?q?try=20#2=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/actions/type_spec.coffee | 90 ++++++++++++------- 1 file changed, 60 insertions(+), 30 deletions(-) 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 ca101ce878a8..b40480643fdf 100644 --- a/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/actions/type_spec.coffee @@ -4,6 +4,12 @@ Keyboard = Cypress.Keyboard Promise = Cypress.Promise $selection = require("../../../../../src/dom/selection") +## trim new lines at the end of innerText +## due to changing browser versions implementing +## this differently +trimInnerText = ($el) -> + _.trimEnd($el.get(0).innerText, "\n") + describe "src/cy/commands/actions/type", -> before -> cy @@ -11,6 +17,31 @@ describe "src/cy/commands/actions/type", -> .then (win) -> @body = win.document.body.outerHTML + el = cy.$$('[contenteditable]:first').get(0) + + innerHtml = el.innerHTML + + ## by default... the last new line by itself + ## will only ever count as a single new line... + ## but new lines above it will count as 2 new lines... + ## so by adding "3" new lines, the last counts as 1 + ## and the first 2 count as 2... + el.innerHTML = '

'.repeat(3) + + ## browsers changed their implementation + ## of the number of newlines that

+ ## create. newer versions of chrome set 2 new lines + ## per set - whereas older ones create only 1 new line. + ## so we grab the current sets for the assertion later + ## so this test is browser version agnostic + newLines = el.innerText + + ## disregard the last new line, and divide by 2... + ## this tells us how many multiples of new lines + ## the browser inserts for new lines other than + ## the last new line + @multiplierNumNewLines = (newLines.length - 1) / 2 + beforeEach -> doc = cy.state("document") @@ -1038,7 +1069,7 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
foo
' cy.get("[contenteditable]:first") .type("bar").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\n") + expect(trimInnerText($div)).to.eql("foobar") expect($div.get(0).textContent).to.eql("foobar") expect($div.get(0).innerHTML).to.eql("
foobar
") @@ -1046,7 +1077,7 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '

foo

' cy.get("[contenteditable]:first") .type("bar").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\n\n") + expect(trimInnerText($div)).to.eql("foobar") expect($div.get(0).textContent).to.eql("foobar") expect($div.get(0).innerHTML).to.eql("

foobar

") @@ -1054,13 +1085,13 @@ describe "src/cy/commands/actions/type", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
bar
' cy.get("[contenteditable]:first") .type("{selectall}{leftarrow}foo").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\n") + expect(trimInnerText($div)).to.eql("foobar") it "collapses selection to end on {rightarrow}", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '
bar
' cy.get("[contenteditable]:first") .type("{selectall}{leftarrow}foo{selectall}{rightarrow}baz").then ($div) -> - expect($div.get(0).innerText).to.eql("foobarbaz\n") + expect(trimInnerText($div)).to.eql("foobarbaz") it "can remove a placeholder
", -> cy.$$('[contenteditable]:first').get(0).innerHTML = '

' @@ -1451,7 +1482,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{home}11{uparrow}{home}22{uparrow}{home}33").then ($div) -> - expect($div.get(0).innerText).to.eql("33foo\n22bar\n11baz\n") + expect(trimInnerText($div)).to.eql("33foo\n22bar\n11baz") context "{end}", -> it "sets which and keyCode to 35 and does not fire keypress events", (done) -> @@ -1501,7 +1532,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{end}11{uparrow}{end}22{uparrow}{end}33").then ($div) -> - expect($div.get(0).innerText).to.eql("foo33\nbar22\nbaz11\n") + expect(trimInnerText($div)).to.eql("foo33\nbar22\nbaz11") context "{uparrow}", -> beforeEach -> @@ -1540,7 +1571,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{leftarrow}{leftarrow}{uparrow}11{uparrow}22{downarrow}{downarrow}33").then ($div) -> - expect($div.get(0).innerText).to.eql("foo22\nb11ar\nbaz33\n") + expect(trimInnerText($div)).to.eql("foo22\nb11ar\nbaz33") it "uparrow ignores current selection", -> ce = cy.$$('[contenteditable]:first').get(0) @@ -1556,7 +1587,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{uparrow}11").then ($div) -> - expect($div.get(0).innerText).to.eql("11foo\nbar\nbaz\n") + expect(trimInnerText($div)).to.eql("11foo\nbar\nbaz") it "up and down arrow on textarea", -> cy.$$('textarea:first').get(0).value = 'foo\nbar\nbaz' @@ -1570,7 +1601,6 @@ describe "src/cy/commands/actions/type", -> .type('{uparrow}{uparrow}') .should('have.value', '14') - context "{downarrow}", -> beforeEach -> cy.$$("#comments").val("foo\nbar\nbaz") @@ -1626,7 +1656,7 @@ describe "src/cy/commands/actions/type", -> cy.get("[contenteditable]:first") .type("{downarrow}22").then ($div) -> - expect($div.get(0).innerText).to.eql("foo\n22bar\nbaz\n") + expect(trimInnerText($div)).to.eql("foo\n22bar\nbaz") context "{selectall}{del}", -> it "can select all the text and delete", -> @@ -1688,18 +1718,19 @@ describe "src/cy/commands/actions/type", -> it "inserts new line into [contenteditable] ", -> cy.get("#input-types [contenteditable]:first").invoke("text", "foo") .type("bar{enter}baz{enter}{enter}{enter}quux").then ($div) -> - expect($div.get(0).innerText).to.eql("foobar\nbaz\n\n\nquux\n") + conditionalNewLines = "\n\n".repeat(@multiplierNumNewLines) + + expect(trimInnerText($div)).to.eql("foobar\nbaz#{conditionalNewLines}\nquux") expect($div.get(0).textContent).to.eql("foobarbazquux") expect($div.get(0).innerHTML).to.eql("foobar
baz


quux
") it "inserts new line into [contenteditable] from midline", -> cy.get("#input-types [contenteditable]:first").invoke("text", "foo") .type("bar{leftarrow}{enter}baz{leftarrow}{enter}quux").then ($div) -> - expect($div.get(0).innerText).to.eql("fooba\nba\nquuxzr\n") + expect(trimInnerText($div)).to.eql("fooba\nba\nquuxzr") expect($div.get(0).textContent).to.eql("foobabaquuxzr") expect($div.get(0).innerHTML).to.eql("fooba
ba
quuxzr
") - describe "modifiers", -> describe "activating modifiers", -> @@ -2211,7 +2242,6 @@ describe "src/cy/commands/actions/type", -> .then -> expect(changed).to.eql 0 - describe "caret position", -> it "respects being formatted by input event handlers" @@ -2279,32 +2309,35 @@ describe "src/cy/commands/actions/type", -> el.innerHTML = 'start'+ '
middle
'+ '
end
' + cy.get('[contenteditable]:first') ## move cursor to beginning of div .type('{selectall}{leftarrow}') - .type('{rightarrow}'.repeat(14)+'[_I_]').then -> - expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('start\nmiddle\ne[_I_]nd\n') + .type('{rightarrow}'.repeat(14)+'[_I_]').then ($el) -> + expect(trimInnerText($el)).to.eql('start\nmiddle\ne[_I_]nd') it "can wrap cursor to prev line in [contenteditable] with {leftarrow}", -> $el = cy.$$('[contenteditable]:first') el = $el.get(0) + el.innerHTML = 'start'+ '
middle
'+ '
end
' - cy.get('[contenteditable]:first').type('{leftarrow}'.repeat(12)+'[_I_]').then -> - expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('star[_I_]t\nmiddle\nend\n') + cy.get('[contenteditable]:first').type('{leftarrow}'.repeat(12)+'[_I_]').then ($el) -> + expect(trimInnerText($el)).to.eql('star[_I_]t\nmiddle\nend') it "can wrap cursor to next line in [contenteditable] with {rightarrow} and empty lines", -> $el = cy.$$('[contenteditable]:first') el = $el.get(0) - el.innerHTML = '

'.repeat(4)+ - '
end
' + el.innerHTML = '

'.repeat(4) + '
end
' + + newLines = "\n\n\n".repeat(@multiplierNumNewLines) cy.get('[contenteditable]:first') .type('{selectall}{leftarrow}') - # .type('foobar'+'{rightarrow}'.repeat(6)+'[_I_]').then -> - # expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('foobar\n\n\n\nen[_I_]d\n') + .type('foobar'+'{rightarrow}'.repeat(6)+'[_I_]').then -> + expect(trimInnerText($el)).to.eql("foobar#{newLines}\nen[_I_]d") it "can use {rightarrow} and nested elements", -> $el = cy.$$('[contenteditable]:first') @@ -2314,19 +2347,19 @@ describe "src/cy/commands/actions/type", -> cy.get('[contenteditable]:first') .type('{selectall}{leftarrow}') .type('{rightarrow}'.repeat(3)+'[_I_]').then -> - expect(cy.$$('[contenteditable]:first').get(0).innerText).to.eql('sta[_I_]rt\n') + expect(trimInnerText($el)).to.eql('sta[_I_]rt') it "enter and \\n should act the same for [contenteditable]", -> - cleanseText = (text) -> - text.replace(/ /g, ' ') + ## non breaking white space + text.split('\u00a0').join(' ') expectMatchInnerText = ($el , innerText) -> - expect(cleanseText($el.get(0).innerText)).to.eql(innerText) + expect(cleanseText(trimInnerText($el))).to.eql(innerText) ## NOTE: this may only pass in Chrome since the whitespace may be different in other browsers ## even if actual and expected appear the same. - expected = "{\n foo: 1\n bar: 2\n baz: 3\n}\n" + expected = "{\n foo: 1\n bar: 2\n baz: 3\n}" cy.get('[contenteditable]:first') .invoke('html', '

') .type('{{}{enter} foo: 1{enter} bar: 2{enter} baz: 3{enter}}') @@ -2337,7 +2370,6 @@ describe "src/cy/commands/actions/type", -> .should ($el) -> expectMatchInnerText($el, expected) - it "enter and \\n should act the same for textarea", -> expected = "{\n foo: 1\n bar: 2\n baz: 3\n}" cy.get('textarea:first') @@ -2348,8 +2380,6 @@ describe "src/cy/commands/actions/type", -> .type('{{}\n foo: 1\n bar: 2\n baz: 3\n}') .should('have.prop', 'value', expected) - - describe "{enter}", -> beforeEach -> @$forms = cy.$$("#form-submits") From 7fb1d58dd2f1bd1692c12bd4452f017cdcf3e3d2 Mon Sep 17 00:00:00 2001 From: Brian Mann Date: Thu, 4 Apr 2019 18:02:49 -0400 Subject: [PATCH 13/16] Revert "server: correct failing tests" This reverts commit a4e3da0859c88c56b39d101dd3e0ab45051f6ab2. --- packages/server/test/integration/http_requests_spec.coffee | 2 ++ packages/server/test/integration/server_spec.coffee | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/server/test/integration/http_requests_spec.coffee b/packages/server/test/integration/http_requests_spec.coffee index 2906005b9114..c920db6dc1f8 100644 --- a/packages/server/test/integration/http_requests_spec.coffee +++ b/packages/server/test/integration/http_requests_spec.coffee @@ -1250,6 +1250,7 @@ describe "Routes", -> expect(res.body).to.include("The error was:") expect(res.body).to.include("connect ECONNREFUSED 127.0.0.1:64644") expect(res.body).to.include("The stack trace was:") + expect(res.body).to.include("_exceptionWithHostPort") expect(res.body).to.include("TCPConnectWrap.afterConnect") expect(res.body).to.include("\n ") @@ -1269,6 +1270,7 @@ describe "Routes", -> expect(res.body).to.include("The error was:") expect(res.body).to.include("connect ECONNREFUSED 127.0.0.1:64644") expect(res.body).to.include("The stack trace was:") + expect(res.body).to.include("_exceptionWithHostPort") expect(res.body).to.include("TCPConnectWrap.afterConnect") expect(res.body).not.to.include("\n ") diff --git a/packages/server/test/integration/server_spec.coffee b/packages/server/test/integration/server_spec.coffee index d5a61fb09eff..ab8612303773 100644 --- a/packages/server/test/integration/server_spec.coffee +++ b/packages/server/test/integration/server_spec.coffee @@ -547,6 +547,7 @@ describe "Server", -> @server._onResolveUrl("http://localhost:64646", {}, @automationRequest) .catch (err) -> expect(err.message).to.eq("connect ECONNREFUSED 127.0.0.1:64646") + expect(err.stack).to.include("._errnoException") expect(err.port).to.eq(64646) expect(err.code).to.eq("ECONNREFUSED") From 9d25e9c8685c9169e3a1adbd17d903fd4c87a5a7 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Thu, 4 Apr 2019 18:07:31 -0400 Subject: [PATCH 14/16] use image cypress/browsers:node8.2.1-chrome73 to match Node version in the Electron itself, but having latest Chrome --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 099531299972..0dc0f96badd9 100644 --- a/circle.yml +++ b/circle.yml @@ -23,7 +23,7 @@ executors: # the Docker image with Cypress dependencies and Chrome browser cy-doc: docker: - - image: cypress/browsers:node8.15.1-chrome73 + - image: cypress/browsers:node8.2.1-chrome73 environment: PLATFORM: linux From c10062469f14d4cbb2140e535deb62102a93d7b2 Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Mon, 8 Apr 2019 14:46:39 -0400 Subject: [PATCH 15/16] fix navigation_spec cross-origin errors --- .../commands/navigation_spec.coffee | 33 +++++++++++++++---- packages/runner/package.json | 1 + 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/packages/driver/test/cypress/integration/commands/navigation_spec.coffee b/packages/driver/test/cypress/integration/commands/navigation_spec.coffee index 6f4f58609eec..1489f179b3ce 100644 --- a/packages/driver/test/cypress/integration/commands/navigation_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/navigation_spec.coffee @@ -91,6 +91,7 @@ describe "src/cy/commands/navigation", -> expect(stub2).to.be.calledOnce expect(stub3).to.be.calledOnce + # Array(100).fill().map -> it "removes listeners", -> win = cy.state("window") @@ -100,6 +101,14 @@ describe "src/cy/commands/navigation", -> expect(rel).to.be.calledWith("beforeunload") expect(rel).to.be.calledWith("unload") + + # cy.reload().then -> + # cy.wrap(null).should -> + # expect(rel).to.be.calledWith("beforeunload") + # expect(rel).to.be.calledWith("unload") + + + describe "errors", -> beforeEach -> Cypress.config("defaultCommandTimeout", 50) @@ -149,6 +158,7 @@ describe "src/cy/commands/navigation", -> expect(win.foo).to.be.undefined it "throws when reload times out", (done) -> + console.time('foo') locReload = cy.spy(Cypress.utils, "locReload") cy @@ -167,6 +177,8 @@ describe "src/cy/commands/navigation", -> cy.on "fail", (err) -> expected = true + console.timeEnd('foo') + expect(err.message).to.include "Your page did not fire its 'load' event within '1ms'." .reload({timeout: 1}) @@ -232,17 +244,18 @@ describe "src/cy/commands/navigation", -> $(doc.body).empty().html(@body) ## TODO: fix this - it.skip "(FLAKY) sets timeout to Cypress.config(pageLoadTimeout)", -> - timeout = cy.spy Promise.prototype, "timeout" - Cypress.config("pageLoadTimeout", 4567) + # it.skip "(FLAKY) sets timeout to Cypress.config(pageLoadTimeout)", -> + # timeout = cy.spy Promise.prototype, "timeout" + # Cypress.config("pageLoadTimeout", 4567) - cy - .visit("/fixtures/jquery.html") - .go("back").then -> - expect(timeout).to.be.calledWith(4567, "go") + # cy + # .visit("/fixtures/jquery.html") + # .go("back").then -> + # expect(timeout).to.be.calledWith(4567, "go") it "removes listeners", -> cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .then -> winLoadListeners = cy.listeners("window:load") @@ -266,6 +279,7 @@ describe "src/cy/commands/navigation", -> stub3 = cy.stub() cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .then -> cy.on("stability:changed", stub1) @@ -279,6 +293,7 @@ describe "src/cy/commands/navigation", -> it "removes listeners from window", -> cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .then (win) -> rel = cy.stub(win, "removeEventListener") @@ -369,6 +384,7 @@ describe "src/cy/commands/navigation", -> it "logs go", -> cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .go("back").then -> lastLog = @lastLog @@ -378,12 +394,14 @@ describe "src/cy/commands/navigation", -> it "can turn off logging", -> cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .go("back", {log: false}).then -> expect(@lastLog).to.be.undefined it "does not log 'Page Load' events", -> cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .go("back").then -> @logs.slice(0).forEach (log) -> @@ -393,6 +411,7 @@ describe "src/cy/commands/navigation", -> beforeunload = false cy + .visit("/fixtures/generic.html") .visit("/fixtures/jquery.html") .window().then (win) -> cy.on "window:before:unload", => diff --git a/packages/runner/package.json b/packages/runner/package.json index 74503f700776..860b7a022344 100644 --- a/packages/runner/package.json +++ b/packages/runner/package.json @@ -24,6 +24,7 @@ "lib" ], "devDependencies": { + "@babel/plugin-proposal-decorators": "7.4.0", "@babel/plugin-proposal-object-rest-spread": "7.4.0", "@cypress/react-tooltip": "0.4.0", "bin-up": "1.1.0", From 5ffdf3afd351be147db82b298462180a4a30cc05 Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Mon, 8 Apr 2019 15:03:58 -0400 Subject: [PATCH 16/16] fix return_value_spec errors --- .../commands/navigation_spec.coffee | 28 ++++++------------- .../integration/e2e/return_value_spec.coffee | 4 +-- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/driver/test/cypress/integration/commands/navigation_spec.coffee b/packages/driver/test/cypress/integration/commands/navigation_spec.coffee index 1489f179b3ce..4a5fa333708d 100644 --- a/packages/driver/test/cypress/integration/commands/navigation_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/navigation_spec.coffee @@ -91,7 +91,6 @@ describe "src/cy/commands/navigation", -> expect(stub2).to.be.calledOnce expect(stub3).to.be.calledOnce - # Array(100).fill().map -> it "removes listeners", -> win = cy.state("window") @@ -101,14 +100,6 @@ describe "src/cy/commands/navigation", -> expect(rel).to.be.calledWith("beforeunload") expect(rel).to.be.calledWith("unload") - - # cy.reload().then -> - # cy.wrap(null).should -> - # expect(rel).to.be.calledWith("beforeunload") - # expect(rel).to.be.calledWith("unload") - - - describe "errors", -> beforeEach -> Cypress.config("defaultCommandTimeout", 50) @@ -158,7 +149,6 @@ describe "src/cy/commands/navigation", -> expect(win.foo).to.be.undefined it "throws when reload times out", (done) -> - console.time('foo') locReload = cy.spy(Cypress.utils, "locReload") cy @@ -177,8 +167,6 @@ describe "src/cy/commands/navigation", -> cy.on "fail", (err) -> expected = true - console.timeEnd('foo') - expect(err.message).to.include "Your page did not fire its 'load' event within '1ms'." .reload({timeout: 1}) @@ -244,14 +232,14 @@ describe "src/cy/commands/navigation", -> $(doc.body).empty().html(@body) ## TODO: fix this - # it.skip "(FLAKY) sets timeout to Cypress.config(pageLoadTimeout)", -> - # timeout = cy.spy Promise.prototype, "timeout" - # Cypress.config("pageLoadTimeout", 4567) - - # cy - # .visit("/fixtures/jquery.html") - # .go("back").then -> - # expect(timeout).to.be.calledWith(4567, "go") + it.skip "(FLAKY) sets timeout to Cypress.config(pageLoadTimeout)", -> + timeout = cy.spy Promise.prototype, "timeout" + Cypress.config("pageLoadTimeout", 4567) + + cy + .visit("/fixtures/jquery.html") + .go("back").then -> + expect(timeout).to.be.calledWith(4567, "go") it "removes listeners", -> cy diff --git a/packages/driver/test/cypress/integration/e2e/return_value_spec.coffee b/packages/driver/test/cypress/integration/e2e/return_value_spec.coffee index 9a10b99e8776..0eb158f95fad 100644 --- a/packages/driver/test/cypress/integration/e2e/return_value_spec.coffee +++ b/packages/driver/test/cypress/integration/e2e/return_value_spec.coffee @@ -29,7 +29,7 @@ describe "return values", -> it "stringifies function bodies", (done) -> cy.on "fail", (err) -> - expect(err.message).to.include("> function () {") + expect(err.message).to.include("> function") expect(err.message).to.include("return \"foo\";") expect(err.message).to.include("Cypress detected that you invoked one or more cy commands but returned a different value.") @@ -78,7 +78,7 @@ describe "return values", -> expect(lastLog.get("name")).to.eq("foo") expect(lastLog.get("error")).to.eq(err) expect(err.message).to.include("> cy.foo()") - expect(err.message).to.include("> function () {") + expect(err.message).to.include("> function") expect(err.message).to.include("return \"bar\";") expect(err.message).to.include("Cypress detected that you invoked one or more cy commands in a custom command but returned a different value.")