cypress 16.2.0 → 16.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular/dist/index.js +10 -12
- package/angular/package.json +7 -22
- package/dist/bin/cypress +8 -8
- package/dist/{cli-AgTnS5LO.js → cli-y9Bb9Y77.js} +215 -40
- package/dist/cli.js +6 -6
- package/dist/{cypress-CdDm9AVa.js → cypress-CvEs5adm.js} +2 -2
- package/dist/cypress.js +8 -8
- package/dist/exec/spawn.js +4 -4
- package/dist/exec/xvfb.js +7 -4
- package/dist/index.js +8 -8
- package/dist/{spawn-DElwyZHC.js → spawn-Bx99tBTm.js} +529 -69
- package/dist/{tap-WHD3nHJC.js → tap-BMFGLoCT.js} +108 -26
- package/dist/{xvfb-CbW2_YXR.js → xvfb-DxbcANVl.js} +238 -25
- package/mount-utils/dist/index.js +1 -1
- package/mount-utils/package.json +15 -14
- package/package.json +5 -5
- package/react/dist/cypress-react.cjs.js +9 -7
- package/react/dist/cypress-react.esm-bundler.js +9 -7
- package/react/package.json +26 -46
- package/svelte/dist/cypress-svelte.cjs.js +3 -2
- package/svelte/dist/cypress-svelte.esm-bundler.js +3 -2
- package/svelte/package.json +24 -22
- package/types/cy-bluebird.d.ts +1 -0
- package/types/cy-chai.d.ts +99 -2
- package/types/cypress.d.ts +216 -43
- package/types/net-stubbing.d.ts +1 -1
- package/vue/dist/cypress-vue.cjs.js +4 -2
- package/vue/dist/cypress-vue.esm-bundler.js +4 -2
- package/vue/dist/index.d.ts +3 -3
- package/vue/package.json +35 -42
- package/angular/angular/README.md +0 -18
- package/angular/angular/dist/index.d.ts +0 -120
- package/angular/angular/dist/index.js +0 -479
- package/angular/angular/package.json +0 -82
- package/mount-utils/mount-utils/README.md +0 -140
- package/mount-utils/mount-utils/dist/index.d.ts +0 -12
- package/mount-utils/mount-utils/dist/index.js +0 -41
- package/mount-utils/mount-utils/package.json +0 -52
- package/react/react/README.md +0 -19
- package/react/react/dist/cypress-react.cjs.js +0 -293
- package/react/react/dist/cypress-react.esm-bundler.js +0 -268
- package/react/react/dist/index.d.ts +0 -95
- package/react/react/package.json +0 -113
- package/svelte/svelte/README.md +0 -19
- package/svelte/svelte/dist/cypress-svelte.cjs.js +0 -122
- package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +0 -120
- package/svelte/svelte/dist/index.d.ts +0 -31
- package/svelte/svelte/package.json +0 -63
- package/vue/vue/README.md +0 -14
- package/vue/vue/dist/cypress-vue.cjs.js +0 -8692
- package/vue/vue/dist/cypress-vue.esm-bundler.js +0 -8671
- package/vue/vue/dist/index.d.ts +0 -1413
- package/vue/vue/package.json +0 -97
package/types/cypress.d.ts
CHANGED
|
@@ -226,6 +226,7 @@ declare namespace Cypress {
|
|
|
226
226
|
[key: string]: Storable
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- public type; kept an interface because a type alias would stop declaration merging in user code
|
|
229
230
|
interface StorableArray extends Array<Storable> { }
|
|
230
231
|
|
|
231
232
|
type StorableRecord = Record<string, Storable>
|
|
@@ -326,6 +327,7 @@ declare namespace Cypress {
|
|
|
326
327
|
/**
|
|
327
328
|
* The interface for user-defined properties in Window object under test.
|
|
328
329
|
*/
|
|
330
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- users declare their AUT window properties by merging into it
|
|
329
331
|
interface ApplicationWindow { } // tslint:disable-line
|
|
330
332
|
|
|
331
333
|
/**
|
|
@@ -624,6 +626,16 @@ declare namespace Cypress {
|
|
|
624
626
|
* Returns a jQuery object obtained by wrapping an object in jQuery.
|
|
625
627
|
*/
|
|
626
628
|
wrap(wrappingElement_function: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((index: number) => string | JQuery)): JQuery
|
|
629
|
+
/**
|
|
630
|
+
* Returns the elements matching a jQuery selector, as a jQuery object.
|
|
631
|
+
* Without a `context`, it searches the document that Cypress's own scripts
|
|
632
|
+
* run in, not your application. To search your application, pass its
|
|
633
|
+
* document or an element in it as `context`.
|
|
634
|
+
* @example
|
|
635
|
+
* cy.document().then((doc) => {
|
|
636
|
+
* const $buttons = Cypress.dom.query('button', doc)
|
|
637
|
+
* })
|
|
638
|
+
*/
|
|
627
639
|
query(selector: JQuery.Selector, context?: Element | JQuery): JQuery
|
|
628
640
|
/**
|
|
629
641
|
* Returns an array of raw elements pulled out from a jQuery object.
|
|
@@ -633,7 +645,6 @@ declare namespace Cypress {
|
|
|
633
645
|
* Returns a boolean indicating whether an object is a DOM object.
|
|
634
646
|
*/
|
|
635
647
|
isDom(obj: any): boolean
|
|
636
|
-
isType(element: JQuery | HTMLElement, type: string): boolean
|
|
637
648
|
/**
|
|
638
649
|
* Returns a boolean indicating whether an element is visible.
|
|
639
650
|
*/
|
|
@@ -644,15 +655,29 @@ declare namespace Cypress {
|
|
|
644
655
|
isHidden(element: JQuery | HTMLElement, methodName?: string, options?: object): boolean
|
|
645
656
|
/**
|
|
646
657
|
* Returns a boolean indicating whether an element can receive focus.
|
|
658
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object with
|
|
659
|
+
* more than one element, returns `true` if any of them can receive focus.
|
|
647
660
|
*/
|
|
648
661
|
isFocusable(element: JQuery | HTMLElement): boolean
|
|
662
|
+
/**
|
|
663
|
+
* Returns a boolean indicating whether an element accepts typed text: a
|
|
664
|
+
* `<textarea>`, a contenteditable element, or an `<input>` whose `type` is
|
|
665
|
+
* `text`, `password`, `email`, `number`, `date`, `week`, `month`, `time`,
|
|
666
|
+
* `datetime`, `datetime-local`, `search`, `url`, or `tel`.
|
|
667
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, checks its
|
|
668
|
+
* first element.
|
|
669
|
+
*/
|
|
649
670
|
isTextLike(element: JQuery | HTMLElement): boolean
|
|
650
671
|
/**
|
|
651
|
-
* Returns a boolean indicating whether an element is scrollable.
|
|
672
|
+
* Returns a boolean indicating whether an element or the window is scrollable.
|
|
673
|
+
* Accepts the window, a DOM element, or a jQuery object. For a jQuery object,
|
|
674
|
+
* checks its first element.
|
|
652
675
|
*/
|
|
653
676
|
isScrollable(element: Window | JQuery | HTMLElement): boolean
|
|
654
677
|
/**
|
|
655
678
|
* Returns a boolean indicating whether an element currently has focus.
|
|
679
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, checks
|
|
680
|
+
* its first element.
|
|
656
681
|
*/
|
|
657
682
|
isFocused(element: JQuery | HTMLElement): boolean
|
|
658
683
|
/**
|
|
@@ -663,9 +688,16 @@ declare namespace Cypress {
|
|
|
663
688
|
* Returns a boolean indicating whether an element is attached to the DOM.
|
|
664
689
|
*/
|
|
665
690
|
isAttached(element: JQuery | HTMLElement | Window | Document): boolean
|
|
691
|
+
/**
|
|
692
|
+
* Returns a boolean indicating whether an element matches a jQuery selector.
|
|
693
|
+
* For a jQuery object with more than one element, returns `true` if any of
|
|
694
|
+
* them match. Accepts a DOM element or a jQuery object.
|
|
695
|
+
*/
|
|
666
696
|
isSelector(element: JQuery | HTMLElement, selector: JQuery.Selector): boolean
|
|
667
697
|
/**
|
|
668
|
-
* Returns a boolean indicating whether
|
|
698
|
+
* Returns a boolean indicating whether `element2` is `element1` or is
|
|
699
|
+
* inside it. Each argument can be a DOM element or a jQuery object.
|
|
700
|
+
* For a jQuery object, checks its first element.
|
|
669
701
|
*/
|
|
670
702
|
isDescendent(element1: JQuery | HTMLElement, element2: JQuery | HTMLElement): boolean
|
|
671
703
|
/**
|
|
@@ -688,22 +720,146 @@ declare namespace Cypress {
|
|
|
688
720
|
* Returns a boolean indicating whether an object is a jQuery object.
|
|
689
721
|
*/
|
|
690
722
|
isJquery(obj: any): obj is JQuery
|
|
723
|
+
/**
|
|
724
|
+
* Returns a boolean indicating whether an `<input>` or `<button>` has the
|
|
725
|
+
* given `type`, or any of the given types when `type` is an array. It reads
|
|
726
|
+
* the element's `type` property rather than its attribute, so an `<input>`
|
|
727
|
+
* with an unrecognized `type` counts as `'text'`, and a `<button>` with no
|
|
728
|
+
* `type` counts as `'submit'`. Returns `false` for any other element.
|
|
729
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, checks its
|
|
730
|
+
* first element.
|
|
731
|
+
*/
|
|
691
732
|
isInputType(element: JQuery | HTMLElement, type: string | string[]): boolean
|
|
692
|
-
|
|
693
|
-
|
|
733
|
+
/**
|
|
734
|
+
* Returns a string representation of an element, the window, or the document.
|
|
735
|
+
* `'long'` (the default) returns the element's HTML with its content
|
|
736
|
+
* abbreviated, and `'short'` returns its tag name with its id or classes.
|
|
737
|
+
*/
|
|
738
|
+
stringify(element: JQuery | HTMLElement | Window | Document, form?: 'long' | 'short'): string
|
|
739
|
+
/**
|
|
740
|
+
* Returns the raw elements in a jQuery object: the element itself when it
|
|
741
|
+
* holds one, an array of elements when it holds more than one, and
|
|
742
|
+
* `undefined` when it is empty.
|
|
743
|
+
*/
|
|
744
|
+
getElements(element: JQuery): HTMLElement | HTMLElement[] | undefined
|
|
745
|
+
/**
|
|
746
|
+
* Returns the selector that `cy.contains()` uses to find elements whose
|
|
747
|
+
* text includes `text`, plus submit buttons whose `value` has `text` as one
|
|
748
|
+
* of its space-separated words. `filter` limits the search to elements
|
|
749
|
+
* matching a selector, and can list several selectors separated by commas.
|
|
750
|
+
* Matching ignores case unless `options.matchCase` is `true`.
|
|
751
|
+
*
|
|
752
|
+
* The selector relies on pseudo-classes that only Cypress's copy of jQuery
|
|
753
|
+
* understands, so run it with `Cypress.$` or `Cypress.dom.query()`, not
|
|
754
|
+
* `document.querySelectorAll()`.
|
|
755
|
+
* @example
|
|
756
|
+
* Cypress.dom.getContainsSelector('Log in', 'button', { matchCase: true })
|
|
757
|
+
*/
|
|
694
758
|
getContainsSelector(text: string, filter?: string, options?: CaseMatchable): JQuery.Selector
|
|
695
|
-
|
|
696
|
-
|
|
759
|
+
/**
|
|
760
|
+
* Picks one element from a list of matches, the way `cy.contains()` does.
|
|
761
|
+
* Starting at `index` (default `0`) and skipping `<script>` and `<style>`,
|
|
762
|
+
* it moves on to the next element in the list for as long as that element
|
|
763
|
+
* is nested inside the current one, and stops at the deepest. If that
|
|
764
|
+
* element is inside an `<a>`, `<button>`, `<label>`, or submit `<input>`
|
|
765
|
+
* that is also in the list, it picks that ancestor instead.
|
|
766
|
+
*
|
|
767
|
+
* Returns a jQuery object holding the chosen element.
|
|
768
|
+
*/
|
|
769
|
+
getFirstDeepestElement(elements: JQuery, index?: number): JQuery
|
|
770
|
+
/**
|
|
771
|
+
* Returns the window that contains an element or a document, or the window
|
|
772
|
+
* itself when passed a window. Accepts any of these, or a jQuery object
|
|
773
|
+
* holding one. For a jQuery object, uses its first element.
|
|
774
|
+
*/
|
|
775
|
+
getWindowByElement(element: JQuery<HTMLElement | Document | Window> | HTMLElement | Document | Window): Window
|
|
776
|
+
/**
|
|
777
|
+
* Returns a sentence explaining why an element is not visible.
|
|
778
|
+
* Accepts a DOM element or a jQuery object.
|
|
779
|
+
*/
|
|
697
780
|
getReasonIsHidden(element: JQuery | HTMLElement, options?: object): string
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
781
|
+
/**
|
|
782
|
+
* Returns the closest ancestor of an element that can scroll, as a jQuery
|
|
783
|
+
* object, or `null` if there is none. The element itself is not checked.
|
|
784
|
+
* It walks out of shadow roots to their hosts and can return `<html>`.
|
|
785
|
+
* Returns `null` right away for `<html>`, `<body>`, or the document.
|
|
786
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, starts
|
|
787
|
+
* from its first element.
|
|
788
|
+
*/
|
|
789
|
+
getFirstScrollableParent(element: JQuery | HTMLElement): JQuery | null
|
|
790
|
+
/**
|
|
791
|
+
* Returns the element, or its closest ancestor, whose CSS `position` is
|
|
792
|
+
* `fixed` or `sticky`, as a jQuery object, or `null` if there is none.
|
|
793
|
+
* It walks out of shadow roots to their hosts. Returns `null` right away for
|
|
794
|
+
* `<html>`, `<body>`, or the document.
|
|
795
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, starts
|
|
796
|
+
* from its first element.
|
|
797
|
+
*/
|
|
798
|
+
getFirstFixedOrStickyPositionParent(element: JQuery | HTMLElement): JQuery | null
|
|
799
|
+
/**
|
|
800
|
+
* Returns the element, or its closest ancestor, whose CSS `position` is
|
|
801
|
+
* `sticky`, as a jQuery object, or `null` if there is none. It walks out of
|
|
802
|
+
* shadow roots to their hosts. Returns `null` right away for `<html>`,
|
|
803
|
+
* `<body>`, or the document.
|
|
804
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, starts
|
|
805
|
+
* from its first element.
|
|
806
|
+
*/
|
|
807
|
+
getFirstStickyPositionParent(element: JQuery | HTMLElement): JQuery | null
|
|
808
|
+
/**
|
|
809
|
+
* Rounds a point to whole pixels so it stays inside the element it targets.
|
|
810
|
+
* `xPosition` (`'left'`, `'center'`, or `'right'`) and `yPosition` (`'top'`,
|
|
811
|
+
* `'center'`, or `'bottom'`) say which edge the point sits on, and both
|
|
812
|
+
* default to `'center'`. A left or top edge rounds up, a center rounds down,
|
|
813
|
+
* and a right or bottom edge rounds down and then subtracts 1.
|
|
814
|
+
* Returns an object with `x` and `y`.
|
|
815
|
+
*/
|
|
816
|
+
getCoordsByPosition(left: number, top: number, xPosition?: 'left' | 'center' | 'right', yPosition?: 'top' | 'center' | 'bottom'): { x: number, y: number }
|
|
817
|
+
/**
|
|
818
|
+
* Returns an element's `width`, `height`, `scrollTop`, and `scrollLeft`, and
|
|
819
|
+
* the position of its box measured three ways: `fromElViewport` is relative
|
|
820
|
+
* to the viewport of the window the element is in, `fromElWindow` is
|
|
821
|
+
* relative to that window's document (so it includes the window's scroll),
|
|
822
|
+
* and `fromAutWindow` is relative to your application's top-level window,
|
|
823
|
+
* adding the offsets of any iframes in between.
|
|
824
|
+
* Accepts a DOM element or a jQuery object. For a jQuery object, measures its
|
|
825
|
+
* first element.
|
|
826
|
+
*/
|
|
702
827
|
getElementPositioning(element: JQuery | HTMLElement): ElementPositioning
|
|
828
|
+
/**
|
|
829
|
+
* Returns the topmost element at a point in `doc`'s viewport, looking inside
|
|
830
|
+
* open shadow roots, or `null` when the point is outside the viewport.
|
|
831
|
+
*/
|
|
703
832
|
getElementAtPointFromViewport(doc: Document, x: number, y: number): Element | null
|
|
833
|
+
/**
|
|
834
|
+
* Returns the same measurements as `getElementPositioning()`, with `x` and
|
|
835
|
+
* `y` added to `fromElViewport`, `fromElWindow`, and `fromAutWindow` for a
|
|
836
|
+
* point at `position` inside the element. `position` defaults to `'center'`
|
|
837
|
+
* and can be `'topLeft'`, `'top'`, `'topRight'`, `'left'`, `'center'`,
|
|
838
|
+
* `'right'`, `'bottomLeft'`, `'bottom'`, or `'bottomRight'`. Any other value
|
|
839
|
+
* throws a `TypeError`.
|
|
840
|
+
* Accepts a DOM element or a jQuery object.
|
|
841
|
+
*/
|
|
704
842
|
getElementCoordinatesByPosition(element: JQuery | HTMLElement, position?: string): ElementCoordinates
|
|
843
|
+
/**
|
|
844
|
+
* Like `getElementCoordinatesByPosition()`, but the point is `x` and `y`
|
|
845
|
+
* pixels from the element's top-left corner, as in `.click(x, y)`. The
|
|
846
|
+
* returned `top` and `left` values are shifted by `x` and `y` as well.
|
|
847
|
+
* Accepts a DOM element or a jQuery object.
|
|
848
|
+
*/
|
|
705
849
|
getElementCoordinatesByPositionRelativeToXY(element: JQuery | HTMLElement, x: number, y: number): ElementPositioning
|
|
850
|
+
/**
|
|
851
|
+
* Returns the element that hosts editing for `element`: the closest element,
|
|
852
|
+
* starting with `element` itself, that has a `contenteditable` attribute
|
|
853
|
+
* other than `"false"`. If there is none, returns the document's `<html>`
|
|
854
|
+
* element, which is the editing host when the document is in `designMode`.
|
|
855
|
+
* Pass a DOM element.
|
|
856
|
+
*/
|
|
706
857
|
getHostContenteditable(element: HTMLElement): HTMLElement
|
|
858
|
+
/**
|
|
859
|
+
* Returns the start and end offsets of the current text selection in an
|
|
860
|
+
* `<input>`, a `<textarea>`, or a contenteditable element. Returns
|
|
861
|
+
* `{ start: 0, end: 0 }` for any other element. Pass a DOM element.
|
|
862
|
+
*/
|
|
707
863
|
getSelectionBounds(element: HTMLElement): { start: number, end: number }
|
|
708
864
|
}
|
|
709
865
|
|
|
@@ -1345,9 +1501,12 @@ declare namespace Cypress {
|
|
|
1345
1501
|
/**
|
|
1346
1502
|
* Save/Restore browser Cookies, LocalStorage, and SessionStorage data resulting from the supplied `setup` function.
|
|
1347
1503
|
*
|
|
1504
|
+
* Yields the status of the session: `'created'` when `setup` ran for a new session, `'restored'` when a saved
|
|
1505
|
+
* session was restored, or `'recreated'` when a restored session failed validation and `setup` ran again.
|
|
1506
|
+
*
|
|
1348
1507
|
* @see https://on.cypress.io/session
|
|
1349
1508
|
*/
|
|
1350
|
-
session(id: string | object, setup: () => void, options?: SessionOptions): Chainable<
|
|
1509
|
+
session(id: string | object, setup: () => void, options?: SessionOptions): Chainable<'created' | 'restored' | 'recreated'>
|
|
1351
1510
|
|
|
1352
1511
|
/**
|
|
1353
1512
|
* Get the window.document of the page that is currently active.
|
|
@@ -4033,7 +4192,7 @@ declare namespace Cypress {
|
|
|
4033
4192
|
ensureScrollable: boolean
|
|
4034
4193
|
}
|
|
4035
4194
|
|
|
4036
|
-
interface ScrollIntoViewOptions extends ScrollToOptions {
|
|
4195
|
+
interface ScrollIntoViewOptions extends Omit<ScrollToOptions, 'ensureScrollable'> {
|
|
4037
4196
|
/**
|
|
4038
4197
|
* Amount to scroll after the element has been scrolled into view
|
|
4039
4198
|
*
|
|
@@ -4092,14 +4251,14 @@ declare namespace Cypress {
|
|
|
4092
4251
|
*/
|
|
4093
4252
|
cacheAcrossSpecs?: boolean
|
|
4094
4253
|
/**
|
|
4095
|
-
* Function to run immediately after
|
|
4096
|
-
*
|
|
4097
|
-
*
|
|
4098
|
-
* Cypress command
|
|
4254
|
+
* Function to run immediately after `setup` creates a session, or after a saved session is
|
|
4255
|
+
* restored. The session is invalid if this function throws an exception, contains a failing
|
|
4256
|
+
* Cypress command, returns a Promise that rejects or resolves to `false`, or returns nothing
|
|
4257
|
+
* and its last Cypress command yields `false`. Returning `false` directly, without a Promise,
|
|
4258
|
+
* does not invalidate the session.
|
|
4099
4259
|
*
|
|
4100
4260
|
* If validation fails immediately after `setup`, the test will fail.
|
|
4101
4261
|
* If validation fails after restoring a session, `setup` will re-run.
|
|
4102
|
-
* @default {false}
|
|
4103
4262
|
*/
|
|
4104
4263
|
validate?: () => Promise<false | void> | void
|
|
4105
4264
|
}
|
|
@@ -4322,6 +4481,13 @@ declare namespace Cypress {
|
|
|
4322
4481
|
encoding: Encodings
|
|
4323
4482
|
}
|
|
4324
4483
|
|
|
4484
|
+
/**
|
|
4485
|
+
* What the chai-jquery `match` assertion accepts for a DOM subject: anything jQuery's `.is()` accepts.
|
|
4486
|
+
*
|
|
4487
|
+
* @see http://chaijs.com/plugins/chai-jquery/#matchselector
|
|
4488
|
+
*/
|
|
4489
|
+
type JQueryMatchable = string | Element | ArrayLike<Element> | JQuery<any> | ((this: Element, index: number, element: Element) => boolean)
|
|
4490
|
+
|
|
4325
4491
|
// Kind of onerous, but has a nice auto-complete.
|
|
4326
4492
|
/**
|
|
4327
4493
|
* @see https://on.cypress.io/should
|
|
@@ -4912,8 +5078,10 @@ declare namespace Cypress {
|
|
|
4912
5078
|
* @see http://chaijs.com/api/bdd/#method_throw
|
|
4913
5079
|
* @see https://on.cypress.io/assertions
|
|
4914
5080
|
*/
|
|
5081
|
+
/* eslint-disable @typescript-eslint/no-unsafe-function-type -- public type; `Function` here is any error constructor, and narrowing it would break users */
|
|
4915
5082
|
// tslint:disable-next-line ban-types
|
|
4916
5083
|
(chainer: 'throw', error: Error | Function, expected?: string | RegExp): Chainable<Subject>
|
|
5084
|
+
/* eslint-enable @typescript-eslint/no-unsafe-function-type */
|
|
4917
5085
|
/**
|
|
4918
5086
|
* Asserts that the target is a member of the given array list.
|
|
4919
5087
|
* @example
|
|
@@ -5516,8 +5684,10 @@ declare namespace Cypress {
|
|
|
5516
5684
|
* @see http://chaijs.com/api/bdd/#method_throw
|
|
5517
5685
|
* @see https://on.cypress.io/assertions
|
|
5518
5686
|
*/
|
|
5687
|
+
/* eslint-disable @typescript-eslint/no-unsafe-function-type -- public type; `Function` here is any error constructor, and narrowing it would break users */
|
|
5519
5688
|
// tslint:disable-next-line ban-types
|
|
5520
5689
|
(chainer: 'not.throw', error: Error | Function, expected?: string | RegExp): Chainable<Subject>
|
|
5690
|
+
/* eslint-enable @typescript-eslint/no-unsafe-function-type */
|
|
5521
5691
|
/**
|
|
5522
5692
|
* Asserts that the target is a member of the given array list.
|
|
5523
5693
|
* @example
|
|
@@ -5976,10 +6146,11 @@ declare namespace Cypress {
|
|
|
5976
6146
|
* @example
|
|
5977
6147
|
* cy.get('#result').should('have.attr', 'role')
|
|
5978
6148
|
* cy.get('#result').should('have.attr', 'role', 'menu')
|
|
6149
|
+
* cy.get('#result').should('have.attr', 'tabindex', 0)
|
|
5979
6150
|
* @see http://chaijs.com/plugins/chai-jquery/#attrname-value
|
|
5980
6151
|
* @see https://on.cypress.io/assertions
|
|
5981
6152
|
*/
|
|
5982
|
-
(chainer: 'have.attr', value: string, match?: string): Chainable<Subject>
|
|
6153
|
+
(chainer: 'have.attr', value: string, match?: string | number): Chainable<Subject>
|
|
5983
6154
|
/**
|
|
5984
6155
|
* Assert that the first element of the selection has the given attribute, using `.attr()`. Optionally, assert a particular value as well. The return value is available for chaining.
|
|
5985
6156
|
* @example
|
|
@@ -6003,7 +6174,7 @@ declare namespace Cypress {
|
|
|
6003
6174
|
* @see http://chaijs.com/plugins/chai-jquery/#dataname-value
|
|
6004
6175
|
* @see https://on.cypress.io/assertions
|
|
6005
6176
|
*/
|
|
6006
|
-
(chainer: 'have.data', value: string, match?: string): Chainable<Subject>
|
|
6177
|
+
(chainer: 'have.data', value: string, match?: string | number | boolean | null): Chainable<Subject>
|
|
6007
6178
|
/**
|
|
6008
6179
|
* Assert that the selection contains at least one element which has a descendant matching the given selector, using `.has()`.
|
|
6009
6180
|
* @example
|
|
@@ -6037,13 +6208,13 @@ declare namespace Cypress {
|
|
|
6037
6208
|
*/
|
|
6038
6209
|
(chainer: 'include.html', value: string): Chainable<Subject>
|
|
6039
6210
|
/**
|
|
6040
|
-
* Assert that the first element of the selection has the given id, using `.
|
|
6211
|
+
* Assert that the first element of the selection has the given id, using `.prop('id')`.
|
|
6041
6212
|
* @example
|
|
6042
6213
|
* cy.get('#result').should('have.id', 'result')
|
|
6043
6214
|
* @see http://chaijs.com/plugins/chai-jquery/#idid
|
|
6044
6215
|
* @see https://on.cypress.io/assertions
|
|
6045
6216
|
*/
|
|
6046
|
-
(chainer: 'have.id', value: string
|
|
6217
|
+
(chainer: 'have.id', value: string | number): Chainable<Subject>
|
|
6047
6218
|
/**
|
|
6048
6219
|
* Assert that the first element of the selection has the given property, using `.prop()`. Optionally, assert a particular value as well. The return value is available for chaining.
|
|
6049
6220
|
* @example
|
|
@@ -6060,7 +6231,7 @@ declare namespace Cypress {
|
|
|
6060
6231
|
* @see http://chaijs.com/plugins/chai-jquery/#texttext
|
|
6061
6232
|
* @see https://on.cypress.io/assertions
|
|
6062
6233
|
*/
|
|
6063
|
-
(chainer: 'have.text', value: string): Chainable<Subject>
|
|
6234
|
+
(chainer: 'have.text', value: string | number): Chainable<Subject>
|
|
6064
6235
|
/**
|
|
6065
6236
|
* Assert that the text of the first element of the selection partially contains the given text, using `.text()`.
|
|
6066
6237
|
* @example
|
|
@@ -6068,7 +6239,7 @@ declare namespace Cypress {
|
|
|
6068
6239
|
* @see http://chaijs.com/plugins/chai-jquery/#texttext
|
|
6069
6240
|
* @see https://on.cypress.io/assertions
|
|
6070
6241
|
*/
|
|
6071
|
-
(chainer: 'contain.text', value: string): Chainable<Subject>
|
|
6242
|
+
(chainer: 'contain.text', value: string | number): Chainable<Subject>
|
|
6072
6243
|
/**
|
|
6073
6244
|
* Assert that the text of the first element of the selection partially contains the given text, using `.text()`.
|
|
6074
6245
|
* @example
|
|
@@ -6076,7 +6247,7 @@ declare namespace Cypress {
|
|
|
6076
6247
|
* @see http://chaijs.com/plugins/chai-jquery/#texttext
|
|
6077
6248
|
* @see https://on.cypress.io/assertions
|
|
6078
6249
|
*/
|
|
6079
|
-
(chainer: 'include.text', value: string): Chainable<Subject>
|
|
6250
|
+
(chainer: 'include.text', value: string | number): Chainable<Subject>
|
|
6080
6251
|
/**
|
|
6081
6252
|
* Assert that the first element of the selection has the given value, using `.val()`.
|
|
6082
6253
|
* @example
|
|
@@ -6084,7 +6255,7 @@ declare namespace Cypress {
|
|
|
6084
6255
|
* @see http://chaijs.com/plugins/chai-jquery/#valuevalue
|
|
6085
6256
|
* @see https://on.cypress.io/assertions
|
|
6086
6257
|
*/
|
|
6087
|
-
(chainer: 'have.value', value: string): Chainable<Subject>
|
|
6258
|
+
(chainer: 'have.value', value: string | number): Chainable<Subject>
|
|
6088
6259
|
/**
|
|
6089
6260
|
* Assert that the first element of the selection partially contains the given value, using `.val()`.
|
|
6090
6261
|
* @example
|
|
@@ -6092,7 +6263,7 @@ declare namespace Cypress {
|
|
|
6092
6263
|
* @see http://chaijs.com/plugins/chai-jquery/#valuevalue
|
|
6093
6264
|
* @see https://on.cypress.io/assertions
|
|
6094
6265
|
*/
|
|
6095
|
-
(chainer: 'contain.value', value: string): Chainable<Subject>
|
|
6266
|
+
(chainer: 'contain.value', value: string | number): Chainable<Subject>
|
|
6096
6267
|
/**
|
|
6097
6268
|
* Assert that the first element of the selection partially contains the given value, using `.val()`.
|
|
6098
6269
|
* @example
|
|
@@ -6100,15 +6271,15 @@ declare namespace Cypress {
|
|
|
6100
6271
|
* @see http://chaijs.com/plugins/chai-jquery/#valuevalue
|
|
6101
6272
|
* @see https://on.cypress.io/assertions
|
|
6102
6273
|
*/
|
|
6103
|
-
(chainer: 'include.value', value: string): Chainable<Subject>
|
|
6274
|
+
(chainer: 'include.value', value: string | number): Chainable<Subject>
|
|
6104
6275
|
/**
|
|
6105
|
-
* Assert that the selection matches a given selector, using `.is()`. Note that this overrides the built-in chai assertion. If the
|
|
6276
|
+
* Assert that the selection matches a given selector, element, elements, jQuery object, or predicate, using `.is()`. Note that this overrides the built-in chai assertion. If the subject is not a DOM element or jQuery object, only a regular expression is accepted, and a regular expression never matches a DOM element or jQuery object.
|
|
6106
6277
|
* @example
|
|
6107
6278
|
* cy.get('#result').should('match', ':empty')
|
|
6108
6279
|
* @see http://chaijs.com/plugins/chai-jquery/#matchselector
|
|
6109
6280
|
* @see https://on.cypress.io/assertions
|
|
6110
6281
|
*/
|
|
6111
|
-
(chainer: 'match', value:
|
|
6282
|
+
(chainer: 'match', value: JQueryMatchable): Chainable<Subject>
|
|
6112
6283
|
|
|
6113
6284
|
// jquery-chai.not
|
|
6114
6285
|
/**
|
|
@@ -6204,10 +6375,11 @@ declare namespace Cypress {
|
|
|
6204
6375
|
* @example
|
|
6205
6376
|
* cy.get('#result').should('not.have.attr', 'role')
|
|
6206
6377
|
* cy.get('#result').should('not.have.attr', 'role', 'menu')
|
|
6378
|
+
* cy.get('#result').should('not.have.attr', 'tabindex', 0)
|
|
6207
6379
|
* @see http://chaijs.com/plugins/chai-jquery/#attrname-value
|
|
6208
6380
|
* @see https://on.cypress.io/assertions
|
|
6209
6381
|
*/
|
|
6210
|
-
(chainer: 'not.have.attr', value: string, match?: string): Chainable<Subject>
|
|
6382
|
+
(chainer: 'not.have.attr', value: string, match?: string | number): Chainable<Subject>
|
|
6211
6383
|
/**
|
|
6212
6384
|
* Assert that the first element of the selection does not have the given attribute, using `.attr()`. Optionally, assert a particular value as well. The return value is available for chaining.
|
|
6213
6385
|
* @example
|
|
@@ -6231,7 +6403,7 @@ declare namespace Cypress {
|
|
|
6231
6403
|
* @see http://chaijs.com/plugins/chai-jquery/#dataname-value
|
|
6232
6404
|
* @see https://on.cypress.io/assertions
|
|
6233
6405
|
*/
|
|
6234
|
-
(chainer: 'not.have.data', value: string, match?: string): Chainable<Subject>
|
|
6406
|
+
(chainer: 'not.have.data', value: string, match?: string | number | boolean | null): Chainable<Subject>
|
|
6235
6407
|
/**
|
|
6236
6408
|
* Assert that the selection does not contain at least one element which has a descendant matching the given selector, using `.has()`.
|
|
6237
6409
|
* @example
|
|
@@ -6265,13 +6437,13 @@ declare namespace Cypress {
|
|
|
6265
6437
|
*/
|
|
6266
6438
|
(chainer: 'not.include.html', value: string): Chainable<Subject>
|
|
6267
6439
|
/**
|
|
6268
|
-
* Assert that the first element of the selection does not have the given id, using `.
|
|
6440
|
+
* Assert that the first element of the selection does not have the given id, using `.prop('id')`.
|
|
6269
6441
|
* @example
|
|
6270
6442
|
* cy.get('#result').should('not.have.id', 'result')
|
|
6271
6443
|
* @see http://chaijs.com/plugins/chai-jquery/#idid
|
|
6272
6444
|
* @see https://on.cypress.io/assertions
|
|
6273
6445
|
*/
|
|
6274
|
-
(chainer: 'not.have.id', value: string
|
|
6446
|
+
(chainer: 'not.have.id', value: string | number): Chainable<Subject>
|
|
6275
6447
|
/**
|
|
6276
6448
|
* Assert that the first element of the selection does not have the given property, using `.prop()`. Optionally, assert a particular value as well. The return value is available for chaining.
|
|
6277
6449
|
* @example
|
|
@@ -6288,7 +6460,7 @@ declare namespace Cypress {
|
|
|
6288
6460
|
* @see http://chaijs.com/plugins/chai-jquery/#texttext
|
|
6289
6461
|
* @see https://on.cypress.io/assertions
|
|
6290
6462
|
*/
|
|
6291
|
-
(chainer: 'not.have.text', value: string): Chainable<Subject>
|
|
6463
|
+
(chainer: 'not.have.text', value: string | number): Chainable<Subject>
|
|
6292
6464
|
/**
|
|
6293
6465
|
* Assert that the text of the first element of the selection does not contain the given text, using `.text()`.
|
|
6294
6466
|
* @example
|
|
@@ -6296,7 +6468,7 @@ declare namespace Cypress {
|
|
|
6296
6468
|
* @see http://chaijs.com/plugins/chai-jquery/#texttext
|
|
6297
6469
|
* @see https://on.cypress.io/assertions
|
|
6298
6470
|
*/
|
|
6299
|
-
(chainer: 'not.contain.text', value: string): Chainable<Subject>
|
|
6471
|
+
(chainer: 'not.contain.text', value: string | number): Chainable<Subject>
|
|
6300
6472
|
/**
|
|
6301
6473
|
* Assert that the text of the first element of the selection does not contain the given text, using `.text()`.
|
|
6302
6474
|
* @example
|
|
@@ -6304,7 +6476,7 @@ declare namespace Cypress {
|
|
|
6304
6476
|
* @see http://chaijs.com/plugins/chai-jquery/#texttext
|
|
6305
6477
|
* @see https://on.cypress.io/assertions
|
|
6306
6478
|
*/
|
|
6307
|
-
(chainer: 'not.include.text', value: string): Chainable<Subject>
|
|
6479
|
+
(chainer: 'not.include.text', value: string | number): Chainable<Subject>
|
|
6308
6480
|
/**
|
|
6309
6481
|
* Assert that the first element of the selection does not have the given value, using `.val()`.
|
|
6310
6482
|
* @example
|
|
@@ -6312,7 +6484,7 @@ declare namespace Cypress {
|
|
|
6312
6484
|
* @see http://chaijs.com/plugins/chai-jquery/#valuevalue
|
|
6313
6485
|
* @see https://on.cypress.io/assertions
|
|
6314
6486
|
*/
|
|
6315
|
-
(chainer: 'not.have.value', value: string): Chainable<Subject>
|
|
6487
|
+
(chainer: 'not.have.value', value: string | number): Chainable<Subject>
|
|
6316
6488
|
/**
|
|
6317
6489
|
* Assert that the first element of the selection does not contain the given value, using `.val()`.
|
|
6318
6490
|
* @example
|
|
@@ -6320,7 +6492,7 @@ declare namespace Cypress {
|
|
|
6320
6492
|
* @see http://chaijs.com/plugins/chai-jquery/#valuevalue
|
|
6321
6493
|
* @see https://on.cypress.io/assertions
|
|
6322
6494
|
*/
|
|
6323
|
-
(chainer: 'not.contain.value', value: string): Chainable<Subject>
|
|
6495
|
+
(chainer: 'not.contain.value', value: string | number): Chainable<Subject>
|
|
6324
6496
|
/**
|
|
6325
6497
|
* Assert that the first element of the selection does not contain the given value, using `.val()`.
|
|
6326
6498
|
* @example
|
|
@@ -6328,15 +6500,15 @@ declare namespace Cypress {
|
|
|
6328
6500
|
* @see http://chaijs.com/plugins/chai-jquery/#valuevalue
|
|
6329
6501
|
* @see https://on.cypress.io/assertions
|
|
6330
6502
|
*/
|
|
6331
|
-
(chainer: 'not.include.value', value: string): Chainable<Subject>
|
|
6503
|
+
(chainer: 'not.include.value', value: string | number): Chainable<Subject>
|
|
6332
6504
|
/**
|
|
6333
|
-
* Assert that the selection does not match a given selector, using `.is()`. Note that this overrides the built-in chai assertion. If the
|
|
6505
|
+
* Assert that the selection does not match a given selector, element, elements, jQuery object, or predicate, using `.is()`. Note that this overrides the built-in chai assertion. If the subject is not a DOM element or jQuery object, only a regular expression is accepted, and a regular expression never matches a DOM element or jQuery object.
|
|
6334
6506
|
* @example
|
|
6335
6507
|
* cy.get('#result').should('not.match', ':empty')
|
|
6336
6508
|
* @see http://chaijs.com/plugins/chai-jquery/#matchselector
|
|
6337
6509
|
* @see https://on.cypress.io/assertions
|
|
6338
6510
|
*/
|
|
6339
|
-
(chainer: 'not.match', value:
|
|
6511
|
+
(chainer: 'not.match', value: JQueryMatchable): Chainable<Subject>
|
|
6340
6512
|
|
|
6341
6513
|
// fallback
|
|
6342
6514
|
/**
|
|
@@ -6440,7 +6612,7 @@ declare namespace Cypress {
|
|
|
6440
6612
|
|
|
6441
6613
|
interface BeforeRunDetails {
|
|
6442
6614
|
browser?: Browser
|
|
6443
|
-
config:
|
|
6615
|
+
config: PluginConfigOptions
|
|
6444
6616
|
cypressVersion: string
|
|
6445
6617
|
group?: string
|
|
6446
6618
|
parallel?: boolean
|
|
@@ -6900,6 +7072,7 @@ declare namespace Cypress {
|
|
|
6900
7072
|
}
|
|
6901
7073
|
```
|
|
6902
7074
|
*/
|
|
7075
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- users add custom properties by merging into it, as documented above
|
|
6903
7076
|
interface cy extends Chainable<undefined> { }
|
|
6904
7077
|
}
|
|
6905
7078
|
|
package/types/net-stubbing.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ type Method =
|
|
|
74
74
|
|
|
75
75
|
export type ResourceType = 'document' | 'fetch' | 'xhr' | 'websocket' | 'stylesheet' | 'script' | 'image' | 'font' | 'cspviolationreport' | 'ping' | 'manifest' | 'other'
|
|
76
76
|
|
|
77
|
-
export namespace CyHttpMessages {
|
|
77
|
+
export declare namespace CyHttpMessages {
|
|
78
78
|
export interface BaseMessage<T = any> {
|
|
79
79
|
/**
|
|
80
80
|
* The body of the HTTP message.
|
|
@@ -81,6 +81,7 @@ const getContainerEl = () => {
|
|
|
81
81
|
* Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
|
|
82
82
|
* @param optionalCallback Callback to be called before the next test runs
|
|
83
83
|
*/
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- published API; narrowing the parameter would break callers that pass a `Function`
|
|
84
85
|
function setupHooks(optionalCallback) {
|
|
85
86
|
// We don't want CT side effects to run when e2e
|
|
86
87
|
// testing so we early return.
|
|
@@ -100,7 +101,6 @@ function setupHooks(optionalCallback) {
|
|
|
100
101
|
Cypress.Commands.overwrite('origin', () => {
|
|
101
102
|
throw new Error('cy.origin from a component spec is not allowed');
|
|
102
103
|
});
|
|
103
|
-
// @ts-ignore
|
|
104
104
|
Cypress.on('test:before:after:run:async', () => {
|
|
105
105
|
optionalCallback?.();
|
|
106
106
|
});
|
|
@@ -8601,6 +8601,7 @@ const cleanup = () => {
|
|
|
8601
8601
|
Cypress.vueWrapper = null;
|
|
8602
8602
|
Cypress.vue = null;
|
|
8603
8603
|
};
|
|
8604
|
+
/* eslint-enable @typescript-eslint/no-empty-object-type */
|
|
8604
8605
|
/**
|
|
8605
8606
|
* Mounts a component and returns an object containing the component and VueWrapper
|
|
8606
8607
|
* @param componentOptions
|
|
@@ -8623,7 +8624,7 @@ function mount(componentOptions, options = {}) {
|
|
|
8623
8624
|
// then wait for cypress to load
|
|
8624
8625
|
return cy.then(() => {
|
|
8625
8626
|
var _a, _b;
|
|
8626
|
-
// @ts-
|
|
8627
|
+
// @ts-expect-error - `cy.state` is internal and not in the public Cypress types
|
|
8627
8628
|
const document = cy.state('document');
|
|
8628
8629
|
const el = getContainerEl();
|
|
8629
8630
|
// merge the extensions with global
|
|
@@ -8639,6 +8640,7 @@ function mount(componentOptions, options = {}) {
|
|
|
8639
8640
|
const wrapper = VTUmount(componentOptions, Object.assign({ attachTo: componentNode }, options));
|
|
8640
8641
|
Cypress.vueWrapper = wrapper;
|
|
8641
8642
|
Cypress.vue = wrapper.vm;
|
|
8643
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting -- yields so the component's lifecycle hooks run before the test continues
|
|
8642
8644
|
return cy
|
|
8643
8645
|
.wait(1, { log: false })
|
|
8644
8646
|
.then(() => {
|
|
@@ -61,6 +61,7 @@ const getContainerEl = () => {
|
|
|
61
61
|
* Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
|
|
62
62
|
* @param optionalCallback Callback to be called before the next test runs
|
|
63
63
|
*/
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- published API; narrowing the parameter would break callers that pass a `Function`
|
|
64
65
|
function setupHooks(optionalCallback) {
|
|
65
66
|
// We don't want CT side effects to run when e2e
|
|
66
67
|
// testing so we early return.
|
|
@@ -80,7 +81,6 @@ function setupHooks(optionalCallback) {
|
|
|
80
81
|
Cypress.Commands.overwrite('origin', () => {
|
|
81
82
|
throw new Error('cy.origin from a component spec is not allowed');
|
|
82
83
|
});
|
|
83
|
-
// @ts-ignore
|
|
84
84
|
Cypress.on('test:before:after:run:async', () => {
|
|
85
85
|
optionalCallback?.();
|
|
86
86
|
});
|
|
@@ -8581,6 +8581,7 @@ const cleanup = () => {
|
|
|
8581
8581
|
Cypress.vueWrapper = null;
|
|
8582
8582
|
Cypress.vue = null;
|
|
8583
8583
|
};
|
|
8584
|
+
/* eslint-enable @typescript-eslint/no-empty-object-type */
|
|
8584
8585
|
/**
|
|
8585
8586
|
* Mounts a component and returns an object containing the component and VueWrapper
|
|
8586
8587
|
* @param componentOptions
|
|
@@ -8603,7 +8604,7 @@ function mount(componentOptions, options = {}) {
|
|
|
8603
8604
|
// then wait for cypress to load
|
|
8604
8605
|
return cy.then(() => {
|
|
8605
8606
|
var _a, _b;
|
|
8606
|
-
// @ts-
|
|
8607
|
+
// @ts-expect-error - `cy.state` is internal and not in the public Cypress types
|
|
8607
8608
|
const document = cy.state('document');
|
|
8608
8609
|
const el = getContainerEl();
|
|
8609
8610
|
// merge the extensions with global
|
|
@@ -8619,6 +8620,7 @@ function mount(componentOptions, options = {}) {
|
|
|
8619
8620
|
const wrapper = VTUmount(componentOptions, Object.assign({ attachTo: componentNode }, options));
|
|
8620
8621
|
Cypress.vueWrapper = wrapper;
|
|
8621
8622
|
Cypress.vue = wrapper.vm;
|
|
8623
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting -- yields so the component's lifecycle hooks run before the test continues
|
|
8622
8624
|
return cy
|
|
8623
8625
|
.wait(1, { log: false })
|
|
8624
8626
|
.then(() => {
|