Тест nativescript-dev-appium e2e не выполнен - PullRequest
0 голосов
/ 04 ноября 2019

Я пытаюсь провести e2e-тестирование с nativescript-dev-appium, но не получилось. Я не знаю что не так. Я кодирую по этой ссылке https://github.com/NativeScript/ns-dev-days-appium-plugin

и это android28

"android28": {
        "platformName": "Android",
        "platformVersion": "28",
        "deviceName": "Emulator-Api28-Google",
        "avd": "Emulator-Api28-Google",
        "lt": 60000,
        "newCommandTimeout": 720,
        "noReset": false,
        "fullReset": false,
        "app": ""
    }

$ npm run e2e - --runType android28

@ e2e /appium-demo node ./node_modules/nativescript-dev-appium/check-dev-deps.js &&  tsc -p e2e  &&  mocha --opts ./e2e/config/mocha.opts  "--runType" "android28"



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


    /appium-demo/e2e/config/appium.capabilities.json
    Capabilities found at: /appium-demo/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: /appium-demo/platforms/android/app/build/outputs/apk/debug/app-debug.apk 
      1) "before all" hook: start server
      2) "after all" hook: stop server

      0 passing (109ms)
      2 failing

  1) "before all" hook: start server:
     TypeError: Cannot read property 'sdk' of undefined
      at fs_1.readFileSync.split.forEach.line (node_modules/mobile-devices-controller/lib/android-controller.js:678:44)
      at Array.forEach (<anonymous>)
      at fs_1.readdirSync.filter.forEach.f (node_modules/mobile-devices-controller/lib/android-controller.js:671:18)
      at Array.forEach (<anonymous>)
      at Function.parseEmulatorsAvds (node_modules/mobile-devices-controller/lib/android-controller.js:668:14)
      at Function.<anonymous> (node_modules/mobile-devices-controller/lib/android-controller.js:862:57)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/mobile-devices-controller/lib/android-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/mobile-devices-controller/lib/android-controller.js:4:12)
      at Function.parseEmulators (node_modules/mobile-devices-controller/lib/android-controller.js:856:16)
      at Function.<anonymous> (node_modules/mobile-devices-controller/lib/android-controller.js:46:37)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/mobile-devices-controller/lib/android-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/mobile-devices-controller/lib/android-controller.js:4:12)
      at Function.getAllDevices (node_modules/mobile-devices-controller/lib/android-controller.js:42:16)
      at Function.<anonymous> (node_modules/mobile-devices-controller/lib/device-controller.js:242:63)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/mobile-devices-controller/lib/device-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/mobile-devices-controller/lib/device-controller.js:4:12)
      at Function.mapDevicesToArray (node_modules/mobile-devices-controller/lib/device-controller.js:235:16)
      at Function.<anonymous> (node_modules/mobile-devices-controller/lib/device-controller.js:24:52)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/mobile-devices-controller/lib/device-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/mobile-devices-controller/lib/device-controller.js:4:12)
      at Function.getDevices (node_modules/mobile-devices-controller/lib/device-controller.js:22:16)
      at DeviceManager.<anonymous> (node_modules/nativescript-dev-appium/lib/device-manager.js:41:86)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/nativescript-dev-appium/lib/device-manager.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/nativescript-dev-appium/lib/device-manager.js:3:12)
      at DeviceManager.startDevice (node_modules/nativescript-dev-appium/lib/device-manager.js:18:16)
      at Object.<anonymous> (node_modules/nativescript-dev-appium/lib/utils.js:491:44)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/nativescript-dev-appium/lib/utils.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/nativescript-dev-appium/lib/utils.js:3:12)
      at Object.exports.prepareDevice (node_modules/nativescript-dev-appium/lib/utils.js:489:50)
      at AppiumServer.<anonymous> (node_modules/nativescript-dev-appium/lib/appium-server.js:165:40)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/nativescript-dev-appium/lib/appium-server.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/nativescript-dev-appium/lib/appium-server.js:3:12)
      at AppiumServer.prepDevice (node_modules/nativescript-dev-appium/lib/appium-server.js:164:16)
      at AppiumServer.<anonymous> (node_modules/nativescript-dev-appium/lib/appium-server.js:55:28)
      at Generator.next (<anonymous>)
      at fulfilled (node_modules/nativescript-dev-appium/lib/appium-server.js:4:58)
      at process._tickCallback (internal/process/next_tick.js:68:7)

  2) "after all" hook: stop server:
     TypeError: Cannot read property 'platform' of undefined
      at Function.getApplicationId (node_modules/mobile-devices-controller/lib/device-controller.js:96:20)
      at Function.<anonymous> (node_modules/mobile-devices-controller/lib/device-controller.js:217:47)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/mobile-devices-controller/lib/device-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/mobile-devices-controller/lib/device-controller.js:4:12)
      at Function.uninstallApplication (node_modules/mobile-devices-controller/lib/device-controller.js:216:16)
      at Object.<anonymous> (node_modules/nativescript-dev-appium/index.js:92:64)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/node_modules/nativescript-dev-appium/index.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/nativescript-dev-appium/index.js:3:12)
      at Object.stopServer (node_modules/nativescript-dev-appium/index.js:84:12)
      at Context.<anonymous> (e2e/setup.js:33:41)
      at Generator.next (<anonymous>)
      at /home/mai/code/mobile_app/appium-demo/e2e/setup.js:7:71
      at new Promise (<anonymous>)
      at __awaiter (e2e/setup.js:3:12)
      at Context.<anonymous> (e2e/setup.js:32:12)
      at process.topLevelDomainCallback (domain.js:126:23)

1 Ответ

0 голосов
/ 04 ноября 2019

Это может быть, а может и не быть той же проблемой, но у меня возникли проблемы с запуском тестов Appium. На самом деле я использую ту же команду, что и вы:

npm run e2e -- --runType android28

И несмотря на то, что AVD определен для Android 28, он не запустится. В конечном итоге мне нужно было создать новый AVD, использующий Android 28, и назвать его «Emulator-Api28-Google» в соответствии с файлом конфигурации. После этого все бананы были приемными.

Надеюсь, это поможет!

...