Commit Graph

28 Commits

Author SHA1 Message Date
Zach Bloomquist d185a74dc9 Allow circular structures to be sent over the websocket, make it an error to send circular request bodies (#4407)
* use a parser that supports circular json

* update tests to work with new socketio version

* add error message when users supply circular body to visit/request

* show the path of the circular reference detected

* Revert "use a parser that supports circular json"

This reverts commit c052f44ec8.

* add failing driver and server tests for circular objs over websocket

* use a parser that supports circular json

* add has-binary2 patch that enables circular objects to be inspected

* update socket spec

* rejectUnauthorized: false

* use @packages/socket instead of copying client source

* prevent false positive

* use commit hash for socket.io-circular-parser

* cleanup bundling of socket.io for node + browser

- keep the interfaces identical
- browser simply has less properties than the node variant

* properly import client + circularParser from socket package

* @cypress/what-is-circular

* dont require the extension, it causes gulp to hang

* fix runner tests hanging


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-06-13 17:43:59 -04:00
Zach Bloomquist c1a345dce2 Improved proxy support (#3531)
* https-proxy: unused file

* server: wrap all https requests that use a proxy

* server: use request lib in ensureUrl if proxy is in use. this makes runs tab work behind a proxy

* electron: pass --proxy-server to app itself, so the embedded github login page works

* cli: first attempt at env vars from windows registry

* cli: api cleanup

* cli: lint

* cli: fix crash on no proxy, add tests

* add desktop-gui watch to terminals.json

* cli: pass along --proxy-source

* electron: pass --proxy-bypass-list too

* server: whitelist proxy* args

* cli: better wording

* desktop-gui: display proxy settings

* extension: force proxy [wip]

* extension: finally, i am victorious over coffeescript

* extension: add -loopback to bypasslist

* extension: revert changes

Revert "extension: force proxy [wip]"

This reverts commit 3ab6ba42a763f25ee65f12eb8b79eb597efc9b11.

* desktop-gui: skip proxysettings if there aren't any

* https-proxy, server: proxy directConnections using https-proxy-agent

* https-agent: pool httpsAgents

* https-proxy: work when they're not on a proxy

* https-proxy: ci - use agent 1.0

* https-proxy: tests

* desktop-gui: hide proxy settings when not using proxy

* https-proxy: pass req through to https-proxy-agent callback

* cli: use get-windows-proxy

* desktop-gui: always show proxy settings

* server: use get-windows-proxy

* electron, server: supply electron proxy config when window launched

* server: fix

* https-proxy: cleanup

* server: clean up ensureUrl

* https-proxy: cleanup

* cli: fix

* cli: fix destructuring

* server: enable ForeverAgent to pool HTTPS/HTTP connections

#3192

* server: updating snapshot

* https-proxy: don't crash, do error if proxy unreachable

* https-proxy:

* get-windows-proxy@1.0.0

* https-proxy: use proxy-from-env to decide on a proxy for a url

* server: fallback to HTTP_PROXY globally if HTTPS_PROXY not set

* server: proxy args test

* cli: add proxy tests

* cli: add test that loadSystemProxySettings is called during download

* cli, server: account for the fact that CI has some proxy vars set

* https-proxy: ""

* cli, https-proxy, server: ""

* desktop-gui: update settings gui

* desktop-gui: cypress tests for proxy settings

* server: strict undefined check

* cli, server: move get-windows-proxy to scope, optionalDeps

* server, cli: use new and improved get-windows-proxy

* cli, server: 1.5.0

* server: re-check for proxy since cli may have failed to load the lib

* server, cli: 1.5.1

* server: NO_PROXY=localhost by default, clean up

* https-proxy: disable Nagle's on proxy sockets

\#3192

* https-proxy: use setNoDelay on upstream, cache https agent

* https-proxy: test basic auth

* https-proxy: add todo: remove this

* server: add custom HTTP(s) Agent implementation w keepalive, tunneling

* server: typescript for agent

* add ts to zunder

* server: more ts

* ts: add missing Agent type declaration

* server: create CombinedAgent

* server: use agent in more places

* ts: more declarations

* server: make script work even if debug port not supplied

* server: begin some testing

* server, ts: agent, tests

* server: test

* server: agent works with websockets now

* server: update snapshot

* server: work out some more bugs with websockets

* server: more websockets

* server: add net_profiler

* https-proxy: fix dangling socket on direct connection

* server: fix potential 'headers have already been sent'

* https-proxy: nab another dangler

* server: update test to expect agent

* https-proxy: fix failing test

* desktop-gui: change on-link

* server: add tests for empty response case

* server: tests

* server: send keep-alive with requests

* server: make net profiler hook on socket.connect

* server: only hook profiler once

* server: update tests, add keep-alive test

* server: only regen headers if needed

* server: move http_overrides into CombinedAgent, make it proxy-proof

for #112

* server: update snapshot

* server: undo

* server: avoid circular dependency

* https-proxy, server: use our Agent instead of https-proxy-agent

* server: add dependency back

* cli: actually use proxy for download

* server, launcher, ts: typescript

* Revert "server, launcher, ts: typescript"

This reverts commit d3f8b8bbb6.

* Revert "Revert "server, launcher, ts: typescript""

This reverts commit 818dfdfd00.

* ts, server: respond to PR

* server, ts: types

* ts: really fix types

* https-proxy, server: export CA from https-proxy

* agent, server, https-proxy: move agent to own package

* agent => networking, move connect into networking

* fix tests

* fix test

* networking: respond to PR changes, add more unit tests

* rename ctx

* networking, ts: add more tests

* server: add ensureUrl tests

* https-proxy: remove https-proxy-agent

* server: use CombinedAgent for API

* server: updates

* add proxy performance tests

* add perf tests to workflow

* circle

* run perf tests with --no-sandbox

* networking, ts: ch-ch-ch-ch-changes

* server, networking: pr changes

* run networking tests in circle

* server: fix performance test

* https-proxy: test that sockets are being closed

* https-proxy: write, not emit

* networking: fix test

* networking: bubble err in connect

* networking: style

* networking: clean p connect error handling

* networking => network

* server: make perf tests really work

* server: really report

* server: use args from browser

* server: use AI to determine max run time

* server: load electron only when needed


Co-authored-by: Brian Mann <brian@cypress.io>
2019-03-31 23:39:10 -04:00
Lila Conlee 1e87dbcd4d Separate test error into separate component (#3457)
* wip: add initial work for md in test error messages

* Get basic external open from errors opening

* Only linkify 'https://on.cypress.io' addresses

* Add link styling for test errors

* Fix reporter linting errors

* wip: working on adding tests

* Remove backticks from test errors in text terminal mode

* Begin adding markdown to test error messages

* Add styles for test error messages

* Fix test error reporter specs

* Convert cypress test to js

* Revert "Begin adding markdown to test error messages"

This reverts commit 088bbc3994.

* Revert "Remove backticks from test errors in text terminal mode"

This reverts commit fe1595c4dd.

* Revert "Add styles for test error messages"

This reverts commit e155dec8a9.

* Update markdown rendering to only render docs links

* Add scripts for cypress reporter tests

* Remove docs link logic

* Remove test for docs link clicking

* Make test error a functional component
2019-03-21 14:18:10 -05:00
renovate[bot] d3b2384cb3 fix(deps): update dependency node-uuid to version 1.4.8 🌟 (#3436)
* fix(deps): update node-uuid to 1.4.8 🌟

* remove unused, deprecated node-uuid package
2019-02-12 15:57:15 +06:30
Brian Mann 2333d04a54 secure cookie error crash (#2685)
- fixes #1264 
- fixes #1321 
- fixes #1799  
- fixes #2689
- fixes #2688
- fixes #2687 	
- fixes #2686
2018-11-01 12:34:37 -04:00
Allen Moore 93966e30db Change hard-coded forward slash in watch path to platform specific path delimiter (#2400)
Closes #712

- Fixes broken watch path on Windows when using any trans-piled code (ts, cucumber etc...)
- update related unit tests
2018-09-06 10:18:54 -04:00
Brian Mann 126933385e capture electron console logs and more debug logs (#2303) 2018-08-09 08:27:53 -04:00
Brian Mann 58f3453b35 remove unused file causing binary build failures 2018-06-29 00:12:59 -04:00
Chris Breiding 7f1a69f20e Add 'after:screenshot' plugin event (#2058)
- Fixes #2039
- Fixes #2040
2018-06-28 23:11:43 -04:00
Brian Mann dc28e87fb8 add support for handling event streams / server sent events / SSE (#2054)
* WIP: fixing SSE

* adds tests and error handling for event streams

* fixes failing tests due to request dep upgrade

* whoops, make sure e2e tests finish. add snapshot
2018-06-28 06:22:38 -04:00
Brian Mann 98fc4bc83c screenshot perf and high dpi res (#1864)
- fixes #1857 
- fixes #1863
2018-06-18 03:15:02 -04:00
Chris Breiding 0e2246785c Screenshot fixes/enhancements (#1858)
* create directory path from screenshot name

* fix screenshot e2e specs

* ensure unique file paths for non-named screenshots

* append failure screenshots with ‘— failure’

* fix snapshot differences caused by slow computer

* fix driver specs

* fix minutes/seconds e2e snapshot replacer

* fix minutes/seconds e2e snapshot replacer again

* fix e2e specs failing due to screenshot path differences

* more snapshot fixes

* more snapshot fixes

* more snapshot fixes

* fix reporter showing wrong path for nested spec when no tests

* nest non-named screenshots in path based on spec path

* fix specs

* fix snapshot

* test that server + project state is reset between specs in cypress run mode

* rename spec.path to spec.relative. pass around the spec object instead of a string path

- store state on the project for current spec + browsers
- simplify how desktop gui passes around spec object
- fixes #1921
- make all specs a real spec model
- rename ‘Run all tests’ to ‘Run all specs’

* remove pretty-error dependency

* fixes #1919 and #1918, add Cypress.spec and Cypress.browser

* fixes all the failing tests

* fixes failing tests

* types: Cypress.spec

* add types for Cypress.browser

* fixes more failing tests

* enable null for spec props when running "All Specs"

* read comments per PR

https://github.com/cypress-io/cypress/pull/1858#issuecomment-396121876

* fixes failing tests

* fix linting

* fix types assertion

* fixes failing tests

* fixes failing tests, update from -- failed to (failed)

* ugh regexp

* fixes more tests

* add name, specName, and testFailure to the afterScreenshot props

* fix failing tests. append (failed) for failed screenshots

- use { testFailure: true } to indicate a failing test screenshot for
use in props
2018-06-17 20:01:27 -04:00
Chris Breiding d1fe365eca Add cy.task() command (#1422)
* server: handle undefined values from plugins

* server: have plugins process inherit stdio

so console.logs and such from plugins file come through

* add cy.task()

* server: fix config spec

* driver: fix task spec

* server: change ‘task’ to ‘task:requested’

* server: have ‘task’ event take object literal instead of function

* server: document how to run individual integration and e2e tests

* fix cy.task specs

* server: fix task e2e spec

* ensure stack trace comes through for task error

* don’t show stack for ‘known’ user errors

* add types for cy.task

* @sandbox -> sinon

* add e2e spec for task returning undefined

* update readme re: e2e —spec

* timedout -> timedOut

* new Promise + setTimeout -> Promise.delay

* improve cy.task() error messages

* fix specs
2018-05-15 20:49:20 -04:00
Brian Mann 40813b1954 Issue 416 431 681 980 1248 (#1583)
* extract random string to util

* run specs in isolation, aggregate totalFailures, display output per spec, enable globbing for specs

* extract electron app ready into its own module

* WIP: e2e tests around spec isolation, snapshots, stdout, and complete test results

* removed unused and deprecated remove id's feature

* move fs_warn to fs util to promisify an fs singleton

* create a glob singleton util

* cleanup dead removeIds code

* extract files controller specs into its own file

* extract finding specs out of project instance into its own utility with no state

* use glob util singleton

* use fs util singleton

* lots of formatting and cleanup

* fixes failing headless specs

* fixes all failing unit tests

* fixes failing integration test

* WIP: temporarily throw old error msg

* WIP: skip failing --record integration tests for now

* fix failing e2e tests
2018-04-14 23:13:44 -04:00
Brian Mann 81294562e3 server: fix snapshots, and don't print warnings when socket has been ended 2018-01-06 18:15:10 -05:00
Brian Mann 191dbfb354 server: fixes #691, add event for exposing browser launch args (#1078)
* server: fixes #691, add event for exposing browser launch args

- enable special handling of ‘—load-extension’
- add e2e / integration / unit tests
- handle both chrome + electron cases

* server: iterate on failing tests, don't strip electron options else we lose valuable properties

- add better debugging

* server: fix failing tests, browsers needed

* server: send in a complete browser object for 'before:browser:launch'

- useful for doing conditional things with version and/or path
2017-12-17 16:57:26 -05:00
Jamie 875e378930 feature: Update cy.visit to allow for visiting non-2xx response pages when option set (#982)
* Update requestUrl method to accept options param

* Update requestUrl to only throw error when failOnStatusCode option is true

* Set the default option value for failOnStatusCode to true

* Pass options to requestUrl call

* Update _onResolveUrl to take an options param

* Update _onResolveUrl to set domain for invalid status codes when visitable

* Update socket delegator to pass options arg to onResolveUrl

* Add server test case for new functionality around resolving non-2xx responses

* Add new driver test routes

* Add driver pkg test case for visiting non-2xx pages

* Add error test for edge case when non-2xx and non html response

* driver: normalize error messages by reducing 2 or more new lines into only 2 new lines

* driver: make test server routes clearer, remove unused route

* driver: simplify accepting bad status codes logic

- keep the isOkStatusCode logic in the server only, instead of also
putting it in the driver
- update the tests accordingly
- remove test that was unnecessary

* driver: add error message for explaining how to test bad status codes

* server: fix failing snapshot tests due to error message changes new line normalization
2017-12-03 17:10:49 -05:00
Chris Breiding 915264f834 Fix firing 'watched:file:changed' twice on change (#975)
* server: upgrade browserify preprocessor to 1.0.1

* server: rename preprocessor config to file object

* server: normalize path when removing preprocessor file

* server: only add one listener for file:updated in socket

previously, a listener would be added for every spec file opened, linearly increasing how many watched:file:changed events would be fired when a single file changed
2017-11-29 13:33:12 -05:00
Chris Breiding 1ec6f7815f Create plugins API and add preprocessor plugin support (#888)
* fix broken menu specs

* extract browserify code and create preprocessor abstraction

* server: remove unused code

* server: implement logic for importing preprocessor

* server: add eslintrc and ignore test fixtures

* server: implement plugins API

* server: add node_cache module to manage clearing a package and its dependencies

* server: clear plugins file from cache to re-require it

* server: set pluginsFile to absolute path

* server: add debug logging to plugins

* server: watch pluginsFile

* server: throw the right error when requiring plugins file

* server: organize config folders and keys visually

* server: scaffold plugins file

* server: require plugins file via nodeCache.require

* server: update browserify preprocessor name and point to github for now

* server: remove redundant integration tests

* server: always scaffold plugins file, except when falsey

* server: add plugins file test to scaffold spec

* server: always provide util.fileUpdated to preprocessor

* server: update browserify-preprocessor dep

* server: fix integration tests

* server: remove redundant logic

* server: catch errors thrown synchronously by plugins function

* server: reduce chances of flakyness in async test

* driver: fix broken spec

* server: don’t check for dirname of supportFile and pluginFile when we know they’re already a directory

* driver: there is no dist

* server: update default options sent to browserify preprocessor

* server: send config into browserify instead of options

* server: add test around default preprocessor

* server: update browserify preprocessor

* server: refactor events spec to better handle multiple calls to handleEvent

* server: add tests around project:open events

* server/desktop-gui: handle errors when plugins file changes

* server: fix events spec

* server: allow any file types to be spec files

* server: validate config.pluginsFile

* server: remove link to error doc

* server: improve plugins error message

* server: simplify example plugins file

* server: on:spec:file:preprocessor -> file:preprocessor

* server: wrap plugins in a child process

* server: rename specsGlob to testFiles

* server: bump browserify-preprocessor ‘version’

* server: fix references left by merge

* server: fix incorrect function names

* server: fix plugin error serialization

* server: display error if plugins process has an uncaught exception or unhandled rejection

* server: reset domain on reset

* server: exit early on plugin error headlessly

* server: add e2e tests for plugins/preprocessors

* server: remove obselete node cache file

* server: fix integration tests

* server: log plugins error before exiting

* server: use npm version of browserify preprocessor

* server: extract string-splitting function

* socket: use path.join in spec

* server: eslint ignore scaffold files

* server: fix scaffolded plugins file links, add snapshot test

* server: if app_spec runs, cause a failure [skip ci]

- tested locally
2017-11-19 23:20:54 -05:00
Brian Mann e9a08bfee3 driver, server: normalize backend:request and automation:request API's 2017-08-13 22:44:15 -04:00
Brian Mann 4089c5c240 driver: WIP continued converting navigation specs
- make existingState local to socket listening
- consolidated preserve:run:state as backend request
- fix state bugs with runner
- make navigation work across domain changes
2017-08-07 01:06:59 -04:00
Brian Mann 81e759544e driver: must set log props default to empty obj 2017-07-17 01:14:57 -04:00
Brian Mann 4a1e371775 driver: normalize backend:request events, promisification, error handling, socket messaging 2017-07-13 22:15:03 -04:00
Chris Breiding 143d5ac990 server: pass through project path so state gets saved per-project 2017-06-29 16:45:20 -04:00
Gleb Bahmutov 77cbe7c599 server: do not try to bundle __all spec - there is no spec, close #137 (#138)
* server: do not try to bundle __all spec - there is no spec, close #137

* server: fix socket 'save:app:state not correctly saving state in project

* server: fix broken socket_specs

* server: add simple unit test to socket __all test file watch
2017-06-07 09:55:58 -04:00
Gleb Bahmutov 98e804990c WIP: rework saved state to be saved per project (#101)
* server: use package name to hash state folder

* unit test saved state hash utility

* server: use package name to hash state folder

* unit test saved state hash utility

* server: update unit tests to per-project state

* server: fix remaining unit tests after changing state to per project

* start e2e tests for saved state

* force state save and check if file was saved

* server: integration test for state saved per project, close #113
2017-06-01 00:02:48 -04:00
Brian Mann 817758e4b6 all: symlink all cypress packages in root node_modules for easy access 2017-05-31 12:51:35 -04:00
Brian Mann 71f07c2512 server: rename packages/app -> packages/server 2017-05-09 13:51:45 -04:00