NativeScript / nativescript-dev-appium

A package to help with writing and executing e2e Appium tests in NativeScript apps
Apache License 2.0
70 stars 27 forks source link

Stuck on `Check if emulator is running` #271

Closed thruthesky closed 4 years ago

thruthesky commented 4 years ago

Test is stuck after Check if emulator is running and sometime later it says Check has failed.

Please help.

Environment

This is tns info:

$ tns info ✔ Getting NativeScript components versions information... ✔ Component nativescript has 6.1.2 version and is up to date. ⚠ Update available for component tns-core-modules. Your current version is 6.0.7 and the latest available version is 6.1.1. ✔ Component tns-android has 6.1.2 version and is up to date. ✔ Component tns-ios has 6.1.1 version and is up to date.

This is package.json:

{ "name": "philgo-v5", "nativescript": { "id": "com.philgo.philgo", "tns-ios": { "version": "6.1.1" }, "tns-android": { "version": "6.1.2" } }, "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "./node_modules/.bin/cypress open", "lint": "ng lint", "e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts --recursive e2e --appiumCapsLocation ./e2e/config/appium.capabilities.json", "android": "tns run android", "ios": "tns run ios", "mobile": "tns run", "preview": "tns preview", "compile:server": "webpack --config webpack.server.config.js --progress --colors", "serve:ssr": "node dist/server", "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server", "ssr:serve": "nodemon --watch src/ --watch libs/ -e ts,html,scss --exec 'npm run build:ssr && npm run serve:ssr'", "build:client-and-server-bundles": "ng build --prod && ng run philgo-v5:server:production --bundleDependencies all" }, "private": true, "dependencies": { "@angular/animations": "~8.2.1", "@angular/cdk": "~8.2.3", "@angular/common": "~8.2.1", "@angular/compiler": "~8.2.1", "@angular/core": "~8.2.1", "@angular/fire": "^5.2.1", "@angular/forms": "~8.2.1", "@angular/http": "~8.0.0-beta.10", "@angular/material": "^8.2.3", "@angular/platform-browser": "~8.2.1", "@angular/platform-browser-dynamic": "~8.2.1", "@angular/platform-server": "~8.2.1", "@angular/pwa": "^0.803.8", "@angular/router": "~8.2.1", "@angular/service-worker": "~8.2.1", "@nguniversal/express-engine": "^8.1.1", "@nguniversal/module-map-ngfactory-loader": "8.1.1", "@ngxs/store": "^3.5.1", "@teammaestro/nativescript-svg": "^1.0.1", "core-js": "^2.5.4", "firebase": "^7.1.0", "cypress": "^3.4.1", "domino": "^2.1.3", "express": "^4.15.2", "localstorage-polyfill": "^1.0.1", "memory-cache": "^0.2.0", "hammerjs": "^2.0.8", "nativescript-angular": "~8.2.1", "nativescript-plugin-firebase": "^10.0.1", "nativescript-theme-core": "^2.0.23", "nativescript-ui-sidedrawer": "^7.0.2", "reflect-metadata": "~0.1.12", "rxjs": "~6.5.0", "tns-core-modules": "~6.0.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.800.0", "@angular/cli": "~8.0.3", "@angular/compiler-cli": "~8.2.1", "@nativescript/schematics": "~0.7.0", "@nativescript/tslint-rules": "~0.0.2", "@types/chai": "~4.1.7", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/mocha": "~5.2.5", "@types/node": "~8.9.4", "chai": "~4.1.2", "codelyzer": "^5.0.0", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "mobile-devices-controller": "^5.2.2", "mocha": "~5.2.0", "mocha-junit-reporter": "~1.18.0", "mocha-multi": "~1.0.1", "mochawesome": "~3.1.2", "nativescript-dev-appium": "^6.1.2", "nativescript-dev-webpack": "~1.0.0", "node-sass": "^4.7.1", "protractor": "~5.4.0", "ts-loader": "^5.2.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.4.3", "webpack-cli": "^3.1.0" } }

Describe the bug

When I run test, it is stuck after Check if "emaulator-xxxx" is running.

$ npm run e2e -- --runType android28

> philgo-v5@0.0.0 e2e /Users/jaehosong/apps/philgo/philgo-v5
> tsc -p e2e && mocha --opts ./e2e/config/mocha.opts --recursive e2e --appiumCapsLocation ./e2e/config/appium.capabilities.json "--runType" "android28"

