Сбой подключения пусковой установки на подготовительный круг CI - PullRequest
0 голосов
/ 18 января 2019

Я пытаюсь запустить набор тестов на Circle CI, используя Sauce Labs. Конфигурация работала в прошлом, но около месяца назад она начала выходить из строя. Когда я запускаю wdio.conf локально, все работает нормально, но когда он запускается как часть рабочего процесса CircleCI, я получаю сообщение об ошибке ниже.

Конфигурация wdio довольно проста:

exports.config = {
    specs: getTargetFeatureFiles(specFilePattern),
    cucumberOpts: {
        require: ['./test/uitest/step_definitions/**/*.js'],
        compiler: [`js:${compilerPath}`],
        ignoreUndefinedDefinitions: false,
        timeout: 120000,
        backtrace: true,
        tagExpression: 'not @norun',
        format: ['pretty'],
        strict: true,
    },
    exclude: [
        // 'path/to/excluded/files'
    ],
    maxInstances: 1,
    capabilities: [
        {
            maxInstances: 1,
            browserName: 'chrome',
            version: '68.0',
            platform: 'Windows 10',
        },
        {
            maxInstances: 1,
            browserName: 'firefox',
            platform: 'Linux',
            version: '45.0',
        },
    ],
    sync: true,
    logLevel: 'error',
    coloredLogs: true,
    deprecationWarnings: true,
    bail: 0,
    screenshotPath: `./auto-tests/errorShots/${dateString}`,
    baseUrl: process.env.WEB_SERVER || 'http://localhost:8080',
    host: process.env.HUB_HOST || 'localhost',
    waitForTimeout: WAIT_TIMEOUT_MS,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    services: ['visual-regression', 'sauce'],
    user: process.env.SAUCE_USERNAME,
    key: process.env.SAUCE_ACCESS_KEY,
    sauceConnect: true,
    seleniumLogs: './auto-tests/logs/',
    // Array of arguments for the Selenium server, passed directly to child_process.spawn.
    seleniumArgs: {
        javaArgs: getJavaArgs(),
    },
    visualRegression: {
        compare: new VisualRegressionCompare.LocalCompare({
            referenceName: context => {
                const referenceName = getScreenshotName(
                    './test/uitest/features/support/screenshots/reference',
                    context
                )
                if (process.env.FAIL_WHEN_NO_REFERENCE_IMAGE === '1') {
                    if (!fs.existsSync(referenceName)) {
                        return 'test/uitest/features/support/screenshots/reference/Reference-image-not-found.png'
                    }
                }
                return referenceName
            },
            screenshotName: getScreenshotName.bind(
                null,
                './auto-tests/screenshots/latest'
            ),
            diffName: getScreenshotName.bind(null, './auto-tests/screenshots/diff'),
            misMatchTolerance: BASE_SCREENSHOT_TOLERANCE,
        }),
        viewports,
    },
    framework: 'cucumber',
    reporters: ['spec'],
    reporterOptions: {
        outputDir: './auto-tests/reports',
    },
    afterTest: function (test) {
        // if test passed, ignore, else take and save screenshot.
        if (test.passed) {
            return
        }
        // get current test title and clean it, to use it as file name
        const filename = encodeURIComponent(test.title.replace(/\s+/g, '-'))
        // build file path
        const filePath = this.screenshotPath + filename + '.png'
        // save screenshot
        browser.saveScreenshot(filePath)
        console.log('\n\tScreenshot location:', filePath, '\n')
    },
    beforeFeature: function (feature) {
        browser.timeouts('implicit', implicitWaitTimeout)
        if (!global.cucumber) {
            global.cucumber = {}
        }
        global.cucumber.feature = feature
        browser.call(function () {
            return resetToDefautMappings()
        })
    },
    beforeScenario: function (scenario) {
        global.cucumber.scenario = scenario
    },
    beforeStep: function (step) {
        global.cucumber.step = step
    },}
A service failed in the 'onPrepare' hook
Error: spawn /root/project/node_modules/sauce-connect-launcher/sc/sc-4.5.3-linux/bin/sc ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Continue...
ERROR: connect ECONNREFUSED 127.0.0.1:4445
chrome.71.windows10
    at new RuntimeError (/root/project/node_modules/webdriverio/build/lib/utils/ErrorHandler.js:143:12)
    at Request._callback (/root/project/node_modules/webdriverio/build/lib/utils/RequestHandler.js:330:43)
    at self.callback (/root/project/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at Request.onRequestError (/root/project/node_modules/request/request.js:881:8)
    at ClientRequest.emit (events.js:187:15)
    at ClientRequest.EventEmitter.emit (domain.js:442:20)
    at Socket.socketErrorListener (_http_client.js:391:9)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:442:20)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    ```
...