cy.contains() improvements: normalizing whitespaces, case-sensi… (#5653)

* migrate vscode eslint settings

* Handles whitespaces with newlines.

* Feature: contains() matches case insensitivity

* Fixed merge conflicts.

* Fixed conflicts.

* Added option type, CaseMatchable.

* Fixed lint error.

* Added test for leading/trailing spaces.

* Add an error message for regex and matchCase conflict.

* Fix the valid case that throws an error.

* Fix how error message is thrown.

* update some cli deps that have fallen out of date since last commit

* update cli snapshot

Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
Co-authored-by: Jennifer Shehane <shehane.jennifer@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
This commit is contained in:
Kukhyeon Heo
2020-01-31 01:28:18 +09:00
committed by GitHub
parent c491a3eda5
commit 7ff91ed1d9
6 changed files with 187 additions and 30 deletions
+15 -3
View File
@@ -594,7 +594,7 @@ declare namespace Cypress {
* // tries to find the given text for up to 1 second
* cy.contains('my text to find', {timeout: 1000})
*/
contains(content: string | number | RegExp, options?: Partial<Loggable & Timeoutable>): Chainable<Subject>
contains(content: string | number | RegExp, options?: Partial<Loggable & Timeoutable & CaseMatchable>): Chainable<Subject>
/**
* Get the child DOM element that contains given text.
*
@@ -612,7 +612,7 @@ declare namespace Cypress {
* // yields <ul>...</ul>
* cy.contains('ul', 'apples')
*/
contains<K extends keyof HTMLElementTagNameMap>(selector: K, text: string | number | RegExp, options?: Partial<Loggable & Timeoutable>): Chainable<JQuery<HTMLElementTagNameMap[K]>>
contains<K extends keyof HTMLElementTagNameMap>(selector: K, text: string | number | RegExp, options?: Partial<Loggable & Timeoutable & CaseMatchable>): Chainable<JQuery<HTMLElementTagNameMap[K]>>
/**
* Get the DOM element using CSS "selector" containing the text or regular expression.
*
@@ -621,7 +621,7 @@ declare namespace Cypress {
* // yields <... class="foo">... apples ...</...>
* cy.contains('.foo', 'apples')
*/
contains<E extends Node = HTMLElement>(selector: string, text: string | number | RegExp, options?: Partial<Loggable & Timeoutable>): Chainable<JQuery<E>>
contains<E extends Node = HTMLElement>(selector: string, text: string | number | RegExp, options?: Partial<Loggable & Timeoutable & CaseMatchable>): Chainable<JQuery<E>>
/**
* Double-click a DOM element.
@@ -1995,6 +1995,18 @@ declare namespace Cypress {
timeout: number
}
/**
* Options that check case sensitivity
*/
interface CaseMatchable {
/**
* Check case sensitivity
*
* @default true
*/
matchCase: boolean
}
/**
* Options that control how long the Test Runner waits for an XHR request and response to succeed
*/