0

In my Vaadin web application tested by Selenium IDE (not Vaadin Testbench - I am aware of it, but I dont wanna use it) I want to verify, that error message pop-up was NOT triggered => so the test can continue running.

I have no problem with identifying the pop-up. Its locator is

css=div.v-Notification.failure

and I have checked that Selenium IDE recognizes presence of this element correctly.

But there is a problem with delay in my webapp. When Selenium IDE clicks a GUI element, the request for data is sent to ESB. When the ESB is turned off or some error occurs, webapp is notified and it displays the error popup. However, this doesn't occure immideately, processing of the request takes some time.

So testing assertElementNotPresent always passes, as the pop up is not yet generated right after GUI click. I know the article about AJAX testing in Selenium, but it doesn't help me in this case either, because waitForElementNotPresent also immideately assumes the pop up is not there, although it appears just a few moments later... And obviously I can't use opposite waitForElementPresent, because I want my test to continue when the error pop up is not there.

The only thing that is "working" is hardcoded pause step in test, but this is not the good way (refer to linked article, if you doubt why...also I don't want my test suite to take ages with a lot of pauses).

Any other ideas or approaches, that could enlight me a bit?

Ellrohir
  • 1,017
  • 1
  • 14
  • 32
  • The original issue is that you do not know when the popup will show up, so other than using certain timeout with `waitForElementPresent(popup) if(popup = null) proceed`, I don't think there is a better approach. Unless you know what the next thing coming, then you can use `waitForElementPresent(anyElementOnNewPage)` – kurakura88 Jul 15 '16 at 08:17

2 Answers2

0

You mentioned that you're trying to recognize the presence of the element. In this case, try using assertNotVisible and waitForNotVisible

Rodel Bernal
  • 323
  • 2
  • 13
  • sadly, this doesnt make any change...if IDE asks "is the element not visible?" right after GUI click the answer is "yes, it is not" - it appears few moments later, but test already passed...i need some delay, but preferably not hardcoded `pause` which is either unnecesarily long or too short... – Ellrohir Jul 15 '16 at 06:56
0

There is a variant with Selenium IDE flowcontrol.

Check this out:

storeEval               | 0                               | i
storeEval               | false                           | x
while                   | ${x} == false 
pause                   | 1000
storeElementPresent     | css=div.v-Notification.failure  | x
storeEval               | ${i}+1                          | i
storeEval               | if (${i}>30) {true} else {${x}} | x
endWhile
assertElementNotPresent | css=div.v-Notification.failure

This will wait for popup for about 30 second and will fail the test immediately on popup appearance. I am pretty sure that there should be a shorter way to perform it. But it should work.

Antesser
  • 669
  • 4
  • 5