-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 support for page object-formatted object-based selectors #1156
Conversation
@senocular This fix could be on the next release? Thanks Guys. |
something happened to the tests, it seems to have crashed half way. |
This has a dependency on #1155 and won't work until that's in |
Ah yes. Would it be possible to merge the other PR into this one? |
Yeah I can work on that |
39dbb8e
to
a7f6465
Compare
Merged with #1155 and fixed some tests. @drptbl, if you're still around and could give this a whirl, making sure nothing existing breaks and it works as you might expect, that would be great. @beatfactor as with before, I can squash to one commit if/when it goes in. |
Cool, I'll try to take another look here. Thanks. |
9af2d42
to
ec8999a
Compare
There was an issue with error messaging when using selector objects in command calls. For example if you had something like: browser.getText({selecto:'div', locateStrategy:'css selector'}, function (result) {
console.log('My div text is ', result.value);
}); The error message would be:
The first problem being that its picking up the confusing "(anonymous)" text. But I think more importantly, you're losing the problem key. With the latest commit, if
|
Hey, sorry for the slow progress here. I think this looks good, but could you also add/update an example testcase with how will this be used? Also could you move all the selector tests inside a folder in src/api/element-selectors? Thanks. |
@beatfactor Can you be more specific about this? Thanks. |
I was thinking of updating one of the sample tests in the examples folder with showing how this can be used, but I think we can do that when the original #1116 is fully implemented? |
@beatfactor yeah, as is, I don't think anyone would need to use this right now. It doesn't add much new other than a new syntax for the same inputs. With |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, can you squash the commits please? Then I will merge it to master. Thanks, and once again sorry for taking so long to review.
1635a0a
to
d8993c1
Compare
Done |
Hold on, I think the tests didn't make the commit... |
d8993c1
to
d5367da
Compare
tests confirmed added: https://github.com/nightwatchjs/nightwatch/pull/1156/files#diff-3523a9a2061901f4ab5d9fba67c6da9e And passing, so that is also a good sign |
Hi, thanks for this feature! It's very useful! @beatfactor, any thoughts on when this will be released in a tag? |
@beatfactor Any idea when this is going to be released? |
(Partial implementation of the original #1116)
Adds support for optional, object-based selector values in commands using the format used by page elements. ex:
Client
is not defined properly when an assertion fail if the selector is defined in page objects #1107, Test randomly fails withError while running waitForElementVisible command: allElements.shift is not a function
error. #1100, Passing two page object element selectors as arguments in a custom command (error 'allElements.shift is not a function') #895selector
andlocateStrategy
, but it opens up the possibility for additional properties in the future.useCss()
oruseXpath()
can be maintained when writing custom commands, for example, if the custom command uses strategies within the selectors for its requests, preventing interference with the global strategy (users won't have to restore their set strats upon using a custom command that uses other strats).Also noticed this seems to be an exact implementation of #720.