Created
July 11, 2017 17:24
-
-
Save joelgriffith/8dd0d690e5683e437ed0061ee9994458 to your computer and use it in GitHub Desktop.
Composing a user interaction with further assertions
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
// :missingUsername visits a page and immediately clicks submit | |
// without entering the user's name. It returns the chrome instance | |
// so you can invoke further actions or assertions! | |
const missingUsername = (chrome) => | |
chrome.goto('http://localhost:3000/') | |
.then(() => chrome.click('[data-test="submit"]')); | |
// Consume the prior action and assert further behavior | |
it('should allow users to dismiss errors', () => { | |
return missingUsername(chrome) | |
.then(() => chrome.click('[data-test="error"] button')) | |
.then(() => chrome.exists('[data-test="error"]')) | |
.then((errorExists) => expect(errorExists).toEqual(false)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment