Fix testing-library__cypress feedback from #37692 (#39394)

This commit is contained in:
Simon Jespersen
2019-10-24 19:20:13 +02:00
committed by Wesley Wigham
parent 7d4caa8dd6
commit 42718dc2ab
4 changed files with 81 additions and 251 deletions

View File

@@ -17,11 +17,9 @@ import {
SelectorMatcherOptions as DTLSelectorMatcherOptions,
} from '@testing-library/dom';
import * as JQuery from 'jquery';
export interface CTLMatcherOptions {
timeout?: number;
container?: JQuery;
container?: HTMLElement | JQuery;
}
export type MatcherOptions = DTLMatcherOptions | CTLMatcherOptions;
@@ -41,14 +39,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByPlaceholderText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByPlaceholderText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -61,14 +52,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByPlaceholderText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryAllByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByPlaceholderText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -81,14 +65,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findByPlaceholderText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
findByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
findByPlaceholderText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -101,14 +78,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByPlaceholderText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
findAllByPlaceholderText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
findAllByPlaceholderText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -121,14 +91,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
queryByText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -141,14 +104,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
queryAllByText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -161,14 +117,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findByText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
findByText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
findByText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -181,11 +130,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByText<E extends Node = HTMLElement>(id: Matcher, options?: SelectorMatcherOptions): Chainable<E[]>;
findAllByText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -198,14 +143,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByLabelText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
queryByLabelText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByLabelText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -218,14 +156,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByLabelText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
queryAllByLabelText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByLabelText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -238,14 +169,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findByLabelText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<E>>;
findByLabelText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
findByLabelText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -258,14 +182,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByLabelText<E extends Node = HTMLElement>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<E[]>;
findAllByLabelText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: SelectorMatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByLabelText(id: Matcher, options?: SelectorMatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -278,11 +195,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByAltText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryByAltText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByAltText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -295,14 +208,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByAltText<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryAllByAltText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByAltText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -315,11 +221,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
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]>>;
findByAltText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -332,11 +234,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByAltText<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByAltText<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByAltText(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -349,11 +247,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryByTestId<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByTestId(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -366,11 +260,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryAllByTestId<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByTestId(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -383,11 +273,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
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]>>;
findByTestId(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -400,11 +286,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByTestId<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByTestId<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByTestId(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -417,11 +299,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryByTitle<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByTitle(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -434,11 +312,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryAllByTitle<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByTitle(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -451,11 +325,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
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]>>;
findByTitle(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -468,11 +338,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByTitle<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByTitle<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByTitle(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -485,14 +351,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByDisplayValue<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryByDisplayValue<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByDisplayValue(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -505,14 +364,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByDisplayValue<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
queryAllByDisplayValue<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByDisplayValue(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -525,14 +377,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findByDisplayValue<E extends Node = HTMLElement>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<E>>;
findByDisplayValue<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
findByDisplayValue(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -545,11 +390,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByDisplayValue<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByDisplayValue<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByDisplayValue(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -562,11 +403,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryByRole<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryByRole(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -579,11 +416,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
queryAllByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<JQuery<E>>;
queryAllByRole<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<JQuery<HTMLElementTagNameMap[K]>>;
queryAllByRole(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -596,11 +429,7 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
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]>>;
findByRole(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
/**
* dom-testing-library helpers for Cypress
@@ -613,16 +442,9 @@ declare global {
* @see https://github.com/testing-library/cypress-testing-library#usage
* @see https://github.com/testing-library/dom-testing-library#table-of-contents
*/
findAllByRole<E extends Node = HTMLElement>(id: Matcher, options?: MatcherOptions): Chainable<E[]>;
findAllByRole<K extends keyof HTMLElementTagNameMap>(
id: Matcher,
options?: MatcherOptions,
): Chainable<Array<HTMLElementTagNameMap[K]>>;
findAllByRole(id: Matcher, options?: MatcherOptions): Chainable<JQuery>;
}
}
}
declare const Cypress: Cypress.Chainable;
export default Cypress;
export { configure };

View File

@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"cypress": "^3.5.0"
}
}

View File

@@ -1,43 +1,51 @@
import Cypress, { configure } from '@testing-library/cypress';
/// <reference types="Cypress" />
import { configure } from '@testing-library/cypress';
configure({ testIdAttribute: 'data-myown-testid' });
// 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');
cy.findByPlaceholderText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByLabelText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByAltText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByTestId('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByTitle('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByDisplayValue('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findByRole('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
// 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');
cy.findAllByPlaceholderText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByLabelText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByAltText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByTestId('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByTitle('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByDisplayValue('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.findAllByRole('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
// queryBy*
Cypress.queryByPlaceholderText('foo');
Cypress.queryByText('foo');
Cypress.queryByLabelText('foo');
Cypress.queryByAltText('foo');
Cypress.queryByTestId('foo');
Cypress.queryByTitle('foo');
Cypress.queryByDisplayValue('foo');
Cypress.queryByRole('foo');
cy.queryByPlaceholderText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByLabelText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByAltText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByTestId('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByTitle('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByDisplayValue('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryByRole('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
// queryAllBy*
Cypress.queryAllByPlaceholderText('foo');
Cypress.queryAllByText('foo');
Cypress.queryAllByLabelText('foo');
Cypress.queryAllByAltText('foo');
Cypress.queryAllByTestId('foo');
Cypress.queryAllByTitle('foo');
Cypress.queryAllByDisplayValue('foo');
Cypress.queryAllByRole('foo');
cy.queryAllByPlaceholderText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByLabelText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByAltText('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByTestId('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByTitle('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByDisplayValue('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
cy.queryAllByRole('foo'); // $ExpectType Chainable<JQuery<HTMLElement>>
// with container option
const container = document.createElement('div');
cy.queryAllByRole('foo', { container }); // $ExpectType Chainable<JQuery<HTMLElement>>
const $container = cy.$$('body').append('div');
cy.queryAllByRole('foo', { container: $container }); // $ExpectType Chainable<JQuery<HTMLElement>>

View File

@@ -1,9 +1,3 @@
{
"extends": "dtslint/dt.json",
"rules": {
"whitespace": [
false
],
"no-unnecessary-generics": false
}
"extends": "dtslint/dt.json"
}