diff --git a/coverage/coverage.json b/coverage/coverage.json index 6efc56d..e1c957d 100644 --- a/coverage/coverage.json +++ b/coverage/coverage.json @@ -1 +1 @@ -{"/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js":{"b":{},"branchMap":{},"code":["(function () { (function($){","\t$(function(){","\t\t$('h1').click(function(){","\t\t\t$('body').append('
(function () { (function($){
$(function(){
- $('h1').click(function(){
- $('body').append('<div>added through jquery</div>');
+ $('a').click(function(){
+ $('body').append('<div id="jQueryAddedDiv">added through jquery</div>');
})
});
})(jQuery);
@@ -245,7 +245,7 @@
diff --git a/coverage/lcov.info b/coverage/lcov.info
index 2a06445..8ed3b87 100644
--- a/coverage/lcov.info
+++ b/coverage/lcov.info
@@ -4,16 +4,16 @@ FN:1,(anonymous_1)
FN:2,(anonymous_2)
FN:3,(anonymous_3)
FNF:3
-FNH:2
+FNH:3
FNDA:1,(anonymous_1)
FNDA:1,(anonymous_2)
-FNDA:0,(anonymous_3)
+FNDA:1,(anonymous_3)
DA:1,1
DA:2,1
DA:3,1
-DA:4,0
+DA:4,1
LF:4
-LH:3
+LH:4
BRF:0
BRH:0
end_of_record
diff --git a/specs/test-spec.js b/specs/test-spec.js
index 1713487..d95892b 100644
--- a/specs/test-spec.js
+++ b/specs/test-spec.js
@@ -1,16 +1,28 @@
var webdriver = require('selenium-webdriver');
var fs = require('fs');
+jasmine.getEnv().addReporter(new jasmine.ConsoleReporter(console.log));
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
-describe('basic test', function () {
- it('should be on correct page', function (done) {
+describe('Main page', function () {
+ it('should have title of Test Title', function (done) {
driver.get('http://localhost:9001/');
driver.getTitle().then(function(title) {
expect(title).toBe('Test Title');
});
+ done();
+ });
+ it('should show extra div when clicking on link', function (done) {
+ driver.findElement(webdriver.By.id('clicker')).click();
+ driver.findElement(webdriver.By.id('jQueryAddedDiv')).then(function(element){
+ element.getText().then(function(div_text){
+ expect(div_text).toBe('added through jquery');
+ done();
+ });
+ });
+
driver.switchTo().defaultContent();
driver.executeScript("return window.__coverage__;").then(function (obj) {
fs.writeFile('coverage/coverage.json', JSON.stringify(obj));
diff --git a/src/index.html b/src/index.html
index ec03721..ba889dd 100644
--- a/src/index.html
+++ b/src/index.html
@@ -4,6 +4,7 @@
On page load value
+ add div
diff --git a/src/js/main-instrumented.js b/src/js/main-instrumented.js
index 5a24b23..a38b178 100644
--- a/src/js/main-instrumented.js
+++ b/src/js/main-instrumented.js
@@ -3,7 +3,7 @@ var __cov_Hq55tQjQYx3tAA6SCTbFyg = (Function('return this'))();
if (!__cov_Hq55tQjQYx3tAA6SCTbFyg.__coverage__) { __cov_Hq55tQjQYx3tAA6SCTbFyg.__coverage__ = {}; }
__cov_Hq55tQjQYx3tAA6SCTbFyg = __cov_Hq55tQjQYx3tAA6SCTbFyg.__coverage__;
if (!(__cov_Hq55tQjQYx3tAA6SCTbFyg['/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js'])) {
- __cov_Hq55tQjQYx3tAA6SCTbFyg['/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js'] = {"path":"/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js","s":{"1":0,"2":0,"3":0,"4":0},"b":{},"f":{"1":0,"2":0,"3":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}},"2":{"name":"(anonymous_2)","line":2,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":13}}},"3":{"name":"(anonymous_3)","line":3,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":26}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":7,"column":11}},"2":{"start":{"line":2,"column":1},"end":{"line":6,"column":4}},"3":{"start":{"line":3,"column":2},"end":{"line":6,"column":1}},"4":{"start":{"line":4,"column":3},"end":{"line":4,"column":55}}},"branchMap":{},"code":["(function () { (function($){","\t$(function(){","\t\t$('h1').click(function(){","\t\t\t$('body').append('added through jquery');","\t\t})","\t});","})(jQuery);","}());"]};
+ __cov_Hq55tQjQYx3tAA6SCTbFyg['/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js'] = {"path":"/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js","s":{"1":0,"2":0,"3":0,"4":0},"b":{},"f":{"1":0,"2":0,"3":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}},"2":{"name":"(anonymous_2)","line":2,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":13}}},"3":{"name":"(anonymous_3)","line":3,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":25}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":7,"column":11}},"2":{"start":{"line":2,"column":1},"end":{"line":6,"column":4}},"3":{"start":{"line":3,"column":2},"end":{"line":6,"column":1}},"4":{"start":{"line":4,"column":3},"end":{"line":4,"column":75}}},"branchMap":{},"code":["(function () { (function($){","\t$(function(){","\t\t$('a').click(function(){","\t\t\t$('body').append('added through jquery');","\t\t})","\t});","})(jQuery);","}());"]};
}
__cov_Hq55tQjQYx3tAA6SCTbFyg = __cov_Hq55tQjQYx3tAA6SCTbFyg['/Users/matt.huntington/Documents/Sites/e2e-with-coverage/src/js/main.js'];
-__cov_Hq55tQjQYx3tAA6SCTbFyg.s['1']++;(function($){__cov_Hq55tQjQYx3tAA6SCTbFyg.f['1']++;__cov_Hq55tQjQYx3tAA6SCTbFyg.s['2']++;$(function(){__cov_Hq55tQjQYx3tAA6SCTbFyg.f['2']++;__cov_Hq55tQjQYx3tAA6SCTbFyg.s['3']++;$('h1').click(function(){__cov_Hq55tQjQYx3tAA6SCTbFyg.f['3']++;__cov_Hq55tQjQYx3tAA6SCTbFyg.s['4']++;$('body').append('added through jquery');});});}(jQuery));
+__cov_Hq55tQjQYx3tAA6SCTbFyg.s['1']++;(function($){__cov_Hq55tQjQYx3tAA6SCTbFyg.f['1']++;__cov_Hq55tQjQYx3tAA6SCTbFyg.s['2']++;$(function(){__cov_Hq55tQjQYx3tAA6SCTbFyg.f['2']++;__cov_Hq55tQjQYx3tAA6SCTbFyg.s['3']++;$('a').click(function(){__cov_Hq55tQjQYx3tAA6SCTbFyg.f['3']++;__cov_Hq55tQjQYx3tAA6SCTbFyg.s['4']++;$('body').append('added through jquery');});});}(jQuery));
diff --git a/src/js/main.js b/src/js/main.js
index 9ed01fd..acd0405 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -1,7 +1,7 @@
(function($){
$(function(){
- $('h1').click(function(){
- $('body').append('added through jquery');
- })
+ $('a').click(function(){
+ $('body').append('added through jquery');
+ });
});
})(jQuery);
\ No newline at end of file