Skip to content

Commit

Permalink
add test for #5446
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Jan 9, 2020
1 parent f4e3b12 commit 79bdca0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/server/__snapshots__/6_visit_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports['e2e visit / low response timeout / passes'] = `
✓ scrolls automatically to div with id=foo
✓ can load an http page with a huge amount of elements without timing out
✓ can load a local file with a huge amount of elements without timing out
✓ can load a site via TLSv1
issue #225: hash urls
✓ can visit a hash url and loads
✓ can visit the same hash url and loads
Expand All @@ -35,14 +36,14 @@ exports['e2e visit / low response timeout / passes'] = `
✓ sets accept header to text/html,*/*
11 passing
12 passing
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 11
│ Passing: 11
│ Tests: 12
│ Passing: 12
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
Expand All @@ -66,9 +67,9 @@ exports['e2e visit / low response timeout / passes'] = `
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ visit_spec.coffee XX:XX 11 11 - - - │
│ ✔ visit_spec.coffee XX:XX 12 12 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! XX:XX 11 11 - - -
✔ All specs passed! XX:XX 12 12 - - -
`
Expand Down
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"express-session": "1.16.1",
"express-useragent": "1.0.12",
"http-mitm-proxy": "0.7.0",
"https-pem": "2.0.0",
"https-proxy-agent": "3.0.0",
"istanbul": "0.4.5",
"mocked-env": "1.2.4",
Expand Down
29 changes: 29 additions & 0 deletions packages/server/test/e2e/6_visit_spec.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
_ = require("lodash")
Bluebird = require("bluebird")
cert = require("https-pem")
https = require("https")
useragent = require("express-useragent")
{ allowDestroy } = require("@packages/network")
e2e = require("../support/helpers/e2e")

## create an HTTPS server that forces TLSv1
startTlsV1Server = (port) ->
Bluebird.fromCallback (cb) ->
opts = _.merge({
secureProtocol: "TLSv1_server_method",
}, cert)

serv = https.createServer opts, (req, res) =>
res.setHeader('content-type', 'text/html')
res.end('foo')

allowDestroy(serv)

serv.listen port, (err) =>
cb(null, serv)

serv.on('error', cb)

onServer = (app) ->
app.get "/agent.json", (req, res) ->
source = req.headers["user-agent"] ? ""
Expand Down Expand Up @@ -75,6 +98,12 @@ describe "e2e visit", ->
spec: "visit_spec.coffee"
snapshot: true
expectedExitCode: 0
onRun: (exec) ->
startTlsV1Server(6776)
.then (serv) ->
exec()
.then ->
serv.destroy()
}

e2e.it "fails when network connection immediately fails", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ describe "visits", ->
it "can load a local file with a huge amount of elements without timing out", ->
cy.visit("/elements.html", {timeout: 5000})

## https://github.com/cypress-io/cypress/issues/5446
it "can load a site via TLSv1", ->
cy.visit("https://localhost:6776")

context "issue #225: hash urls", ->
rand = Math.random()

Expand Down

0 comments on commit 79bdca0

Please sign in to comment.