Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide a way to enrich/customize output promise in 4.0 #37

Closed
sebv opened this issue Oct 24, 2013 · 2 comments
Closed

provide a way to enrich/customize output promise in 4.0 #37

sebv opened this issue Oct 24, 2013 · 2 comments

Comments

@sebv
Copy link
Contributor

sebv commented Oct 24, 2013

I was using chai-as-promised to do some chaining like this:

browser
  .init({browserName:'chrome'})
  .get("http://admc.io/wd/test-pages/guinea-pig.html")
  .title()
    .should.become('I am a page title - Sauce Labs')
  .elementById('i am a link')
  .click()
  .eval("window.location.href")
    .should.eventually.include('guinea-pig2')
  .fin(function() { return browser.quit(); })
  .done();

(see wd project)

It was working fine before 4.0, cause the input and output promise were the same, but now the chain broken cause all there is is a then method.

Now I understand why the 4.0 rewrite is simpler, but it would be good to be able to enrich the output. For example if you are using Q promise, and you cannot do something like this, it does not feel right.

var promise = Q.fcall(function() {return "1234";});
promise.should.become('1234').done();
@sebv
Copy link
Contributor Author

sebv commented Oct 24, 2013

Am thinking of something like this:

sebv/chai-as-promised@domenic:master...master

Not sure if it is the best way to customize chai,but it is flexible and easy to test.

@sebv
Copy link
Contributor Author

sebv commented Oct 25, 2013

closing since pull request was opened.

@sebv sebv closed this as completed Oct 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant