WebdriverIO Jasmine Framework Adapter (Legacy)
This package, `wdio-jasmine-framework`, is an **abandoned** framework adapter for older versions of WebdriverIO, specifically designed for WebdriverIO v3 or v4. Its last update was 7 years ago, with version 0.3.8. It integrates the Jasmine testing framework with the WebdriverIO test runner, allowing users to write end-to-end tests using Jasmine's BDD syntax. Unlike its modern counterpart, `@wdio/jasmine-framework`, this package is not compatible with current WebdriverIO versions (v7, v8, v9) due to significant architectural changes and dependency updates within the WebdriverIO ecosystem. Its primary function was to enable Jasmine `describe`, `it`, and `expect` syntax within WebdriverIO test files, along with configuration options like `defaultTimeoutInterval` and `expectationResultHandler` via `wdio.conf.js`. Users requiring Jasmine integration with modern WebdriverIO should use the actively maintained `@wdio/jasmine-framework` package.
Common errors
-
Error: Cannot find module 'wdio-jasmine-framework'
cause The package `wdio-jasmine-framework` is not installed or the `framework` option in `wdio.conf.js` points to the wrong module.fixIf trying to use a modern WebdriverIO setup, you should install and use the current adapter: `npm install @wdio/jasmine-framework --save-dev`. Then, update your `wdio.conf.js` to `framework: '@wdio/jasmine-framework'`. If intentionally targeting a very old WebdriverIO version, ensure `npm install wdio-jasmine-framework --save-dev` was run successfully. -
DEPRECATION: Calling `fail` with an error message of type `Error` is deprecated. Pass a string instead.
cause The `wdio-jasmine-framework` package uses outdated Jasmine APIs that generate deprecation warnings with newer Jasmine versions, even if those versions are compatible with this adapter.fixThis specific warning cannot be fixed within `wdio-jasmine-framework` itself as it's an abandoned package. The only true fix is to migrate to the actively maintained `@wdio/jasmine-framework` package, which is compatible with current Jasmine versions. -
Error: Given framework 'jasmine' was not found! Do you have the corresponding WDIO adapter installed?
cause WebdriverIO cannot find the installed Jasmine framework adapter. This typically happens when using a newer WebdriverIO CLI which expects scoped packages (like `@wdio/jasmine-framework`) but an old `wdio-jasmine-framework` is present, or no adapter is installed.fixEnsure you have the correct, modern Jasmine adapter installed: `npm install @wdio/jasmine-framework --save-dev`. Then, configure `framework: '@wdio/jasmine-framework'` in your `wdio.conf.js`. If you're using an extremely old WebdriverIO version, ensure `wdio-jasmine-framework` is installed and the `framework` name is 'jasmine'.
Warnings
- breaking This `wdio-jasmine-framework` package (version 0.3.8, last updated 7 years ago) is completely abandoned and incompatible with modern WebdriverIO versions (v5, v6, v7, v8, v9). Attempting to use it with recent WebdriverIO installations will lead to errors and unexpected behavior.
- deprecated The `wdio-jasmine-framework` package uses deprecated Jasmine functions, leading to warnings in test reports. This indicates its outdated nature and lack of alignment with current Jasmine best practices.
- gotcha Due to its age, this package lacks support for modern JavaScript features (e.g., async/await natively in tests without transpilation) and TypeScript. Using it in a modern development environment will require extensive polyfills or older Babel/TypeScript configurations, which is not recommended. WebdriverIO v7 and later have a strong focus on TypeScript support.
- gotcha Security vulnerabilities are likely present in this abandoned package and its old dependencies, as it has not received updates for over seven years. Using it in production or sensitive environments poses a significant security risk.
Install
-
npm install wdio-jasmine-framework -
yarn add wdio-jasmine-framework -
pnpm add wdio-jasmine-framework
Imports
- Framework Configuration
import { jasmine } from 'wdio-jasmine-framework';// wdio.conf.js module.exports = { // ... framework: 'jasmine', // ... }; - Global browser object
describe('My test suite', () => { it('should navigate to a page', async () => { await browser.url('https://example.com'); await expect(browser).toHaveTitle('Example Domain'); }); }); - jasmineNodeOpts
// wdio.conf.js module.exports = { // ... jasmineNodeOpts: { defaultTimeoutInterval: 60000, expectationResultHandler: function(passed, assertion) { if (!passed) { console.log(`Assertion failed: ${assertion.message}`); // Example: browser.saveScreenshot(`./screenshots/${assertion.fullName}.png`); } } } // ... };
Quickstart
/* wdio.conf.js */
const path = require('path');
exports.config = {
runner: 'local',
specs: [
'./test/specs/**/*.js'
],
exclude: [],
maxInstances: 1,
capabilities: [{
maxInstances: 1,
browserName: 'chrome'
}],
logLevel: 'info',
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
services: [],
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000, // Extend timeout for example tests
expectationResultHandler: function(passed, assertion) {
if (!passed) {
console.error(`Jasmine Assertion Failed: ${assertion.message} - ${assertion.fullName}`);
// In a real scenario, you might take a screenshot here
// browser.saveScreenshot(`./error_screenshots/${assertion.fullName}.png`);
}
}
},
reporters: ['spec'],
compilerOptions: {
module: 'commonjs',
target: 'es5'
},
autoCompile: true,
};
/* test/specs/example.js */
describe('Example WebdriverIO with Jasmine', () => {
it('should have the correct title', async () => {
await browser.url('https://webdriver.io');
await expect(browser).toHaveTitle('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');
});
it('should find an element by text', async () => {
await browser.url('https://webdriver.io');
const gettingStartedLink = await $('[href="/docs/gettingstarted"]');
await expect(gettingStartedLink).toBePresent();
await expect(gettingStartedLink).toHaveTextContaining('Getting Started');
});
});