Created
August 9, 2021 12:55
Revisions
-
gioragutt created this gist
Aug 9, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ declare namespace Cypress { interface Chainable { tid: Cypress.Chainable['get']; } } function attributeSelector(key: string, value: string) { return `[${key}=${value}]`; } function tidSelector(testId: string) { return attributeSelector('data-test-id', testId); } Cypress.Commands.add('tid', (testId: string, options?: Parameters<Cypress.Chainable['tid']>[1]) => { return cy.get(tidSelector(testId), options); });