Search code examples
karateui-automation

How to check if the page is hanging or taking more than usual time in karate ui automation?


After submitting some elements the page gets hanged. So can I verify it if it is taking more time?


Solution

  • Read the documentation on waits: https://github.com/karatelabs/karate/tree/master/karate-core#wait-api

    So you can expect Karate to fail the test if an element does not appear within a particular time.

    You can also do time calculations manually: https://github.com/karatelabs/karate#commonly-needed-utilities

    * def getTime = function(){ return java.lang.System.currentTimeMillis() }
    * def startTime = getTime()
    * java.lang.Thread.sleep(100)
    * def endTime = getTime()
    * def elapsedTime = endTime - startTime
    * print 'elapsed:', elapsedTime, 'milliseconds'