Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

selenium-webdriver mocha integration breaks this #7105

Closed
lukeis opened this issue Mar 4, 2016 · 3 comments
Closed

selenium-webdriver mocha integration breaks this #7105

lukeis opened this issue Mar 4, 2016 · 3 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 7105

When using the node/npm selenium-webdriver module to wrap mocha the wrapped versions
of beforeEach/it/afterEach/etc. do not correctly maintain the `this` value inside the
tests (which is normally a convenient place to share per test data before before/after
hooks and the test).

Fixing this seems to require add a bind call to https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/testing/index.js#L123

Changing the line from:
flow.execute(fn).then(seal(done), done);

To:
flow.execute(fn.bind(this)).then(seal(done), done);

Reported by hkhalsa@quickleft.com on 2014-03-19 20:49:24

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2014-03-23 20:58:13

  • Labels added: Lang-Javascript

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

This issue was closed by revision 4b871079874d.

Reported by jmleyba on 2014-03-26 17:10:01

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:22:12

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant