diff --git a/cypress/integration/spec.js b/cypress/integration/spec.js index e391435..8b2c143 100644 --- a/cypress/integration/spec.js +++ b/cypress/integration/spec.js @@ -1,4 +1,5 @@ /// +/// describe('cypress-xpath', () => { it('adds xpath command', () => { diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..d1d818e --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,15 @@ +/// + +declare namespace Cypress { + interface Chainable { + /** + * 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(selector: string, options?: Partial): Chainable> + } +}