Commit Graph

119 Commits

Author SHA1 Message Date
Kukhyeon Heo
128f2eb69e Add type for Cypress.automation (#7573) 2020-06-04 21:34:33 +06:30
Ben Kucera
f93f46cde8 fix typedefs for cy.screenshot options, Cypress.log (#7445) 2020-06-03 12:26:59 -04:00
Ben Kucera
f6613bd6fc fix typedefs: add taskTimeout to cypress config (#7521) 2020-05-29 10:14:25 -04:00
Hossam Magdy
071c5c74c6 feat(driver): Add support for encoding option in cy.request() (#7382) 2020-05-26 15:13:32 -04:00
Gleb Bahmutov
0dbd6304c8 Split types files again (#7403) 2020-05-18 19:25:52 -04:00
Gleb Bahmutov
2e5bb50706 Update a few missing TS types in CLI to get Kitchensink types check to pass (#7401) 2020-05-18 18:02:54 -04:00
Zach Bloomquist
a854089c77 fix(types): use SinonStatic for Cypress.sinon type (#7398) 2020-05-18 14:31:45 -04:00
Gleb Bahmutov
a2c0bc3e3e include CLI TS types in a way to avoid clashing with Jest (#7352) 2020-05-15 17:31:22 -04:00
Zach Bloomquist
6960f7cd78 Rewrite JS/HTML using AST-based approach (#5273)
* Add winPropAccessor to security.js, remove other replacers

* Add start of Cypress.resolveWindowReference

* Add regexes for dot and bracket access

* Some security_spec tests pass with new injection

* Add resolveWindowReference unit tests

* Old security_spec now passes with resolveWindowReference

* Inject stub resolveWindowReference so proxy still works outside of Cypress

* wip: rewrite HTML + JS with tokenizer

* Move to using esprima + hyntax to rewrite JS + HTML

* remove comment; oneLine makes the whole thing commented

* Fix tests, apple.com edge case

* wip: add getOrSet

* Revert "wip: add getOrSet"

This reverts commit a5c647c00f.

* release 3.5.0 [skip ci]

* use recast to replace window property accesses

* replace assignments to top properly

* fix yarn.lock

* bump deps

* update integration tests

* remove old security ts?

* fix integration spec

* always ignore js interception failure

* use globalThis instead of window

* add experimentalSourceRewriting flag

* restore regex-writer spec

* fix types

* update config_spec

* add source rewriting spec

* cleanup

* simplify rewriting logic, move rules into rewriter package

* create threaded rewriting tool for non-streaming use

* update @packages/rewriter to use threads for async

* use async rewriting where convenient

* add worker-shim.js

* add performance info to debug logs

* properly handle +=, -=, ...

* add proxy, rewriter to unit-tests stage

* cleanup

* use parse5 to rewrite HTML, strip SRI

* update tests

* reorganization, cleanup

* rewrite ALL parent, top identifiers except in a few cases

* handle many JS edge cases

* ensure parse5@5.1.1 is installed

* update yarn.lock

* update tests

* add debugging, add tests

* add attempted repro for .href issue

* implement source maps + extending inline source maps

* update opts passing in proxy layer

* fix sourcemap naming structure

* update tests to account for sourcemaps

* sourcemap tests

* remote source maps work

* comment

* update rewriter tests

* clean up TODOs in resolveWindowReference

* remove @types/nock

* clean up todos in deferred-source-map-cache

* fix rewriter build script

* fix concatStream import

* bump expectedresultcount

* clean up js-rules

* threading improvements, workaround for Electron segfault

* no visit_spec for now

* fix 6_visit_spec

* update MAX_WORKER_THREADS

* add repro for #3975

* cleanup

* cleanup

* make better use of namedTypes and builders

* get rid of the horrific closureDetectionTernary

ast-types keeps track of scope, so it is unneeded

* fix #3975, #3994

* add x-sourcemap, sourcemap header support

* snap-shot-it 7.9.3

* add deferred-source-map-cache-spec

* add tests

* Throw error in driver if AST rewriting fails

* Fix "location = 'relative-url'"

* fix max recursion depth

* slim down some fixtures

* fix window.location usage

* don't mess with `frames` at all

* no integration tests

* skip testing apple.com for now

* update wording: regex-based vs. ast-based

* skip real-world tests for now

* add some padding to process.exit workaround

* fix resolvers_spec

* fix html-spec

* cleanup

* Update packages/rewriter/lib/js-rules.ts

* Update packages/driver/src/cypress/resolvers.ts

* just import find by itself

* privatize typedefs for Cypress.state, remove .gitignore, remove dead code

Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
2020-05-11 12:54:14 -04:00
Gleb Bahmutov
627c9deb08 add TS types for partial config options (#7239) 2020-05-07 10:39:31 -04:00
Xander Dumaine
5a64934c66 Correct typing of CypressRunResult::runs (#6127)
* Add a type for CypressFailedRunResult distinct from CypressRunResult

* add back @example for detecting cy run failure

* remove trailing whitespaces found in dtslint

Co-authored-by: Joseph Weissman <61561354+CypressJoseph@users.noreply.github.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2020-04-14 15:17:13 +06:30
Zach Bloomquist
b6703aaec7 Add support for sameSite in cookie-related commands (#6828)
* add experimental feature for sameSite

* allow experimental descriptions to render markdown

* sameSite support mostly working

* also strip sameSite from setCookie yielded value

* don't use `unspecified` - let browser set default

* add tests

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

* decaffeinate: Convert cdp_automation_spec.coffee to JS

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

* cleanup cdp_automation_spec.ts

* update unit tests

* update settings_spec to not render as markdown

* user-friendly error for insecure SameSite=None

* fix styling

* fix markdown renderer

* update types + schema

* use renderInline

* update experiment summary

* bind renderFn to md
2020-03-27 10:04:50 -04:00
Gleb Bahmutov
095e2a3550 add tag to Cypress NPM module API options (#6796) 2020-03-25 15:57:09 +06:30
Kukhyeon Heo
ee494d04ee Added TypeScript type checker + Fixed type errors. (#5780)
* Added type_check.js

* Now checks cli, too.

* Ignored a line that should fail.

* Removed cli shims and post-install.

* Updated @types/chai to fix type error.

* Fixed keyboard type errors.

* Updated typescript to 3.7.2 to fix window.Node error in dom/document.

* Removed tsconfig errors that caused type errors in reporter and runner.

* Ignored error test by dtslint. Becaust it's done by type_check.js

* Added npm command.

* Added it to CI.

* Added skipLibCheck option.

* Removed checking chai folder existence.

copy of chai is unnecessary.

* Added 'ignore-progress' option for CI.

* Show success message when type check is finished successfully.

* Use ignore-progress option on CI.

* Moved type definitions from devDependencies to dependencies.

* Fixed new type errors after rebase.

* Updated type errors.

* Removed cli. Because its types are checked by dtslint.

* type_check -> type-check for consistency.

* Updated json-schema.

* Updated blob-util.

* Fix wrong command in CI.

* Revert "Updated blob-util."

This reverts commit e46549af54.
Because it's a breaking change.

* Remove copies of @types if exists.

* Fix stream buffer type error.

* Fix type errors in ui-components.

* Fix type failure.

* Fix lint error.

* Fix type errors

* Regenerate yarn.lock

* Fix type error.

* Fix type failures.

Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2020-03-17 11:01:31 +06:30
Jennifer Shehane
28fa3c7421 Add more checks for el existence before traversing up parent els (#6708)
* add check within getFirstStickyPositionParent for $el[0] to exist

- pull out check for undefined or html/body/doc element into a shared
elements method.

* prevent more checks on undefined parents & els causing getComputedStyle to throw

* yarn-lock

* Expand isUndefinedOrHTMLBodyDoc to Cypress.dom + add types

* Add unit tests for isUndefinedOrHTMLBodyDoc method

* yarn-lock

* move 'el[0]' existence check to below other checks (right when it's needed)

* yarn-lock
2020-03-16 20:34:49 +06:30
Gleb Bahmutov
333ab85324 add Cypress.sinon type (#6725) 2020-03-16 09:17:05 -04:00
Joseph Weissman
c5c484e272 Improve types for cy.its() with property paths (#6667)
Improve types for cy.its() with property paths
- provides additional signature for `cy.its()`
- adds kitchen sink examples for path-based property access
- improve typing for its/invoke
2020-03-11 11:00:19 -04:00
Joseph Weissman
a565a77700 Characterize overloaded signatures of cy.clearLocalStorage more… (#6652)
* Characterize overloaded signatures of cy.clearLocalStorage more carefully

* capture clearLocalStorage signatures in kitchen sink tests
2020-03-09 10:32:43 +06:30
Joseph Weissman
22a6420b4b Provide more narrow type for click position
- Now gives intellisense feedback for valid arguments
  to click/dblclick/rightclick
2020-03-06 12:18:12 -05:00
Kyle Roberts
855657d334 Add Cypress.dom.* to TS type declarations (#5298)
* add isDetached to type declaration

* add rest of dom function declarations

* remove any type union

* remove duplicate declaration

* add docstrings for documented types

* .js => .ts

* update types + tests

fix ts lint

* add Cypress.dom type tests

Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-03-02 14:22:13 -05:00
Chris Breiding
778321786f Pass projectRoot and configFile to plugins file through config (#6317)
* decaffeinate: Rename index.coffee from .coffee to .js

* decaffeinate: Convert index.coffee to JS

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

* refactor decaffeinated plugins/index.js

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

* decaffeinate: Convert 3_plugins_spec.coffee to JS

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

* fix wrongly removed return

* refactor e2e plugins spec, update snapshot

* pass env argument to plugins file

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

* decaffeinate: Convert index_spec.coffee to JS

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

* update plugins tests

* update scaffold snapshot

* add back server test script and document running individual tests

* add projectRoot and configFile directly to config

* normalize browsers in snapshot

* add types for configFile and projectRoot

* fix linting issues

* return return

* Merge

* remove file

* remove unnecessary returns
2020-02-28 14:13:36 -05:00
Kukhyeon Heo
189efd241b Fix the type of $$. (#6327)
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-02-19 15:17:20 +06:30
Ben Kucera
14798042e8 fix: typedefs for isBrowser (#6448)
* fix: typedefs for isBrowser
2020-02-13 18:23:18 +00:00
Greg Lahaye
434d23b132 Fix broken Screenshot link in cli/types/index.d.ts (#6360) 2020-02-07 15:07:04 -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
4b4842e55c Define types for plugin events (#6322)
* define types for plugin events

* add plugins file TS test

* fix plugins return type

* add void returns where allowed

* config can be partial

* add async test

* cannot return unknown keys in config

* add more tests

* add Task types and tests

* fix style issues

* update task type with compromise, remove redundant tests

* fix type

* bump kitchensink dep

* add typescript reference and jsdoc to plugins scaffold file

* update scaffold snapshot

* add more tests for before:browser:launch

* fix return type

Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2020-02-05 16:01:11 -05:00
Ben Kucera
94176149c4 deprecated before:browser:launch event (#6293)
* deprecate old API for before:browser:launch

* trigger ci

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

* add e2e test for chrome preferences

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

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

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

* remove psInclude

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

* fix failing tests, tighten up code

* remove unused Promise.all

* more code cleanup from coffeescript conversion

* fix expectedExitcode

* update snapshot with cross origin error message

* more code cleanup from coffeescript conversion

* remove global state, cleanup normalizing stdout in snapshots

* fix asserting on the expected exit code

* remove firefox a default browser in e2e tests

* remove dupe const

* make onStdout return first arg by default

* remove only

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

* fix test for electron

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

* make e2e test pass properly, and capture snapshot

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

* revert firefox specific changes to reduce PR diff

* remove newline

* temp 02/04/20 [skip ci]

* add more scenarios / return values

* rename plugin deprecation project fixture

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

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

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

* cleanup let -> const, coffescript conversion

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

(cherry picked from commit ba23be5349)

* bump cli snap-shot-it

* cleanup: let -> const, parseFloat, formatting

* revert cross origin normalization

* fix spacing

* add types for plugin events

* dont pad warning message in run mode

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

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

* add extensions for electron + warning if install fails

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

* e2e test electron via devtools extension

* remove .only

* add stdout assertions to e2e/1_deprecated_spec

* remove snapshot whitespace

* rename deprecation event

* update deprecated browser launch args warning message

* throw error on unexpected bbl property

* add tests for warning + error on bbl

* update snapshot

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

* try fix e2e fullscreen spec, update snapshots

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

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

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

* fix fullscreen e2e test

* only push user gesture arg if chromium

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

* remove conditional args in fullscreen test

* dont automatically install the latest version of chrome in circle

* add stubs for new electron properties

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

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

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

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

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

* add back --start-maximized in chrome

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

Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-02-05 13:07:59 -05:00
Zach Bloomquist
0e82cde8d9 Update browser types (#6254)
* update browser types and list

* add todo

* first pass of changes

* remove 'server' mode, since it is unused

* use foundbrowser type for eletron definition

* fix server unit tests

* update --browser arg to allow name:channel

* improve backwards compatibility impl

* update 3_config_spec snapshot

* fix 2_headless_spec

* fix 5_stdout_spec

* update browser icon stuff

* update 5_spec_isolation_spec snapshot

* Chrome Canary => Canary

* update user-facing types

* fix displayName type

* add debug logs

* fix cypress_spec

* taps

* update config.json
2020-01-31 12:58:12 -05:00
Kukhyeon Heo
7ff91ed1d9 cy.contains() improvements: normalizing whitespaces, case-sensi… (#5653)
* migrate vscode eslint settings

* Handles whitespaces with newlines.

* Feature: contains() matches case insensitivity

* Fixed merge conflicts.

* Fixed conflicts.

* Added option type, CaseMatchable.

* Fixed lint error.

* Added test for leading/trailing spaces.

* Add an error message for regex and matchCase conflict.

* Fix the valid case that throws an error.

* Fix how error message is thrown.

* update some cli deps that have fallen out of date since last commit

* update cli snapshot

Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2020-01-30 11:28:18 -05:00
Kukhyeon Heo
11bd06b6ee Added missing EventEmitter2 type to Cypress and cy + missing ru… (#6066)
* Added EventEmitter2 type to Cypress and cy.

* Added missing runUrl

* runUrl is optional

* Fixed typo.

Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2020-01-07 10:05:47 -05:00
Oliver Joseph Ash
78d0536109 TypeScript: strict parameter type for location (#5574)
* TypeScript: strict parameter type for `location`

* extend Location, return correct type

* add type tests


Co-authored-by: Zach Bloomquist <github@chary.us>
2019-12-19 10:25:18 -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
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
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
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
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
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
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
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
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
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
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
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