Skip to main content

hermione-browser-version-changer

Overview

Use the hermione-browser-version-changer plugin to manage the definition of the browser version for tests.

Install

npm install -D hermione-browser-version-changer

Setup

Add the plugin to the plugins section of the testplane config:

module.exports = {
plugins: {
'hermione-browser-version-changer': {
enabled: true,
initStore: async () => {
return {
'70.1': ['title1', 'title2'],
'70.2': ['title3', 'title4']
};
}
browsers: {
chrome: {
'70.1': (test, ver, store) => store[ver].includes(test.title),
'70.2': (test, ver, store) => store[ver].includes(test.title)
}
}
},

// other Testplane plugins...
},

// other Testplane settings...
};

Description of configuration parameters

ParameterTypeDefault valueDescription
enabledBooleantrueEnable / disable the plugin.
initStoreFunctionnoopFunction for initializing the storage (store), which will be available in predicate.
browsersObjectN/AA list of browsers and their settings. See details below.

enabled

Enable or disable the plugin. By default: true.

initStore

Optional parameter. Function for initializing the storage (store), which will be available in predicate. The store can be used in predicate for any test to determine which version of the browser belongs to it. By default: _.noop from lodash.

The function can be asynchronous.

browsers

A list of browsers and their settings. It has the following format:

browsers: {
<browser-id>: {
<browser-version-1>: <predicate>,
<browser-version-2>: <predicate>,
// other browser versions...
},
// other browsers...
}

predicate(test, version, store)

A predicate function that receives the test instance (test), browser version (version) and a link to the storage (store). It should return true if the test fits the specified browser version, otherwise it should return false.

Passing parameters via the CLI

All plugin parameters that can be defined in the config can also be passed as command line options or through environment variables during Testplane startup. Use the prefix --browser-version-changer- for command line options and testplane_browser_version_changer_ for environment variables. For example:

npx testplane --browser-version-changer-enabled false
testplane_browser_version_changer_enabled=false npx testplane