Commit Graph

20 Commits

Author SHA1 Message Date
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
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
Chris Breiding
6ba8d7cc93 Electron v5.0.10 (#4720)
* fix specs

* use debugger protocol for cookie handling in electron

* use latest gulp

* use rimraf instead of gulp-clean

* use electron 3.1.8 and node 10.2.1

* use gulp 4 in packages/static

* fix sendCommandAsync, log Schema.getDomains on CDP connect

* autofill e2e test name [skip ci]

* electron@5.0.7, see what new failures exist

* --no-sandbox for launching Electron

* update cookies logic for electron

* node 12

* update snapshot for new node

* update error message for new node

* stub sendCommandAsync

* only connect to socket if path has been replaced, fixes #4776

* update node-sass to support node 12

* skip wacky socket tests for now

* snapshot

* fix run_plugins_spec snapshot, don't include stack trace

* use --no-sandbox on linux to run as root

* allow sendCommandAsync to resolve

* use euid for root check

* log domains even if undefined

* don't worry about ending 1xx responses immediately anymore

* use --max-http-header-size, change max size from 8kb to 1mb, fix #76

* do not send 502 on failed websocket, just send back ECONNRESET

* update websocket spec port to not collide with other test

* update outdated expect

* Revert "only connect to socket if path has been replaced, fixes #4776"

This reverts commit f179eda5ca.

* update gulp in root

* update https-proxy unit tests

* update network spec to properly close server

* update reporter spec

* update https-proxy-agent to fix node 10.10.0 change

discussion: https://github.com/nodejs/node/issues/24474\#issuecomment-511963799

* only pass --max-http-header-size on node >=12

* use own server-destroy implementation that supports secureConnect events

* oops

* update socket_spec

* electron 6.0.0

* console.table introduced in node 10

* change browserify entry to init.js

* handle edge case when no response body

* console.table added in node 10

* do not exit app when all BrowserWindows are closed

* update e2e snapshots

* value may not be null

* update plugins spec

* correct cookie expiry, use browser.getversion for CDP version check

* fix snapshotting for require stacks

* reorder cookies in spec

* warn when depreated electron callback apis are used

* only report 1 plugin error per process

* cleanup

* node 12.4.0, cypress/browsers:node12.4.0-chrome76 docker image

* update shell.openExternal to promisified

* update dialog.showOpenDialog to promisified

* update webContents.session.setProxy to promisified

* updating native dependencies since we don't need ancient node ABI support anymore

* WIP: switch cookies to simpler, jar-less approach

* WIP: switch cookies to simpler, jar-less approach

* making tests pass

* improve cookie filtering logic

* Remove unneeded Promise.try

* filter what makes it to the extension

* properly re-set superdomain cookies on cross-origin cy.visit

* allow comma-separated list of e2e tests

* sort cookies in order of expiration date, ascending

* updating tests, cleanup

* update tests

* version electron as a devDependency, electron@6.0.1

* cleanup, remove old automation

* cleanup, remove old automation

* bump chokidar to fix win10 + node12 issue

was seeing this on windows:
https://github.com/nuxt/nuxt.js/issues/6035

fixed with version bump

* enable now-supported quit role, re-enable old tests

* don't need that arg there

* remove last deprecated callback electron invocations

* Delete cypress.json

* responding to PR feedback

* cleanup

* invoke

* use 'quit' role

* Use new appMenu role for Cypress menu on mac

* electron@6.0.2

* electron@6.0.3

* remove domain: cookie.domain and see what happens

* remove setErrorHandler

* Revert "remove domain: cookie.domain and see what happens"

This reverts commit 49e916896d.

* add unit tests for cookies

* ci

* fix project-content css

* electron@6.0.4

* fix specs_list test

* electron@6.0.7

* some cleanup

* electron@6.0.9

* Update 8_reporters_spec.coffee.js

* electron@5.0.10 - Chromium 73, Node 12

* cli: fix the STDIN pipe on Windows (#5045)

* cli: pipe stdin

* uggh, here is the actual change

* update cli unit tests

* add unit test

* more permissive check for json to include application/vnd.api+j… (#5166)

* more permissive check for json to include

* add json test for content-type application/vnd.api+json

* cruder solution passes e2e tests locally, so let's go with that

* Remove 'charset' from content-type before checking if JSON

* fix eslint for fixture specs (#5176)

* update eslint to lint files within 'fixtures' in support files

- ignore some edge cases like jquery, jsx and obvious js files we wrote
with broken code

* Fixes from eslint to 'fixtures' files

* 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

* Addresses #2953 (#5174)

* Addresses #2953

* Added proper test for new error message

* Didn't realize it ran this test as well, whoops

* Implementing changes as suggested by @jennifer-shehane

* Fixing tests and error output. Moved the checks to the start of the get command to ensure we always catch improper options

* Removing issue test since the querying spec covers it

* Using coffescript isArray check

* depromisify things that were promisified b/t electron 5 <=> 6

Revert "update shell.openExternal to promisified"

This reverts commit 8b6460d015.

Revert "update dialog.showOpenDialog to promisified"

This reverts commit 5f178b075b.

Revert "update webContents.session.setProxy to promisified"

This reverts commit 727df3a4e5.

* node12.4.0-chrome76 => node12.0.0-chrome75

* fix tests for electron downgrade

* node12.0.0-chrome75 => node12.0.0-chrome73


Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-09-24 14:35:24 -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
Zach Bloomquist
1f185f7f11 Fix cy.visit slowness by removing Electron timers workaround (#4385)
* add tests for getAddress on localhost

* add test for visit resolving quickly

* add debug logs to network

* network: override addRequest in HttpAgent, not createSocket

* don't need to add connection: keep-alive to all responses

https://github.com/cypress-io/cypress/pull/4385#issuecomment-499103484

* test that visit finishes quickly

* do not forward connection header

* add tests to help reproduce

* cleanup

* still send keep-alive

* update tests

* remove timers

* add snapshots to e2e test

* remove tests for debugging

* try making console writes async

* Revert "remove timers"

This reverts commit b9d65a4e5c.

* allow DEBUG_COLORS to be passed in an e2e test

* try: using system node for the timers, setting up our own IPC

* Revert "try: using system node for the timers, setting up our own IPC"

This reverts commit c51b3957e2.

* put the interesting test first

* use electron-mocha to run tests in electron

* Revert "use electron-mocha to run tests in electron"

This reverts commit 8b82f0eeb3.

* support legacy addRequest invocation

* Revert "Revert "remove timers""

This reverts commit 93f15fcb17.

* update snapshot

* Revert "try making console writes async"

This reverts commit 9c8337e433.

* complete in 150ms, not 1000ms
2019-06-17 12:41:22 -04:00
Chris Breiding
21effb4a9a handle case where task handler is undefined (#2581) 2018-10-15 15:21:34 -04:00
Chris Breiding
70b0fa21eb merge handlers for multiple task registrations (#2289) 2018-09-08 19:06:57 -04:00
Brian Mann
2689ff8416 add more debug logs (#2109) 2018-07-06 17:19:20 -04:00
Chris Breiding
7f1a69f20e Add 'after:screenshot' plugin event (#2058)
- Fixes #2039
- Fixes #2040
2018-06-28 23:11:43 -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
David Almeida
a77e7255ca server(fix) cleanup integrationFolder in filePath, close #1704 (#1705) 2018-06-05 15:22:56 -04:00
Brian Mann
fc423ca467 WIP creating a new banner + summary table for runs #1588 (#1722)
* WIP creating a new banner + summary table for runs [skip ci]

* WIP continuing to iterate on new run output, use tables for results [skip ci]

* log -> debug

* switch out 400 -> 412 status code on schema errors

* update humanTime to take short or long formats

* debug the starting argv

* create terminal-size wrapper to return terminal columns + rows

* created custom terminal tables for displaying new stdout results for running multiple specs

- made tables responsive when columns < 100

* add e2e tests around exiting with error when browser cannot be found or specs cannot be found

- instead of creating a run, immediately die without making any requests
- improve BROWSER_NOT_FOUND error message

* strip ansi color codes from terminal spec, use chalk instead of colors

* pass webUrl from recording runs to be able to display URL before tests run

* finished new stdout flow for running specs iteratively

* when webUrl is present, display the recorded run in the header + footer

- move from ‘white’ to ‘reset’
- tighten up intro table

* change results output from "Video Captured" to "Video" to pair with newest config option

* use runUrl, not webUrl, fix white space, ensure that e2e snapshots are accurately normalized

* use console.log, not console.error to capture stdout for dashboard

* e2e tests around logging warnings when cannot record video

* 0 seconds -> X seconds

* Tests Starting -> Run Starting, Tests Finished -> Results

* Started video recording -> hr line break

* All Done -> Run Finished

* evenly space stdout section headers

* add a new line when exiting early from bundle errors

* sanitize stdout better, replace duration seconds, etc

* update all the various e2e stdout snapshots

* ensure that COLUMNS env is set to 100 for snapshots to pass

* better logging for env var

* env -> stdout

* store as string

* remove columns

* echo columns

* add columns back in

* comment out

* set terminal columns

* cleanup circle.yml [skip ci]

* normalize more result properties for browser, os, cypress

* set columns for server tests

* enforce no colors and correct columns + rows for e2e tests, fix cloning env vars

* update e2e tests for newest stdout

* set env vars for columns + lines for e2e tests, remove stty

* fix snapshots when duration is X second, X seconds, or XX seconds

* use process.env.COLUMNS not process.stdout

* ugh

* stringify

* log crap out

* quotes oh my

* fix failing e2e snapshot tests

* fix failing e2e tests

* fix failing integration tests

* fixes failing unit tests
2018-05-21 18:37:35 -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
Chris Breiding
e5626d050a Remove file from preprocessing after closing browser (#1572)
* remove file from preprocessing after closing browser

* guard against removing file if no spec

* use the same nomenclature in child process as in parent process

* ensure file object state is cleared when closing file in child process

* fix spec broken by upstream changes
2018-04-23 16:15:46 -04: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
Brian Mann
c1bcb2f641 Issue 1042 (#1057)
* server: remove unused file

* server: WIP, start implementing accepting plugin returning promise and yielding config overrides [skip ci]

* server: cleanup the env + environentVariables disaster. simplify and only use 'env'

* server, desktop-gum: rename 'env' to 'cypressEnv' to avoid conflicts, fix failing tests

* server: modify plugins error content to be clearer

* runner, driver: more environmentVariables -> env cleanup

* fixes #509 return the complete configuration object to Cypress.config()

* fixes #1042 enable plugins to return a promise and modify config

* desktop-gui: add 'plugin' override to configuration display

* server: bug fix when plugin cause a project not to open

* desktop-gui: fix for failing e2e test

* server: make errors clearer when plugins crash

* server: fix bug with PLUGINS_FUNCTION_ERROR not sending right arguments

- fix failing tests
- improve plugin error content

* server: fix failing snapshots, preprocessor is invoked for support + spec files

* server: fix tests, don't watch the support file initially

- this was causing a problem where unhandled preprocessor errors were
causing the entire process to hang.
- this was happening because we weren’t properly running support files
through a custom preprocessor initially

* fixes failing tests
2017-12-11 20:53:23 -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
eb7110bcd0 Fix plugins process error reporting (#946)
* server: fix error sent from plugins process to main process

* server: improve snapshot normalization
2017-11-22 17:13:02 -05:00
Chris Breiding
88efc33aba server: fix missing reject arg and add test (#935) 2017-11-20 20:56: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