mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-24 07:59:12 -05:00
4b368830fa
* WIP: refactor runs and recordings, update to new API updates, iteratively send spec results [skip ci] * update / add schema deps * add takenAt to screenshots payload * WIP: refactor recordings to send correctly payloads, iterative through each spec, error handling, e2e tests * add missing properties, remove hacks, upload stdout, passing tests * normalize wall clock for newest schema spec * rename projectPath -> projectRoot for clarity * normalize specPattern to be relative to projectRoot * comment out lib/api debug code * WIP fixes a lot of failing tests * many more tests around recording * WIP: update to use x-os-name on all instead of platform * WIP: update to route version 4 for creating instances * server: upgrade json-schemas to 4.7.2 * remove debug logs * fix stdout not being restored correctly between specs * test all the edge cases with failed api interactions and early exits * add e2e tests around recording without projectID * add e2e tests around recording without recordKey * refactored all tests surrounding record mode, removed duplicates, tested only edge cases * fixes #1692 * fix failing unit tests, bump schemas * bump sinon, replace custom sandbox * fix sinon@5 not restoring fake timers automatically * missing e2e record snapshots * fix failing tests, don't pass config through each run, remove old timings in favor of spec isolation * more e2e test fixes * add e2e tests around uploading artifacts, fix bug with not uploading videos when it should - cleanup some dead code - add debug logs * cleanup dead code, remove notion of failingTests
135 lines
4.0 KiB
CoffeeScript
135 lines
4.0 KiB
CoffeeScript
## THESE TESTS ARE COMMENTED OUT BECAUSE ALL OF REMOTE_INITIAL
|
|
## WAS REFACTORED AND MOST DO NOT APPLY.
|
|
## WILL ADD UNIT TESTS AS PROBLEMS ARISE (IF THEY ARISE)
|
|
|
|
require("../spec_helper")
|
|
|
|
through = require("through")
|
|
Readable = require("stream").Readable
|
|
proxy = require("#{root}lib/controllers/proxy")
|
|
|
|
describe "lib/proxy", ->
|
|
|
|
# it "injects content", (done) ->
|
|
# readable = new Readable
|
|
|
|
# readable.push('<head></head><body></body>')
|
|
# readable.push(null)
|
|
|
|
# readable.pipe(proxy.injectContent("wow"))
|
|
# .pipe through (d) ->
|
|
# expect(d.toString()).to.eq("<head> wow</head><body></body>")
|
|
# done()
|
|
|
|
# describe "redirects", ->
|
|
# beforeEach ->
|
|
# @req = {
|
|
# url: "/__remote/#{@baseUrl}/",
|
|
# session: {}
|
|
# }
|
|
|
|
# nock(@baseUrl)
|
|
# .get("/")
|
|
# .reply(301, "", {
|
|
# 'location': @redirectUrl
|
|
# })
|
|
|
|
# @res.redirect = (loc) =>
|
|
# @req.url = loc
|
|
# proxy.handle(@req, @res)
|
|
|
|
# it "redirects on 301", (done) ->
|
|
# nock(@redirectUrl)
|
|
# .get("/")
|
|
# .reply(200, =>
|
|
# done()
|
|
# )
|
|
|
|
# proxy.handle(@req, @res)
|
|
|
|
# it "resets session remote after a redirect", (done) ->
|
|
# nock(@redirectUrl)
|
|
# .get("/")
|
|
# .reply(200, =>
|
|
# expect(@req.session.remote).to.eql("http://x.com")
|
|
# done()
|
|
# )
|
|
|
|
# proxy.handle(@req, @res)
|
|
|
|
# context "#parseReqUrl", ->
|
|
# it "removes /__remote/", ->
|
|
# url = proxy.parseReqUrl("/__remote/www.github.com")
|
|
# expect(url).to.eq "www.github.com"
|
|
|
|
# it "removes __initial query param", ->
|
|
# url = proxy.parseReqUrl("/__remote/www.github.com?__initial=true")
|
|
# expect(url).to.eq "www.github.com"
|
|
|
|
# it "leaves other query params", ->
|
|
# url = proxy.parseReqUrl("/__remote/www.github.com?__initial=true&foo=bar")
|
|
# expect(url).to.eq "www.github.com/?foo=bar"
|
|
|
|
# it "doesnt strip trailing slashes", ->
|
|
# url = proxy.parseReqUrl("/__remote/www.github.com/")
|
|
# expect(url).to.eq "www.github.com/"
|
|
|
|
# context "#prepareUrlForRedirect", ->
|
|
# it "prepends with /__remote/ and adds __initial=true query param", ->
|
|
# url = proxy.prepareUrlForRedirect("www.github.com", "www.github.com/bar")
|
|
# expect(url).to.eq "/__remote/www.github.com/bar?__initial=true"
|
|
|
|
# it "doesnt strip leading slashes", ->
|
|
# url = proxy.prepareUrlForRedirect("www.github.com", "www.github.com/")
|
|
# expect(url).to.eq "/__remote/www.github.com/?__initial=true"
|
|
|
|
# it "handles url leading slashes", ->
|
|
# url = proxy.prepareUrlForRedirect("www.github.com/foo", "www.github.com/foo/")
|
|
# expect(url).to.eq "/__remote/www.github.com/foo/?__initial=true"
|
|
|
|
# it "handles existing query params", ->
|
|
# url = proxy.prepareUrlForRedirect("www.github.com", "www.github.com/foo?bar=baz")
|
|
# expect(url).to.eq "/__remote/www.github.com/foo?bar=baz&__initial=true"
|
|
|
|
# context "setting session", ->
|
|
# beforeEach ->
|
|
# nock(@baseUrl)
|
|
# .get("/")
|
|
# .reply(200)
|
|
|
|
# nock(@baseUrl)
|
|
# .get("/?foo=bar")
|
|
# .reply(200)
|
|
|
|
# it "sets immediately before requests", ->
|
|
# @req =
|
|
# url: "/__remote/#{@baseUrl}"
|
|
# session: {}
|
|
|
|
# proxy.handle(@req, @res)
|
|
|
|
# expect(@req.session.remote).to.eql(@baseUrl)
|
|
|
|
# it "does not include query params in the url", ->
|
|
# @req =
|
|
# url: "/__remote/#{@baseUrl}?foo=bar"
|
|
# session: {}
|
|
|
|
# proxy.handle(@req, @res)
|
|
# expect(@req.session.remote).to.eql(@baseUrl)
|
|
|
|
# context "relative files", ->
|
|
# it "#getRelativeFileContent strips trailing slashes", ->
|
|
# createReadStream = sinon.stub(fs, "createReadStream")
|
|
# proxy.getRelativeFileContent("index.html/", {})
|
|
# expect(createReadStream).to.be.calledWith("/Users/brian/app/index.html")
|
|
|
|
# context "absolute files", ->
|
|
|
|
# context "file files", ->
|
|
|
|
# context "errors", ->
|
|
# it "bubbles 500's from external server"
|
|
|
|
# it "throws on authentication required"
|