npm.io
10.2.0 • Published 2 weeks ago

@wdio/jasmine-framework

Licence
MIT
Version
10.2.0
Deps
7
Size
59 kB
Vulns
0
Weekly
0
Stars
9.9K

WDIO Jasmine Framework Adapter

A WebdriverIO plugin. Adapter for Jasmine testing framework.

Installation

The easiest way is to keep @wdio/jasmine-framework as a devDependency in your package.json, via:

npm install @wdio/jasmine-framework --save-dev

Instructions on how to install WebdriverIO can be found here.

Configuration

Following code shows the default wdio test runner configuration...

// wdio.conf.ts
export const config = {
    // ...
    framework: 'jasmine',
    jasmineOpts: {
        defaultTimeoutInterval: 60000
    },
    // ...
}

Assertions

The global expect combines Jasmine's matchers and the WebdriverIO matchers. Jasmine's sync matchers and the matchers of jasmine.addMatchers return undefined. WebdriverIO matchers, Jasmine's async matchers and the matchers of jasmine.addAsyncMatchers return a promise, so await them:

expect([1, 2]).toHaveSize(2)                                   // Jasmine, sync
await expect($('#logo')).toHaveSize({ width: 32, height: 32 }) // WebdriverIO, async

For TypeScript, add jasmine to types in your tsconfig.json:

{
    "compilerOptions": {
        "types": ["node", "jasmine", "@wdio/globals/types", "@wdio/jasmine-framework"]
    }
}

See Using Jasmine for the details.

jasmineOpts Options

defaultTimeoutInterval
expectationResultHandler
grep
invertGrep
cleanStack
random
stopOnSpecFailure
oneFailurePerSpec
failSpecWithNoExpectations
specFilter
requires
helpers
----

For more information on WebdriverIO see the homepage.

Keywords