Я использую селен + мавен + огурец + тестнг + аппиум для теста мобильного интерфейса. Также я запускаю эти случаи на реальном устройстве. Но приложение запускается два раза;
Mar 03, 2020 5:56:11 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
Mar 03, 2020 5:56:37 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
И тогда я вижу следующее сообщение об ошибке;
Scenario: [1.0] Check Incoming Payment Types [90m# src/test/resources/features/Android/Payment.feature:6[0m
[31mGiven [0m[31modeal app is launched[0m [90m# PaymentFlow.launchedOdealApp()[0m
[31morg.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'admins-Mac-mini.local', ip: 'fe80:0:0:0:14b1:249d:6e8e:379f%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.3', java.version: '1.8.0_231'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: /Users/busekaya/Desktop/app..., appActivity: com.telera.merchant.splash...., appPackage: com.telera.merchant.stage.d..., automationName: UiAutomator2, clearSystemFiles: false, databaseEnabled: false, desired: {app: /Users/busekaya/Desktop/app..., appActivity: com.telera.merchant.splash...., appPackage: com.telera.merchant.stage.d..., automationName: UiAutomator2, clearSystemFiles: false, deviceName: TestDevice-1, noReset: true, platformName: android, platformVersion: 7.1.1, udid: ZH33D2543D}, deviceApiLevel: 25, deviceManufacturer: motorola, deviceModel: Moto E (4) Plus, deviceName: ZH33D2543D, deviceScreenDensity: 320, deviceScreenSize: 720x1280, deviceUDID: ZH33D2543D, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, pixelRatio: 2, platform: LINUX, platformName: Android, platformVersion: 7.1.1, statBarHeight: 48, takesScreenshot: true, udid: ZH33D2543D, viewportRect: {height: 1136, left: 0, top: 48, width: 720}, warnings: {}, webStorageEnabled: false}
Session ID: 9b91b01c-08bd-4b7a-a65e-4e09e5a7fcf5
*** Element info: {Using=id, value=login}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:61)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:372)
at io.appium.java_client.DefaultGenericMobileDriver.findElementById(DefaultGenericMobileDriver.java:69)
at io.appium.java_client.AppiumDriver.findElementById(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementById(AndroidDriver.java:1)
at org.openqa.selenium.By$ById.findElement(By.java:188)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:57)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:205)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:201)
at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:641)
at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:638)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249)
at com.odealMobile.PaymentFlow.launchedOdealApp(PaymentFlow.java:44)
at ✽.Given odeal app is launched(src/test/resources/features/Android/Payment.feature:7)
[0m
[36mWhen [0m[36muser log in to Odeal successfully[0m [90m# PaymentFlow.loginTheApp()[0m
[36mAnd [0m[36mClicks on New Payment button[0m [90m# PaymentFlow.clickNewPayment()[0m
[36mAnd [0m[36mEnter Price to Opened Page[0m [90m# PaymentFlow.enterPrice()[0m
[36mAnd [0m[36mClicks on Get Paid button[0m [90m# PaymentFlow.clickPaidButton()[0m
[36mThen [0m[36mAll Payment Types will be Appeared[0m [90m# PaymentFlow.checkPaymentTypes()[0m
[31mFailed scenarios:[0m
[31msrc/test/resources/features/Android/Payment.feature:6 [0m# Scenario: [1.0] Check Incoming Payment Types
1 Scenarios ([31m1 failed[0m)
6 Steps ([31m1 failed[0m, [36m5 skipped[0m)
0m54.617s
org.openqa.selenium.NoSuchSessionException: A session is either terminated or not started
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'admins-Mac-mini.local', ip: 'fe80:0:0:0:14b1:249d:6e8e:379f%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.3', java.version: '1.8.0_231'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: /Users/busekaya/Desktop/app..., appActivity: com.telera.merchant.splash...., appPackage: com.telera.merchant.stage.d..., automationName: UiAutomator2, clearSystemFiles: false, databaseEnabled: false, desired: {app: /Users/busekaya/Desktop/app..., appActivity: com.telera.merchant.splash...., appPackage: com.telera.merchant.stage.d..., automationName: UiAutomator2, clearSystemFiles: false, deviceName: TestDevice-1, noReset: true, platformName: android, platformVersion: 7.1.1, udid: ZH33D2543D}, deviceApiLevel: 25, deviceManufacturer: motorola, deviceModel: Moto E (4) Plus, deviceName: ZH33D2543D, deviceScreenDensity: 320, deviceScreenSize: 720x1280, deviceUDID: ZH33D2543D, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, pixelRatio: 2, platform: LINUX, platformName: Android, platformVersion: 7.1.1, statBarHeight: 48, takesScreenshot: true, udid: ZH33D2543D, viewportRect: {height: 1136, left: 0, top: 48, width: 720}, warnings: {}, webStorageEnabled: false}
Session ID: 9b91b01c-08bd-4b7a-a65e-4e09e5a7fcf5
*** Element info: {Using=id, value=login}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:61)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:372)
at io.appium.java_client.DefaultGenericMobileDriver.findElementById(DefaultGenericMobileDriver.java:69)
at io.appium.java_client.AppiumDriver.findElementById(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementById(AndroidDriver.java:1)
at org.openqa.selenium.By$ById.findElement(By.java:188)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:57)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:205)
at org.openqa.selenium.support.ui.ExpectedConditions$7.apply(ExpectedConditions.java:201)
at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:641)
at org.openqa.selenium.support.ui.ExpectedConditions$22.apply(ExpectedConditions.java:638)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249)
at com.odealMobile.PaymentFlow.launchedOdealApp(PaymentFlow.java:44)
at ✽.Given odeal app is launched(src/test/resources/features/Android/Payment.feature:7)
===============================================
Suite
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================
На самом деле я вижу открытое приложение на мобильном устройстве, но мой случай не запускается. Хочу подчеркнуть, приложение открывается два раза. Сначала открывается приложение и появляется домашняя страница, а затем она закрывается. Затем приложение открывается во второй раз, и ни одно дело не запускается.
Мобильное устройство, которое я использовал для своего теста: Motorola Moto E (4) Plus, 7.1.1 Appium версия 1.15.1
Информация о моей желаемой возможности:
//Screen Classes Initialization
public void setupCucumber () throws MalformedURLException {
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "TestDevice-1");
cap.setCapability("automationName", "UiAutomator2");
cap.setCapability("udid", "ZH33D2543D");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "7.1.1");
cap.setCapability("noReset", "true");
//cap.setCapability("fullReset", "false");
cap.setCapability("clearSystemFiles", "false");
cap.setCapability("appPackage", "com.telera.merchant.stage.debug");
cap.setCapability("appActivity", "com.telera.merchant.splash.SplashActivity");
cap.setCapability("app", "/Users/busekaya/Desktop/app-stage-debug.apk");
//cap.setCapability("autoAcceptAlerts", true);
//cap.setCapability("path", "/Users/busekaya/Desktop/app-stage-debug.apk");
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap); //"http://127.0.0.1:4723/wd/hub\"
driver.manage().timeouts().implicitlyWait(200, TimeUnit.SECONDS);
wait = new WebDriverWait(driver, 200);
}
Файл функций огурца;
Feature: [1] All Scenarios About Payment
@buse2
Scenario: [1.0] Check Incoming Payment Types
Given app is launched
When user log in successfully
And Clicks on New Payment button
And Enter Price to Opened Page
And Clicks on the Get Paid button
Then All Payment Types will be Appeared