Cannot start AppiumDriverLocalService in Jenkin
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
Description
I can start AppiumDriverLocalService in local but when run on Jenkin, i receive a error :
io.appium.java_client.service.local.InvalidServerInstanceException: Invalid server instance exception has occured: The invalid appium node C:\windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\appium\build\lib\main.js has been defined
Caused by: java.io.IOException: The node C:\windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\appium\build\lib\main.jsdoesn't exist
Environment
Appium : 1.8.1
Java client : 5.0.4
Details
Please provide more details, if necessary.
Code To Reproduce Issue [ Good To Have ]
private static final String NODE_JS_PATH = "C:/Program Files/nodejs/node.exe";
private static final String APPIUM_JS_PATH = System.getenv("AppData") + "/npm/node_modules/appium/build/lib/main.js";
AppiumServiceBuilder builder = new AppiumServiceBuilder();
builder.usingDriverExecutable(new File(NODE_JS_PATH));
builder.withAppiumJS(new File(APPIUM_JS_PATH));
builder.usingAnyFreePort();
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(builder);
service.start();
service.getUrl();
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM, platformName);
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
caps.setCapability(MobileCapabilityType.DEVICE_NAME, usingDeviceId);
caps.setCapability(MobileCapabilityType.UDID, usingDeviceId);
caps.setCapability(AndroidMobileCapabilityType.CHROMEDRIVER_EXECUTABLE, System.getProperty("user.dir") + "/src/test/java/resources/chromedriver.exe");
caps.setCapability("unicodeKeyboard", "true");
caps.setCapability("appPackage", appPackage);
caps.setCapability("appActivity", appActivity);
caps.setCapability(AndroidMobileCapabilityType.NATIVE_WEB_SCREENSHOT, true);
caps.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);
driver = new AndroidDriver(service, caps);
driver.manage().timeouts().implicitlyWait(timeDefault, TimeUnit.SECONDS);
Link to Appium logs
Started by timer
Running as SYSTEM
Building in workspace D:\Workspace\maven_appium
[maven_appium] $ cmd /c call C:\windows\TEMP\jenkins1643235431572429234.bat
D:\Workspace\maven_appium>mvn clean test -DsuiteXmlFiles=runSuites/AllRun.xml
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< Maven_Appium:Maven_Appium >----------------------
[INFO] Building Maven_Appium 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Maven_Appium ---
[INFO] Deleting D:\Workspace\maven_appium\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Maven_Appium ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Workspace\maven_appium\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ Maven_Appium ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 63 source files to D:\Workspace\maven_appium\target\classes
[INFO] /D:/Workspace/maven_appium/src/main/java/actions/APIClass/SellerWeb_Changestock.java: D:\Workspace\maven_appium\src\main\java\actions\APIClass\SellerWeb_Changestock.java uses or overrides a deprecated API.
[INFO] /D:/Workspace/maven_appium/src/main/java/actions/APIClass/SellerWeb_Changestock.java: Recompile with -Xlint:deprecation for details.
[INFO] /D:/Workspace/maven_appium/src/main/java/actions/ScreenRecord.java: Some input files use unchecked or unsafe operations.
[INFO] /D:/Workspace/maven_appium/src/main/java/actions/ScreenRecord.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Maven_Appium ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Workspace\maven_appium\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ Maven_Appium ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 20 source files to D:\Workspace\maven_appium\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ Maven_Appium ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[WARNING] Corrupted stdin stream in forked JVM 1. See the dump file D:\Workspace\maven_appium\target\surefire-reports\2019-08-30T03-08-35_575-jvmRun1.dumpstream
[INFO] Running TestSuite
[TestNGContentHandler] [WARN] It is strongly recommended to add "" at the top of your file, otherwise TestNG may fail or not work as expected.
[TestNG] [WARN] AnnotationTransformer already set
...
... TestNG 6.10 by Cédric Beust (cedric@beust.com)
...
Success to connect database
before deviceMapping : {192.168.106.101:5555=true}-13
after deviceMapping : {192.168.106.101:5555=false}-13
[ERROR] Tests run: 313, Failures: 1, Errors: 0, Skipped: 312, Time elapsed: 3.096 s <<< FAILURE! - in TestSuite
[ERROR] BeforeClass(chat.Chat) Time elapsed: 2.264 s <<< FAILURE!
io.appium.java_client.service.local.InvalidServerInstanceException: Invalid server instance exception has occured: The invalid appium node C:\windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\appium\build\lib\main.js has been defined
Caused by: java.io.IOException: The node C:\windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\appium\build\lib\main.jsdoesn't exist
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] Chat>Testbase.BeforeClass:78 » InvalidServerInstance Invalid server instance e...
[INFO]
[ERROR] Tests run: 155, Failures: 1, Errors: 0, Skipped: 154
[INFO]
[ERROR] There are test failures.
Please refer to D:\Workspace\maven_appium\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.731 s
[INFO] Finished at: 2019-08-30T03:08:40+07:00
[INFO] ------------------------------------------------------------------------
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Saving reports...
Processing 'C:\Program Files (x86)\Jenkins\jobs\Seller _Appium\builds\278\testng\testng-results.xml'
TestNG Reports Processing: FINISH
Finished: SUCCESS
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the AppiumServiceBuilder setup and the NODE_JS_PATH and APPIUM_JS_PATH values in the reproduction code, then compare them with the Jenkins log showing the SYSTEM profile path. Run the Maven TestNG suite described in the log and verify that AppiumDriverLocalService can start under Jenkins and that the BeforeClass failure is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, node.js
- Domain
- mobile, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100