Operating System
MacOS Big Sur 11.4
Katalon Studio Version
8.4.0
Environment (for Mobile testing):
-
Appium version
1.22.3 -
Mobile platform/version under test: (for example: iOS 11 or Android 7)
iOS 15.2 -
Real device or emulator/simulator: (for example: iPhone 6s real or Nexus 6 simulator)
iPad 9th Generation Simulator -
Xcode version (for iOS): (for example: Xcode 8 or Xcode 11)
13.2.1
Steps to reproduce:
Problem #1
Using the ‘Start Existing Application’ keyword start your IOS app.
This will unforutnately restart the application on every test run (which is annoying as it means I need to run a log in script before every test).
The only way for me to interact with elements, specifically tap on them, is by using the ‘Double Tap’ keyword. This does not act like a Double Tap within my application and has thus far only ever tapped on the element at hand once (which is what I want as an alternative to not being able to us 'Tap).
Even when using the recorder and being 100% confident Katalon knows about the object I’m pointing at, the ‘Tap’ command will ‘pass’ but never actually taps the element!
Problem #2
To combat the issue experienced above regarding the app restarting on each test run, I decided to instead use the ‘Start Application’ keyword and set the uninstallafterclose param to false. This fixed that issue.
The problems arose when I soon found whilst I am still unable to use the ‘Tap’ keyword, my workaround of using ‘Double Tap’ now actually does double tap! (This is not what I want as it generates unexpected results.)
Final question to solve!
Essentially, I’d like to know how to:
- Start my application without the need for a restart on each test case execution WHILST simultaneously being able to use the ‘Tap’ keyword OR at least being able to use the work around of ‘Double Tap.’
Please also provide your test scripts if possible.
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 static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
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.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys
import com.kms.katalon.core.util.KeywordUtil as KeywordUtil
Mobile.startApplication(‘/Users/KATALON/tasea.app’, false)
try {
'Navigate to trinoor module'
Mobile.doubleTap(findTestObject('IOS_OBJECTS/002_STAPLE_OBJECTS/001_trinoorModule'), 0, FailureHandling.STOP_ON_FAILURE)
'Navigate to Math subapp'
Mobile.doubleTap(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/001_mathSubApp'), 0, FailureHandling.STOP_ON_FAILURE)
'The following \'Verify Element Exist\' steps can only pass if the value of each object has a predefined and expected attribute value '
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/002_result_44'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/003_result_7'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/004_result_18'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/005_result_3'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/006_result_440009'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/007_result_70003'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/008_result_180045'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/009_result_29999'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/010_result_infinity'), 0)
'Scroll to new region'
Mobile.scrollToText('Logic', FailureHandling.STOP_ON_FAILURE)
// Mobile.scrollToText('Logic', FailureHandling.STOP_ON_FAILURE)
'Tap the logic button'
Mobile.tap(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/011_logic_button'), 0)
'Verify a false result is generated'
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/012_false_result'), 0)
'Get to text input'
Mobile.doubleTap(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/012_compareTextInput'), 0)
'Change the text to ensure a positive result is generated'
Mobile.setText(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/012_compareTextInput'), 'compare_text_1', 0)
'Tap logic button'
Mobile.doubleTap(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/011_logic_button'), 0)
'Verify true result'
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/013_true_result'), 0)
'Scroll to next region'
Mobile.scrollToText('Conversions', FailureHandling.STOP_ON_FAILURE)
'The following \'Verify Element Exist\' steps can only pass if the value of each object has a predefined and expected attribute value '
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/014_result_508cm'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/015_result_error'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/016_result_679999999fahr'), 0)
Mobile.verifyElementExist(findTestObject('IOS_OBJECTS/003_TRINOOR_MODULE/001_MATH/017_result_25ms'), 0)
'Navigate back home'
Mobile.doubleTap(findTestObject('IOS_OBJECTS/002_STAPLE_OBJECTS/002_homeButton'), 0)
}
catch (Exception ex) {
KeywordUtil.markFailed('Test failed due to: ’ + ex)
Mobile.doubleTap(findTestObject('IOS_OBJECTS/002_STAPLE_OBJECTS/002_homeButton'), 0)
}
