Last active
March 20, 2017 18:25
-
-
Save brian-mann/6884d1cca0a1f5f2b9643c888dec0473 to your computer and use it in GitHub Desktop.
custom command works
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 characters
Cypress.addParentCommand('getCheckbox', function (labelText) { | |
return cy.chain().get('label').contains(labelText).find('input[type="checkbox"]') | |
}) | |
Cypress.addParentCommand("requestUrl", function(url) { | |
// url = baseUrl + url; | |
return cy.chain().request(url); | |
}); | |
it('works', function(){ | |
cy.visit('/index.html') | |
cy.getCheckbox('foo').should('be.checked') | |
}) | |
it('works on request', function(){ | |
cy | |
.requestUrl('http://www.example.com').then(function(response){ | |
expect(response).to.be.ok | |
}) | |
}) |
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 characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<label> | |
foo | |
<input type='checkbox' checked /> | |
</label> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment