Commit Graph

371 Commits

Author SHA1 Message Date
Ben Kucera dd51b41ae2 render ansi colors for file:preprocessor error message (#6535)
* show colored spec compile errors in browser reporter
2020-03-10 10:24:11 -04:00
Jennifer Shehane 2ba53f6837 Better handle reserved key CYPRESS_ENV being set by users to va… (#6437)
* Add warning when setting CYPRESS_ENV to non-production value

* Add warning and update error when setting CYPRESS_ENV in config to non-production value

* Update config test/to throw

* we want warning, not throw

* Rename env var to CYPRESS_INTERNAL_ENV + fix warning to actually warn when staging

* update cli snapshot to include new 'info' command

* yarn.lock

* removed the warning from config, is overboard on our own tests 😓

* cleanup from review

Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2020-03-06 16:53:48 +06:30
Chris Breiding e93e6ae0b4 Validate plugin event registration (#5356)
* Turn exception message into something human readable

* Pass ipc as parameter to invoke function

* Creating file to validate event name and handler

* Creating tests to validate_event

* Remove ipc from invoke parameter

* Removing ipc parameter being passed to validateEvent

* convert spec to js

* increase line-height for plugins error message

* refactor error messages and implementation

* fix race condition where async error in plugins file could hang run

a quick async error at the root of the plugins file had the potential to hang the run because the ‘exitEarlyWithErr’ listener was registered later than that error was emitted

this enables that error to be tracked so we can properly exit at the appropriate time

it also refactors run.js to not rely on an event emitted on the project and instead passes through an onError handler, which makes more sense since the event was only used in run.js (except for one case). it also makes for easier unit testing

* fix missing reference

* fix duplicate reference

* fix args being passed in incorrectly

* fix way args were handled in server.open

* fix exit early implementation

* fix duplicate logging

* fix unit test

* update snapshot

* fix missing reference

* add e2e test to cover plugin registration validation

* clean up after merge

* add back snapshot

* fix e2e tests

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-03-05 16:00:42 -05:00
Chris Breiding edb9a98268 Allow %, &, and ? in spec file name. (#6539)
* Allow %, & in file name.

* Extract escapeFilenameInUrl

* Fix tests.

* Add test for ? (non-Windows).

* Remove platform condition. And handle when special chars are in the dir.

* Fix failure.

* Fix failure.

* add e2e test for specs with special characters

* minor refactor

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-03-05 12:21:29 -05:00
Chris Breiding 474b80a50f Fix race condition when there's an early asynchronous error in… (#6610)
* fix race condition when there's an async error in root of plugins file

* return the promise

* fix routes creation

* fix tests

* fix error throwing and add tests

* update snapshots

* revert changes to server.open signatures in tests

* fix test

* properly wrap error so it doesn't log twice

* slow down test to ensure plugins error occurs before run is over

* wait to log early exit error until after run start
2020-03-04 11:59:01 -05:00
Zach Bloomquist a4b11e1928 Use CDP to record video for Electron, record video in Electron… (#6632)
* Use CDP to record video for Electron

* Enable video recording in Electron headed

* Test video in headed + headless for all browsers

* Update e2e tests
2020-03-03 15:42:43 -05:00
Zach Bloomquist 483d494557 Reconnect to CDP on WebSocket failure (#6532)
* wip: reconnect to CDP automatically

i think we should not do this, see:
https://github.com/cypress-io/cypress/issues/5685\#issuecomment-589732584

* reconnect to CDP automatically

* cleanup

* fix unit tests

* update snapshot

* replace automation client disconnected line
2020-02-28 15:28:48 -05:00
Chris Breiding 778321786f Pass projectRoot and configFile to plugins file through config (#6317)
* decaffeinate: Rename index.coffee from .coffee to .js

* decaffeinate: Convert index.coffee to JS

* decaffeinate: Run post-processing cleanups on index.coffee

* refactor decaffeinated plugins/index.js

* decaffeinate: Rename 3_plugins_spec.coffee from .coffee to .js

* decaffeinate: Convert 3_plugins_spec.coffee to JS

* decaffeinate: Run post-processing cleanups on 3_plugins_spec.coffee

* fix wrongly removed return

* refactor e2e plugins spec, update snapshot

* pass env argument to plugins file

* decaffeinate: Rename index_spec.coffee from .coffee to .js

* decaffeinate: Convert index_spec.coffee to JS

* decaffeinate: Run post-processing cleanups on index_spec.coffee

* update plugins tests

* update scaffold snapshot

* add back server test script and document running individual tests

* add projectRoot and configFile directly to config

* normalize browsers in snapshot

* add types for configFile and projectRoot

* fix linting issues

* return return

* Merge

* remove file

* remove unnecessary returns
2020-02-28 14:13:36 -05:00
Jennifer Shehane b4f6f0c566 Set window size to a better default size when running Chrome he… (#6440)
* Set window size to a better default size when running headless in chrome

* add test for spawning in 720p

Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
2020-02-28 09:35:05 +06:30
TomaszG 9a78515f70 Issue 6231 use more information from gitlab (#6561)
* #6231 use more CI information from GitLab

* issue-6231 fix spec provider tests

* issue-6231 use GitLab CI Repository URL instead of Project URL as remoteOrigin commit param
2020-02-27 14:20:42 +06:30
decaffeinate 7f8f602781 decaffeinate: Run post-processing cleanups on index_spec.coffee 2020-02-25 09:37:14 -05:00
decaffeinate 1e66229925 decaffeinate: Convert index_spec.coffee to JS 2020-02-25 09:33:58 -05:00
decaffeinate 5ef5b1029c decaffeinate: Rename index_spec.coffee from .coffee to .js 2020-02-25 09:33:56 -05:00
renovate[bot] eab801ae3f chore(deps): Update dependency eslint to version 6.8.0 🌟 (#6509)
* chore(deps): Update eslint to 6.8.0 🌟

* fix missing dangling commas for linter

* fix missing dangling commas for linter

* more lint fixes

* yarn lock

Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-02-25 00:09:47 +06:30
Jennifer Shehane e0736b1358 remove 'electron' as known browser family during validation err… (#6517)
* remove 'electron' as known browser family during validation error.

* fix tests that had unexpected results because fixture has invalid family name set

* whoops, missed updated one family in the spec

* missed another snapshot change
2020-02-21 10:41:18 +06:30
Gleb Bahmutov 070fceff20 add "cypress info" command (#6372)
* WIP: add cli info command to list detected browsers

* print found browsers

* change to list

* start work on info command calling into binary

* move info command into binary

* print OS info during cypress info command

* add binary cache path to info command

* add browser profile path

* add memory

* get browser profile path without partition

* pick real browsers as examples

* output same info as desired

* better names

* changed colors

* add list of cached binary versions

* do not put stable into name

* add underlined link

* conditionally show profile path, only if the folder exists

* do not list cached binaries

* human-friendly memory print

* print env proxy vars

* print CYPRESS_ env variables

* use _.sample

* update order

* store cypress info output on CI as HTML page artifact

* add percy CLI screenshots

* sanitize cypress info command

* store CLI snapshots in cli/visual-snapshots folder

* update cli unit snapshot

* add cli unit test

* start e2e testing for cypress info

* add test with proxy and cypress vars

* make sure we call the binary

* stricter start check

* start unit testing modes info

* test info mode browser print

* add test for profile path

* add cypress info command to test binary Circle job

* add cypress info to test-binary-as-specific-user circle

* print cypress info --dev on circle and on appveyor

* update .gitignore

* move error in environment load to debug
2020-02-20 10:54:25 -05:00
Zach Bloomquist dd3b63aa0b Update project error UI (#6432)
* update default title to "an unexpected error occurred"

* show stack trace in error, if avail

* add "copy to clipboard"

* wrap browser errors

* add tests

* improve md formatting

* update desktopgui tests

* update
2020-02-14 16:29:51 -05:00
Zach Bloomquist 15c3e95429 Improve error experience when visiting outside of Cypress-launched browser (#6435)
* force websockets transport

* wip: ensure ws connections take place thru a known socket

* clean up yesterday's work

* remove dead code (request is undefined)

* update websocket tests

* add websocket tests

* update socket + server specs

* add token auth for file_server

* Fix cy.visit file_server

* restrict non-proxied URLs, serve error on runner URL non-proxied

* add e2e test for server splash page

* fix types

* use clientRoute, fix tests

* only run 6_non_proxied in electron

* use browser.path

* improve empty options type

* add ws assertions in e2e tests

* fix server_spec

* refactor socket whitelisting logic

* update server_spec

* respond to PR feedback

- added tests for non-clientRoute redirecting to clientRoute when not behind proxy
- cleaned up comments
- cleaned up logic in server.coffee
- moved error html to own file
- added unit test for socket whitelist + fixed removal bug
2020-02-14 16:21:36 -05:00
Alejandro Estrada d9c83dcd4e Read additional optional GH actions environment variables (#6394)
* Update GH actions env vars

* Add GITHUB_REPOSITORY env

* Fix test

* Remove unused env

* Add GH branch

* Revert format changes

* Add new test
2020-02-13 12:41:07 -05:00
Zach Bloomquist 3007c4f354 Pass -no-remote when launching firefox (#6400)
* pass -no-remote when launching firefox

* use name-channel for profile directories in FF

* Revert "use name-channel for profile directories in FF"

This reverts commit dcfa147415.

* Move profiles into name-channel directories

* fix e2e test
2020-02-10 13:46:17 -05:00
Zach Bloomquist ca46c1606f Handle errors during initial Marionette connection (#6370)
* use Promises driver and handle connection errors

* repin marionette-client dep

* --compilers... so our tests run....

* update firefox spec

* fix failing specs from tests not running

* update error with a hint

* fix the other on

* tests
2020-02-07 17:27:45 -05:00
Chris Breiding d76123b3d9 Add Firefox support (#1359)
Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-02-06 10:52:13 -05:00
Zach Bloomquist 7019a0bfef updates to electon extensions
- Windows.resetExtensions => removeAllExtensions
- remove all extensions before installing too
2020-02-05 17:39:52 -05:00
Zach Bloomquist 291a3546da Remove --browser canary backwards-compatibility (#6333)
* remove --browser canary compatibility

* update warning when canary is passed

* add tests for --browser canary warning

* Update packages/server/test/unit/browsers/browsers_spec.coffee
2020-02-05 15:53:52 -05:00
Ben Kucera 94176149c4 deprecated before:browser:launch event (#6293)
* deprecate old API for before:browser:launch

* trigger ci

* allow chrome preferences to be overwritten in before:browser:launch

* add e2e test for chrome preferences

* add launchOptions.windowSize, refactor plugin handling into browser/utils

* async/await-ify chrome.ts, update e2e.js

* add padding to warning, allow more than 1 warning in run mode

* remove psInclude

* bump snap-shot-it, remove patch-package

* fix failing tests, tighten up code

* remove unused Promise.all

* more code cleanup from coffeescript conversion

* fix expectedExitcode

* update snapshot with cross origin error message

* more code cleanup from coffeescript conversion

* remove global state, cleanup normalizing stdout in snapshots

* fix asserting on the expected exit code

* remove firefox a default browser in e2e tests

* remove dupe const

* make onStdout return first arg by default

* remove only

* make expectedExitCode: 0 the default, remove duplicate option from all e2e tests

* fix test for electron

* reuse _getArgs() properly, tighten up dupe code, move perf e2e tests to use new e2e.it helpers

* make e2e test pass properly, and capture snapshot

- this was being overlooked because expectedExitCode wasn’t being set
(until now its the default)

* revert firefox specific changes to reduce PR diff

* remove newline

* temp 02/04/20 [skip ci]

* add more scenarios / return values

* rename plugin deprecation project fixture

* prevent warnings in run mode from being called multiple times in the same browser launch

- add plugin integration tests
- cleanup some promise code in browsers/chrome
- refactor the e2e deprecation tests

* update e2e deprecation specs, test that deprecation warning is displayed once per spec on a run

* cleanup let -> const, coffescript conversion

* bump snap-shot-it, remove patch-package

(cherry picked from commit ba23be5349)

* bump cli snap-shot-it

* cleanup: let -> const, parseFloat, formatting

* revert cross origin normalization

* fix spacing

* add types for plugin events

* dont pad warning message in run mode

* add e2e test for adding extensions before:browser:launch

* fix failing electron unit test, consolidate creating default launch options

* add extensions for electron + warning if install fails

* fix failing tests, yield the right before:browser:launch args signature

* e2e test electron via devtools extension

* remove .only

* add stdout assertions to e2e/1_deprecated_spec

* remove snapshot whitespace

* rename deprecation event

* update deprecated browser launch args warning message

* throw error on unexpected bbl property

* add tests for warning + error on bbl

* update snapshot

* revive 2 useful tests to validate how launchOption args are merged

* try fix e2e fullscreen spec, update snapshots

* tighten up code for throwing errors on unknown launch options properties

- list out the unknown and expected properties using existing
conventions
- tighten up the error message a bit

* rename options -> launchOptions, add e2e test for adding unknown properties to launchOptions, removed dupe snapshots

* fix fullscreen e2e test

* only push user gesture arg if chromium

* add e2e tests for throwing + rejecting errors, run e2e tests on all browsers, avoid ps logic only in electron

* remove conditional args in fullscreen test

* dont automatically install the latest version of chrome in circle

* add stubs for new electron properties

* switch from using port 5555 to 5544 to avoid common conflicts

* temporarily commenting out windowSize launchOption so release is unblocked and all tests pass

- can add it back in later once the e2e tests pass in CI

* make the path to chrome profile correctly dynamic to account for all operating systems

* remove magic length(8) and slice out the first 4 custom args set from the plugin launch options

* add back --start-maximized in chrome

* deleting windowSize-related code... for now!

Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-02-05 13:07:59 -05:00
Ben Kucera dca481a079 Prep 4.0 launcher improvements (#6311)
* async/await-ify chrome.ts, update e2e.js

* remove psInclude

* bump snap-shot-it, remove patch-package

* fix failing tests, tighten up code

* remove unused Promise.all

* more code cleanup from coffeescript conversion

* fix expectedExitcode

* update snapshot with cross origin error message

* more code cleanup from coffeescript conversion

* remove global state, cleanup normalizing stdout in snapshots

* fix asserting on the expected exit code

* remove firefox a default browser in e2e tests

* remove dupe const

* make onStdout return first arg by default

* make expectedExitCode: 0 the default, remove duplicate option from all e2e tests

* reuse _getArgs() properly, tighten up dupe code, move perf e2e tests to use new e2e.it helpers

* make e2e test pass properly, and capture snapshot

- this was being overlooked because expectedExitCode wasn’t being set
(until now its the default)

* revert firefox specific changes to reduce PR diff

* remove newline

Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2020-02-04 05:26:32 -05:00
Gleb Bahmutov 45efc7c429 Merge branch 'develop' into v4.0-release 2020-02-03 17:25:31 -05:00
Gleb Bahmutov 76a18307f0 throw specific error when cannot parse Cypress arguments (#6280)
* WIP: throw specific error when cannot parse Cypress arguments

* test invalid config string

* add unit test

* rework error message, handle env, reporter options and config

* add args error unit tests

* rework snapshots

* use reporterOptions name

* update snapshot
2020-01-31 22:34:47 -05:00
Zach Bloomquist 0784af719c Merge branch 'develop' into v4.0-release 2020-01-31 13:31:36 -05:00
Zach Bloomquist 0e82cde8d9 Update browser types (#6254)
* update browser types and list

* add todo

* first pass of changes

* remove 'server' mode, since it is unused

* use foundbrowser type for eletron definition

* fix server unit tests

* update --browser arg to allow name:channel

* improve backwards compatibility impl

* update 3_config_spec snapshot

* fix 2_headless_spec

* fix 5_stdout_spec

* update browser icon stuff

* update 5_spec_isolation_spec snapshot

* Chrome Canary => Canary

* update user-facing types

* fix displayName type

* add debug logs

* fix cypress_spec

* taps

* update config.json
2020-01-31 12:58:12 -05:00
Zach Bloomquist d816772133 Add process profiler for debugging (#6171)
* add process profiler for debugging

* remove existing CYPRESS_MEMORY check

* rename some columns, format PIDs a little nicer, start when debug is enabled or verbosedebug is enabled

* use shared method for determining if this is the electron process running

* finish adding enhanced grouping

* cleanup

* add tests for changes to other parts of cypress

* add tests for process_profiler

* use browser displayname to group

* fix ffmpeg and add tests

Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2020-01-31 12:29:47 -05:00
Chris Breiding c491a3eda5 Merge branch 'develop' into v4.0-release 2020-01-29 12:47:11 -05:00
Jacob Salinas 1f1fed2a47 Update Bamboo variables for CI (#6158)
* bamboo variables and test

* lint fix

* fix it better, reduce indents

* Remove agentId and planKey

Co-authored-by: jsalinas405 <57186891+jsalinas405@users.noreply.github.com>
2020-01-16 22:50:08 +06:30
Gleb Bahmutov 059e802105 retry CRI.List when connecting to the browser (#6133)
* WIP: retry CRI.List when connecting to the browser

* add unit tests

* don't need to use module.exports to stub this

* use existing retry delay logic for CRI list

* add tests that stdout is correct

Co-authored-by: Zach Bloomquist <github@chary.us>
2020-01-13 10:02:06 -05:00
Quinton Aiken 12882aa4d5 Collect GitLab CI_JOB_NAME env var (#6111) 2020-01-08 13:41:55 +06:30
decaffeinate f0adc7b06f decaffeinate: Run post-processing cleanups on exit.coffee and 12 other files
Revert changes to scaffold_spec snapshot
2019-12-27 12:09:31 -05:00
decaffeinate c5f5551c35 decaffeinate: Convert exit.coffee and 12 other files to JS 2019-12-27 12:09:31 -05:00
decaffeinate 3892814c2f decaffeinate: Rename exit.coffee and 12 other files from .coffee to .js 2019-12-27 12:09:31 -05:00
renovate[bot] c3ad1a372a fix(deps): update dependency ansi_up to version .x 🌟 (#4331)
* fix(deps): update ansi_up to 4.0.3 🌟

* Update ansi_up to use new non-deprecated 2.0+ api

* Do not pass 'use_classes: true' (defaults to false) - we are expecting rgb values in our tests

* set back to use_classes

* Fix 'use_classes' option which was being incorrectly passed

Co-authored-by: Renovate Bot <renovatebot@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2019-12-20 18:31:15 +06:30
Zach Bloomquist ddc86343a1 Always use 127.0.0.1 instead of localhost for CDP (#5960)
* force ipv4 for CDP

* update tests
2019-12-20 00:21:43 +06:30
Zach Bloomquist c8b184be44 Fix cypress run --headless (#5953)
* fix chrome headless

* update tests, load absolutely no extensions

* lol

* add e2e test for '--headless' flag

* add get:screenshots:taken

* add test for window bounds

* fix --headless test

* update snapshot

* ts'ify and document functions in chrome.ts

* properly export @packages/launcher types

* fix types

* assert on window bounds in headless spec

* add navigator.userAgent test

* only run in ci

* remove test of questionable value
2019-12-16 13:10:12 -05:00
Zach Bloomquist 580898119d Fix open_project_spec (#5946) 2019-12-12 19:27:43 -05:00
Gleb Bahmutov fe44330165 pass additional Electron launch args from env variable (#5891)
* pass additional Electron launch args from env variable

* iterate over keys

* add environment test

* hmm, print error

* do not rethrow error

* do not swallow error in development, stub disable hw acc method

* use app.command.appendArgument
2019-12-12 16:10:27 -05:00
Brian Mann 6e9e6ab3c6 fix desktop gui specs not being watched for file changes (#5934)
* always null out specsWatcher so opening the project watches the specs for changes correctly

* add test, cleanup
2019-12-12 15:31:44 -05:00
Zach Bloomquist 35109fb08c Chrome headless (#5676)
* always disable xvfb

* add --headless

* Revert "always disable xvfb" - it is still needed for Electron

This reverts commit 058679f4ce.

* updates

* update 3_plugins_spec

* update wording now that chrome can be headless

* fix video recording when headless

* Don't assume that chrome is headed

* update electron video recording message

* Add 2_headless_spec for Cypress.browser values

* update headless language

* still use headless by default for electron and headed for chrome

* fix up cli

* fix e2e tests

* update npm api types

* fix 2_headless_spec

* keep alphabetical ordering

* increase binary size limit

* add a comment on the cli error impl

* use _.defaults for default for headed

* fix

* _.defaults mutates
2019-12-12 12:26:32 -05:00
Ben Kucera 8c13594b39 cleanup after decaffeinate 2019-12-11 16:48:31 -05:00
Zach Bloomquist 34037137c6 Electron upgrade (#5849)
* electron@7.x

* node12.8.1-chrome78-ff70

* Revert "node12.8.1-chrome78-ff70" for now

This reverts commit db2d521994.

* update sendCommand to log on all sendcommands

* promisification in 6.x

* Revert "Revert "node12.8.1-chrome78-ff70" for now"

This reverts commit 57fe764098.

* fix sendcommand

* fix cdp in electron

* fix desktop-gui test

* skip tests that will be fixed by #4973

* bump MAX_ALLOWED_FILE_SIZE :/

* update electron browser spec

* make new dialog code null-proof

* add failing e2e test for issue 5475

* bump electron packager

* add e2e snapshot

* update deprecated electron getters/setters

https://github.com/electron/electron/blob/7-1-x/docs/api/modernization/property-updates.md

* build and test on Mac

* move macbuildfilters to top

* 7.1.3

* electron@7.1.4


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-12-11 13:29:33 -05:00
Chris Breiding f2600b5e35 Merge branch 'develop' into v4.0-release 2019-12-09 13:46:05 -05:00
KHeo 4a2636ddd3 decaffeinate: Run post-processing cleanups on project.coffee and 3 others
decaffeinate: Run post-processing cleanups on project_spec.coffee
decaffeinate: Run post-processing cleanups on open_project.coffee
decaffeinate: Run post-processing cleanups on open_project_spec.coffee
Fixed error.
Fixed snapshot.
Removed returns.
2019-12-06 17:22:29 -05:00
decaffeinate f41b53e123 decaffeinate: Convert project.coffee and 3 others to JS
decaffeinate: Convert project_spec.coffee to JS

decaffeinate: Convert open_project.coffee to JS

decaffeinate: Convert open_project_spec.coffee to JS
2019-12-06 17:22:29 -05:00