Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjansma committed Oct 26, 2018
1 parent 1a00830 commit 4e87820
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 45 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "boomerang",
"private": true,
"main": "boomerang.js",
"version": "1.568.0",
"version": "1.621.0",
"homepage": "https://github.com/akamai/boomerang/",
"authors": [
"Philip Tellis"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
},
{
"name": "Avinash Shenoy",
"email": "ashenoy@gmail.com"
"email": "nash.shenoy@gmail.com"
}
],
"license": "BSD-3-Clause",
Expand Down
3 changes: 2 additions & 1 deletion tests/boomerang-test-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@

t.configureTestEnvironment();

if (window.BOOMR_LOGN_always !== true) {
// Initialize if waiting for LOGN plugin or if the plugin doesn't exist
if (window.BOOMR_LOGN_always !== true || !BOOMR.plugins.LOGN) {
// fake session details so beacons send
BOOMR.addVar({
"h.key": window.BOOMR_API_key ? window.BOOMR_API_key : "aaaaa-bbbbb-ccccc-ddddd-eeeee",
Expand Down
56 changes: 32 additions & 24 deletions tests/e2e/e2e-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ function run(testPath, file) {
var fileName = file + ".html";

it("Should pass " + testPath + "/" + fileName, function(done) {
var logCount = 0;

if (typeof browser.waitForAngularEnabled === "function") {
browser.waitForAngularEnabled(false);
}
Expand All @@ -32,36 +30,46 @@ function run(testPath, file) {
"http://" + servers.main + ":" + ports.main + "/pages/" + testPath + "/" + fileName
);

browser.driver.executeScript("return navigator.userAgent;").then(function(ua) {
console.log("User-Agent:", ua);
});

browser.driver.get("http://" + servers.main + ":" + ports.main + "/pages/" + testPath + "/" + fileName);

setInterval(function() {
// poll every 100ms for new logs or the test framework to note we're complete
(function poll() {
// get browser logs
browser.manage().logs().get("browser").then(function(browserLog) {
if (browserLog.length > logCount) {
for (var i = logCount; i < browserLog.length; i++) {
var log = browserLog[i];
console.log("[" + new Date(log.timestamp).toLocaleTimeString() + "] " + log.message);
}

logCount = browserLog.length;
}
browserLog.forEach(function(log) {
console.log("[" + new Date(log.timestamp).toLocaleTimeString() + "] " + log.message);
});
});
}, 1000);

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

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

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

done();
});
});
console.log("Navigation complete");

browser.driver.executeScript("return BOOMR_test.getTestFailureMessages()").then(function(testFailures) {
if (testFailures.length > 0) {
throw new Error(testFailures);
}

done();
});
});
});
})();
});
});
}
Expand Down
10 changes: 7 additions & 3 deletions tests/page-templates/14-errors/45-reporting-api.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<%= header %>
<%= boomerangScriptMin %>
<script src="45-reporting-api.js" type="text/javascript"></script>
<script>
window.willReportDeprecation = BOOMR_test.isChrome() &&
window.ReportingObserver &&
window.chrome &&
typeof window.chrome.loadTimes === "function";

function errorFunction() {
if (BOOMR_test.isChrome() && window.ReportingObserver) {
return chrome.loadTimes().firstPaintTime; // cause a deprecation warning
if (window.willReportDeprecation) {
return window.chrome.loadTimes().firstPaintTime; // cause a deprecation warning
}
}
errorFunction();
Expand Down
26 changes: 13 additions & 13 deletions tests/page-templates/14-errors/45-reporting-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ describe("e2e/14-errors/45-reporting-api", function() {
});

it("Should have put the err on the beacon", function() {
if (!BOOMR.window.ReportingObserver) {
if (!window.willReportDeprecation) {
return this.skip();
}
var b = tf.lastBeacon();
assert.isDefined(b.err);
});

it("Should have had a single error", function() {
if (!BOOMR.window.ReportingObserver) {
if (!window.willReportDeprecation) {
return this.skip();
}
var b = tf.lastBeacon();
assert.equal(C.jsUrlDecompress(b.err).length, 1);
});

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

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

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

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

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

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

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

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

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

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

it("Should have lineNumber ~ " + (HEADER_LINES + 7), function() {
if (!BOOMR.window.ReportingObserver) {
if (!window.willReportDeprecation) {
return this.skip();
}
var b = tf.lastBeacon();
Expand Down
11 changes: 10 additions & 1 deletion tests/protractor.config.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ exports.config = {
capabilities: {
browserName: "chrome",
chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=1024,768" ]
args: [
"--headless",
"--disable-gpu",
"--window-size=1024,768",
"--remote-debugging-port=9222"
]
},
loggingPrefs: {
"driver": "INFO",
"browser": "INFO"
}
}
};
5 changes: 5 additions & 0 deletions tests/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ app.post("/json", require("./route-json"));
app.get("/drop", dropRequest);
app.post("/drop", dropRequest);

// load in any additional routes
if (fs.existsSync("./routes.js")) {
require("./routes")(app);
}

// for every GET, look for a file with the same name appended with ".headers"
// if found, parse the headers and write them on the response
// whether found or not, let the req/res pass through with next()
Expand Down

0 comments on commit 4e87820

Please sign in to comment.