Use multiple browser providers as one.
const Multi = require('airtap-multi')
const multi = new Multi()
multi.add('airtap-playwright')
multi.add('airtap-sauce')
// Get manifests with name 'firefox'
const manifests = await multi.manifests([{
name: 'firefox'
}])
// Only from the airtap-sauce provider
const manifests = await multi.manifests([{
name: 'firefox',
provider: 'airtap-sauce'
}])
// Instantiate a browser (see browser-provider for details)
const browser = multi.browser(manifest, target)
Implements the browser-provider
interface with a few additional methods.
Add a provider that's been installed in a nearby node_modules
. The optional options
object will be passed to the provider's constructor.
Add multiple providers in the form of { [id]: options }
:
multi.add({
'airtap-sauce': {
username: 'example',
key: 'secret'
}
})
If the second options
argument is provided, those options will be deeply merged into the options of each provider.
Add a provider as a constructor function.
Add multiple providers using an array, where each array element is of the above types (string, object or function).
Get an added provider by its id.
for (const [id, provider] of multi) {
// ..
}
for (const id of multi.keys()) {
// ..
}
for (const provider of multi.values()) {
// ..
}
With npm do:
npm install airtap-multi
MIT © 2020-present Airtap contributors