Commit Graph

397 Commits

Author SHA1 Message Date
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
Gleb Bahmutov
dd81ca5e3e add options argument to cy.contains TS definition (#4756) 2019-07-19 10:15:50 -04:00
John Arlinghaus
8153c6ec96 Add option to ignore special character sequences to cy.type (#4744)
* Added option to ignore special character sequences to cy.type

* Fixed lint issues

* Made option to disable special character sequences more explicitly named.

* Add typedef for new disableSpecialCharSequences option of type


Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-07-18 14:47:55 +06:30
renovate[bot]
5ab23f022f chore(deps): update dependency @cypress/eslint-plugin-dev to version 3.3.0 🌟 (#4723)
* chore(deps): update @cypress/eslint-plugin-dev to 3.3.0 🌟

* sort json package.json files + add note to skipped tests
2019-07-16 14:21:08 +06:30
Zach Bloomquist
79c7a6c36a Mention HTTP_PROXY if download error occurs; fall back to NPM's… (#4705)
* Mention HTTP_PROXY if download error occurs; fall back to NPM's proxy config in install

* better debug logs

* snap-shot-it@7.7.1 -> 7.8.0

* respect npm_config in server, add debug logs for proxy
2019-07-15 15:21:48 -04:00
Ben Kucera
f518e6e8c2 refactor typedefs for cy (#3499)
* refactor typedefs for cy

* fix dtslint

* fix dtslint

* add test for extending types
03-00000014

* typo

* docs and examples for cy type

* sorted props

* remove a few tabs

* better jsdoc
2019-07-15 10:36:12 -04:00
renovate[bot]
325fbf6f63 fix(deps): Update dependency lodash to version 4.17.14 🌟 (#4709)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-07-15 12:34:22 +06:30
Jennifer Shehane
5963b1eff8 Add example for location.href - also should example (#4702) 2019-07-12 13:59:53 -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
renovate[bot]
e51f87ba7d chore(deps): update dependency dependency-check to version 3.4.… (#4690)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-07-10 16:24:33 +06:30
renovate[bot]
a474755e16 fix(deps): Update dependency lodash to version 4.17.13 🌟 (#4684)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-07-10 10:11:47 +06:30
Gleb Bahmutov
c57d302176 Verify downloaded test runner zip file 812 (#4193)
* if download has checksum use it to verify downloaded file

* check only filesize if no checksum available

* add download tests

* move checksum into util for reuse, be explicit

* add comments explaining headers used to verify checksum

* move hasha to dev dependency

* remove unnecessary function

* do not use deprecated Promise.join with spread

* fix promise join callback

* linting
2019-07-09 14:03:00 -04:00
Paul Sachs
27ccf751ba Publicly export withinSubject option on get command (#2791)
* Publicly export withinSubject field on get requests

* Fix linting

* review adjustments
2019-07-09 10:57:13 -04:00
Jennifer Shehane
13b5a0acda Prefer American spelling 'canceled' (#4676) 2019-07-09 21:15:04 +06:30
Ben Kucera
52ca8ed839 support partial matching text,html,value (#3259)
* add "be.focused" to chai_jquery

* add comment explaining the mess

* add type definitions

* refactor assertion to use jquery assertion

* remove trailing whitespace

* add test for multiple elements, update typedefs

* fix failing tests: not.be.visible -> not.exist

* allow should(not.be.visible) for failed selectors

* remove unrelated visibility changes

* support partial matching text,html,value,id

* add partials for html,text,value ONLY, add typedefs, fix tests

* address changes
2019-07-09 10:30:15 -04:00
Gleb Bahmutov
db62738209 Clean env variable CYPRESS_INSTALL_BINARY before checking (#4579)
* fix: trim and remove double quotes around CYPRESS_INSTALL_BINARY

* linting

* add one more unit test for dequote

* add one more unit test

* fix jsdoc

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

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

* Added method to utils to convert percent value to percentage

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


Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
2019-07-01 09:07:33 +06:30
Zach Bloomquist
19e1297240 Add server onAnyRequest, etc... functions to typedefs (#4109) 2019-06-28 19:52:58 +06:30
Jennifer Shehane
e7e3153d39 Update configuration schema to match docs (#4300) 2019-06-28 19:52:15 +06:30
Jennifer Shehane
f685926130 update Readme for CLI to be more robust and match other packages [skip ci] 2019-06-28 13:33:48 +06:30
James George
70c441c9f9 fix(chore): fixup usage information (#4546)
* Fixup usage information

* Update unit test snapshot
2019-06-25 12:32:24 -04:00
renovate[bot]
c2d9ae4e42 fix(deps): update dependency fs-extra to version .x 🌟 (#4555)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-06-25 17:20:04 +06:30
Gleb Bahmutov
932bd1a585 chore: newline at the end of package.json 2019-06-19 15:39:01 -04:00
renovate[bot]
d01c4f0715 chore(deps): Update dependency snap-shot-it to version 7.7.1 🌟 (#4498)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-06-19 15:08:24 +06:30
Zach Bloomquist
60318a7f0f Use is-html as a fallback to check if cy.visit() response is HTML (#4321)
* use is-html as a fallback to check if response is HTML

* end response with passthru stream

* clean up network_failures

* add test that visit passes with undef content-type

* handle empty responses too

* try to fix dtslint: bump package version 2
02-00000876

* fix failing tests via develop merge


Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-06-19 03:05:38 -04:00
Jennifer Shehane
a151428e8e remove unused nyc dev dependency (#4486) 2019-06-18 12:04:07 +06:30
Dmitriy Kovalenko
e44fc780dd [#4461] Change typescript declaration for .writeFile() (#4463)
* [#4461] Change typescript declaration for .writeFile()

* Fix dtslint error

* Add example to tsdoc definition

* Add testing example of new ts definition

* Fix trailling whitespace
2019-06-17 22:14:43 +06:30
renovate[bot]
86574be7ea chore(deps): update dependency snap-shot-it to version 7.5.1 🌟 (#4465)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-06-14 22:45:22 +06:30
Jennifer Shehane
4bd3cf2c53 Ensure that test titles are strings before sanitizing them for screenshot names (#4317)
* Ensure that test titles are strings before sanitizing them for screenshot names

* Fix linting errors

* stringify non-string title, return '' for null and undefined

* minor cleanup. extract to outer function. refactor to lodash.


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-06-12 13:14:32 -04:00
renovate[bot]
be5909f63c fix(deps): Update dependency fs-extra to version .x 🌟 (#4437)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-06-12 10:50:22 +06:30
Ben Kucera
7efd9d8ab0 fix programmatic focus/blur events, typing into currently focused (#2982)
* fix programmatic blur events, allow typing into currently focused, fix getHostContenteditable

* intercept .blur

* reference issues in tests

* make tests account for conditional number of new lines inserted

- newer browsers insert a double new line, whereas older browsers dont
- write a helper that exposes the multiplier of new lines

* cleanup, remove dead code

* make tests dynamic when browser is or isn't out of focus

* cleanup, remove old notes, add more notes

* add failing tests for when native focus / blur are called multiple times

- need to handle not firing the events conditionally based on whether
or not the element would / should receive them

* remove old code for priming focus/blur events when window is out of focus

* remove dead code

* update focus_blur spec + add chai-subset

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

* decaffeinate: Convert focus_blur_spec.coffee to JS

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

* add failing test

* fix double blur/focus events

* make document.hasFocus always return true, add test

* fix focus events when non-focusable element

* remove unneeded retrun

* fix focusing body/ bluring active element on click

* forgot to call .get() with index

* fix focus issue with body/window

* still allow firefocus on window, skip firing focus if firstfocusable is window during click

* left out return in intercept blur/focus

* cleanup test code for focus_blur spec

* add tests to type_spec, focus_blur_spec
00-00005bfe

* update focus logic for click, fix dtslint error
06-00003d9c

* add tests for selectionchange event in focus_blur spec
01-00000dae

* set dep to exact version
06-00002320

* minor formatting

* intercept focus/blur for SVGElement

* add comment to type-into-already-focused logic


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
2019-06-11 11:06:26 -04:00
Gleb Bahmutov
06796484ec use relative types path from sinon-chai (#4382)
* use relative types path from sinon-chai

* change sinon-chai path post-install
2019-06-04 12:52:52 -04:00
Jennifer Shehane
e354d160fb Only submit forms with buttons of type='submit' or that are not type='reset' or type='button' (#4365)
* Fix issue where button of type='reset' would be activated during implicit form submission instead of button type='submit'

* Update to account for the fact that default type of button is 'submit'


Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
2019-06-04 10:05:12 +06:30
Ben Kucera
c3397dceb2 fix flaky spec: server e2e snapshot spec (#4324)
* fix flaky spec: server e2e snapshot spec - cleanse uploading multi results
05-00001bc5

* try to fix dtslint: bump package version
01-000059dc

* try to fix dtslint: bump package version 2
02-00000876

* clean up whitespace bonanza
2019-05-28 14:54:19 -04:00
Stefano Magni
d55acdee2e Fix the cy.stub type signature (#4302)
* Fix the cy.stub type signature

* Fix the TS linter failures
2019-05-24 12:39:30 -04:00
Brian Mann
6850e68b48 do not mutate process.env when verifying (#4281) 2019-05-22 17:12:13 -04:00
Ben Kucera
ef5c38d178 add "be.focused" and "have.focus" to assertions (#3219) (#4274)
* add "be.focused" to chai_jquery

* add comment explaining the mess

* add type definitions

* refactor assertion to use jquery assertion

* remove trailing whitespace

* add test for multiple elements, update typedefs

* fix failing tests: not.be.visible -> not.exist

* allow should(not.be.visible) for failed selectors

* remove unrelated visibility changes

* extract only focus assertion

* Revert "Merge remote-tracking branch 'origin/develop' into issue-97-focus-assertion"

This reverts commit b401c32a61, reversing
changes made to ab14758d31.

* force jquery to use custom focus pseudo selector

* only force custom matchers for focus selectors

* rewrote matchesSelector wrap code

* add lodash

* Merge in origin/develop

* changes on 3.3.0

Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2019-05-21 18:56:15 -04:00
Jennifer Shehane
cacd122c67 Fix mixed use of both XVFB and Xvfb to all be Xvfb (#4262) 2019-05-21 10:33:59 -04:00
Brian Mann
77c62e010b improve CLI verify + run display warnings (#4230)
* tighten up potential xvfb display problems

- improve the warning message on possible display problems
- reuse existing helper functions for platform detection
- instead of relying on timing mechanisms, if a possible display
problem is detected on linux - capture all of the stderr silently and
if the broken gtk message is detected, retry running

* consolidated and simplified smoke testing, xvfb error logging and messaging

- added —dev support to cypress verify cli command

* fix lots of tests, restore one error message

* fixed remaining CLI tests

* console.log pong only in electron mode

* remove dead code
2019-05-17 09:12:03 -04:00
renovate[bot]
83bc2cc83e chore(deps): update snap-shot-it to 7.4.4 🌟 (#4224) 2019-05-17 13:19:27 +06:30
renovate[bot]
76cb0efe52 fix(deps): update dependency getos to version .x 🌟 (#4222)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2019-05-17 12:05:47 +06:30
Zach Bloomquist
432b5366d9 Expose cy.isCy as Cypress.isCy, add typedefs (#4170)
* expose cy.isCy on Cypress object

* add typedefs for Cypress.isCy

* :face_palm:
2019-05-16 11:10:58 +06:30
Zach Bloomquist
b8a6baaca3 Retry certain requests on failure (#4015)
* retry requests, basic e2e test

* basic e2e test for chrome behavior

* don't use timeouts to test

* some minor cleanup

* validate google chrome's retry behavior w/ a proxy

* get retries on network errors workin

* cleanup

* final changes before switching approach

* Reverting previous approach in request.coffee, server.coffee

* add retryOnNetworkFailure

* now works with retryOnStatusCodeFailure

* retry 4 times in addition to the 1 initial attempt

* add tests for subresources

* much improved error handling

* have the e2e test really work

* e2e baseurl check

* retry baseurl check

* remove special handling for node 8.2.1 bug

* WIP: continue making progress building out request retry

- swap out passthrough’s for pumpify / duplexify / pump
- clean up error handling / messaging / retry logic

* pipe clientrequest events

* buffer req body to disk, restore error handling/retrying

* don't bubble up errors from failed attempts

* actually pipe reqstream, oops

* add some e2e tests for request body

* revert lib/request.coffee to 7be1051

* add almost-working lazy-stream

* manually fire the 'pipe' event on the reqStream to copy headers to the outgoing message

- restore the ‘error’ propagation so that all tests pass for now

* cleanup leaking 'undefined' into stdout, causing failing e2e tests

- do not set onWarning as a property of project, just pass as an
argument

* add new options to request_spec, deduplicate default opts

* use stream buffer in request.coffee

* revert request.coffee

* last stream_buffer changes before removing fs stuff

* remove fs stuff from stream_buffer, add stream piping tests

* it works! :tada::tada:🎉 using duplexify to separate delayStream and reqBodyBuffer

* retry for .5s max on ECONNREFUSED

* add error codes

* don't timeout proxied requests

* restore baseurl check

* update new e2e tests

* make delay work with rp

* propagate clientresponse events

* removing tests that don't do anything now that we don't ESOCKETTIMEOUT on proxied requests

* add new visit, req options to index.d.ts

* don't fail on server-performance-test

* make retries with status code work again

* account for different stack trace in ci

* fix test

* retry https requests

* add tests for https passthru retries working

* clean up error handling for https-proxy

* fix failing https-proxy tests, tweak agent error handling to prevent multiple callbacks

* make expectedExitCode actual vs. expected in the correct order

* bump up e2e test timeout so it can retry and still work

* update tests

* retry up to 500ms on proxied requests

* add tests for incompatible options errors

* remove .only

* maybe this will help it act more consistently

* help e2e test work in ci

* don't reconnect on already made connections

* clarify naming

* wip: testing https proxy

* better debug calls

* WIP: getting proxy passthrough retry tests going

* handle retrying upstream proxy errors

- add tests for successfully retrying proxy errors and for unsuccessful
retries
- fix onClose errors when proxy connection is closed before enough data
is received
- fix not returning setTimeout correctly

* group related code accordingly

* do not build typescript by default, drop extension from main

* more TODO notes

* don't set a default NO_PROXY if NO_PROXY = ''

* debugging-proxy@2.0.0

* null out reqBodyBuffer when req finishes

* wip: retry in agent, not https-proxy [skip-ci]

* update https-proxy to use @packages/network retries

* retry after connection but before proxy tunnel established

* appease my linty overlords

* update https-proxy tests

* update agent specs, decided to still use tls.connect

it's easier to test and has less complexity

* test retrying HTTPS passthru

* debugging-proxy@2.0.1

* increase defaultCommandTimeout 100 -> 200 to prevent flake in CI

* auto formatting

* fix test to be dynamic and not rely on magic constants

* copy types field when linking proxy images, update packages/network types field

* linting

* add network index.js file

* linting

* improve error messaging experience when verifying base url

* only insert 1 new line

* fix failing test not binding to localhost

* removed test that's covered by e2e specs

* remove dash in 're-try'

* some cleanup for readability

* use allocUnsafe per perf

* unset NO_PROXY with an empty string

* move retry ensuring the baseUrl into url, cleanup some imperative code

* if the head is already present during connect, make connection, else wait for first head bytes

* minor formatting, clarity around conditions, naming

* rename retryInterval -> retryIntervals

* set defaults for requests during creation for clarity

* rename send -> sendPromise to pair better with sendStream

* use retryIntervals instead of juggling MAX_REQUEST_RETRIES

- ensure debug messages are consistent between request streams +
promises
- set static constants

* DRY up status check + network failure + retry logic

- keeps the debug logic identical between promises + streams
- ensures all logic paths are also consistent
- consolidates the pop’ing of intervals in a single place

* find / replace fail

* derp

* make the logic actually correct, set intervals as cloned defaults for recursive lookup

* pass arg correctly

* reduce debugging noise, formatting

* rename intervals -> delaysRemaining for clarity

* added unit tests around getDelayForRetry

* set retryIntervals as default options correctly, add unit tests


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
2019-05-15 12:46:55 -04:00
Gleb Bahmutov
ebb8afdff4 logger warn from CLI should strip all indent from nested message (#4188) 2019-05-13 18:27:26 -04:00