Parsed args:   {"port":4723,"projectDir":"/Users/jaehosong/apps/philgo/philgo-v5","projectBinary":"/Users/jaehosong/apps/philgo/philgo-v5/node_modules/.bin","pluginRoot":"/Users/jaehosong/apps/philgo/philgo-v5/node_modules/nativescript-dev-appium","pluginBinary":"/Users/jaehosong/apps/philgo/philgo-v5/node_modules/nativescript-dev-appium/node_modules/.bin","wdaLocalPort":8410,"testFolder":"e2e","runType":"android28","appiumCapsLocation":"./e2e/config/appium.capabilities.json","verbose":false,"cleanApp":false,"path":"/Users/jaehosong/apps/philgo/philgo-v5","capabilitiesName":"appium.capabilities.json","driverConfig":{"host":"localhost","port":4723},"logImageTypes":[]}

./e2e/config/appium.capabilities.json
Capabilities found at: ./e2e/config/appium.capabilities.json
Automation name set to: UIAutomator2
To change automation name, you need to set it in appium capabilities!
Available applications:  ["platforms/android/app/build/outputs/apk/debug/app-debug.apk"]
Pick first application:   "platforms/android/app/build/outputs/apk/debug/app-debug.apk"
Application full path: /Users/jaehosong/apps/philgo/philgo-v5/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Executing "/bin/ps aux | grep -ie 'sdk/emulator/qemu' | grep -ie 'Pixel2Api28PieX86' | grep -v grep  | xargs kill -9"
No matching processes to kill!
Starting emulator with options: -avd Pixel2Api28PieX86 -port 5548 ["-no-audio","-no-boot-anim","-wipe-data","-no-snapshot-load","-no-snapshot-save"]
Booting emulator ...
Check if "emulator-5548" is running.
Check has "failed".
5548 failed to boot in 150000 milliseconds true
Executing "/bin/ps aux | grep -w '13136' | grep -v grep  | xargs kill -9"
Matching process:
jaehosong        13136  17.1  6.0  8768792 2010996 s004  S+    2:43PM   4:12.36 /Users/jaehosong/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64 -avd Pixel2Api28PieX86 -port 5548 -no-audio -no-boot-anim -wipe-data -no-snapshot-load -no-snapshot-save
jaehosong        13143   0.0  0.1  4849200  21808 s004  S+    2:43PM   0:00.08 /Users/jaehosong/Library/Android/sdk/emulator/emulator64-crash-service -pipe com.google.AndroidEmulator.CrashService.13136 -ppid 13136 -data-dir /tmp/android-jaehosong/61cebd4b-f55a-48a9-a570-f3842be25475

Executing "/bin/ps aux | grep -ie 'sdk/emulator/qemu' | grep -ie 'Pixel2Api28PieX86' | grep -v grep  | xargs kill -9"
Matching process:
jaehosong        13136  10.8  6.0  8766696 2010980 s004  R+    2:43PM   4:12.40 /Users/jaehosong/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64 -avd Pixel2Api28PieX86 -port 5548 -no-audio -no-boot-anim -wipe-data -no-snapshot-load -no-snapshot-save

Waiting for Pixel2Api28PieX86 to stop!
Device: Pixel2Api28PieX86 is successfully killed!
Trying to boot emulator again!
Left retries: undefined!
Executing "/bin/ps aux | grep -ie 'sdk/emulator/qemu' | grep -ie 'Pixel2Api28PieX86' | grep -v grep  | xargs kill -9"
No matching processes to kill!
Starting emulator with options: -avd Pixel2Api28PieX86 -port 5548 ["-no-audio","-no-boot-anim","-wipe-data","-no-snapshot-load","-no-snapshot-save","-no-window"]
Booting emulator ...
Check if "emulator-5548" is running.

To Reproduce

$ tns build android
$ npm run e2e -- --runType android28

Expected behavior

Test should run

Sample project

Additional context

2019-10-11_14-57-48

thruthesky commented 4 years ago

When I restarted my Mac book, It's working.

markusmauch commented 4 years ago

Rebooting the system helps only the first time then the same error occurs again:

ERROR: Process "emulator64-crash-service" not found. Failed to delete lock file for C:\Users\androiddev5.android\avd\Pixel.avd! Starting emulator with options: -avd Pixel -port 5546 ["-no-audio","-no-boot-anim","-wipe-data","-no-snapshot-load","-no-snapshot-save","-no-window"] Booting emulator ... Check if "emulator-5546" is running. Check has "passed". Check if emulator is responding Emulator is not responding!