Commit Graph

48 Commits

Author SHA1 Message Date
Maarten Claes
c4e90956de Allow timeout on hash (#3844)
Allow timeout on hash according to the documentation (https://docs.cypress.io/api/commands/hash.html#Arguments).
2019-03-29 12:14:34 -04:00
Takuya HARA
e2e454262b fix: trigger() accepts arbitrary event properties in options (#3809) 2019-03-26 15:59:57 -04:00
Jennifer Shehane
e4bb945541 remove string as valid type for match chainer (#3787)
Co-authored-by: Zach Bloomquist <github@chary.us>
2019-03-25 18:16:34 +06:30
Gleb Bahmutov
f81dc7a6b2 move 3rd party types to dev dependencies in CLI NPM package (#3425)
* wip: move lodash types to dev dependencies

* move blob-util types

* move types for minimatch

* do not lint types from minimatch

* move types sinon to dev dependencies

* move sinon-chai types to dev dependencies

* update tslint

* move types bluebird to dev dependencies

* move mocha types

* move jquery types to dev dependencies

* rename moment local wrapper

* move chai and chai-jquery

* refactor code for building CLI and dealing with folders

* linting

* include types subfolders

* replace types with relative paths

* transform sinon path to relative

* linting

* do not delete d.ts files

* linting

* chore: build npm package from this branch

* add minimatch relative reference

* work around minimatch

* set sinon to be relative load

* add readme to CLI

* linting readme
2019-03-05 12:49:42 -05:00
Zach Bloomquist
d24285bbdd Visit with a POST and/or custom headers (#3489)
* driver, server: visit with a POST [wip]

* driver, server: allow sending body, headers, method in .visit

* driver: test: doublequotes

* driver: api cleanup, error handling

* driver, server: tests

* driver: only recognize visit(opts) if options is sole argument

* server: don't confuse options

* driver: validate method passed to 'visit'

* driver: validate that headers is an object

* driver: shows URL and not object in command log (fixes part of #678)

* cli: add new cy.visit(opts) invocation
2019-02-27 09:19:31 -08:00
Jennifer Shehane
a18dac6931 fix typo in index.d.ts file (#3588) 2019-02-25 23:04:21 +00:00
Gleb Bahmutov
5e86622b63 add sinon stub types to window alert and confirm (#3452) 2019-02-13 13:09:24 -05:00
Gleb Bahmutov
a92d0579a1 Fix jsdoc examples and expand comments in TypeScript definition file (#3163)
* update a few comments

* update more jsdocs

* update actions examples

* update a few more docs

* more jsdoc

* disable linting jsdoc comments in index.d.ts file
2019-01-23 01:50:34 -05:00
Nicholas Boll
2e2c5af441 fix: Type definitions for .then (#3105)
Fixes #3075
2019-01-09 13:43:19 -05:00
Gleb Bahmutov
71429e620e Fix TypeScript Omit definition (#3031)
* test built binary and NPM against kitchensink

* try building cypress/browsers:chrome67

* implement Omit using Exclude

* bump down to chrome64

* remove this branch from building binary
2019-01-02 15:09:18 -05:00
Thomas Rich
852176f468 https://github.com/cypress-io/cypress/issues/2975 (#2976)
Connects https://github.com/cypress-io/cypress/issues/2975
2018-12-26 23:19:13 +06:30
Gleb Bahmutov
ee659b3d2b fix: set object for qs property in cy.request types, close #2305 (#2306)
* fix: set object for qs property in cy.request types, close #2305

* server whitelist callback takes request, returns boolean
2018-12-25 23:02:49 -08:00
Gleb Bahmutov
d3193d5ec0 Revert "Revert "fix: upgrade sinon types to min TS 2.8 (#2966)"" (#2974)
* Revert "Revert "fix: upgrade sinon types to min TS 2.8 (#2966)""

This reverts commit cc3de8ff78.

* enable dtslint in cli again
2018-12-20 13:10:21 -05:00
Brian Mann
cc3de8ff78 Revert "fix: upgrade sinon types to min TS 2.8 (#2966)"
This reverts commit 203622080e.
2018-12-19 23:51:54 -05:00
Gleb Bahmutov
203622080e fix: upgrade sinon types to min TS 2.8 (#2966) 2018-12-19 18:33:38 -05:00
Jeremy Tymes
c0ce2c460b Allow separate request and response timeout overrides in cy.wait (#2829)
* Allow overriding the request and response timeouts for XHR.

* Add interface to the XHR wait overloads to take in the request and response timeouts.
2018-12-02 22:49:48 -05:00
Paul Sachs
ca1139a092 Update types to support promises in wrap (#2807) 2018-12-02 21:04:42 -05:00
Pete Johanson
7640eeb8b6 Add strong typed definition for Cypress.moment(). (#2746) 2018-11-15 09:50:11 -05:00
Gleb Bahmutov
30556480c7 add missing screenshot options type and a few type tests (#2655) 2018-10-25 12:37:56 +02:00
Jennifer Shehane
3b804cd09c bump @types/jquery (#2369)
* bump @types/jquery
* update expected Cypress.$ type
2018-08-28 11:52:05 -04:00
Gleb Bahmutov
ca20e74486 fix dtslint file name rule (#2192) 2018-07-23 11:32:37 +02:00
Gleb Bahmutov
7a2c21144f add missing TypeScript jsdocs for types for issue 2009 (#2137)
* doc second cy.find type

* document type for cy.request

* document Cypress.env command

* doc type for Cypress.log

* doc types for uncheck

* add type docs for cy.spy

* document spies and stubs types

* add space to align jsdoc stars

* types: show to correctly pass request options, close #2093

* cast just the http method property

* types for spy withArgs and as

* doc more types for overrides

* type for spread

* type for overriden then

* types for cy.trigger overrides

* rest of types of overriden methods, close #2009
2018-07-12 18:42:50 -04:00
Gleb Bahmutov
ee3eb4a2dd add cy.stub type for window alert and confirm (#2008)
* add cy.stub type for window alert and confirm

* jsdoc for cy.contains

* add jsdoc for viewport width and height

* jsdoc for prev command

* add jsdoc for cy.wait

* add jsdoc for clearLocalStorage

* jsdoc for wrap

* add jsdoc for screenshot with filename

* add jsdoc for clock

* add jsdoc example to cy.its

* complete jsdoc for siblings

* jsdoc for route overrides
2018-06-25 16:42:51 -07:00
Brian Mann
abfb594872 add browser.isHeadless + browser.isHeaded (#1975)
* add isHeadless + isHeaded to browser

- move around logic so that instead of launching a browser by name, its
passed the entire browser object
- simplify logic for passing around options.headed

* launch the browser with an object, not browser name

* update browser types

* fix failing tests
2018-06-18 03:15:19 -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
Gleb Bahmutov
360b58b27d Ts server yields 1907 (#1911)
* types: cy.server yields default server options, close #1907

* add examples to a few TS commands
2018-06-08 11:47:24 -04:00
Gleb Bahmutov
3241c6e229 types for auth in cy.visit, close #1897 (#1908) 2018-06-08 10:11:36 -04:00
Gleb Bahmutov
ff58367838 Ts definition for clear local storage 1899 (#1903)
* types: clearLocalStorage yields localStorage, close #1899

* types: minimatch is a function, close #1902
2018-06-07 20:10:45 -04:00
Gleb Bahmutov
39b31fd771 Route typescript fix 1831 (#1874)
* types: add object to routes, close #1831

* types: remove Response type from cy.route, it belongs only in cy.request

* add example to cy.route doc

* types: add PATCH method, same as pull request #1778
2018-06-05 15:33:24 -04:00
Kevin Heard
5330ccd476 fix typo in comments (#1791) 2018-06-05 15:20:59 -04:00
Brian Mann
d92d51a8eb rename videoRecording -> video (#1804) 2018-05-29 17:23:01 -04:00
Brian Mann
4053596a88 validate cli + env var config, add breaking config changes (#1784)
* fixes #1783 validate configuration values after they're set from CLI + Env Vars

* fixes #1754 remove screenshotOnHeadlessFailure and rename trashAssetsBeforeHeadlessRuns

* derp copypasta fail
2018-05-28 01:27:54 -04:00
Chris Breiding
7db71497a4 Update typescript types for screenshots (#1757)
* update typescript types for screenshots

* fullpage -> fullPage
2018-05-22 20:15:50 -04:00
Chris Breiding
118297a30e Add screenshot configuration API (#1504)
* 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

* add Cypress.Screenshot.defaults, implement most options

* accept new options in cy.screenshot()

* add jsconfig files for vscode’s sake

* only open test when capturing runner

* use dom to hide runner ui instead of react

* screenshot capture “all” -> “runner”

* fix specs

* refactor pausing timers

* implement before/after screenshot callbacks

* fix lint error

* enforce order of captures

* fix spec

* refactor app.jsx screenshot handling

* wait two ticks for repaint to occur before/after screenshots

* use special pixels to ensure cypress ui is hidden when taking app screenshot

* crop non-app from app screenshots

* add e2e test for pathological case where app has pixels that match rendering helper pixels

* fix screenshot app capture snapshot

* add unit tests for lib/automation/screenshot

* use blackout in app capture spec to ensure it renders

* fix task e2e spec

* fix driver screenshot spec

* use Promise.map {concurrency: 1} instead of utils.runSerially

* normalize minute durations in e2e test snapshots

* increase timeout for screenshot app capture e2e test

* correct app capture snapshot

* always run screenshot afterAll step

* call timer functions with context set

* simplify screenshot capture option to just be a string

* clone screenshot config to prevent mutation

* always capture runner w/o blackout on failures

* refactor and add more tests for screenshot events

* default to app capture

* try/catch screenshot dom modifications in case the iframe is cross-origin

* don’t blackout on runner captures

* update e2e test with latest screenshot api

* fix screenshots e2e test now that app capture is default

* refactor server/screenshots

* implement fullPage screenshot capture

* use capture: ‘fullpage’ instead of fullPage: true

* remove unnecessary try/catches

* add e2e tests for fullpage captures

* fix unit tests

* refactor full page screenshots

* rename/refactor from fullpage to multipart

* implement element captures

* split up screenshot e2e tests

* expose clip as screenshot option

* take devicePixelRatio into account for screenshot cropping

* some formatting and fun with retina offscreen images

* determine device pixel ratio server-side

window.devicePixelRatio can’t be trusted, because in headless electron it returns 1 even on a retina screen. Instead, we determine it server-side by dividing the screenshot resolution by the viewport size.

* refactor screenshot buffer handling

* add support for cy.within

* make fullpage the default capture

* only allow one element to be screenshotted

* coerce capture into ‘app’ for element captures

* fix specs broken by fixture change

* make top-left screenshot helper pixel less noticeable

* add some code comments

* refactor runner screenshots handling

* clean up before/after screenshot code

* ensure cleanup if test restarts in middle of screenshot

* skip pixel-checking on failure screenshots to reduce latency

* add types for new screenshot api

* fix typescript linting issues

* @sandbox -> sinon

* fix screenshots spec

* fix e2e spec

* fix specs

* fix specs
2018-05-16 15:00:59 -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
Gleb Bahmutov
bf4f6b9c75 fix: typescript definition for scrollIntoView, close #1606 (#1609)
* fix: fix the typescript definition for scrollIntoView, close #1606

* separate scrollTo options from scrollIntoView
2018-05-15 12:45:20 -04:00
Dumitrana Alinus
95f86236c4 Update index.d.ts (#1622)
Use local types for blob, bluebird, minimatch
2018-05-12 10:15:50 -04:00
PINGUET Julien
a88c04b3bd Add .filter(Function) typing (#1670)
* Add .filter(Function) typing

* Add .filter(Function) typing
2018-05-11 22:10:20 -04:00
Nicholas Boll
039192b1cd chore(types): Add initial Cypress.log API (#1289) 2018-04-15 01:56:59 -04:00
Nicholas Boll
075a3a0757 feat: Add type definitions for Cypress.off (#1514)
* feat: Add Cypress.off type definitions

* Added .off types and tests
2018-04-15 01:53:04 -04:00
Nicholas Boll
88f534bf08 fix: Incorrect type for 'then' returning a wrapped 'undefined' (#1220) 2018-02-04 14:45:42 -05:00
Nicholas Boll
ae8b147e28 feat: Add TypeScript support for Cypress action events (#1187)
* feat: Add support for Cypress action events

* fix: Fixed documentation URL for actions

* fix dtslint test failures
2018-01-16 10:59:00 -05:00
Nicholas Boll
a51ea1f783 doc: should/and chainer autocomplete (#1132)
* fix: within type definition

* doc: should/and chainer autocomplete

* chore: Updated example documentation to match #1117
2018-01-09 17:05:55 -05:00
Gleb Bahmutov
aa0a41caf5 Doc ts better 1117 (#1122)
* ts: document common assertions, cy and Cypress

* document more common methods

* more comments for #1117

* todomvc examplehas good intellisense, close #1117
2017-12-24 18:25:06 -05:00
Nicholas Boll
233ddf8d7b fix: Unwrap subject returned by cy.then (#1085)
* fix: Unwrap subject returned by cy.then

* update to use Cypress.Promise
2017-12-19 11:15:05 -05:00
Nicholas Boll
a06ca4a19b chore: Add extra chainer types for auto-complete (#1059) 2017-12-14 16:47:39 -05:00
Nicholas Boll
5d761630f2 chore: Update type definitions to match API more closely (#1048)
* chore: Fill out Cypress API types

* chore: Convert Chainable into a Generic with a subject

* chore: undefined return of then keeps Subject

* fix: Remove incorrect comment

* chore: Add element keys to all selector methods

* chore: Remove generic from cy.not - it doesn't make sense

* chore: Add ChainableArray for array Subjects

* chore: Add ChainerArray to thread types through

* chore: Remove ChainableArray interface

* chore: Fix stub/spy types - returns Agent interface
2017-12-11 21:45:39 -05:00
Nicholas Boll
6db7a83125 chore: Add dtslint and Cypress static types (#1044)
* chore: Add dtslint and Cypress static types

* chore: Fix types location for cli build

* chore: Removed api from api command paths

* chore: Remove semicolons from type definitions

* chore: Removed semicolons not caught by tslint

* chore: Add type tests
2017-12-08 16:41:34 -05:00