Skip to content
This repository was archived by the owner on Oct 13, 2022. It is now read-only.

Commit ad6a767

Browse files
NicholasBollbahmutov
authored andcommitted
feat: Add type definitions (#16)
Fixes #4
1 parent 1046981 commit ad6a767

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cypress/integration/spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="cypress" />
2+
/// <reference path="../../src/index.d.ts" />
23

34
describe('cypress-xpath', () => {
45
it('adds xpath command', () => {

src/index.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference types="cypress" />
2+
3+
declare namespace Cypress {
4+
interface Chainable<Subject> {
5+
/**
6+
* Get one or more DOM elements by an XPath selector.
7+
* **Note:** you can test XPath expressions from DevTools console using $x(...) function, for example $x('//div') to find all divs.
8+
* @see https://github.com/cypress-io/cypress-xpath
9+
* @example
10+
* cy.xpath(`//ul[@class="todo-list"]//li`)
11+
* .should('have.length', 3)
12+
*/
13+
xpath<E extends Node = HTMLElement>(selector: string, options?: Partial<Loggable & Timeoutable>): Chainable<JQuery<E>>
14+
}
15+
}

0 commit comments

Comments
 (0)