Manual linking together of -wd
and -core
:
import initTestium from 'testium-core';
import createDriver from 'testium-driver-wd';
import {test} from 'tap';
test('my test', async t => {
let b = await initTestium().then(createDriver);
await b.navigateTo('/foo');
t.equal(await b.getTitle(), 'Hello World', 'shows the right title');
});
Same, but -sync
instead of -wd
:
import initTestium from 'testium-core';
import createDriver from 'testium-driver-sync';
import {test} from 'tap';
test('my test', async t => {
let b = await initTestium().then(createDriver);
b.navigateTo('/foo');
t.equal(b.getTitle(), 'Hello World');
});
Using -mocha
and explict driver library:
import injectBrowser from 'testium-mocha';
import createDriver from 'testium-driver-sync';
import assert from 'assertive';
describe('my feature', () => {
before(injectBrowser({ driver: createDriver }));
before(() => {
this.browser.navigateTo('/foo');
});
it('shows the right title', () => {
assert.equal('Hello World', this.browser.getTitle());
});
});
Using -mocha
and automatic driver loading:
import injectBrowser from 'testium-mocha';
import assert from 'assertive';
describe('my feature', () => {
before(injectBrowser({ driver: 'sync' }));
before(() => {
this.browser.navigateTo('/foo');
});
it('shows the right title', () => {
assert.equal('Hello World', this.browser.getTitle());
});
});
Using -tap
and automatic driver loading:
import test from 'testium-tap';
test('my feature', { driver: 'wd' }, async (t, browser) => {
await browser.navigateTo('/foo');
t.equal(await b.getTitle(), 'Hello World', 'shows the right title');
});