nonopolarity
nonopolarity

Reputation: 151036

In Magellan / Nightwatch, if we do .waitForElementNotVisible() but the element fade out or in, does the test actually work?

For .waitForElementNotVisible(selector, 2000), supposedly, it can test whether the element is fading out in 0.75 second.

But what if our code has a bug, and it is doing the wrong thing and the element is not visible and is fading in?

Now, won't .waitForElementNotVisible() actually still succeed (and pass the test), because at time = 0, it really is not visible (because it is fading in).

In other words, .waitForElementNotVisible() can succeed no matter what?

(There can be two situations, one is JavaScript adjusting the opacity every 33ms, for example, and the other case is CSS transition).

Upvotes: 0

Views: 340

Answers (1)

Bao Tran
Bao Tran

Reputation: 626

I think this is an assertion so you should use expect/assert api instead:

browser.waitForElementNotVisible(selector, 2000)

be

browser.expect.element(selector).to.not.be.visible.after(2000);

Upvotes: 0

Related Questions