cybernaut
Version:
Reliable, automated web UI testing in BDD-style.
30 lines • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const createDebug = require("debug");
const selenium_webdriver_1 = require("selenium-webdriver");
const test_context_1 = require("../core/test-context");
const debug = createDebug('cybernaut:test');
function run(implementation, logger, config) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { capabilities, timeouts } = config;
debug('Create the browser session');
const driver = yield new selenium_webdriver_1.Builder().withCapabilities(capabilities).build();
try {
debug('Manage the timeout behavior');
yield driver.manage().setTimeouts({
implicit: timeouts.element,
pageLoad: timeouts.page,
script: timeouts.script
});
debug('Run the test implementation');
yield implementation(new test_context_1.TestContext(driver, logger, config), config);
}
finally {
debug('Terminate the browser session');
yield driver.quit();
}
});
}
exports.run = run;
//# sourceMappingURL=test.js.map