From 4e87820cd3a4df27d7a1df515d41719ad9655997 Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Fri, 26 Oct 2018 16:08:53 +0200 Subject: [PATCH] Misc fixes --- bower.json | 2 +- package-lock.json | 2 +- package.json | 2 +- tests/boomerang-test-framework.js | 3 +- tests/e2e/e2e-debug.js | 56 +++++++++++-------- .../14-errors/45-reporting-api.html | 10 +++- .../14-errors/45-reporting-api.js | 26 ++++----- tests/protractor.config.debug.js | 11 +++- tests/server/app.js | 5 ++ 9 files changed, 72 insertions(+), 45 deletions(-) diff --git a/bower.json b/bower.json index 37b54a150..bc85736e9 100644 --- a/bower.json +++ b/bower.json @@ -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" diff --git a/package-lock.json b/package-lock.json index c13e24413..525963a5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "boomerangjs", - "version": "1.568.0", + "version": "1.621.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bbce1e094..10525fb1b 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,7 @@ }, { "name": "Avinash Shenoy", - "email": "ashenoy@gmail.com" + "email": "nash.shenoy@gmail.com" } ], "license": "BSD-3-Clause", diff --git a/tests/boomerang-test-framework.js b/tests/boomerang-test-framework.js index 263779e47..39a88ea9f 100644 --- a/tests/boomerang-test-framework.js +++ b/tests/boomerang-test-framework.js @@ -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", diff --git a/tests/e2e/e2e-debug.js b/tests/e2e/e2e-debug.js index a4713a482..6cc72c438 100644 --- a/tests/e2e/e2e-debug.js +++ b/tests/e2e/e2e-debug.js @@ -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); } @@ -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(); + }); + }); + }); + })(); }); }); } diff --git a/tests/page-templates/14-errors/45-reporting-api.html b/tests/page-templates/14-errors/45-reporting-api.html index b6d7e9afc..8387bce65 100644 --- a/tests/page-templates/14-errors/45-reporting-api.html +++ b/tests/page-templates/14-errors/45-reporting-api.html @@ -1,10 +1,14 @@ <%= header %> <%= boomerangScriptMin %> -