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

Commit

Permalink
feat: Add type definitions (#16)
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
NicholasBoll authored and bahmutov committed Dec 18, 2018
1 parent 1046981 commit ad6a767
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions cypress/integration/spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="cypress" />
/// <reference path="../../src/index.d.ts" />

describe('cypress-xpath', () => {
it('adds xpath command', () => {
Expand Down
15 changes: 15 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// <reference types="cypress" />

declare namespace Cypress {
interface Chainable<Subject> {
/**
* Get one or more DOM elements by an XPath selector.
* **Note:** you can test XPath expressions from DevTools console using $x(...) function, for example $x('//div') to find all divs.
* @see https://github.com/cypress-io/cypress-xpath
* @example
* cy.xpath(`//ul[@class="todo-list"]//li`)
* .should('have.length', 3)
*/
xpath<E extends Node = HTMLElement>(selector: string, options?: Partial<Loggable & Timeoutable>): Chainable<JQuery<E>>
}
}

0 comments on commit ad6a767

Please sign in to comment.