0

When a single test fails, it is reported out as two test failures because the next set's beforeAll fails for the reason of the prior test failing. Is this behavior caused by the Jasmine option expectationResultHandler or something else I can modify to get it to stop doing this?

// wdio conf, barely any tweaks from the default jasmine one
exports.config = {
    runner: 'local',
    specs: [
        './test/specs/**/*.js'
    ],
    exclude: [
        // 'path/to/excluded/files'
    ],
    suite: 'all',
    suites: {
        all: ['./test/specs/**/*.js'],
        api: ['./test/specs/**/*.api.js'],
        ui: ['./test/specs/**/*.ui.js'],
    },
    maxInstances: 1,
    capabilities: [{
        maxInstances: 5,
        browserName: 'chrome',
        acceptInsecureCerts: true,
        'goog:chromeOptions': {
            args: ['--headless', '--disable-gpu'],
        }
    }],
    // Level of logging verbosity: trace | debug | info | warn | error | silent
    logLevel: 'silent',
    bail: 0,
    baseUrl: 'https://example.com',
    waitforTimeout: 10000,
    connectionRetryTimeout: 120000,
    connectionRetryCount: 3,
    services: ['chromedriver'],
    framework: 'jasmine',
    reporters: ['spec'],
    jasmineNodeOpts: {
        defaultTimeoutInterval: 60000,
        expectationResultHandler: function (passed, assertion) {
            // do something
        }
    },
    waitforTimeout: 5000,
}

Example output with the problem:

[chrome version mac os x #0-0] 18 passing (15.8s)
[chrome version mac os x #0-0] 2 failing
[chrome version mac os x #0-0]
[chrome version mac os x #0-0] 1) Page Layout has the correct search results table headings
[chrome version mac os x #0-0] Expected 'DOB' to equal 'Clear'.
[chrome version mac os x #0-0] Error: Expected 'DOB' to equal 'Clear'.
[chrome version mac os x #0-0]     at <Jasmine>
[chrome version mac os x #0-0]     at <Jasmine>
[chrome version mac os x #0-0]     at UserContext.<anonymous> (path)
[chrome version mac os x #0-0] Expected 'DOB' to equal 'Clear'.
[chrome version mac os x #0-0] error properties: Object({ matcherName: 'toEqual', passed: false, expected: 'Clear', actual: 'DOB' })
[chrome version mac os x #0-0] Error: Expected 'DOB' to equal 'Clear'.
[chrome version mac os x #0-0]     at <Jasmine>
[chrome version mac os x #0-0]     at <Jasmine>
[chrome version mac os x #0-0]     at UserContext.<anonymous> (path)
[chrome version mac os x #0-0]
[chrome version mac os x #0-0] 2) Recent Things "before all" hook
[chrome version mac os x #0-0] Expected 'DOB' to equal 'Clear'.

A single assert failed, it got recorded twice for its it and then the next beforeAll "failed" because of the problem

ItsASine
  • 141
  • 3
  • 12

0 Answers0