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

[Enhancement] Support "suppressNotFoundErrors" option for "waitFor..." commands #2527

Closed
benjaminr-ps opened this issue Oct 23, 2020 · 4 comments

Comments

@benjaminr-ps
Copy link

Is your feature request related to a problem? Please describe.
I want to wait for an element beeing present after some time, to be optional only and not failing.
The use case for instance is loading spinner, which blocks any interaction.
The loading spinner may vary in its presence, which might be due to the backend systems.
To circumvent that fact, I use the waitForElementPresent command.
But if the element is not found by selector (of any kind) the command let the test fail.

Describe the solution you'd like
The waitFor commands (or especially the waitForElementPresent command) should allow to define a flag to suppress this not founding.

Describe how the solution will work
In the Page Object's elements selection, the "suppressNotFoundErrors" can be defined optionally.
Whenever this is defined and set to "true", the waitFor command will silently fail and does not propagate higher.

Describe alternatives you've considered
Add a further parameter to the waitFor commands, depicted to suppressNotFoundErrors.

Additional context
Nothing

@Pieras2
Copy link

Pieras2 commented Oct 23, 2020

If I well understand, do you want a command that waits for an element that will appear in future?
If so, it can be solved by preparing your own custom command using available api cmds

@benjaminr-ps
Copy link
Author

@Pieras2 No, this capability already exists by the waitForElementPresent(/Visible) command.

I would like to have the ability to suppress the "element was not found error", which might occur, if element does not show up in future.

This kind of behaviour was already implemented for other element commands, like getText or getAttribute.

@beatfactor beatfactor added this to Needs triage in Nightwatch 1.7 via automation Mar 17, 2021
@beatfactor beatfactor moved this from Needs triage to Low priority in Nightwatch 1.7 Mar 19, 2021
@Dharin-shah
Copy link
Contributor

PR for the same
#2632

@beatfactor beatfactor moved this from Low priority to In progress in Nightwatch 1.7 Apr 7, 2021
@beatfactor
Copy link
Member

I'm afraid this is not how the suppressNotFoundErrors flag is supposed to work and it cannot be added for waitFor commands. Commands like waitForElementVisible already suppress the notFound errors and the assertion should always fail if the element is not found.

This flag is only useful for assertions like assert.visible where the element might not exist and only to avoid the additional errors in the output. waitForElementVisible is supposed to be the same as assert.visible with suppressNotFoundErrors: true.

Nightwatch 1.7 automation moved this from In progress to Closed Apr 12, 2021
@beatfactor beatfactor removed this from Closed in Nightwatch 1.7 Apr 12, 2021
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

4 participants