Open jzaratei opened 5 years ago
If any is interesting, here is a workaround on IOSManager, for adding UDID devices from iphone X onwards. It uses the "idevice_id --list" command from libimobiledevice library to get all the udids:
private ArrayList<String> getIOSUDID() {
ArrayList<String> deviceUDIDiOS = new ArrayList<String>();
try {
int startPos = 0;
int endPos = IOS_UDID_LENGTH - 1;
Optional<String> getIOSDeviceID = Optional.of(cmd.runProcessCommandToGetDeviceID(profile));
if (!getIOSDeviceID.get().contains("-")){ //Iphone X onwards contains "-" in UDID
getIOSDeviceID = Optional.of(new CommandPrompt().runCommand("idevice_id --list"));
deviceUDIDiOS.addAll(Arrays.asList(getIOSDeviceID.get().split("\n")));
} else {
while (endPos < getIOSDeviceID.get().length()) {
deviceUDIDiOS.add(getIOSDeviceID.get().substring(startPos, endPos + 1)
.replace("\n", ""));
startPos += IOS_UDID_LENGTH;
endPos += IOS_UDID_LENGTH;
}
}
} catch (Exception e) {
e.printStackTrace();
throw new IllegalStateException("Failed to fetch iOS device connected");
}
return deviceUDIDiOS;
}
@jzaratei Sorry, this issue split out my way. This has been already fixed in master.
@saikrishna321 Its still not working, are you sure the fix is in master ?
@narmadha956 Yes, Can you post what error ur getting?
I have an XR and I'm using ATD, it keeps saying no devices connected.
On debugging I see, DeviceManager dependency is 2863590efe, which is the latest commit. The code in IOSManager.java is like this :
private ArrayList<String> getIOSUDID() {
ArrayList<String> deviceUDIDiOS = new ArrayList<String>();
try {
int startPos = 0;
int endPos = IOS_UDID_LENGTH - 1;
Optional<String> getIOSDeviceID = Optional.of(cmd.runProcessCommandToGetDeviceID(profile));
while (endPos < getIOSDeviceID.get().length()) {
deviceUDIDiOS.add(getIOSDeviceID.get().substring(startPos, endPos + 1)
.replace("\n", ""));
startPos += IOS_UDID_LENGTH;
endPos += IOS_UDID_LENGTH;
}
} catch (InterruptedException | IOException e) {
e.printStackTrace();
throw new IllegalStateException("Failed to fetch iOS device connected");
}
return deviceUDIDiOS;
}
I can see "system_profiler SPUSBDataType | sed -n -E -e '/(iPhone|iPad|iPod)/,/Serial/s/ Serial Number: (.+)/\1/p'" returning correct UDID of XR, but without "-" in between. But it doesn't enter the while condition "while (endPos < getIOSDeviceID.get().length())" as the XR UDID length is 24 which is not less than 39(endPos is initialised to 39).
@saikrishna321 Even if I fix IOSManager, and use it in ATD, still unable to execute tests on XR. Should I raise this as ATD issue ? Getting nullpointer only while trying to execute on XR, working on other 40 digit UDID devices.
Logs :
Mar 13, 2020 3:17:28 PM com.appium.utils.ConfigFileManager <clinit>
INFO: Using config file from [config.properties]
Mar 13, 2020 3:17:28 PM com.appium.utils.ConfigFileManager <clinit>
SEVERE: Error while loading config file: config.properties (No such file or directory)
Mar 13, 2020 3:17:41 PM com.appium.schema.CapabilitySchemaValidator validateRemoteHosts
INFO: ATD is Running on 127.0.0.1
Mar 13, 2020 3:17:41 PM com.appium.manager.ATDRunner parallelExecution
INFO: com.appium.manager.ATDRunnerTotal Number of devices detected::1
Mar 13, 2020 3:17:41 PM com.appium.manager.DeviceAllocationManager getDevices
INFO: All devices connected
_ _ _ _ _ _
__| | (_) ___ | |_ _ __ (_) | |__ _ _ | |_ ___
/ _` | | | / __| | __| | '__| | | | '_ \ | | | | | __| / _ \
| (_| | | | \__ \ | |_ | | | | | |_) | | |_| | | |_ | __/
\__,_| |_| |___/ \__| |_| |_| |_.__/ \__,_| \__| \___|
...
... TestNG 7.0.1 by Cédric Beust (cedric@beust.com)
...
Mar 13, 2020 3:32:34 PM com.appium.manager.LocalAppiumManager startAppiumServer
INFO: LocalAppiumManagerStarting Appium Server on Localhost
Picking UserSpecified Path for AppiumServiceBuilder
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Appium] Welcome to Appium v1.17.0-beta.1
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] port: 19094
[Appium] logFile: /Users/narmadhar/Documents/git/ATD/AppiumTestDistribution/target/appiumlogs/appium_logs.txt
[Appium] relaxedSecurityEnabled: true
[Appium] Appium REST http interface listener started on 127.0.0.1:19094
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getStatus() with args: []
[debug] [GENERIC] Responding to client with driver.getStatus() result: {"build":{"version":"1.17.0-beta.1"}}
[HTTP] <-- GET /wd/hub/status 200 6 ms - 75
[HTTP]
Mar 13, 2020 3:33:00 PM com.appium.manager.LocalAppiumManager startAppiumServer
INFO: LocalAppiumManagerAppium Server Started at......http://127.0.0.1:19094/wd/hub
Mar 13, 2020 3:33:00 PM com.appium.manager.DeviceAllocationManager allocateDevice
INFO: Allocated Device com.appium.manager.AppiumDevice@4463a217 for Execution
java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)
at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at com.appium.capabilities.DesiredCapabilityBuilder.capabilityObject(DesiredCapabilityBuilder.java:88)
at com.appium.capabilities.DesiredCapabilityBuilder.lambda$desiredCapabilityForLocalAndRemoteATD$1(DesiredCapabilityBuilder.java:121)
at java.util.HashMap$KeySet.forEach(HashMap.java:933)
at com.appium.capabilities.DesiredCapabilityBuilder.desiredCapabilityForLocalAndRemoteATD(DesiredCapabilityBuilder.java:109)
at com.appium.capabilities.DesiredCapabilityBuilder.buildDesiredCapability(DesiredCapabilityBuilder.java:54)
at com.appium.manager.AppiumDriverManager.buildDesiredCapabilities(AppiumDriverManager.java:171)
at com.appium.manager.AppiumDriverManager.startAppiumDriverInstance(AppiumDriverManager.java:153)
at com.appium.manager.AppiumParallelMethodTestListener.allocateDeviceAndStartDriver(AppiumParallelMethodTestListener.java:120)
at com.appium.manager.AppiumParallelMethodTestListener.beforeInvocation(AppiumParallelMethodTestListener.java:93)
at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:56)
at org.testng.internal.BaseInvoker.runInvokedMethodListeners(BaseInvoker.java:55)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:574)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Mar 13, 2020 3:33:00 PM com.context.SessionContext <clinit>
Before DeviceId00008020-000928A6146A002E
INFO: SessionContext default constructor
Mar 13, 2020 3:33:00 PM com.context.SessionContext loadReportPortalProperties
Its me
INFO: Using reportportal.properties file from src/test/resources/reportportal.properties
Mar 13, 2020 3:33:00 PM com.context.SessionContext loadReportPortalProperties
INFO: reportportal.properties file NOT FOUND - /Users/narmadhar/Documents/git/ATD/AppiumTestDistribution/src/test/resources/reportportal.properties
Mar 13, 2020 3:33:00 PM com.context.SessionContext <clinit>
INFO: Initialized SessionContext
Mar 13, 2020 3:33:00 PM com.context.SessionContext addContext
INFO: Adding context for thread - 21
Mar 13, 2020 3:33:00 PM com.context.TestExecutionContext <init>
INFO: dragNDrop - TestExecution context created
com.appium.executor.CustomeListener.beforeInvocation() was invoked
java.lang.NullPointerException
at com.appium.manager.ScreenShotManager.captureScreenShot(ScreenShotManager.java:80)
at com.appium.manager.TestLogger.handleTestFailure(TestLogger.java:193)
at com.appium.manager.TestLogger.endLogging(TestLogger.java:111)
at com.appium.manager.AppiumParallelMethodTestListener.afterInvocation(AppiumParallelMethodTestListener.java:139)
at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:60)
at org.testng.internal.BaseInvoker.runInvokedMethodListeners(BaseInvoker.java:55)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:631)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
FAILED: dragNDrop
java.lang.NullPointerException
at com.appium.manager.AppiumParallelMethodTestListener.afterInvocation(AppiumParallelMethodTestListener.java:154)
at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:60)
at org.testng.internal.BaseInvoker.runInvokedMethodListeners(BaseInvoker.java:55)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:631)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
===============================================
ATDTest
Tests run: 1, Failures: 1, Skips: 0
===============================================
===============================================
ATDSuiteName
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================
Disconnected from the target VM, address: '127.0.0.1:58996', transport: 'socket'
Finally complete
_____ _ ____ _ _ _
|_ _| ___ ___ | |_ / ___| ___ _ __ ___ _ __ | | ___ | |_ ___ __| |
| | / _ \ / __| | __| | | / _ \ | '_ ` _ \ | '_ \ | | / _ \ | __| / _ \ / _` |
| | | __/ \__ \ | |_ | |___ | (_) | | | | | | | | |_) | | | | __/ | |_ | __/ | (_| |
|_| \___| |___/ \__| \____| \___/ |_| |_| |_| | .__/ |_| \___| \__| \___| \__,_|
|_|
java.lang.AssertionError: Testcases have failed in parallel execution expected [false] but found [true]
Expected :false
Actual :true
<Click to see difference>
at org.testng.Assert.fail(Assert.java:97)
at org.testng.Assert.failNotEquals(Assert.java:969)
at org.testng.Assert.assertFalse(Assert.java:65)
at com.test.site.Runner.testApp(Runner.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:597)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.testng.TestRunner.privateRun(TestRunner.java:766)
at org.testng.TestRunner.run(TestRunner.java:587)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1109)
at org.testng.TestNG.runSuites(TestNG.java:1039)
at org.testng.TestNG.run(TestNG.java:1007)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
===============================================
Default Suite
Total tests run: 1, Passes: 0, Failures: 1, Skips: 0
===============================================
Process finished with exit code 0
@narmadha956 Please try with version
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.AppiumTestDistribution</groupId>
<artifactId>AppiumTestDistribution</artifactId>
<version> bef9b5ac70 </version>
</dependency>
Hi, the IOSManager() is not recognizing an Iphone Xs with OS 12.3 as a real device. The actual udid is: 00008020-0013056136E1002E
Thanks for your support.