karma-runner / karma-runner/karma

Webdriver integration for integration/e2e tests

Open
#413 19 comments 2 reactions 0 assignees View on GitHub
discuss needs: investigation
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.