forked from bluesmoon/boomerang
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Errors: Send during onload if autorun=false
- Loading branch information
Showing
10 changed files
with
343 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<%= header %> | ||
<%= boomerangScript %> | ||
<!-- | ||
For this test, we'll turn autorun off and trigger an error. | ||
We should see an error beacon be sent, even if no page load beacon is sent. | ||
--> | ||
<script src="23-autorun-false.js" type="text/javascript"></script> | ||
<script> | ||
BOOMR_test.init({ | ||
testAfterOnBeacon: true, | ||
Errors: { | ||
enabled: true | ||
}, | ||
autorun: false | ||
}); | ||
|
||
var a = badFunction(); | ||
</script> | ||
<%= footer %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*eslint-env mocha*/ | ||
/*global BOOMR_test,assert,describe,it*/ | ||
|
||
describe("e2e/14-errors/23-autorun-false", function() { | ||
var tf = BOOMR.plugins.TestFramework; | ||
var t = BOOMR_test; | ||
var C = BOOMR.utils.Compression; | ||
|
||
it("Should have sent one beacon", function(done) { | ||
this.timeout(10000); | ||
t.ensureBeaconCount(done, 1); | ||
}); | ||
|
||
it("Should have http.initiator = error", function() { | ||
var b = tf.lastBeacon(); | ||
assert.equal(b["http.initiator"], "error"); | ||
}); | ||
|
||
it("Should have put err on the beacon", function() { | ||
var b = tf.lastBeacon(); | ||
assert.isDefined(b.err); | ||
}); | ||
|
||
it("Should have an error count = 1", function() { | ||
var b = tf.lastBeacon(); | ||
var err = BOOMR.plugins.Errors.decompressErrors(C.jsUrlDecompress(b.err))[0]; | ||
assert.equal(err.count, 1); | ||
}); | ||
|
||
it("Should have an error coming from the html page", function() { | ||
var b = tf.lastBeacon(); | ||
var err = BOOMR.plugins.Errors.decompressErrors(C.jsUrlDecompress(b.err))[0]; | ||
|
||
if (err.fileName) { | ||
assert.include(err.fileName, "23-autorun-false.html"); | ||
} | ||
|
||
if (err.functionName) { | ||
assert.include(err.functionName, "badFunction"); | ||
} | ||
}); | ||
|
||
it("Should have rt.end", function() { | ||
var b = tf.lastBeacon(); | ||
assert.isDefined(b["rt.end"]); | ||
}); | ||
|
||
it("Should have rt.sl = 0", function() { | ||
var b = tf.lastBeacon(); | ||
assert.equal(b["rt.sl"], 0); | ||
}); | ||
|
||
it("Should have rt.tstart", function() { | ||
var b = tf.lastBeacon(); | ||
assert.isDefined(b["rt.tstart"]); | ||
}); | ||
|
||
it("Should have rt.start = manual", function() { | ||
var b = tf.lastBeacon(); | ||
assert.equal(b["rt.start"], "manual"); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
tests/page-templates/14-errors/24-autorun-false-multiple-then-load.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<%= header %> | ||
<%= boomerangScriptMin %> | ||
<!-- | ||
For this test, we'll turn autorun off and trigger an two errors, wait, then call | ||
BOOMR.page_ready() so the real beacon is sent. | ||
We should see an error beacon be sent, then the page load beacon later. | ||
--> | ||
<script src="24-autorun-false-multiple-then-load.js" type="text/javascript"></script> | ||
<script> | ||
BOOMR_test.init({ | ||
testAfterOnBeacon: 2, | ||
Errors: { | ||
enabled: true | ||
}, | ||
autorun: false | ||
}); | ||
|
||
setTimeout(function() { | ||
// wait until after the error beacon is sent | ||
BOOMR.page_ready(); | ||
}, 5000); | ||
|
||
var a = badFunction(); | ||
</script> | ||
<script> | ||
var b = badFunction2(); | ||
</script> | ||
<%= footer %> |
94 changes: 94 additions & 0 deletions
94
tests/page-templates/14-errors/24-autorun-false-multiple-then-load.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/*eslint-env mocha*/ | ||
/*global BOOMR_test,assert,describe,it*/ | ||
|
||
describe("e2e/14-errors/24-autorun-false-multiple-then-load", function() { | ||
var tf = BOOMR.plugins.TestFramework; | ||
var t = BOOMR_test; | ||
var C = BOOMR.utils.Compression; | ||
|
||
it("Should have sent two beacons", function(done) { | ||
this.timeout(10000); | ||
t.ensureBeaconCount(done, 2); | ||
}); | ||
|
||
it("Should have http.initiator = error on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
assert.equal(b["http.initiator"], "error"); | ||
}); | ||
|
||
it("Should have put err on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
assert.isDefined(b.err); | ||
}); | ||
|
||
it("Should have two errors on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
var errs = BOOMR.plugins.Errors.decompressErrors(C.jsUrlDecompress(b.err)); | ||
assert.equal(errs.length, 2); | ||
}); | ||
|
||
it("Should have an error count = 1 on the first beacon first error", function() { | ||
var b = tf.beacons[0]; | ||
var err = BOOMR.plugins.Errors.decompressErrors(C.jsUrlDecompress(b.err))[0]; | ||
assert.equal(err.count, 1); | ||
}); | ||
|
||
it("Should have an error coming from the html page on the first beacon first error", function() { | ||
var b = tf.beacons[0]; | ||
var err = BOOMR.plugins.Errors.decompressErrors(C.jsUrlDecompress(b.err))[0]; | ||
|
||
if (err.fileName) { | ||
assert.include(err.fileName, "24-autorun-false-multiple-then-load.html"); | ||
} | ||
|
||
if (err.functionName) { | ||
assert.include(err.functionName, "badFunction"); | ||
} | ||
}); | ||
|
||
it("Should have rt.end on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
assert.isDefined(b["rt.end"]); | ||
}); | ||
|
||
it("Should have rt.tstart on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
assert.isDefined(b["rt.tstart"]); | ||
}); | ||
|
||
it("Should have rt.start = manual on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
assert.equal(b["rt.start"], "manual"); | ||
}); | ||
|
||
it("Should have no http.initiator the second beacon", function() { | ||
var b = tf.beacons[1]; | ||
assert.isUndefined(b["http.initiator"]); | ||
}); | ||
|
||
it("Should have rt.start=navigation on the second beacon (if NavigationTiming is supported)", function() { | ||
if (t.isNavigationTimingSupported()) { | ||
assert.equal(tf.beacons[1]["rt.start"], "navigation"); | ||
} | ||
else { | ||
assert.equal(tf.beacons[1]["rt.start"], "none"); | ||
} | ||
}); | ||
|
||
it("Should have put NavigationTiming metrics on the second beacon (if NavigationTiming is supported)", function() { | ||
if (t.isNavigationTimingSupported()) { | ||
assert.isDefined(tf.beacons[1].nt_nav_st); | ||
assert.isDefined(tf.beacons[1].nt_load_st); | ||
} | ||
}); | ||
|
||
it("Should have rt.sl = 0 on the first beacon", function() { | ||
var b = tf.beacons[0]; | ||
assert.equal(b["rt.sl"], 0); | ||
}); | ||
|
||
it("Should have rt.sl = 1 on the second beacon", function() { | ||
var b = tf.beacons[1]; | ||
assert.equal(b["rt.sl"], 1); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/page-templates/14-errors/25-autorun-false-onload-happens.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<%= header %> | ||
<%= boomerangScriptMin %> | ||
<!-- | ||
For this test, we'll turn autorun off and trigger an error. | ||
BOOMR.page_ready() happens right afterward, and should send the normal page load beacon with the error. | ||
--> | ||
<script src="25-autorun-false-onload-happens.js" type="text/javascript"></script> | ||
<script> | ||
BOOMR_test.init({ | ||
testAfterOnBeacon: true, | ||
Errors: { | ||
enabled: true | ||
}, | ||
autorun: false | ||
}); | ||
|
||
var a = badFunction(); | ||
</script> | ||
<script> | ||
BOOMR.page_ready(); | ||
</script> | ||
<%= footer %> |
Oops, something went wrong.