-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(within): Support cy.within (#11)
* feat(within): Support cy.within. Also support passing in a container within the options object. * Installed wait-port and use it within test:cypress:run to avoid race-conditions * Improvements based on feedback. * Documented jQuery vs DOM nodes. * Use Cypress.cy global. * Renamed function and parameter. * Moved utils file. * Use the cy global.
- Loading branch information
1 parent
7d14b89
commit d105706
Showing
8 changed files
with
64 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,8 @@ | |
"contributions": [ | ||
"code", | ||
"doc", | ||
"ideas" | ||
"ideas", | ||
"test" | ||
] | ||
} | ||
], | ||
|
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
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
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,7 +1,7 @@ | ||
import {commands} from './' | ||
|
||
commands.forEach(({name, command}) => { | ||
Cypress.Commands.add(name, command.bind(null, cy)) | ||
Cypress.Commands.add(name, command) | ||
}) | ||
|
||
/* global Cypress, cy */ | ||
/* global Cypress */ |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function getFirstElement(jqueryOrElement) { | ||
if (Cypress.dom.isJquery(jqueryOrElement)) { | ||
return jqueryOrElement.get(0) | ||
} | ||
return jqueryOrElement | ||
} | ||
|
||
function getContainer(container) { | ||
const withinContainer = cy.state('withinSubject') | ||
if (withinContainer) { | ||
return getFirstElement(withinContainer) | ||
} | ||
return getFirstElement(container) | ||
} | ||
|
||
export { | ||
getFirstElement, | ||
getContainer, | ||
} | ||
|
||
/* globals Cypress, cy */ |