Katalon suite taking 30 seconds between steps and I can't figure out why

Let me show you a running code that demonstrates how “Smart Wait” could force your test case to take unexpectedly long time.

Here is a test case:

import org.apache.commons.lang3.time.DurationFormatUtils
import org.apache.commons.lang3.time.StopWatch
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

TestObject makeTestObject(String xpathTemplate, Map<String, String> variables) {
	def groovyscript = '"""' + xpathTemplate + '"""'
	def shell = new GroovyShell(new Binding(variables))
	String expr = shell.evaluate(groovyscript)
	TestObject tObj = new TestObject(expr)
	tObj.addProperty("xpath", ConditionType.EQUALS, expr)
	return tObj
}

StopWatch sp = new StopWatch()
sp.start()

WebUI.openBrowser('https://www.katalon.com/')
WebUI.verifyElementPresent(makeTestObject('//a[contains(.,"Start free trial")]', [:]), 10)
WebUI.closeBrowser()

sp.stop()
println DurationFormatUtils.formatDurationHMS(sp.getTime())

If you run it with “Smart Wait” disabled, you will see

2023-11-17 09:11:00.659 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2023-11-17 09:11:00.660 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/visitKatalonDotComWithSmartWait
2023-11-17 09:11:01.032 INFO  
...
00:00:08.883
2023-11-17 09:11:09.807 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/visitKatalonDotComWithSmartWait

It took less than 9 seconds. It is normal.

Now you want to try enable Smart Wait and run the same test. Occationally you would see somthing like …

00:00:29.192

But sometimes you may see the test finishes just as nomal. Or, it may take over 1 minutes. The duration varies occationally. I guess the behavior of Smart Wait depends on how the target URL http://katalon.com/ behaves internally (if any AJAX events continue to flow, when it stops); and I have no idea about that URL.

I wondered if @kevin.jackey is aware of the Smart Wait. So I thought I should let him know.

If you want to know more about how Smart Wait is implemented, please refer to Stale element not found, is this relate to using same Object? - #95 by Brandon_Hein