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

waitUntil throws error if the element on which it is used does not exist #3837

Closed
garg3133 opened this issue Jul 27, 2023 · 2 comments · Fixed by #3897
Closed

waitUntil throws error if the element on which it is used does not exist #3837

garg3133 opened this issue Jul 27, 2023 · 2 comments · Fixed by #3897
Labels

Comments

@garg3133
Copy link
Member

garg3133 commented Jul 27, 2023

Description of the bug/issue

waitUntil should instead not run at all if there is no element to wait for (element.find() command already waits for the element to be present and then only it passes over to waitUntil).

image

Steps to reproduce

Go to any test and write browser.element.find('<some-invalid-selector>').waitUntil('visible');

Sample test

No response

Command to run

No response

Verbose Output

No response

Nightwatch Configuration

No response

Nightwatch.js Version

3.0.1

Node Version

No response

Browser

No response

Operating System

No response

Additional Information

No response

@gravityvi
Copy link
Member

waitUntil is an assert type. Assert will throw NightwatchAssertError on failure

@garg3133
Copy link
Member Author

garg3133 commented Aug 17, 2023

@gravityvi Yes, it should throw a NightwatchAssertError, but what I'm complaining about is the 500 error messages above the NightwatchAssertError.

Ideally, if the element itself is not present (which we can find just by looking at the result of element.find command), we shouldn't go on to find if the element is visible or not (by running waitUntil('visible') command), but just throw the NightwatchAssertError straightaway.

(And also, the NightwatchAssertError should be but got: "not present" instead of but got: "not visible".)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants