如何使用 wdio appium 运行移动浏览器测试?

问题描述 投票:0回答:0

我正在尝试在 Android chrome 浏览器中为我的基于移动的 Web 应用程序运行基本测试,但出现以下错误。我错过了什么吗?

仅供参考,我正在将我的安卓设备连接到我的笔记本电脑以进行测试 USB调试也打开了。

TypeError: Cannot read properties of undefined (reading 'logLevels')
[0-0]     at remote (file:///C:/vyu_web_wdio/webdriverio-appium-v8/node_modules/webdriverio/build/index.js:28:38)
[0-0]     at exports.remote (C:\vyu_web_wdio\webdriverio-appium-v8\node_modules\webdriverio\build\cjs\index.js:81:12)
[0-0]     at async runTest (C:\vyu_web_wdio\webdriverio-appium-v8\src\test\specs\vyu_web.spec.js:4:21)

这是我的 wdio.conf.js 文件,


exports.config = {


    runner: 'local',
    
    port: 4723,
    specs: [
        './src/test/specs/**/vyu_web.spec.js'
    ],
    exclude: [
        // 'path/to/excluded/files'
    ],

    maxInstances: 10,
    
    capabilities: [
        {
            platformName: 'Android',
            "appium:platformVersion": '13',
            "appium:udid": 'R9HT508KYRE',
            "appium:automationName": 'UIAutomator2',
            browserName: 'chrome',
            acceptInsecureCerts: true // accepts all SSL certificates
        }
    ],
    
    logLevel: 'info',

    bail: 0,
    
    baseUrl: 'http://localhost',
    
    waitforTimeout: 12000,
    
    connectionRetryTimeout: 60000,
    
    connectionRetryCount: 3,
    
    services: ['appium', 'chromedriver'],
    
    framework: 'mocha',
    
    reporters: ['spec'],

    mochaOpts: {
        ui: 'bdd',
        timeout: 999999
    },
}

这是我的规格文件

describe('Android chrome browser test', () => {
    it('Should open google chrome in android and perform these steps', async () => {
        await browser.url("https://www.google.com")

        const input = await $('input[type="text"]')

        await input.setValue('Appium WDIO');

        await browser.keys('\uE007'); // Press Enter

        const title = await browser.getTitle();
        
        console.log('Page title:', title);
    })
})
javascript mocha.js webdriver-io appium-android
© www.soinside.com 2019 - 2024. All rights reserved.