-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
757d487
commit 6dea333
Showing
12 changed files
with
31,822 additions
and
943 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
import '@mate-academy/cypress-tools/support'; | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable<Subject> { | ||
byDataCy(name: string, text: string): Chainable<JQuery>; | ||
} | ||
} | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1 @@ | ||
require('@mate-academy/cypress-tools/support'); | ||
|
||
Cypress.Commands.add( | ||
'byDataCy', | ||
{ prevSubject: 'optional' }, | ||
|
||
(subject, name, text = '') => { | ||
const target = subject || cy; | ||
const selector = `[data-cy="${name}"]`; | ||
|
||
if (text) { | ||
return target.contain(selector, text); | ||
} | ||
|
||
return subject | ||
? subject.find(selector) | ||
: cy.get(selector); | ||
}, | ||
); |
Oops, something went wrong.