Skip to content

Commit 4e87820

Browse files
committed
Misc fixes
1 parent 1a00830 commit 4e87820

File tree

9 files changed

+72
-45
lines changed

9 files changed

+72
-45
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "boomerang",
33
"private": true,
44
"main": "boomerang.js",
5-
"version": "1.568.0",
5+
"version": "1.621.0",
66
"homepage": "https://github.com/akamai/boomerang/",
77
"authors": [
88
"Philip Tellis"

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
},
205205
{
206206
"name": "Avinash Shenoy",
207-
"email": "ashenoy@gmail.com"
207+
"email": "nash.shenoy@gmail.com"
208208
}
209209
],
210210
"license": "BSD-3-Clause",

tests/boomerang-test-framework.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@
240240

241241
t.configureTestEnvironment();
242242

243-
if (window.BOOMR_LOGN_always !== true) {
243+
// Initialize if waiting for LOGN plugin or if the plugin doesn't exist
244+
if (window.BOOMR_LOGN_always !== true || !BOOMR.plugins.LOGN) {
244245
// fake session details so beacons send
245246
BOOMR.addVar({
246247
"h.key": window.BOOMR_API_key ? window.BOOMR_API_key : "aaaaa-bbbbb-ccccc-ddddd-eeeee",

tests/e2e/e2e-debug.js

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ function run(testPath, file) {
2121
var fileName = file + ".html";
2222

2323
it("Should pass " + testPath + "/" + fileName, function(done) {
24-
var logCount = 0;
25-
2624
if (typeof browser.waitForAngularEnabled === "function") {
2725
browser.waitForAngularEnabled(false);
2826
}
@@ -32,36 +30,46 @@ function run(testPath, file) {
3230
"http://" + servers.main + ":" + ports.main + "/pages/" + testPath + "/" + fileName
3331
);
3432

33+
browser.driver.executeScript("return navigator.userAgent;").then(function(ua) {
34+
console.log("User-Agent:", ua);
35+
});
36+
3537
browser.driver.get("http://" + servers.main + ":" + ports.main + "/pages/" + testPath + "/" + fileName);
3638

37-
setInterval(function() {
39+
// poll every 100ms for new logs or the test framework to note we're complete
40+
(function poll() {
41+
// get browser logs
3842
browser.manage().logs().get("browser").then(function(browserLog) {
39-
if (browserLog.length > logCount) {
40-
for (var i = logCount; i < browserLog.length; i++) {
41-
var log = browserLog[i];
42-
console.log("[" + new Date(log.timestamp).toLocaleTimeString() + "] " + log.message);
43-
}
44-
45-
logCount = browserLog.length;
46-
}
43+
browserLog.forEach(function(log) {
44+
console.log("[" + new Date(log.timestamp).toLocaleTimeString() + "] " + log.message);
45+
});
4746
});
48-
}, 1000);
4947

50-
browser.driver.wait(function() {
51-
return element(by.css("#BOOMR_test_complete")).isPresent();
52-
});
48+
// check if our element is there
49+
browser.isElementPresent(by.css("#BOOMR_test_complete"))
50+
.then(function(present) {
51+
if (!present) {
52+
setTimeout(poll, 100);
5353

54-
browser.driver.executeScript("return BOOMR_test.isComplete()").then(function(complete) {
55-
assert.equal(complete, true, "BOOMR_test.isComplete()");
54+
return;
55+
}
5656

57-
browser.driver.executeScript("return BOOMR_test.getTestFailureMessages()").then(function(testFailures) {
58-
if (testFailures.length > 0) {
59-
throw new Error(testFailures);
60-
}
57+
// get error messages
58+
browser.driver.executeScript("return BOOMR_test.isComplete()").then(function(complete) {
59+
assert.equal(complete, true, "BOOMR_test.isComplete()");
6160

62-
done();
63-
});
64-
});
61+
console.log("Navigation complete");
62+
63+
browser.driver.executeScript("return BOOMR_test.getTestFailureMessages()").then(function(testFailures) {
64+
if (testFailures.length > 0) {
65+
throw new Error(testFailures);
66+
}
67+
68+
done();
69+
});
70+
});
71+
});
72+
})();
6573
});
6674
});
6775
}

tests/page-templates/14-errors/45-reporting-api.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<%= header %>
22
<%= boomerangScriptMin %>
3-
<script src="45-reporting-api.js" type="text/javascript"></script>
43
<script>
4+
window.willReportDeprecation = BOOMR_test.isChrome() &&
5+
window.ReportingObserver &&
6+
window.chrome &&
7+
typeof window.chrome.loadTimes === "function";
8+
59
function errorFunction() {
6-
if (BOOMR_test.isChrome() && window.ReportingObserver) {
7-
return chrome.loadTimes().firstPaintTime; // cause a deprecation warning
10+
if (window.willReportDeprecation) {
11+
return window.chrome.loadTimes().firstPaintTime; // cause a deprecation warning
812
}
913
}
1014
errorFunction();

tests/page-templates/14-errors/45-reporting-api.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ describe("e2e/14-errors/45-reporting-api", function() {
1111
});
1212

1313
it("Should have put the err on the beacon", function() {
14-
if (!BOOMR.window.ReportingObserver) {
14+
if (!window.willReportDeprecation) {
1515
return this.skip();
1616
}
1717
var b = tf.lastBeacon();
1818
assert.isDefined(b.err);
1919
});
2020

2121
it("Should have had a single error", function() {
22-
if (!BOOMR.window.ReportingObserver) {
22+
if (!window.willReportDeprecation) {
2323
return this.skip();
2424
}
2525
var b = tf.lastBeacon();
2626
assert.equal(C.jsUrlDecompress(b.err).length, 1);
2727
});
2828

2929
it("Should have count = 1", function() {
30-
if (!BOOMR.window.ReportingObserver) {
30+
if (!window.willReportDeprecation) {
3131
return this.skip();
3232
}
3333
var b = tf.lastBeacon();
@@ -36,7 +36,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
3636
});
3737

3838
it("Should have had a recent timestamp", function() {
39-
if (!BOOMR.window.ReportingObserver) {
39+
if (!window.willReportDeprecation) {
4040
return this.skip();
4141
}
4242
var b = tf.lastBeacon();
@@ -45,7 +45,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
4545
});
4646

4747
it("Should have fileName of the page (if set)", function() {
48-
if (!BOOMR.window.ReportingObserver) {
48+
if (!window.willReportDeprecation) {
4949
return this.skip();
5050
}
5151
var b = tf.lastBeacon();
@@ -60,7 +60,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
6060
});
6161

6262
it("Should have functionName of 'errorFunction'", function() {
63-
if (!BOOMR.window.ReportingObserver) {
63+
if (!window.willReportDeprecation) {
6464
return this.skip();
6565
}
6666
var b = tf.lastBeacon();
@@ -75,7 +75,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
7575
});
7676

7777
it("Should have correct message", function() {
78-
if (!BOOMR.window.ReportingObserver) {
78+
if (!window.willReportDeprecation) {
7979
return this.skip();
8080
}
8181
var b = tf.lastBeacon();
@@ -84,7 +84,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
8484
});
8585

8686
it("Should have source = APP", function() {
87-
if (!BOOMR.window.ReportingObserver) {
87+
if (!window.willReportDeprecation) {
8888
return this.skip();
8989
}
9090
var b = tf.lastBeacon();
@@ -93,7 +93,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
9393
});
9494

9595
it("Should have stack with the stack", function() {
96-
if (!BOOMR.window.ReportingObserver) {
96+
if (!window.willReportDeprecation) {
9797
return this.skip();
9898
}
9999
var b = tf.lastBeacon();
@@ -103,7 +103,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
103103
});
104104

105105
it("Should have type = 'Error'", function() {
106-
if (!BOOMR.window.ReportingObserver) {
106+
if (!window.willReportDeprecation) {
107107
return this.skip();
108108
}
109109
var b = tf.lastBeacon();
@@ -112,7 +112,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
112112
});
113113

114114
it("Should have via = REPORTING", function() {
115-
if (!BOOMR.window.ReportingObserver) {
115+
if (!window.willReportDeprecation) {
116116
return this.skip();
117117
}
118118
var b = tf.lastBeacon();
@@ -121,7 +121,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
121121
});
122122

123123
it("Should have columNumber to be a number if specified", function() {
124-
if (!BOOMR.window.ReportingObserver) {
124+
if (!window.willReportDeprecation) {
125125
return this.skip();
126126
}
127127
var b = tf.lastBeacon();
@@ -135,7 +135,7 @@ describe("e2e/14-errors/45-reporting-api", function() {
135135
});
136136

137137
it("Should have lineNumber ~ " + (HEADER_LINES + 7), function() {
138-
if (!BOOMR.window.ReportingObserver) {
138+
if (!window.willReportDeprecation) {
139139
return this.skip();
140140
}
141141
var b = tf.lastBeacon();

tests/protractor.config.debug.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ exports.config = {
2323
capabilities: {
2424
browserName: "chrome",
2525
chromeOptions: {
26-
args: [ "--headless", "--disable-gpu", "--window-size=1024,768" ]
26+
args: [
27+
"--headless",
28+
"--disable-gpu",
29+
"--window-size=1024,768",
30+
"--remote-debugging-port=9222"
31+
]
32+
},
33+
loggingPrefs: {
34+
"driver": "INFO",
35+
"browser": "INFO"
2736
}
2837
}
2938
};

tests/server/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ app.post("/json", require("./route-json"));
101101
app.get("/drop", dropRequest);
102102
app.post("/drop", dropRequest);
103103

104+
// load in any additional routes
105+
if (fs.existsSync("./routes.js")) {
106+
require("./routes")(app);
107+
}
108+
104109
// for every GET, look for a file with the same name appended with ".headers"
105110
// if found, parse the headers and write them on the response
106111
// whether found or not, let the req/res pass through with next()

0 commit comments

Comments
 (0)