【问题标题】:Unable to run my test locally using web driver io无法使用 Web 驱动程序 io 在本地运行我的测试
【发布时间】:2021-01-27 03:09:59
【问题描述】:

我正在使用这个框架https://github.com/labs42io/web-automation,我想在本地运行我的测试。为此,我在 config 文件夹下创建了一个 wdio.local.conf.js 并将以下值分配给 test:local 到 package json。 "test:local": "node ./node_modules/@wdio/cli/bin/wdio.js ./config/wdio.local.conf.js --spec"。

下面是我的 JSON 包

下面是我的 wdio.local.conf.js

//import { ENGINE_METHOD_DIGESTS } from "constants";

//const { TimelineService } = require('wdio-timeline-reporter/timeline-service');
exports.config = {
    runner: 'local',
    hostname: 'localhost',
    port: 4444,
    path: '/wd/hub',
    specs: ['./src/UI/features/*.feature'],
    maxInstances: 1,
    capabilities: [
        {
            maxInstances: 1,
            browserName: 'chrome',
        },

        // {
        //    maxInstances: 1,
        //     browserName: 'firefox',
        // }

        //{
        //maxInstances: 1,
        //browserName: 'MicrosoftEdge',
        // },//
        //{
        //maxInstances: 1,
        //browserName: 'safari',

        //},//


    ],
    logLevel: 'trace',
    outputDir: './test-report/output',
    bail: 0,
    baseUrl: 'http://localhost',
    waitforTimeout: 10000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    framework: 'cucumber',
    reporters: ['spec', [
        'cucumberjs-json', {
            jsonFolder: './report/cucumber/',
        }],
    ],
    cucumberOpts: {
        requireModule: [
            () => {
                require('ts-node').register({ transpileOnly: true });
            },
        ],
        require: ['./src/UI/steps/*.ts'],
        backtrace: false,
        compiler: [],
        dryRun: false,
        failFast: true,
        format: ['pretty'],
        colors: true,
        snippets: true,
        source: true,
        profile: [],
        strict: false,
        tags: [],
        timeout: 300000,
        ignoreUndefinedDefinitions: false,
        tagExpression: 'not @skip',
    },
    services: ['chromedriver'],
    //services:['selenium-standalone'],
    beforeSession() {
        require('expect-webdriverio').setOptions({ wait: 5000 });
    },
    before() {
        browser.maximizeWindow();
    },
    //afterStep(
    //uri: undefined,
    //feature: undefined,
    // scenario: { error: boolean },
    //) {
    //if (scenario.error) {
    // browser.takeScreenshot();
    //}
    //},//
};

但我无法运行如下所示的测试:

【问题讨论】:

标签: typescript docker testing selenium-chromedriver webdriver-io


【解决方案1】:

您必须设置为 path: '/' 才能像这样使用 wdio-chromedriver-service services: ['chromedriver']

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-10
    • 1970-01-01
    • 1970-01-01
    • 2021-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多