karma-runner / karma-runner/karma
Webdriver integration for integration/e2e tests
- Dominant language
- JavaScript
- Stars
- 12k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
So I have been thinking about this for quite a while now and want to get some more input if this is a good idea to integrate into Karma.
The idea is to integrate the webdriver protocol into Karma in a way that you can run integration tests as easily as you run your unit tests through Karma right now.
Here is a little example of what I imagine:
``` js
// karma.conf.js
browsers = ['chrome', 'firefox'];
files = [
{ pattern: 'tests/e2e/webdriver_test.js', webdriver: true}
];
```
``` js
// webdriver_test.js
var assert = require('assert');
// This gives you the browser that is currently run
// Initialization and connection is all done by Karma
var browser = karma.getBrowser();
browser.on('status', function(info) {
console.log(info);
});
browser.on('command', function(meth, path, data) {
console.log(' > ' + meth, path, data || '');
});
browser.on('ready', function() {
browser.get("http://admc.io/wd/test-pages/guinea-pig.html", function() {
browser.title(function(err, title) {
assert.ok(~title.indexOf('I am a page title - Sauce Labs'), 'Wrong title!');
browser.elementById('i am a link', function(err, el) {
browser.clickElement(el, function() {
browser.eval("window.location.href", function(err, href) {
assert.ok(~href.indexOf('guinea-pig2'));
browser.quit();
});
});
});
});
});
});
```
Contributor guide
Assessment
This issue has not been assessed yet.