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

Add a 'dom' or 'elements' method to qualify assertions? #38

Open
mltsy opened this issue Nov 14, 2017 · 0 comments
Open

Add a 'dom' or 'elements' method to qualify assertions? #38

mltsy opened this issue Nov 14, 2017 · 0 comments

Comments

@mltsy
Copy link
Collaborator

mltsy commented Nov 14, 2017

chai-webdriver uses a .dom flag to start the assertion chain, like this:

expect(...).dom.to.be.there

This library was originally designed without that, because it's a somewhat awkward token, syntactically. However, there are 2 good reasons for having some such unique flag to start the chain:

  1. It namespaces the assertions. If we had such a flag, we could use any name for our assertions (including exist, which we had to avoid, and call there)
  2. When chai-webdriverio is not defined, it would cause the test to fail even if the assertion is called without parenthesis. Without it, you can call .visible outside the scope of chai-webdriverio and have no failure, because .visible just returns undefined, like this: False Positives #37

Possible names for this flag:

  • .dom (to match 'chai-webdriverio`)
  • .wdio
  • .elements
  • .element (potentially, we could offer both elements and element, and use the respective webdriverio method)
  • .html ... ? This isn't quite right - I'm basically out of ideas that actually make sense 😉
@mltsy mltsy mentioned this issue Nov 14, 2017
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