Commit bb32a998 authored by Dave Vandyke's avatar Dave Vandyke 🐈

Refs #12 - Improve output for testpage failures

parent d32705ac
Pipeline #60373590 failed with stages
in 6 minutes and 3 seconds
......@@ -22,7 +22,7 @@ const SKIP_ONLINE_TESTS = false;
const assert = require("assert");
const Jimp = require("jimp");
const {By, until} = require("selenium-webdriver");
const {By, until, error: {TimeoutError}} = require("selenium-webdriver");
let lastScreenshot = Promise.resolve();
......@@ -91,7 +91,7 @@ function getSections(driver)
));
}
it("test pages", function()
it("Test pages", function()
{
return this.driver.navigate().to(TEST_PAGES_URL).then(() =>
this.driver.findElements(By.css(".site-pagelist a"))
......@@ -160,6 +160,7 @@ it("test pages", function()
for (let i = 0; i < testCases.length; i++)
{
let [title, expectedScreenshot, filters] = testCases[i];
let description = ["", "Test case: " + title, url].join("\n ");
p2 = p2.then(() =>
this.driver.navigate().to(this.origin + "/options.html")
......@@ -198,11 +199,13 @@ it("test pages", function()
{
if (pageTitle == "$popup - Exception")
{
assert.equal(handles.length, 3, title);
assert.equal(handles.length, 3,
"Popup is whitelisted" + description);
return closeWindow(this.driver, handles[2], handles[1]);
}
assert.equal(handles.length, 2, title);
assert.equal(handles.length, 2,
"Popup is blocked" + description);
});
}
......@@ -213,8 +216,13 @@ it("test pages", function()
screenshot.width == expectedScreenshot.width &&
screenshot.height == expectedScreenshot.height &&
screenshot.data.compare(expectedScreenshot.data) == 0
), 1000, title
)
), 1000
).catch(e =>
{
if (e instanceof TimeoutError)
e = new Error("Screenshots don't match" + description);
throw e;
})
);
// Sometimes on Firefox there is a delay until the added
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment