jasminekarma-jasminejasmine-node

Is there a way to make Jasmine's expects do retry on fail


Is there a way to make Jasmine's expects do retry on expects fail.

For example I check some result that can be false for some time: expect(await driver.findElement(By.css('.element-not-appears-instantly')).isPresent()).toBe(true) and I want it to reexpect it if there would be false for some timeout and eventially when it timeouts would finish retrying and return current result. Something like this:

reExpect(await driver.findElement(By.css('.element-not-appears-instantly')).isPresent(), timeoutInMilliseconds).toBe(true)

Is it possible somehow to do it extend function expect or suppress expect on throwing. When i'm trying to catch expect it prints fail anywai.

May be there are other testing frameworks that can do that. I mean testing frameworks like jasmine mocha etc, not selenium wrappers like webdriver io or so on.


Solution

  • I can just use assert module from standard library and do whatever I want.