Good morning @duyluong
It only happens in test cases. Not in suites or BDD step definitions.
Here is a sample testcase. When it opens, it takes 8 to 10 seconds. If I add a space in a comment line and save, it takes 8 to 10 seconds.
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import org.apache.commons.lang3.StringUtils as StringUtils
import org.openqa.selenium.Keys as Keys
import groovy.time.TimeCategory as TimeCategory
import com.kms.katalon.core.util.KeywordUtil as KeywordUtil
import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import groovy.time.TimeCategory
import com.katalon.cdp.CdpUtils
import com.katalon.utils.OsUtils
def curGlobalStatus = CustomKeywords.'cannabisCommon.ModifyCSVFile.GetkeyValue'(GlobalVariable.currentTestSuiteId)
def Date today = new Date()
todaysMonth = today.format('MM')
todaysYear = today.format('YYYY')
todaysDay = today.format('dd')
todaysHour = today.format('hh')
todaysMin = today.format('mm')
if (((GlobalVariable.currentTestCaseId == curGlobalStatus) || (curGlobalStatus == 'Success')) || (curGlobalStatus == '')) {
def testFiles = RunConfiguration.getProjectDir().replaceAll('/', '\\\\') + '\\TestFiles'
String seniorPersonInCharge = testFiles + '\\PhotoID - SeniorpersonInCharge.txt'
String licenceHolder = testFiles + '\\PhotoID - Licenceholder.txt'
String seniorPersonInChargeDocument = testFiles + '\\SeniorpersonInCharge.txt'
if (row_number > 0) {
// write current row number to globalvariable
// This is then used in after test case to flag the testcase that errored on the current row
GlobalVariable.currentRowNumber = row_number
}
String curAccountID = GlobalVariable.PortalAccountId
if (RP != '')
curAccountID = RP
// def configuredAccounts = CustomKeywords.'cannabisCommon.ManageLocalConfig.GetPortalAndCRMAccounts'()
// String alternate1 = ""
// String alternate2 = ""
//String altResponsible = ""
if (dataFile == '0') {
def configuredAccounts = CustomKeywords.'cannabisCommon.ManageLocalConfig.GetPortalAndCRMAccounts'()
if (configuredAccounts[5] == "") {
// Throw error that alternates 1 and 2 are missing
} else {
// alternate1 = configuredAccounts[4]
// alternate2 = configuredAccounts[5]
AltRP = configuredAccounts[5]
}
}
if (licAppStatus != 'Success') {
WebUI.click(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Index/a_Licence Ownership'),FailureHandling.STOP_ON_FAILURE)
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
}
if (ownership == "I"){
WebUI.click(findTestObject('Portal/Licence Applications/Page_Licence Application - Licence/input_LicenceOwnershipType_Individual'),FailureHandling.STOP_ON_FAILURE)
//WS.delay(2)
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
// WebUI.setText(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Licence/input_CRABusinessNumber'), '123456782',FailureHandling.STOP_ON_FAILURE)
} else if (ownership == "C"){ // Its a corporation
WebUI.click(findTestObject('Portal/Licence Applications/Page_Licence Application - Licence/input_LicenceOwnershipType - Corporation'),FailureHandling.STOP_ON_FAILURE)
'Get corporate profile guid from csv'
String guid = ''
if (dataFile == '0'){
guid = CustomKeywords.'cannabisCommon.ModifyCSVFile.GetkeyValue'('Last_Corporate_GUID')
} else {
guid = corporateGuid
}
WS.delay(2)
WebUI.selectOptionByValue(findTestObject('Portal/Licence Applications/Page_Licence Applications - Industrial Hemp/select_Corporation name'), guid, true,FailureHandling.STOP_ON_FAILURE)
}
WebUI.click(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/a_Edit - SeniorPersonInCharge'),FailureHandling.STOP_ON_FAILURE)
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
if (runWCAG == 1) {
String url = WebUI.getUrl()
// remove https://ctls-sscdl.uat.hc-sc.gc.ca/ from the url and replace '/' with '-' and remove trailing slash value so QA/LicenceApplication/SiteDetails/b3b1af84-f8be-eb11-8145-005056812cba
// become QA-LicenceApplication-SiteDetails
// todaysYear + '-' + todaysMonth + '-' + todaysDay
def (host, port) = CdpUtils.getServiceEndpoint()
OsUtils.runCommand("lighthouse ${url} --hostname ${host} --port ${port} --preset=desktop --output-path=..\\Katalon_Local_Config\\WCAG\\CDL-New-Ownership-Popup-${todaysYear}-${todaysMonth}-${todaysDay}-${todaysHour}${todaysMin}.html --no-enable-error-reporting", null, null)
}
WebUI.setText(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Licence/input_ResponsiblePersonAccountId'), curAccountID,FailureHandling.STOP_ON_FAILURE)
WebUI.click(findTestObject('Portal/Licence Applications/Page_Licence Application - Licence/button_Validate'),FailureHandling.STOP_ON_FAILURE)
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
WebUI.click(findTestObject('Portal/Licence Applications/Page_Licence Application - Licence/button_Save Close'),FailureHandling.STOP_ON_FAILURE)
//WS.delay(2)
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
// if (AltRP != '') {
// // add alternate responsible person
// WebUI.click(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Licence/a_Edit -AltRP'),FailureHandling.STOP_ON_FAILURE)
//
// CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
//
// WebUI.setText(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Licence/input_AltResponsiblePersonAccountId'), AltRP,FailureHandling.STOP_ON_FAILURE)
// WS.delay(2)
// WebUI.click(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Licence/button_Validate - AltRP'),FailureHandling.STOP_ON_FAILURE)
// CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
//
//
// WebUI.click(findTestObject('Object Repository/Portal/Licence Applications/Page_Licence Application - Licence/button_Save Close - AltRP'),FailureHandling.STOP_ON_FAILURE)
//
// //WS.delay(2)
// CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
//
// }
if (ownership == "I"){
WebUI.sendKeys(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/input_PhotoID-SeniorPersonInChargeSecurityDoc'), seniorPersonInChargeDocument)
WebUI.click(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/button_Upload - 2'))
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(2)
WebUI.sendKeys(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/input_PhotoID-SeniorPersonInCharge'), seniorPersonInCharge)
WebUI.click(findTestObject('Portal/License Applications/Page_Licence Application - Licence/button_Upload'))
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(2)
WebUI.sendKeys(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/input_PhotoID-LicenceHolder'), licenceHolder)
//WS.delay(2)
WebUI.click(findTestObject('Portal/License Applications/Page_Licence Application - Licence/button_Upload - 3'))
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(2)
} else if (ownership == "C"){ // Its a corporation
WebUI.sendKeys(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/input_PhotoID-SeniorPersonInChargeSecurityDoc'), seniorPersonInChargeDocument)
WebUI.click(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/button_Upload - 2'))
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(2)
WebUI.sendKeys(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/input_PhotoID-SeniorPersonInCharge'), seniorPersonInCharge)
WebUI.click(findTestObject('Portal/License Applications/Page_Licence Application - Licence/button_Upload'))
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(2)
}
WebUI.click(findTestObject('Object Repository/Portal/License Applications/Page_Licence Application - Licence/button_Save Next'),FailureHandling.STOP_ON_FAILURE)
//WS.delay(2)
CustomKeywords.'utils.waitForReadyState.waitForJS_Complete_Ready'(1)
return 'Success'
} else {
KeywordUtil.markWarning('Force Skipped')
}