Skip to content

Instantly share code, notes, and snippets.

@ahume
Created January 27, 2014 13:58
Show Gist options
  • Save ahume/8648977 to your computer and use it in GitHub Desktop.
Save ahume/8648977 to your computer and use it in GitHub Desktop.
// All these methods return promises, so I can chain thens like below.
function test() {
page.loadAndWaitForSignInUi()
.then(function() {
return page.setViewportSize(1300, 500);
})
.then(function() {
return page.patchStreamScribe();
})
.then(function() {
return page.login(account.creds);
})
}
// But transparently, the selenium-webdriver module, wraps
// them in a control flow, so you can actually do...
function test() {
// These all wrapped in sync control flow. Don't add anything that doesn't use it.
page.loadAndWaitForSignInUi();
page.setViewportSize(1300, 500);
page.patchStreamScribe();
page.loginToTweetDeck(accounts.twitter.echidna1);
}
// ... with exactly the same result. Until someone else comes along and
// thinks they can add something but the flow control manager knows nothing about it.
// Am I wrong to choose the first example everywhere I've used this?
@tgvashworth
Copy link

The latter is magical and therefore icky, imo.

@ahume
Copy link
Author

ahume commented Jan 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment