monstar-lab / katalon-custom-keyword-ios

katalon custom keyword iOS
0 stars 1 forks source link

Katalon Remote TestKit connection #3

Open chanyadeshani opened 6 years ago

chanyadeshani commented 6 years ago

sample test:

// Please add apk file(/appium/apk/RTKdemo.apk) to "Remote testKit web(https://webapp.appkitbox.com) -> Rapid Tester -> Mobile App(Add)" before this test

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 static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import org.openqa.selenium.remote.DesiredCapabilities
import com.kms.katalon.core.appium.driver.AppiumDriverManager
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.driver.MobileDriverType
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.util.internal.PathUtil as PathUtil
import internal.GlobalVariable as GlobalVariable
import io.appium.java_client.android.AndroidDriver

String RTKServerUrl = "https://gwjp.appkitbox.com/wd/hub";
DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability("userName", "YourRemoteTestKitUsername");
capabilities.setCapability("password", "YourRemoteTestKitpassword");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Galaxy*");
capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("resetKeyboard", true);
capabilities.setCapability("accessToken", "xxxxxxxxxxxxxxxxxxxxxxxxxx");//Can Find your Access Token navigate Rapid Tester > Access Token
capabilities.setCapability("appPackage", "com.example.remotetestkit.demo");
capabilities.setCapability("appActivity", "MainActivity");

AppiumDriverManager.createMobileDriver(MobileDriverType.ANDROID_DRIVER, capabilities, new URL(RTKServerUrl))

Mobile.setText(findTestObject('RemoteTestKit/android.widget.EditText0'), 'RTK', 30)

Mobile.setText(findTestObject('RemoteTestKit/android.widget.EditText1'), 'Remote TestKing', 30)

Mobile.tap(findTestObject('RemoteTestKit/android.widget.Button0 - Save'), 30)

Mobile.closeApplication()