A WebdriverIO plugin adapter that integrates Jasmine testing framework with WebdriverIO test runner for end-to-end testing.
npx @tessl/cli install tessl/npm-wdio--jasmine-framework@9.19.0A WebdriverIO plugin that provides adapter functionality for integrating the Jasmine testing framework with WebdriverIO test runner. This adapter enables end-to-end testing using Jasmine's familiar describe/it syntax and assertion methods within WebdriverIO environments.
npm install @wdio/jasmine-framework --save-devimport JasmineAdapterFactory, { JasmineAdapter } from "@wdio/jasmine-framework";For CommonJS:
const JasmineAdapterFactory = require("@wdio/jasmine-framework").default;
const { JasmineAdapter } = require("@wdio/jasmine-framework");The adapter is typically configured through WebdriverIO configuration rather than direct instantiation:
// wdio.conf.js
export const config = {
framework: 'jasmine',
jasmineOpts: {
defaultTimeoutInterval: 10000,
expectationResultHandler: (passed, data) => {
// Handle assertion results
if (!passed) {
console.log('Assertion failed:', data.message);
}
}
}
};Direct adapter usage (advanced):
import JasmineAdapterFactory from "@wdio/jasmine-framework";
import type { EventEmitter } from "node:events";
const adapter = await JasmineAdapterFactory.init(
'worker-id',
config,
specFiles,
capabilities,
reporter
);
const exitCode = await adapter.run();The WDIO Jasmine Framework is built around several key components:
Factory for creating and initializing JasmineAdapter instances. Provides the main entry point for WebdriverIO test runner integration.
declare const adapterFactory: {
init?: (
cid: string,
config: WebdriverIOJasmineConfig,
specs: string[],
capabilities: Capabilities.ResolvedTestrunnerCapabilities,
reporter: EventEmitter
) => Promise<JasmineAdapter>;
};
export default adapterFactory;
export { JasmineAdapter, adapterFactory };Comprehensive configuration options for customizing Jasmine behavior within WebdriverIO environments, including timeouts, filtering, and custom handlers.
interface JasmineOpts {
defaultTimeoutInterval?: number;
helpers?: string[];
requires?: string[];
random?: boolean;
seed?: Function;
failFast?: boolean;
failSpecWithNoExpectations?: boolean;
oneFailurePerSpec?: boolean;
specFilter?: () => boolean;
grep?: string | RegExp;
invertGrep?: boolean;
cleanStack?: boolean;
stopOnSpecFailure?: boolean;
stopSpecOnExpectationFailure?: boolean;
expectationResultHandler?: (passed: boolean, data: ResultHandlerPayload) => void;
}interface WebdriverIOJasmineConfig extends Omit<WebdriverIO.Config, keyof HooksArray>, HooksArray {
jasmineOpts: Omit<JasmineOpts, 'cleanStack'>;
}
interface ResultHandlerPayload {
passed: boolean;
message?: string;
error?: Error;
}
type HooksArray = {
[K in keyof Required<Services.HookFunctions>]: Required<Services.HookFunctions>[K][];
}