Commit Graph

472 Commits

Author SHA1 Message Date
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
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
decaffeinate ebe6ed07c8 decaffeinate: Run post-processing cleanups on actionability.coffee and 14 other files 2019-12-11 16:42:30 -05:00
decaffeinate be49ff3354 decaffeinate: Convert actionability.coffee and 14 other files to JS 2019-12-11 16:42:29 -05:00
decaffeinate 2cdf3785ed decaffeinate: Rename actionability.coffee and 14 other files from .coffee to .js 2019-12-11 16:42:28 -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
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
decaffeinate 884ee980f5 decaffeinate: Rename project.coffee and 3 others from .coffee to .js
decaffeinate: Rename project_spec.coffee from .coffee to .js

decaffeinate: Rename open_project.coffee from .coffee to .js

decaffeinate: Rename open_project_spec.coffee from .coffee to .js
2019-12-06 17:22:29 -05:00
Zach Bloomquist 606a248fc7 Fix explicitly setting cookies in cy.visit and cy.request (#5896)
* try: options.cookies as object is not documented

* add test that demonstrates 5894

* merge user-supplied cookie header with genned one

* update 2_cookies_spec snapshot

* only consider an existing Cookie header for the 1st request
2019-12-06 15:43:22 -05:00
Zach Bloomquist 93b5c0eec2 Fix CDP cookie matching algorithm (#5862)
* use correct tough.match param order

* add chrome extension types

* fix CDP cookie matching algorithm

* improve domain suffix match

* add tests for cookie matching utils
2019-12-06 15:12:36 -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
decaffeinate 0c2b6c5826 decaffeinate: Run post-processing cleanups on cookies.coffee and 4 other files 2019-12-02 15:04:08 -05:00
decaffeinate 2a2f1fc775 decaffeinate: Convert cookies.coffee and 4 other files to JS 2019-12-02 14:35:41 -05:00
decaffeinate 17f9ed0933 decaffeinate: Rename cookies.coffee and 4 other files from .coffee to .js 2019-12-02 14:35:38 -05:00
Zach Bloomquist b0378dc04e Refactor proxy into own package, implement middleware pattern (#5136)
* renames

* Refactor proxy into own package, implement middleware pattern

don't need these mocha opts anymore

fix test

no more zunder

READMEs

fix test

* pass request by reference

* fix cors path

* Move replace_stream to proxy, concat-stream util in network

* Pin dependency versions

* Revert addDefaultPort behavior

* Add READMEs for proxy, network

* Update README.md

* eslint --fix

* set to null not undefined

* use delete and bump node types

* import cors from package now

* parse-domain@2.3.4

* proxy package needs common-tags

* move pumpify dep

* load through where it's needed, remove unused passthru_stream

* remove unneeded getbuffer call


Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-11-27 19:16:15 -05:00
Kukhyeon Heo 26ed04b637 Fixed null JSON file error. (#5562)
* Fixed null JSON file error.

* Added new fixture page to fix the failure.

* [] -> ''.

* Fixed test message.

* Asserts returned json value on the client side.

* simplify test a little, remove waits

* fixture json format


Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-11-27 10:22:50 -05:00
Zach Bloomquist 4c194fca32 Fix regression in 3.5.0 where a cy.visit that changes superdoma… (#5702)
* clean up cookies_spec in preparation for more assertions

* add test for setting 2 cookies at each redirect

* clean up tests somewhat

* add failing test

* make buffers a singleton

* do not resolve visit on superdomain change with cached buffer

* Update request_spec that expects 1 GET per visit

* update server_specs that expect 1 request/visit

* improve variable names + logging in request.coffee

* always reset buffers before test run + on visit
2019-11-26 13:39:39 -05:00
Aleksandr Elmekeev fd38e39799 Issue 5656 Fix validation of cookie domain (#5657)
* Correct domainMatch usage in request.coffee

* Correct domainMatch usage in cdp_automation.ts

* improve variable names + logging in request.coffee

* truncate screenshot data in verbose cri logs

* add some headers to maybeRetryOnStatusCodeFailure

* try: i believe the cdp_automation ordering was correct

* add add'l cookie verbose logging

* add e2e tests for this cookies bug


Co-authored-by: Zach Bloomquist <github@chary.us>
2019-11-26 12:45:41 -05:00
Gleb Bahmutov b03b25c258 feat: pass list of browsers to plugins file (#5068)
and allow project to customize the list of browsers
2019-11-19 09:02:17 -05:00
Jennifer Shehane d194914408 Get TRAVIS_PULL_REQUEST_SHA or the commit sha (#5714)
* Get TRAVIS_PULL_REQUEST_SHA or the commit sha

* add SHA to captured env vars + update tests for PR vs regular travis env vars
2019-11-18 15:33:58 -05:00
Zach Bloomquist 2efb176f50 Fix bug where cy.request does not work with followRedirect: fal… (#5704)
* add failing test

* always define currentUrl in sendPromise

* simplify test case
2019-11-15 12:16:26 -05:00
Gleb Bahmutov 95a5d17fa0 add ci variables for GitHub Actions (#5687)
* add ci variables for GitHub Actions

* update snapshot
2019-11-15 11:57:16 -05:00
Zach Bloomquist 98063aec64 Fix cy.clearCookie, fix HTTP redirect behavior, fix cy.visit HT… (#5478)
* Add a bunch of extra tests in 2_cookies_spec

* Try not doing weird things to cookies

* if cypress.env.debug is set, log command execution thru server

* improve elctron logging - we missed this when doing cri-client logging

* make video_capture frames part of verbose

* cleanup

* use the data from getCookie to run deleteCookies

* fix screenshots

* still resolve with cleared cookie

* cy.getcookie now gets ALL cookies from ALL domains

* return Promise for followRedirect, not req.init wrap

* allow passing domain: null to cy.getCookies to get all

* update request_spec to be clearer

* still need to call followRedirect option during sendStream

* beautify the e2e tests

* correct e2e test + snapshot

* always discard default ports when get/set buffer - fixes #5367

* make cy.clearCookies({ domain: null }) clear ALL cookies

* update spec

* use string url as key

* rebalance some e2e tests to make time for new cookies e2e tests

* always add default port to buffer url

* jk, remove default port

* set hostOnly: true when appropriate when setting cookies back on visit

* update tests

* Revert "if cypress.env.debug is set, log command execution thru server"

This reverts commit 623ed443d4.

* try to clean diff, cookies_no_baseurl didnt change

* WIP move the expected cookies array out of snapshot and expect inline

* finish updating tests

* add missing snapshot

* remove useless onstdout


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-11-07 19:12:27 -05:00
Zach Bloomquist 2c2549aff6 Catch stray reads/writes on destroyed stream_buffers (#5605)
* Catch stray reads/writes on destroyed stream_buffers

* tsify stream_buffer to catch anything else like this
2019-11-07 17:51:42 -05:00
Zach Bloomquist f5b09091ea Use win.destroy to destroy Electron windows, log more events (#5603)
* Use win.destroy to destroy windows, log more events

* fix test

* Add tests for onbeforeunload, beforeunload exiting successfully

* add window.open beforeunload tests

* beforeunload, not beforeload

* just destroy those child windows
2019-11-07 17:20:07 -05:00
Zach Bloomquist 1e870c5542 Remove deprecated usage of Promise.pending (#5611) 2019-11-07 11:55:29 -05:00
Zach Bloomquist 7ef3078f6a Increase CDP timeout to 20 seconds; add logs after 5 seconds (#5610)
* Increase CDP timeout to 20 seconds; add logs after 5 seconds

* update error messages
2019-11-05 14:25:29 -05:00
Gleb Bahmutov b3e40b08cd allow list of search patterns in testFiles config option (#5402)
* WIP: log spec search steps

* add multiple files via glob test

* allow testFiles to be a string or a list of strings to match

* failing config tests: testFiles type change

Change `testFiles` from a string to either a string **or** array of strings; following similar pattern as `ignoreTestFiles`

* testFiles type change passing tests

* update verbiage related to testFiles type change

* enable running integration tests locally

See https://github.com/paulmillr/chokidar/issues/855 for more details.

* integration tests; failing

Seems to fail for similar reason as #4543 and is likely resolved with PR #4849

* correct test verbiage

Distinguish between the two tests; as they are subtly different.

* update TS types for testFiles type change

Updated the comments, but forgot to update the actual type. This commit rectifies that.

* correct CLI syntax in test

`--config` was not being passed the appropriate value. Now matches other test cases; such as that found in [args_spec](https://github.com/cypress-io/cypress/blob/92b91fe514e5ff6286b4d4e26d2df23062bdf869/packages/server/test/unit/args_spec.coffee#L210)

* remove unsupported syntax from tests

From looking at other tests, it does not appear that the syntax `--config=testFiles=glob1,glob2` is current supported. Removing the test for this test case.

* test the correct config value

Previously was testing `ignoreTestFiles` instead of `testFies`

* provide more accurate test assertion

* correct config's `testFiles` type

Should be a string or an array of strings.

* remove unnecessary newline

* tweak verbiage to better align with intention

Co-Authored-By: Ben Kucera <14625260+Bkucera@users.noreply.github.com>


Co-authored-by: Andrew Smith <andrew@andrew.codes>
2019-10-31 11:26:47 -04:00
Zach Bloomquist 249db45363 Use websockets to stub large XHR response bodies instead of hea… (#5525)
* server: add test for XHR with body > 100kb via CLI

* Use websockets to stub large XHR response bodies instead of headers

* Properly cleanup outstanding XHRs on before:test:run

* Add lil unit test for xhr_ws_server

* Use reset:xhr:server to get around sending entire test:before:run:async payload

* Responding to feedback

* Implement feedback

* move data obj wrapping into xhrs controller
2019-10-30 16:36:02 -04:00
Brian Mann 91a4477ad0 replace handlebars with squirrelly (#5521)
* WIP: rip out handlebars and implement with squirrelly

- handle caching ourselves
- TODO: add tests, make sure escaping and all that jazz works

* fixes squirrelly template handling

* only fire mocha events when in run mode

* add unit tests for template engine rendering + caching
2019-10-30 02:21:53 -04: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
Zach Bloomquist 4b278f89de Fix not keeping track of correct URL when setting cookies durin… (#5455)
* Keep track of correct URL during request redirects

* Add snapshots for URLs during redirects
2019-10-25 13:16:40 -04:00
Gleb Bahmutov 94128a97e3 Fix decoding unicode values in the config object passed to the browser (#5451)
* correctly decode runner config

* add comments with original issue

* remove stray branch name to build
2019-10-24 16:52:08 -04:00
Zach Bloomquist a3265ccdef Control Chrome cookies through CDP (#5297)
* try connecting to chrome remote interface

* linting

* print CRI targets for better debugging

* linting

* load empty tab first when connecting to CRI

* first load blank page, then navigate

* Page.navigate is working

* linting

* remove title

* add mocha banner

* more banners

* update some server unit tests

* update integration test

* document how to run single driver spec file

* set the focus back on the page before navigating from blank chrome tab

* update server unit test

* do not store Chrome remote interface reference for now

* record video of the Chrome tab using screencast API

* use dynamic port to connect to Chrome remote interface

* update unit tests

* refactoring

* wrap chrome remote interface in our interface, limit access to send

* resolved merge

* fix reference

* passing run unit spec

* stub canary search for CI to pass

* add build step to packages/server

* update chrome spec

* do not build js on install for server

* updated spec snapshots

* update 6_visit_spec snapshot

* update snapshot for 6_web_security_spec

* update snapshot for 3_plugins_spec

* update snapshot for 3_user_agent_spec

* update snapshot for 5_stdout_spec

* update snapshot for 2_browser_path_spec

* do not git ignore js files, add note why

* update several snapshots with video on Chrome

* update visit performance snapshot

* add chrome-remote-interface dependency

* cleanup coffeescript conversion to JS, fix some type errors, make parallel override clearer

* fix failing tests

* Fix snapshot - now we do record in Chrome, so warning message is no longer there.

* remove chrome warnings about not recording from snapshot

* Remove performance tests from 6_visit_spec snapshot

* Remove error from snapshot

* Add newline back to cy_visit_performance_spec snapshot

* Use CDP to control Chrome cookies + screenshot

* Add devtools types

* Cleanup

* Cleanup

* Add guards for minimum CDP version

* Fix failing tests

* Split cdp_automation_spec out of electron_spec

* Move takeScreenshot to cri-client

* Navigate to about:blank

* look for blank page url

* add note about avoiding Prettier

* disable prettier a little more

* call chrome remote interface close after each spec

* return promise when starting screencast

* update failing unit tests, add cri client close test

* update integration test

* Add verbose debug statements to cri-client

* Use connect.createRetryingSocket for CDP connection

* record video from chrome browsers

* add method for validating browser family

* update e2e spec snapshot

* update 4_request_spec snapshot

* update snapshot for spec 1_commands_outside_of_test_spec

* update snapshot for 3_plugins_spec

* update snapshot for spec 3_user_agent_spec

* try: Always log video capturing errors

* update snapshot for 2_browser_path_spec

* update snapshot for 2_cookies_spec

* better browser family test

* update snapshot for 5_stdout_spec

* update snapshot for 5_subdomain_spec

* Add protocol_spec tests

* do not capture video during performance test

* Add test for VIDEO_POST_PROCESSING_FAILED warning

* Add basic cookie validation in cy.setCookie

* Update cdp_automation to throw on Network.setCookie failure code

* Update tests 🎉

* Update snapshot

* Fix test

* Remove redundant logs, cleanup

* Add cri-client_spec, fix some small bugs, improve errors

* Update dep

* use client.on to register screencast callback

* use isCookieName

* strict-cookie-parser@3.1.0

* cleanup prettier, extract some functions, switch to browser.family

* moar cleanup and fixes

* add logging to the cri-client so we can see every message sent + received to the cdp protocol

* bump bluebird to 3.7.0 for .tapCatch addition

* Fix unit tests

* WIP: update e2e test to ensure that duration of the video matches what we expect

* Test duration of recorded video

* Run 6_video_compression in chrome + electron

* Cleanup

* finish ffmpeg duration verification

* Update 8_reporters_spec snapshot

* Fix cri-client test

* Update CRI close logic to monkey-patch browser.kill

* add isBrowserFamily back

* make it possible for remote-debugging-port to get overridden

* Make CDP timeout 5s; add unit, e2e tests for CDP failure; add user-friendly CDP failure error

* Update tests

* Use CYPRESS_REMOTE_DEBUGGING_PORT to set CDP port; update CDP error message

* Change new Buffer to Buffer.from

* Apply name validation on all cookie commands

* Just throw on Chrome start if the CDP version is < 1.3

* Fix cypress_spec

* Use CDP to set resolution + scale factor in Chrome e2e

* Revert "Use CDP to set resolution + scale factor in Chrome e2e"

This reverts commit a1b86d9413.

* use CYPRESS_FORCE_BROWSER_SCALE to force standard resolution

* don't do --window-size --kiosk

* Use CDP to set resolution + scale factor in Chrome e2e

* Revert "use CYPRESS_FORCE_BROWSER_SCALE to force standard resolution"

This reverts commit 22c5e78670.

* Use Page.captureScreenshot for Electron + Chrome, reduce logic

* Use before() task to force device metrics in Chrome

* Fix protocol_spec

* Update 7_record_spec to allow for before() hook

* Update 6_task_spec snapshot

* Appease eslint

* Update hooks in 5_spec_isolation snapshot

* some general promisification and cleanup

* feedback on pluginsfile

* cdp_automation feedback

* chrome.coff feedback

* feedback

* run e2e tests on port 4466, ensure no e2e test ever runs on 5566 to prevent conflicting with debugger port

* accept new 'remote:debugger:protocol' automation command to control device metrics overrides

* update web security e2e to run on electron + chrome

* run web security tests in electorn, disable context isolation

* pass disable-site-isolation-trials to Electron so webSecurity works

* Fix errors in e2e tests caused by extra log item

* fix cri-client unit tests

* fancy arrows in log message


Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-10-21 17:07:53 -04:00
Jennifer Shehane fe937d3450 Display full specfile(s) in stdout during cypress run (#5120)
* Begin inserting newlines for long specfiles in results table of stdout

* clean up some decaff weirdness

* move newlines function into util

- call ‘formatPath’ on any area where the path could be too long and
needs to word wrap

* Clean up some styles, padding that does nothing - get specname closer to symbol by 1 pixel

* Commit new snapshot changes. Word wrapping, some spacing changes

* remove more padding that does functionally nothing

* Fix more of the extra unnecessary padding in 'Running' table

* Update other CLI snapshots to match new spacing

* Remove the error thrown when colWidths exceeds 100, I don't see this as necessary since we have snapshots covering the design of the columns.

* Update some snapshots I missed

* Add gaurd in newLine function in case there is no specfile name

* fix more snapshots

* Fix snapshot extra space

* forcibly enable colors in all e2e tests, and strip them back out of the snapshots

* Fix colors that got lost in stdout

* Update newlines function to use simpler ramda split + fix implementation to remove last newline

- write unit test for newlines function for easier refactoring in future

* iterating on fixing the weird column issues

* handle if str is undefined in newlines function

* Draw the tables at exact 100 width, taking into account padding and borders

- Calculate the actual width of the table column in order to add
newlines at that length
- Add newlines for the ‘Finished processing’ output of video file
- Add newlines for the ‘Screenshots’ output of screenshot paths

* remove .only

* Remove extra 1 char padding

* Remove color changes (separate PR for this)

* Replace project path with same num chars of X's

We were just replacing it with foo/bar/baz which would mess up the
alignment of the snapshots since it was removing chars

* If we are running with a CYPRESS_ENV of 'test', replace the cwd

- Replace the current working directory if we’re running withing
Cypress so that our snapshots are consistent when run on diff machines.
- Ideally, I would have liked to have had a special ‘—fake-cwd-path’
flag so that we can override this later, but I couldn’t figure how to
pass that.

* Continue stripping the projectPath from snapshot output

- This is required because some messaging comes from outside of the
run.js file, so we still need to replace these paths in snapshot.

* Update snapshots to have correctly replaced cwd

* Update formatting of new Node Version path to properly return within our stdout tables

* remove tests for method that does not exist

- update the drawing of table columns to match the new logic - don’t
need weird spaces and padding right anymore.
- update snapshot to match

* Update snapshot for performance test that didn't previously run

* return empty string if no name passed (really just for weird edgecases in our own tests)

* Add instructions on how to run performance tests in server

* Update video processing and screenshot tables so they no longer use weird negative padding hack with ' ' border

* Update snapshots to reflect new table spacing

* Another snapshot update missed

* Accept 'FAKE_CWD_PATH' env var to replace it in the run

* Pad paren time to factor in extra whitespace

* Update snapshots to no longer have static 'acb123.mp4' for video names

- This was throwing off the table calculations.

* remove stripping screenshot dimensions + replace padStart with padEnd

* Update snapshots to instead user shorter form 'second' in order to account for shorter duration printing when it is 1 second

* Add correct padding for screenshot dimensions

* update perf spec

* Update performance snapshot

* remove unused 'stripAnsi' dep

* Fix merge conflict failure - didn't regenerate snapshot correctly last time.

* commit size of electron screenshot (fix incoming in another PR to avoid this)

* Correctly handle padding of node version so we don't have to rewrite this later.

* split out let & const assignments


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-10-21 11:21:34 -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
Dave Beshero 57dad4885e fix scaffold command grammatical error (#5361)
* fix scaffold_spec grammatical error

* fix command grammatical error
2019-10-12 12:18:03 -04:00
Gleb Bahmutov a877474df1 Connect to Chrome Remote Interface when launching Chrome and re… (#4628)
* try connecting to chrome remote interface

* linting

* print CRI targets for better debugging

* linting

* load empty tab first when connecting to CRI

* first load blank page, then navigate

* Page.navigate is working

* linting

* remove title

* add mocha banner

* more banners

* update some server unit tests

* update integration test

* document how to run single driver spec file

* set the focus back on the page before navigating from blank chrome tab

* update server unit test

* do not store Chrome remote interface reference for now

* record video of the Chrome tab using screencast API

* use dynamic port to connect to Chrome remote interface

* update unit tests

* refactoring

* wrap chrome remote interface in our interface, limit access to send

* resolved merge

* fix reference

* passing run unit spec

* stub canary search for CI to pass

* add build step to packages/server

* update chrome spec

* do not build js on install for server

* updated spec snapshots

* update 6_visit_spec snapshot

* update snapshot for 6_web_security_spec

* update snapshot for 3_plugins_spec

* update snapshot for 3_user_agent_spec

* update snapshot for 5_stdout_spec

* update snapshot for 2_browser_path_spec

* do not git ignore js files, add note why

* update several snapshots with video on Chrome

* update visit performance snapshot

* add chrome-remote-interface dependency

* cleanup coffeescript conversion to JS, fix some type errors, make parallel override clearer

* fix failing tests

* Fix snapshot - now we do record in Chrome, so warning message is no longer there.

* remove chrome warnings about not recording from snapshot

* Remove performance tests from 6_visit_spec snapshot

* Remove error from snapshot

* Add newline back to cy_visit_performance_spec snapshot

* Navigate to about:blank

* look for blank page url

* add note about avoiding Prettier

* disable prettier a little more

* call chrome remote interface close after each spec

* return promise when starting screencast

* update failing unit tests, add cri client close test

* update integration test

* Add verbose debug statements to cri-client

* Use connect.createRetryingSocket for CDP connection

* record video from chrome browsers

* add method for validating browser family

* update e2e spec snapshot

* update 4_request_spec snapshot

* update snapshot for spec 1_commands_outside_of_test_spec

* update snapshot for 3_plugins_spec

* update snapshot for spec 3_user_agent_spec

* try: Always log video capturing errors

* update snapshot for 2_browser_path_spec

* update snapshot for 2_cookies_spec

* better browser family test

* update snapshot for 5_stdout_spec

* update snapshot for 5_subdomain_spec

* Add protocol_spec tests

* do not capture video during performance test

* Add test for VIDEO_POST_PROCESSING_FAILED warning

* use client.on to register screencast callback

* cleanup prettier, extract some functions, switch to browser.family

* moar cleanup and fixes

* add logging to the cri-client so we can see every message sent + received to the cdp protocol

* bump bluebird to 3.7.0 for .tapCatch addition

* Fix unit tests

* WIP: update e2e test to ensure that duration of the video matches what we expect

* Test duration of recorded video

* Run 6_video_compression in chrome + electron

* Cleanup

* finish ffmpeg duration verification

* Update 8_reporters_spec snapshot

* Update CRI close logic to monkey-patch browser.kill

* add isBrowserFamily back

* make it possible for remote-debugging-port to get overridden

* Make CDP timeout 5s; add unit, e2e tests for CDP failure; add user-friendly CDP failure error

* Update tests

* Use CYPRESS_REMOTE_DEBUGGING_PORT to set CDP port; update CDP error message


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Zach Bloomquist <github@chary.us>
2019-10-11 18:36:05 -04:00
Zach Bloomquist 85485ae218 Add some Chrome flags to make the browser more suitable for tes… (#5310)
* Add some Chrome flags to make the browser more suitable for testing

* Add --disable-dev-shm-usage to Chrome flags

* Remove --disable-dev-shm-usage
2019-10-10 10:02:57 -04:00
Zach Bloomquist 740f5ab6a0 Suppress NODE_TLS_REJECT_UNAUTHORIZED warning (#5256)
* Suppress NODE_TLS_REJECT_UNAUTHORIZED warning

* move warning suppression to own module; add tests with and without

* use spread operator for args

* move originalEmitWarning
2019-10-02 11:38:42 -04:00
Gleb Bahmutov 4ec77e3d58 use Node path from config file to run plugins (#4436)
* use Node path from config file to run plugins

* add finding system node

* memoize node find, use fix-path if Node is not found

* find Node asynchronously

* update note on ENFILE

* print node version before executing registered event

* use nodeVersion option, add validator isOneOf

* linting

* remove resolve-dir

* debugging unit test

* resolve original promise to make the tests run correctly

* update second test

* add unit tests

* upgrade snap-shot-it package to be able to update snapshots

* make finding node path part of startup, merge into config

* update tests

* add node version & path to run output

* add node version display to desktop-gui

* add warnings, add tests, add learn more link in desktop-gui

* Revert "add node version & path to run output"

This reverts commit 40a3218175.

* only show Node Version if it is non-default

* Add e2e test for using system node

* cleanup

* add tests that resolvedNodePath and Version are available in tests

* assert nodeVersion == system

* add nodeVersion to schema

* add new configoptions to types

* add fallback if pluginsfile is disabled

* new package.json sorting

* update some of the wording/styling of Node Version panel

* remove ` from schema file

* clean up decaffeinated tests + update wording when no pluginsfile is present

* playing with messaging.

* push updated node version panel design

* update design + copy of Node panel again

* some more iteration on design (WIP)

* Finish design changes + fix tests

* add debug message

* linting problems

* add missed require

* Add comment to refactor the colWidths in this PR after another PR goes

* replace the exact length of Node version in specfiles

* print object for node version and path instead of %s %s

* update snapshot to match v12 length


Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-10-01 17:08:11 -04:00
Zach Bloomquist 053b6bd993 Fix auth after Electron upgrade (#5243)
* Fix auth after Electron upgrade

shell.openExternal should've been converted to a Promise w/ Electron 5.

* add comment
2019-09-30 12:50:45 -04:00