Commit Graph

441 Commits

Author SHA1 Message Date
Zach Bloomquist
13aa496476 use cross-env in npm scripts so they work on Windows (#5888)
* use cross-env in npm scripts so they work on Windows

* update more cross-envs

* Apply suggestions from code review

Co-Authored-By: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-12-05 11:38:03 -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
Josef Biehler
259bfbecbe add Loggable options to its() / invoke() command (#5519)
* add Loggable options to its() command

* add test for new Loggable option for its()

* add loggable options to invoke()

* add type definition
fix: only set logger config once. afterwards other commands can overwrite the logger config as done in line 322
remove unused error message (usage was removed in a former commit)
remove test that is unnecessary now

* add check if its() was passed additional arguments next to options

* try to fix test

* do not log 'this' context

* from review: add additional tests and fix some edge cases

* add tests for combination of loggable options and numeric index

* fix wrong indentation

* write as 'functionName' and 'propertyName' to match other error message

* Update tests to reflect newly worded errors


Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2019-12-04 11:52:44 +06:30
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
Zach Bloomquist
16f085dc12 Extend cy.its and cy.invoke to accept a number as 1st arg (#5755)
* extend cy.its and cy.invoke to accept a number as 1st arg

* add types tests

* add expecttype

* add its and invoke types to take an index
2019-11-26 08:26:45 -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
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
Nicolas Ramz
9aeadbdfa2 Fix types for cy.dblclick and cy.rightclick (#5618)
* ADDED: missing call signatures for right/dblclick

These two call signatures where missing for rightclick and dblclick: only the `rightclick(options?: Partial<ClickOptions>): Chainable<Subject> ` one was present.

See #5617

* FIXED: typo

* FIXED: dtslint errors
2019-11-07 16:58:50 -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](92b91fe514/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
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
bd54e3dff7 types: add failures and message to npm module result (#5337)
* types: add failures and message to npm module result

* remove memberof in comments
2019-10-22 15:29:21 -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
561bd21cda Run e2e tests in both Chrome and Electron (#5359)
* Update circle.yml to run e2e tests in chrome + electron

* WIP: create multiple tests per browser, but utilizing the same base snapshot

- create a dynamic test title with browser appended
- use a base named snapshot without the browser name appended
- patch snap-shot-it not to rethrow twice unnecessarily which ends up
throwing the wrong error

* Add e2e.coffee to stop-only ignore

* Convert existing x-browser e2e tests to use e2e.it

* update snapshots

* really add e2e to stop-only skip

* Replace screenshot dimensions in all tests, run only in process.env.BROWSER

* add e2e.it to more tests that should be x-browser

* update snapshots

* PEMDAS

* default e2e browser -> electron

Run afterEaches when skipping testo

Recurse upwards with runAfterEach

stop promise chains

* Revert "default e2e browser -> electron"

This reverts commit 3104f998da.

* Undo

* snap-shot-it@7.9.0

* Remove snap-shot-it patch

* Change e2e snapshot to use allowSharedSnapshot

* Add keepScreenshotDimensions to screenshot specs

* update snapshots

* fix snapshotit

* keepScreenshotDimensions: true -> sanitizeScreenshotDimensions: false

* Fix screenshot snapshots

* reduce snapshot noise

* rm 0_simple_spec

* deabstract circle.yml command

* fix circle.yml

* reduce snapshot noise

* clean up 6_visit_spec snapshot

* use allowSharedSnapshot: true in 5_spec_isolation

* Fix 5_screenshots, 2_form_submissions

* Normalize screenshot sizes in 5_spec_isolation snapshot

* Add sanitizeScreenshotDimensions only to non-e2e-project tests
Add --window-size=1280,720 --kiosk to chrome args

* update snapshots

* Use e2e.it for chrome/electron-specific tests

* handle logic for skipping tests when default browsers do not match specified browser

- implement e2e.it.skip to match mocha’s it.skip
- allow turning off dynamic test generation


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-10-16 21:10:50 -04:00
Jennifer Shehane
89ceb7ac45 Remove incorrect typing for Cypress.Commands.overwrite - does not accept options (#5347)
* Remove incorrect typing for Cypress.Commands.overwrite - does not accept options

* remove test that accepted options
2019-10-11 19:21:01 -04:00
Ben Kucera
abdf436638 simulated mouse fixes, rightclick, dblclick (#3030)
* cleanup type_spec, allow unused-vars for args

* fix missing return

* rename mouse/keyboard

* apply changes on this branch with rename

* temp 07/18/19 [skip ci] type_spec minor changes

* temp 07/19/19 [skip ci]

* temp 07/22/19 [skip ci]

* temp 07/22/19 [skip ci]

* remove accidental spec, use beforeEach visit in click_spec

* add tests for cy.trigger changes

* re-run build

* add typedefs

* temp 08/08/19 [skip ci]

* fix type_spec, click_spec

* fix console table event table logging

* fix spec utils

* fix invalid clicking-into-iframe spec

* address review, cleanup

* temp 09/25/19 [skip ci]

* add test for clicking checkbox, cleanup click_spec

* document mouse click and mouse move algo, adjust mouse move, add test for recursive movement

* cleanup / formatting

* scope the getCommandLogWithText to the active runnable to prevent leakage

* cleanup tests, make values static so tests pass consistently

- use attach listener alias APIs
- remove magic number constants
- fix some incoherent html / script tag stuff

* begin implementation for returning fromAutWindow

- restore original fromWindow algorithm
- begin writing fromAutWindow for calculating red hitbox coordinates
which are layered on the AUT

* move describe block with the others

* refactor actions to DRY up duplicated logic between click/dblclick/rightclick

- tighten up the mouse.js method names, name them consistently

* remove comment

* fix iframe coords and test

* rename fromDocCoords->fromWindowCoords, fix type_spec ux test

* tighten up method, remove unnecessary arg

* add debug logic for retries to console.error() non cypress errors

* renamed fromWindow -> fromElWindow, and fromViewport -> fromElViewport

* handle calculating the fromElWindow coordinates inline

* extract out function for clarity, receive consistent arg names

* cleanup, add lots of comments


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-10-11 18:43:57 -04:00
Seb Insua
116a634a90 Add padding support to element screenshot (#4440) (#5078)
* Handle 0px tall elements with a better error message

Closes #5149

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

* Add padding support to element#screenshot

Closes #4440

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

* add e2e tests
2019-10-11 14:52:00 -04:00
Ben Kucera
5654680fcd rename .eslintrc -> .eslintrc.json (#5344) 2019-10-10 15:04:25 -04:00
Jennifer Shehane
24ba72f423 Update cli readme to include link to npm module / add new responsibil… (#5339)
* Update cli readme to include link to npm module / add new responsibilities

* lowercase npm [skip ci]
2019-10-10 11:01:01 -04:00
renovate[bot]
daab2d7075 chore(deps): Update dependency bin-up and is-fork-pr (#5321)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-10-09 17:56:18 -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
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
Gleb Bahmutov
21cdf6fc47 cli: add sizzle types needed by jQuery types (#5247) 2019-09-30 12:47:22 -04:00
Gleb Bahmutov
b6996bd93c upgrade jQuery types to 3.3.31 to pass TS 3.6.2 check (#5230) 2019-09-28 22:01:12 -04: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
Zach Bloomquist
9f717fe7e8 Allow passing qs parameter to cy.visit to set querystring (#5040)
* allow passing qs param to cy.visit

* add types

* qs -> params, merge with url, throw errors on invalid type, add tests

* params -> qs

* cleanup

* fix test
2019-09-17 16:06:55 -04:00
Gleb Bahmutov
cd8da7d5d6 fix: increase XVFB timeout from 5 seconds to 30 seconds 2019-09-10 08:33:07 -04:00
ccodecamp
1b2faa2748 Adding presets for following viewports: 1) iPhone-XR, 2) iPhone-X, 3)… (#4967)
* Adding presets for following viewports: 1) iPhone-XR, 2) iPhone-X, 3) Samsung-S10, 4) Samsung-Note9

* Adding presets for following viewports: 1) iPhone-XR, 2) iPhone-X, 3) Samsung-S10, 4) Samsung-Note9

* Fix casing

* Cleanup

* Update window_spec
2019-08-26 15:25:22 -04:00
Gleb Bahmutov
6930cabd7b Revert "Provide strong types for 'invoke' command (#4022) (#4907)"
This reverts commit 15685dbb9f.

The type for `invoke` command seems to break jQuery method
that take an argument like

```js
cy.get('.trigger-input-range')
  .invoke('val', 25)
```
2019-08-06 15:38:33 -04:00
Mayfield
15685dbb9f Provide strong types for 'invoke' command (#4022) (#4907)
* add strong return type to 'invoke' command

* refactor invoke for clarity. use dtslint tests

* add strong args types using typescript 3.0+ features

* handle invoke's jquery wrapping of its input

* move invoke tests to namespace

* add example to jsdocs of 'invoke'
2019-08-06 10:27:45 -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
renovate[bot]
0e867e0bda chore(deps): update dependency dtslint to version 0.9.0 🌟 (#4852)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-07-29 16:52:13 +06:30
Ben Kucera
1ceb9a4f0f fix .and chainer for chai-jquery assertions (#4834)
* fix .and chainer

* fix .and chainer by returning undefined

* fix .and chainer by returning undefined

* try fix e2e spec: return assertion result?

* add "inlcudes" as "contains" alias, fix chai-jquery typedefs

* re-run dtslint (passes locally)

* extend chai thru cy-chai.d.ts

* remove unneeded code

* add tests for .contains messages
2019-07-29 00:29:41 -04:00
renovate[bot]
3faae834ca chore(deps): update dependency @types/chai to version .x 🌟 (ma… (#4828)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-07-26 16:06:40 +06:30
Jennifer Shehane
f189d5e408 remove packages that do not appear to be used (#4755)
- I may have broken things - let’s see.
2019-07-25 11:08:01 +06:30
Ben Kucera
50a285a980 rename cy.type disableSpecialChars options (#4761)
* Revert "Add option to ignore special character sequences to cy.type (#4744)"

This reverts commit 8153c6ec96.

* rename disableSpecialCharSequences

* update err msg pt 2

* update err msg pt 3

* update parseSpecialChar booleon - default is TRUE

* remove trailing whitespace


Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-07-24 15:50:52 -04:00
Stefano Magni
abc996ec70 Fix the cy.once typings (#4788)
* Fix the cy.once typings

* C -> c


Co-authored-by: Zach Bloomquist <github@chary.us>
2019-07-23 14:37:59 -04:00
renovate[bot]
9756a0382d fix(deps): Update dependency lodash to version 4.17.15 🌟 (#4784)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-07-23 15:54:46 +06:30