@testing-library/cypress - update types to match 5.0.0 (#38368)

* update types to match 5.0.0

* also remove deprecatation from 4.0.0
This commit is contained in:
Basti Buck 2019-09-17 00:11:39 +02:00 committed by Orta
parent 72c07c7005
commit 239f52df4b
2 changed files with 117 additions and 194 deletions

View File

@ -1,7 +1,7 @@
// Type definitions for @testing-library/cypress 4.2
// Type definitions for @testing-library/cypress 5.0
// Project: https://github.com/testing-library/cypress-testing-library
// Definitions by: Aaron Mc Adam <https://github.com/aaronmcadam>
// Basti Buck <https://github.com/ppi-buck>
// Basti Buck <https://github.com/bastibuck>
// Stefano Magni <https://github.com/NoriSte>
// Justin Hall <https://github.com/wKovacs64>
// Brian Ng <https://github.com/existentialism>
@ -21,6 +21,7 @@ import * as JQuery from 'jquery';
export interface CTLMatcherOptions {
timeout?: number;
container?: JQuery;
}
export type MatcherOptions = DTLMatcherOptions | CTLMatcherOptions;
@ -32,8 +33,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -52,8 +53,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -72,19 +73,19 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByPlaceholderText<E extends Node = HTMLElement>(
findByPlaceholderText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
getByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
findByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -92,19 +93,19 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByPlaceholderText<E extends Node = HTMLElement>(
findAllByPlaceholderText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
getAllByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
findAllByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -112,82 +113,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryBySelectText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryBySelectText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllBySelectText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryAllBySelectText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getBySelectText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
getBySelectText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllBySelectText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
getAllBySelectText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -206,8 +133,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -226,19 +153,19 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByText<E extends Node = HTMLElement>(
findByText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
getByText<K extends keyof HTMLElementTagNameMap>(
findByText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -246,16 +173,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByText<E extends Node = HTMLElement>(id: Matcher, options?: SelectorMatcherOptions): Chainable<E[]>;
getAllByText<K extends keyof HTMLElementTagNameMap>(
findAllByText<E extends Node = HTMLElement>(id: Matcher, options?: SelectorMatcherOptions): Chainable<E[]>;
findAllByText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
@ -263,8 +190,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -283,8 +210,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -303,19 +230,19 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByLabelText<E extends Node = HTMLElement>(
findByLabelText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
getByLabelText<K extends keyof HTMLElementTagNameMap>(
findByLabelText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -323,19 +250,19 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByLabelText<E extends Node = HTMLElement>(
findAllByLabelText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<E[]>;
getAllByLabelText<K extends keyof HTMLElementTagNameMap>(
findAllByLabelText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
@ -343,8 +270,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -360,8 +287,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -380,16 +307,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByAltText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
getByAltText<K extends keyof HTMLElementTagNameMap>(
findByAltText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
findByAltText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -397,16 +324,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByAltText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
getAllByAltText<K extends keyof HTMLElementTagNameMap>(
findAllByAltText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByAltText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
@ -414,8 +341,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -431,8 +358,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -448,16 +375,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
getByTestId<K extends keyof HTMLElementTagNameMap>(
findByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
findByTestId<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -465,16 +392,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
getAllByTestId<K extends keyof HTMLElementTagNameMap>(
findAllByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByTestId<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
@ -482,8 +409,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -499,8 +426,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -516,16 +443,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
getByTitle<K extends keyof HTMLElementTagNameMap>(
findByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
findByTitle<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -533,16 +460,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
getAllByTitle<K extends keyof HTMLElementTagNameMap>(
findAllByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByTitle<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
@ -550,8 +477,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -570,8 +497,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -590,19 +517,19 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByDisplayValue<E extends Node = HTMLElement>(
findByDisplayValue<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
getByDisplayValue<K extends keyof HTMLElementTagNameMap>(
findByDisplayValue<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -610,16 +537,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByDisplayValue<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
getAllByDisplayValue<K extends keyof HTMLElementTagNameMap>(
findAllByDisplayValue<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByDisplayValue<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
@ -627,8 +554,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -644,8 +571,8 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
@ -661,16 +588,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
getByRole<K extends keyof HTMLElementTagNameMap>(
findByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
findByRole<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
@ -678,16 +605,16 @@ declare global {
/**
* dom-testing-library helpers for Cypress
*
* `getBy*` APIs search for an element and throw an error if nothing found
* `getAllBy*` APIs search for all elements and an error if nothing found
* `findBy*` APIs search for an element and throw an error if nothing found
* `findAllBy*` APIs search for all elements and an error if nothing found
* `queryBy*` APIs search for an element and returns null if nothing found
* `queryAllBy*` APIs search for all elements and return empty array if nothing found
*
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
getAllByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
getAllByRole<K extends keyof HTMLElementTagNameMap>(
findAllByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByRole<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;

View File

@ -2,31 +2,28 @@ import Cypress, { configure } from '@testing-library/cypress';
configure({ testIdAttribute: 'data-myown-testid' });
// getBy*
Cypress.getByPlaceholderText('foo');
Cypress.getBySelectText('foo');
Cypress.getByText('foo');
Cypress.getByLabelText('foo');
Cypress.getByAltText('foo');
Cypress.getByTestId('foo');
Cypress.getByTitle('foo');
Cypress.getByDisplayValue('foo');
Cypress.getByRole('foo');
// findBy*
Cypress.findByPlaceholderText('foo');
Cypress.findByText('foo');
Cypress.findByLabelText('foo');
Cypress.findByAltText('foo');
Cypress.findByTestId('foo');
Cypress.findByTitle('foo');
Cypress.findByDisplayValue('foo');
Cypress.findByRole('foo');
// getAllBy*
Cypress.getAllByPlaceholderText('foo');
Cypress.getAllBySelectText('foo');
Cypress.getAllByText('foo');
Cypress.getAllByLabelText('foo');
Cypress.getAllByAltText('foo');
Cypress.getAllByTestId('foo');
Cypress.getAllByTitle('foo');
Cypress.getAllByDisplayValue('foo');
Cypress.getAllByRole('foo');
// findAllBy*
Cypress.findAllByPlaceholderText('foo');
Cypress.findAllByText('foo');
Cypress.findAllByLabelText('foo');
Cypress.findAllByAltText('foo');
Cypress.findAllByTestId('foo');
Cypress.findAllByTitle('foo');
Cypress.findAllByDisplayValue('foo');
Cypress.findAllByRole('foo');
// queryBy*
Cypress.queryByPlaceholderText('foo');
Cypress.queryBySelectText('foo');
Cypress.queryByText('foo');
Cypress.queryByLabelText('foo');
Cypress.queryByAltText('foo');
@ -37,7 +34,6 @@ Cypress.queryByRole('foo');
// queryAllBy*
Cypress.queryAllByPlaceholderText('foo');
Cypress.queryAllBySelectText('foo');
Cypress.queryAllByText('foo');
Cypress.queryAllByLabelText('foo');
Cypress.queryAllByAltText('foo');