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.
Fix custom timers for SPA navigations
- Loading branch information
1 parent
721ceb3
commit f35f912
Showing
33 changed files
with
1,156 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
<h1>{{widget.name}}</h1> | ||
<img ng-src="/delay?delay={{widget.id}}000&file=pages/05-angular/support/img.jpg&id={{widget.id}}&rnd={{rnd}}" style="width: 300px; height: auto;" /> | ||
<div class="cart-container" style="display: none"> | ||
<div id="cart-total">${{carttotal}}</div> | ||
</div> |
243 changes: 243 additions & 0 deletions
243
tests/page-templates/08-ember/26-page-params-spa-nav.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,243 @@ | ||
<%= header %> | ||
<%= boomerangScript %> | ||
<base href="/pages/08-ember/26-page-params-spa-nav.html" /> | ||
|
||
<script src="../../vendor/jquery/dist/jquery.min.js"></script> | ||
<script src="../../vendor/ember/ember.prod.js"></script> | ||
<script src="../../vendor/handlebars/handlebars.min.js"></script> | ||
<script src="../../vendor/ember/ember-template-compiler.js"></script> | ||
<script> | ||
// Force navigation to TYPE_NAVIGATE | ||
if (window.performance) { | ||
window.performance.__defineGetter__("navigation", function() { | ||
return {type: 0, redirectCount: 0}; | ||
}); | ||
} | ||
|
||
window.ember_nav_routes = ["/widgets/1", ""]; | ||
window.html5_mode = true; | ||
window.imgs = [3000]; | ||
</script> | ||
<script src="support/app.js"></script> | ||
|
||
<!-- Handlebars templates for our application. --> | ||
<script type="text/x-handlebars"> | ||
<div class="container"> | ||
{{outlet}} | ||
</div> | ||
</script> | ||
|
||
<script src="/test-templates/spa/26-page-params-spa-nav.js" type="text/javascript"></script> | ||
<script src="26-page-params-spa-nav.js" type="text/javascript"></script> | ||
<script> | ||
var img, xhr, beaconCount = 0; | ||
BOOMR.subscribe("onbeacon", function(vars) { | ||
beaconCount++; | ||
if (beaconCount === 3) { | ||
setTimeout(function() { | ||
xhr = new XMLHttpRequest(); | ||
xhr.open("GET", "/delay?delay=100&file=/pages/05-angular/support/widgets.json"); | ||
xhr.addEventListener("load", function() { | ||
img = document.createElement("img"); | ||
img.src = "/delay?delay=1000&id=xhr&file=/pages/05-angular/support/img.jpg"; | ||
document.body.appendChild(img); | ||
}); | ||
xhr.send(null); | ||
}, 100); | ||
} | ||
}); | ||
|
||
// these will be overwritten by the app | ||
custom_metric_1 = 111; | ||
custom_metric_2 = function() { | ||
return 222; | ||
}; | ||
|
||
BOOMR_test.init({ | ||
testAfterOnBeacon: 4, | ||
Ember: { | ||
enabled: true | ||
}, | ||
PageParams: { | ||
pageGroups: [ | ||
{ | ||
type: "Regexp", | ||
parameter1: ".*/widgets/1", | ||
parameter2: "widget1" | ||
}, | ||
{ | ||
type: "Regexp", | ||
parameter1: ".*/26-page-params-spa-nav.html", | ||
parameter2: "home" | ||
} | ||
], | ||
customMetrics: [ | ||
{ | ||
varName: "custom_metric_1", | ||
label: "cmet1", | ||
type: "JavaScriptVar" | ||
}, | ||
{ | ||
varName: "custom_metric_2", | ||
label: "cmet2", | ||
type: "JavaScriptVar" | ||
}, | ||
{ | ||
varName: "missing_metric", | ||
label: "cmet3", | ||
type: "JavaScriptVar" | ||
}, | ||
{ | ||
parameter1: "", | ||
parameter2: "//div[@id='cart-total']", | ||
label: "cmet4", | ||
type: "URLPatternType" | ||
}, | ||
{ | ||
parameter1: "*", | ||
parameter2: "", | ||
label: "cmet5", | ||
type: "URLPatternType" | ||
} | ||
], | ||
customTimers: [ | ||
{ | ||
name: "Timer NavigationTiming", | ||
index: 0, | ||
type: "NavigationTiming", | ||
label: "custom0", | ||
"start": "navigationStart", | ||
"end": "responseEnd" | ||
}, | ||
{ | ||
name: "Timer JavaScript Variable", | ||
index: 1, | ||
type: "Custom", | ||
label: "custom1", | ||
parameter1: "custom_timer_1" | ||
}, | ||
{ | ||
name: "Timer JavaScript Function", | ||
index: 2, | ||
type: "Custom", | ||
label: "custom2", | ||
parameter1: "custom_timer_2" | ||
}, | ||
{ | ||
name: "Timer UserTiming", | ||
index: 3, | ||
type: "UserTiming", | ||
label: "custom3", | ||
parameter1: "", | ||
parameter2: "mark_usertiming" | ||
}, | ||
{ | ||
name: "Missing Timer JavaScript Variable", | ||
index: 4, | ||
type: "Custom", | ||
label: "custom4", | ||
parameter1: "custom_timer_missing" | ||
}, | ||
{ | ||
name: "Missing Timer UserTiming", | ||
index: 5, | ||
type: "UserTiming", | ||
label: "custom5", | ||
parameter1: "", | ||
parameter2: "missing_mark_usertiming" | ||
}, | ||
{ | ||
name: "ResourceGroup Element after spa_hard", | ||
index: 6, | ||
label: "custom6", | ||
type: "ResourceGroup", | ||
value: { | ||
"*/26-page-params-spa-nav.html*": { | ||
on: ["spa_hard"], | ||
resources: [{ | ||
type: "resource", | ||
value: "*id=home*" | ||
}] | ||
} | ||
} | ||
}, | ||
{ | ||
name: "ResourceGroup on spa", | ||
index: 7, | ||
label: "custom7", | ||
type: "ResourceGroup", | ||
value: { | ||
"*/26-page-params-spa-nav.html*": { | ||
on: ["spa"], | ||
resources: [{ | ||
type: "resource", | ||
value: "*id=1*" | ||
}] | ||
} | ||
} | ||
}, | ||
{ | ||
name: "Resource Group nav-start defined as start and ResTiming", | ||
index: 8, | ||
label: "custom8", | ||
type: "ResourceGroup", | ||
value: { | ||
"*/26-page-params-spa-nav.html*": { | ||
on: ["spa"], | ||
resources: [{ | ||
type: "resource", | ||
value: "*id=1*", | ||
start: "navigationStart" | ||
}] | ||
} | ||
} | ||
}, | ||
{ | ||
name: "ResourceGroup on xhr", | ||
index: 9, | ||
label: "custom9", | ||
type: "ResourceGroup", | ||
value: { | ||
"*/26-page-params-spa-nav.html*": { | ||
on: ["xhr"], | ||
resources: [{ | ||
type: "resource", | ||
value: "*id=xhr*" | ||
}] | ||
} | ||
} | ||
}, | ||
{ | ||
name: "Timer ResourceTiming", | ||
index: 10, | ||
type: "ResourceTiming", | ||
label: "custom10", | ||
start: "requestStart", | ||
end: "responseEnd", | ||
url: "*id=home*" | ||
}, | ||
{ | ||
name: "Timer ResourceTiming nav start", | ||
index: 11, | ||
type: "ResourceTiming", | ||
label: "custom11", | ||
start: "navigationStart", | ||
end: "responseEnd", | ||
url: "*id=home*" | ||
}, | ||
{ | ||
name: "Missing Timer ResourceTiming", | ||
index: 12, | ||
type: "ResourceTiming", | ||
label: "custom12", | ||
start: "requestStart", | ||
end: "responseEnd", | ||
url: "*id=doesnotexist*" | ||
} | ||
] | ||
}, | ||
instrument_xhr: true, | ||
autorun: false | ||
}); | ||
</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,6 @@ | ||
/*eslint-env mocha*/ | ||
/*global BOOMR_test*/ | ||
|
||
describe("e2e/08-ember/26-page-params-spa-nav", function() { | ||
BOOMR_test.templates.SPA["26-page-params-spa-nav"](); | ||
}); |
Oops, something went wrong.