Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

feat(SELENIUM_PROMISE_MANAGER): Don't rely on webdriver.promise fun… - #82

Merged
sjelin merged 1 commit into
angular:jasminewd2from
sjelin:sche
Jan 21, 2017
Merged

feat(SELENIUM_PROMISE_MANAGER): Don't rely on webdriver.promise fun…#82
sjelin merged 1 commit into
angular:jasminewd2from
sjelin:sche

Conversation

@sjelin

Copy link
Copy Markdown
Contributor

…ctions

While we support SELENIUM_PROMISE_MANAGER=0 already, we rely on SimpleScheduler and some other
utility functions which will be going away. This allows jasminewd to work without those utility
functions, and even allows people to pass jasminewd their own custom scheduler implementation.

This does not fix our tests, which will also break when those utility functions go away. See
#81

Closes#80

@juliemr

Copy link
Copy Markdown
Member

Please change the commit message to mention "utility function which will be going away after the control flow has been fully deprecated."

@sjelin

Copy link
Copy Markdown
ContributorAuthor

@juliemr done

Comment threadindex.js
newPromise = function(resolver) {
return new Promise(resolver);
};
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For code readability flow, could you change the above to:

if(!scheduler){scheduler={execute: function(fn){returnPromise.resolve().then(fn);}}}if(typeofscheduler.promise=='function'){newPromise=scheduler.promise.bind(scheduler);}else{// what you have now...}

Comment threadindex.js
}

// Figure out how we're getting new promises
var newPromise;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juliemr let me know what you think of this new logic

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like not using try/catch. Works for me!

Comment threadscheduler.md
Your scheduler must emit `"idle"` when it becomes idle.


### Reset API

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juliemr this was also added since your review

Comment threadindex.js
}

// Figure out how we're getting new promises
var newPromise;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like not using try/catch. Works for me!

Comment threadscheduler.md Outdated

jasminewd will automatically look for a `reset` function and call it when specs time out. This is
useful so that if a spec executes a task that hangs, only that spec will timeout (as opposed to
tying up the scheduler and causing all future specs to timeout).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And more generally, so that if a spec times out but has lingering commands, those get cleared instead of executing in random future tests.

…ctions
While we support `SELENIUM_PROMISE_MANAGER=0` already, we rely on `SimpleScheduler` and some other
utility functions which will be going away after the control flow has been fully deprecated. This
commit allows jasminewd to work without those utility functions, and even allows people to pass
jasminewd their own custom scheduler implementation.
This does not fix our tests, which will also break when those utility functions go away. See
angular#81Closesangular#80
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't rely on webdriver.promise or webdriver.promise.Scheduler

2 participants

@sjelin@juliemr