简体   繁体   English

Nativescript appium测试安装老版本

[英]Nativescript appium testing installs old version

I'm developing a mobile app using nativescript + angular and I'm testing it using Appium.我正在使用 nativescript + angular 开发一个移动应用程序,我正在使用 Appium 对其进行测试。 When I run appium end to end tests the the following command it loads a previous build of my application.当我运行 appium 端到端测试以下命令时,它会加载我的应用程序的先前版本。

tns build android
npm run e2e -- --runType device.samsung

If I run the app in the emulator with the following command I get the latest changes如果我使用以下命令在模拟器中运行应用程序,我会得到最新的更改

tns run android

Running my e2e after this the app is reverted to an older state.在此之后运行我的 e2e,应用程序将恢复为较旧的 state。

I've tried uninstalling the app from the emulator, then running my e2e but that fails as there is no application installed.我尝试从模拟器中卸载应用程序,然后运行我的 e2e,但由于没有安装应用程序而失败。 After uninstalling the app I find that I have to use the 'tns run android' command to get the app reinstalled on the device.卸载应用程序后,我发现我必须使用“tns run android”命令才能在设备上重新安装应用程序。

Update: Checking install更新:检查安装

I've checked my setup by following the guides我按照指南检查了我的设置

I've checked my appium.capabilities.json file我检查了我的 appium.capabilities.json 文件

"device.samsung": {
    "platformName": "Android",
    "platformVersion": "7.0",
    "deviceName": "samsung_galaxy_s8",
    "avd": "samsung_galaxy_s8",
    "lt": 60000,
    "newCommandTimeout": 720,
    "noReset": true,
    "fullReset": false,
    "app": ""
},

Update: try turning devMode off更新:尝试关闭 devMode

When running my end to end tests it's saying that devMode is on, but when I try and turn it off it's still saying it's on.在运行我的端到端测试时,它说 devMode 已打开,但是当我尝试将其关闭时,它仍然说它已打开。

npm run e2e -- --devMode=false --runType device.samsung

Update: noReset seems to be the problem更新: noReset 似乎是问题所在

The problem is we want to use 'noReset' as we are trying to test the remember me auto login ability and this requires saving information for the application.问题是我们想使用“noReset”,因为我们正在尝试测试记住我的自动登录能力,这需要为应用程序保存信息。 If this gets reset then it doesn't work and cannot be tested.如果这被重置,那么它就不起作用并且无法测试。 If we set 'noReset' to true then our tests work but the app is not updated when running e2e it doesn't use the running version either.如果我们将 'noReset' 设置为 true,那么我们的测试可以工作,但是在运行 e2e 时应用程序不会更新,它也不会使用正在运行的版本。

Update: Full verbose output更新:完整详细 output

Full verbose output when running end to end tests https://gist.github.com/map7/9de70cb330d8864c58787a251d5ea128运行端到端测试时的完整详细 output https://gist.github.com/map7/954170cb330d5d1888

When starting the end to end tests I can see that it's loading my app three times.在开始端到端测试时,我可以看到它正在加载我的应用程序 3 次。 The first two times it's the correct version, the last time it runs the app it's the previous version and this is where it runs the tests.前两次是正确的版本,最后一次运行应用程序是以前的版本,这是运行测试的地方。

Try to run on the project root:尝试在项目根目录上运行:

rm -rf node_modules/ package-lock.json platforms/ hooks/
npm install

That will clean all the project cache.这将清除所有项目缓存。

At last, start again最后,重新开始

tns build android
npm run e2e -- --runType device.samsung

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM