Created
January 27, 2014 13:58
-
-
Save ahume/8648977 to your computer and use it in GitHub Desktop.
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
// 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? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The latter is magical and therefore icky, imo.