diff --git a/src/tests/nightwatch/utils.js b/src/tests/nightwatch/utils.js index a7a84c35..0247594a 100644 --- a/src/tests/nightwatch/utils.js +++ b/src/tests/nightwatch/utils.js @@ -2,11 +2,13 @@ const request = require('request'); function notNotFound(browser, url) { + const successMessage = `Loaded successfully: ${url}`; + // URLs that the React app manages. These don't return a 404 but instead // display a "Not Found" message. if (url.startsWith('http://localhost:3000')) { browser.url(url); - browser.expect.element('#not-found').to.not.be.present; + browser.waitForElementNotPresent('#not-found', successMessage); browser.back(); } @@ -14,9 +16,9 @@ function notNotFound(browser, url) { else { request(url, (error, response) => { if (response === undefined) { - browser.assert.fail('response is undefined'); + browser.assert.fail(`response is undefined for ${url}`); } else { - browser.assert.equal(response.statusCode, 200); + browser.assert.equal(response.statusCode, 200, successMessage); } }); }