Commit Graph

202 Commits

Author SHA1 Message Date
Jennifer Shehane
125a810bb4 fix: Improve error message when binary not executable (#8438) 2020-09-11 12:23:29 -04:00
Zach Bloomquist
fe4e11ec6e feat(cli): install pre-release binaries by computing binary URL from NPM URL (#8483) 2020-09-08 17:44:37 -04:00
Gleb Bahmutov
ef2363ea78 cli: expose method that parses cypress run CLI logic (#7798)
Co-authored-by: Zach Bloomquist <github@chary.us>
2020-07-14 15:39:17 -04:00
Gleb Bahmutov
653739bb5c Handle --project "" command line argument (#7744)
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2020-06-22 14:34:59 -04:00
Steve
768da16a5e feat: add quiet cli arg/module option (#7714)
* Option to disable Cypress the verbose results to stdout

--quiet mode to disable the verbose results to stdout
but still use specified formatter

* Update cli/schema/cypress.schema.json

Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>

* Cypress module support for --quiet

Cypress module support for --quiet

* Apply suggestions from code review

Co-authored-by: Zach Bloomquist <github@chary.us>

* Address feedback

Address feedback, thanks

Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
Co-authored-by: Zach Bloomquist <github@chary.us>
2020-06-22 11:10:35 -04:00
Gleb Bahmutov
3b6514399d Do not silence cli commands (#6909)
* always log cache path

* cache list always logs

* cypress version should always log result
2020-04-01 11:44:27 -04:00
Zach Bloomquist
d810950379 Switch request, request-promise to @cypress/ forks (#6777) 2020-03-19 11:48:24 +06:30
Zach Bloomquist
47410d50e5 Fix "Parse Error" when performing HTTP requests (#5988)
* Detect if NODE_OPTIONS are present in binary; if not, respawn

* Always reset NODE_OPTIONS, even if no ORIGINAL_

Co-authored-by: Andrew Smith <andrew@andrew.codes>

* Exit with correct code # from stub process

* Clean up based on Brian's feedback

* how process.versions is null, i have no idea, but it is

* add repro for invalid header char

* Always pass NODE_OPTIONS with max-http-header-size (#5452)

* cli: set NODE_OPTIONS=--max-http-header-size=1024*1024 on spawn

* electron: remove redundant max-http-header-size

* server: add useCli option to make e2e tests go thru cli

* server: add test for XHR with body > 100kb via CLI

* clean up conditional

* cli: don't pass --max-http-header-size in dev w node < 11.10

* add original_node_options to restore o.g. user node_options

* force no color

* Revert "Use websockets to stub large XHR response bodies instead of hea… (#5525)"

This reverts commit 249db45363.

* fix yarn.lock

* update 4_xhr_spec snapshot

* make 6_visit_spec reproduce invalid header char error

* pass --http-parser=legacy

* still set headers if an ERR_INVALID_CHAR is raised

* add --http-parser=legacy in some more places

* update http_requests_spec

* readd spawn_spec

* improve debug logging

* remove unnecessary changes

* cleanup

* revert yarn.lock to develop

* use cp.spawn, not cp.fork

to work around the Electron patch: 39baf68790/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch

Co-authored-by: Andrew Smith <andrew@andrew.codes>
2020-03-18 17:26:22 -04:00
Jennifer Shehane
c40461fa22 Don't print 'first time' message if verification is running fro… (#6640)
* don't like 'first time' message if verification is running from 'cypress verify'

* updates snapshots to remove 'first time message' from verify specs
2020-03-16 12:18:38 +06:30
Gleb Bahmutov
2a0bc32700 cypress cache list prints last accessed date (#6627)
* get last access timestamps and print with cache versions

* remove done TODO

* start trying to save HTML but only after snapshot text is confirmed

* store cli test output HTML as static pages

* set our color for table heading

* make code readable

* lock file again

* update saved HTML file

* refactor cache spec

* add test with no access time:
2020-03-09 09:27:54 -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
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
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
09cdcdf0cb Fix cypress cache subcommands (#6348) 2020-02-06 12:58:06 -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
Chris Breiding
c491a3eda5 Merge branch 'develop' into v4.0-release 2020-01-29 12:47:11 -05:00
Gleb Bahmutov
9ac5fe3935 add unit test for xvfb options -screen 2020-01-22 12:41:14 -05:00
Lukas Weber
ee0d6fac91 fix: set explicit screen when spawning own xvfb (#6199)
fixes `cypress verify` crashes on Ubuntu 18
2020-01-22 12:35:08 -05:00
Gleb Bahmutov
e389db4089 Move binary state file to be in the version folder of the cache (#6090)
* WIP: small refactoring for clarity

* move binary state file to version dir

* add issue link
2020-01-06 16:32:03 -05:00
Zach Bloomquist
b130ffca87 Prevent Cypress from showing 200% unzip progress (#6009)
* Prevent unzipWithNode from getting called twice

* fix unzip test

* add unit test to check if unzip is called once

* add unzip test for Darwin

Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-12-26 12:37:09 -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
Chris Breiding
62fde51d84 update cli to work with latest commander.js 2019-12-10 10:03:58 -05:00
Jennifer Shehane
692a3c07d9 Support --tag argument (#5164)
* Alphabetize cli options for my own sanity

* begin added tag flag

* Fix some minor grammar in cli help output + be more specific for specs description

* update snapshot based on alphabetization change

* update snapshot to include --tag in help output

* update logic for pulling out space delimited args to look through --tag and --spec flags dynamically

* Support and pass along tag flag to run and record

- show err if passed without record flag
- sanitize args into comma separated string
- display tag in record errors

* fix some tests/snapshots where 'tag' was missing

* Actually try passing in tag through tests to ensure it prints.

* Merge branch 'develop' into issue-2561-tags

# Conflicts:
#	cli/__snapshots__/cli_spec.js
#	cli/lib/cli.js
#	cli/lib/exec/run.js
#	packages/server/lib/modes/run.js
#	packages/server/lib/util/args.js

* Send 'tags' as an array to backend API

* Update json-schemas to query against 2.2.0 of postRun

- this will require a bump to json-schemas repo

* update test to reflect tags array

* update snapshot to display nightly tag

* rearrange args to alphabetical order in specs

* Add tags to runResponses / remove tag from incorrect instance post

* Fix failing specs / snapshots

* Update error messages + snapshots

* Fix snapshot that no longer displays tag arg

* fix args unit test

* remove extra slash

* add a few more cli tests

* another test just in case

* a quick unit test for displayFlags utility


Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-12-05 23:02:14 +06:30
Gleb Bahmutov
370eb6ab0f pass -- as an argument from CLI to Electron application to avoi… (#5853)
* if cypress gets -- as leading argument, remove it

* start Eletron app args with --

* remove only

* update CLI to pass --no-sandbox before -- separator

* remove -- from args in cypress server

* do not use --no-sandbox in CLI when running in dev mode
2019-12-04 10:13:55 -05:00
Zach Bloomquist
02515fec61 cli: unnzip Cypress using unzip utility on Linux (#5851)
* unzip using 'unzip' utility on linux

* add example unzip test
2019-12-03 09:19:12 -05:00
Gleb Bahmutov
64f5bf0870 catch child process killed with a signal (#5810)
* WIP: catch child process killed with a signal

* unit test getError

* we don't need custom exit code

* Update cli/lib/exec/spawn.js

Co-Authored-By: Zach Bloomquist <github@chary.us>

* Update cli/lib/errors.js

Co-Authored-By: Zach Bloomquist <github@chary.us>

* update snapshots with wording
2019-11-27 15:21:47 -05:00
Gleb Bahmutov
8c911a58ae cli: remove any leftover double quotes from group and ci build… (#5692)
* cli: remove any leftover double quotes from group and ci build id CLI args

* call function directly
2019-11-15 11:59:45 -05:00
Zach Bloomquist
73a76cc600 Revert "Always pass NODE_OPTIONS with max-http-header-size" (#5522)
This reverts commit 978d97ee6d.
2019-10-29 13:45:58 -04:00
Zach Bloomquist
978d97ee6d Always pass NODE_OPTIONS with max-http-header-size (#5452)
* cli: set NODE_OPTIONS=--max-http-header-size=1024*1024 on spawn

* electron: remove redundant max-http-header-size

* server: add useCli option to make e2e tests go thru cli

* server: add test for XHR with body > 100kb via CLI

* clean up conditional

* cli: don't pass --max-http-header-size in dev w node < 11.10

* add original_node_options to restore o.g. user node_options

* force no color
2019-10-25 16:59:35 -04:00
Gleb Bahmutov
fcc252e94d Always use --no-sandbox with Electron on non-Windows system (#5458)
* WIP: add failing test job with non-root user

* change paths to node user

* print more info

* always use --no-sandbox when starting Electron on non-Windows OS

* add another test job that runs as a root

* use tilda

* use 12.0.0 image

* rename job
2019-10-25 10:54:03 -04:00
Zach Bloomquist
74a174bc82 Close CLI when exit event fires (#5413)
* Close CLI when exit event fires

* fix debugging for code and signal

* add test for exit before close

* template quotes -> single quotes

* resolveOn
2019-10-22 16:53:55 -04:00
Gleb Bahmutov
dd70563809 cli: detect installing from postinstall hook (#5407)
* cli: detect installing from postinstall hook

* add unit tests
2019-10-22 11:56:52 -04:00
Gleb Bahmutov
128d4392ae parse ~ in CYPRESS_CACHE_FOLDER env variable (#5393)
* parse ~ in CYPRESS_CACHE_FOLDER env variable

* linting
2019-10-17 11:47:29 -04:00
Ben Kucera
653f52dc3c upgrade eslint-plugin-dev to 5.0.0 (#5382)
* upgrade eslint-plugin-dev to 5.0.0

* more [lint fixes]
2019-10-17 11:40:53 -04:00
Zach Bloomquist
ddf9707e6b Catch & ignore ENOTCONN errors when piping Cypress subprocess (#5293)
* Catch & ignore ENOTCONN errors when piping Cypress subprocess

* Update https-proxy-agent to point back to original repo
2019-10-07 20:19:03 +03:00
Zach Bloomquist
49f5b3e80c Introduce --config-file argument (#3246)
* cli, server: introduce --config-file argument

* server: remove unused import

* server: wip

* server: consider --config-file in settings

* server: pass options to settings.read from config

* server: store options in Project class, pass to all settings calls

* server: _initPlugins needs to accept options, for being called from server

* server: accept optional external options in open

* cli: update help snapshots

* server: realizing now that these were written like this so they could be stubbed - removing some unnecessary usages of @options

* cli: pass configFile when it's false

* server: --config-file false and --config-file blah.json work

* server: add unit tests for --config-file

* server: pass configFile to desktop-gui

* desktop-gui: display 'cypress.json' according to --config-file arg

* desktop-gui: add integration tests for --config-file

* cli: add tests for --config-file

* PR changes

* PR changes

* cli: update snapshots

* server: updating error messages

* runner: update cypress.json mention

* fixing name overlap

* server: integration tests for --config-file

* runner: update Header component tests

* cli: fix snapshot

* desktop-gui: fix test

* driver: fixing error messages - not really any visibility to cli args from here so just static strings

* server: update snapshots

* server: update snapshots

* cli: updating snapshot

* driver: how did i miss this?

* add skipped blank line to the snapshot

* fix missing proxy require statement (was lost in merge of develop)...weird

* add module API defs to types

* module API tests

* send better error when config file can't be found

* fix dtslint test

* update cli help to use 'configuration file'

* update snapshot using 7.7.1 in place

* fix failing config_spec

* be.visible

* show custom config file name in driver errors

* add tests for non-default config file in driver error messages

* single-quote config file name

* 🙅 IIFEs 🙅

* 🤦

* fix failing test

* fix failing test, cleanup

* lint

* delete duplicate coffee spec

* Update run.js

* Delete app_spec.js.mp4

* in open mode, only store projects to recents list if 'cypress.json' is the configFile

discussion: https://git.io/JeGyF

* feedback
2019-09-27 10:25:07 -04:00
Gleb Bahmutov
122a858607 add --no-sandbox to spawn (#5209)
* add --no-sandbox to spawn

* update tests to not require no-sandbox argument

* injecting test-runner:integration-tests for jobs that need to record to the dashboard

* add --no-sandbox positive test

* add comment
2019-09-26 14:58:41 -04:00
Gleb Bahmutov
73e3c7c346 add sandbox argument to [build binary] (#5197)
* add sandbox argument to [build binary]

* relative path

* ughh [build binary]
2019-09-25 08:03:03 -04:00
Zach Bloomquist
7c68c41e88 add --no-sandbox to smoke test (#5196)
* add --no-sandbox to smoke test

* Update verify.js

* appease linter [build binary]

* Update verify_spec.js

* [build binary]

* add test [build binary]

* Update verify_spec.js

* Update verify_spec.js

* update unit test
2019-09-24 21:49:38 -04:00
Gleb Bahmutov
9f082d97ca Catch env variable with reserved name CYPRESS_ENV 1621 (#1626)
* server: check CYPRESS_ENV variable when merging configs

* catch invalid CYPRESS_ENV value in CLI, close #1621

* linting

* sanitize platform in test snapshot

* linting

* update error message text

* add missing comma

* fix finally merge in JS code

* pass CLI linter

* fix log reference, should be debug

* use correct sinon reference

* update message, show first part in red

* update error message text
2019-09-23 11:59:49 -04:00
Gleb Bahmutov
084f25f092 cli: fix the STDIN pipe on Windows (#5045)
* cli: pipe stdin

* uggh, here is the actual change

* update cli unit tests

* add unit test
2019-09-19 13:49:57 -04:00
Gleb Bahmutov
cd8da7d5d6 fix: increase XVFB timeout from 5 seconds to 30 seconds 2019-09-10 08:33:07 -04:00
Gleb Bahmutov
11784c3af2 CLI: increase smoke test timeout to 30s (#4859)
* CLI: increase smoke test timeout to 30s

* hmm install reformarrted some files

* remove formatting changes

* update unit test

* add small test to confirm timeout property

* revert example changes
2019-07-29 12:59:12 -04:00
Jennifer Shehane
a7dfda9865 Show warning when binary is run directly (outside npm module) (#4701)
* commit previous changes made by @bahmutov for #1573

* Pass '--run-from-cli' flag through ping test in order to prevent warning from printing

* woops, require 'argsUntil'

* 'headed' was changed to 'interactiveMode'

* fix duplicate misspelled require

* tighten up args utils and cleanup decaf garbage

* cleanup errors.log to take a cb and conditionally be async

* remove extraneous --run-from-cli argument, consolidate to use --cli

- update tests

* fixes tests, ensure that record.createRun() always returns a promise

* refactor tests to handle new errors.logException interface

* make logException always return a promise, cleanup interface, add test

* fix linting errors


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-07-29 07:33:33 -04:00
Zach Bloomquist
79c7a6c36a Mention HTTP_PROXY if download error occurs; fall back to NPM's… (#4705)
* Mention HTTP_PROXY if download error occurs; fall back to NPM's proxy config in install

* better debug logs

* snap-shot-it@7.7.1 -> 7.8.0

* respect npm_config in server, add debug logs for proxy
2019-07-15 15:21:48 -04:00
Ben Kucera
fbd523615e [internal] Lint typescript, json, new eslint rules (#4449)
* temp 07/01/19 [skip ci] main lint files

* use lint-staged scripts

* fix all auto-fixable eslint errors

* manually fix lint issues in files

* temp 07/01/19 [skip ci]

* bump eslint plugin versions, update circle.yml

* [lint fix] remaining js files

* update vscode/settings.json

* add back stop-only

* use stop-only for linting .onlys

* fix verify_spec, build_spec

* update json plugin

* relint & apply corrections

* fix appveyor.yml not cleansing env vars (very bad)

* dont echo commit message in appveyor script

* retry build &

* re-add & upgrade lint-staged

* update contributing docs

* only let stop-only catch staged changes
2019-07-12 13:59:44 -04:00
Gleb Bahmutov
c57d302176 Verify downloaded test runner zip file 812 (#4193)
* if download has checksum use it to verify downloaded file

* check only filesize if no checksum available

* add download tests

* move checksum into util for reuse, be explicit

* add comments explaining headers used to verify checksum

* move hasha to dev dependency

* remove unnecessary function

* do not use deprecated Promise.join with spread

* fix promise join callback

* linting
2019-07-09 14:03:00 -04:00
Gleb Bahmutov
db62738209 Clean env variable CYPRESS_INSTALL_BINARY before checking (#4579)
* fix: trim and remove double quotes around CYPRESS_INSTALL_BINARY

* linting

* add one more unit test for dequote

* add one more unit test

* fix jsdoc

* a few more edge unit tests
2019-07-08 13:41:44 -04:00
Brian Mann
93b3edaab6 ignore garbage render worker errors coming from electron (#4644)
* ignore garbage render worker errors coming from electron

* add tests
2019-07-03 14:08:07 +02:00
renovate[bot]
a3daee100b fix(deps): update dependency request-progress to version .x 🌟 (#4584)
* fix(deps): update request-progress to 3.0.0 🌟

* Added method to utils to convert percent value to percentage

- Wrote unit tests for both calculateETA and the percent to percentage
conversion


Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-07-01 09:07:33 +06:30