作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想设置的进程自动化测试适用于 Android 和 iOS 平台的移动应用程序(React Native)。为此,我使用 Appium和 WebdriverIO .例如,我使用现有的 appium-boilerplate代码库和现成的application用于运行测试。我在 中运行应用程序安卓模拟器 .基本设置如下所示。
1.阿皮亚
2. WebdriverIO
wdio.shared.conf.js
exports.config = {
// ====================
// Runner and framework
// Configuration
// ====================
runner: 'local',
framework: 'jasmine',
jasmineNodeOpts: {
// Updated the timeout to 30 seconds due to possible longer appium calls
// When using XPATH
defaultTimeoutInterval: 90000,
helpers: [require.resolve('@babel/register')],
},
sync: true,
logLevel: 'silent',
deprecationWarnings: true,
bail: 0,
baseUrl: 'http://the-internet.herokuapp.com',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
reporters: ['spec'],
// ====================
// Appium Configuration
// ====================
services: [
[
'appium',
{
// For options see
// https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-appium-service
args: {
// Auto download ChromeDriver
relaxedSecurity: true,
// chromedriverAutodownload: true,
// For more arguments see
// https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-appium-service
},
command: 'appium',
},
],
],
port: 4723,
};
wdio.android.app.conf.js。
const { join } = require('path');
const { config } = require('./wdio.shared.conf');
// ============
// Specs
// ============
config.specs = [
'./tests/specs/**/app*.spec.js',
];
// ============
// Capabilities
// ============
// For all capabilities please check
// http://appium.io/docs/en/writing-running-appium/caps/#general-capabilities
config.capabilities = [
{
// The defaults you need to have in your config
platformName: 'Android',
maxInstances: 1,
// For W3C the appium capabilities need to have an extension prefix
// http://appium.io/docs/en/writing-running-appium/caps/
// This is `appium:` for all Appium Capabilities which can be found here
'appium:udid': 'emulator-5554',
'appium:deviceName': 'Android SDK build for x86_64',
'appium:platformVersion': '10.0',
'appium:orientation': 'PORTRAIT',
// `automationName` will be mandatory, see
// https://github.com/appium/appium/releases/tag/v1.13.0
'appium:automationName': 'Appium',
// The path to the app
'appium:app': join(process.cwd(), './apps/Android-NativeDemoApp-0.2.1.apk'),
// Read the reset strategies very well, they differ per platform, see
// http://appium.io/docs/en/writing-running-appium/other/reset-strategies/
'appium:noReset': true,
'appium:newCommandTimeout': 240,
},
];
exports.config = config;
3. 步骤
npm run android.app
.之后,测试用例在后台执行,但是
模拟器中没有任何 react 在终端中我看到消息
[HTTP] No route found for /session
最佳答案
我们能够通过覆盖 path
来解决此问题。 wdio.conf.js 中的变量:
...
path: '/wd/hub',
port: 4723,
services: ['appium'],
...
如果没有定义路径,它显然默认为
/session
如您所见,它以 404 失败。
关于android - 使用 Appium 和 WebdriverIO 测试移动应用程序 : "No route found for/session",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67458824/
我是一名优秀的程序员,十分优秀!