Tidied up UI tests

This commit is contained in:
n1474335 2018-12-30 00:26:28 +00:00
parent f7707faece
commit 840e44deac
2 changed files with 7 additions and 6 deletions

View File

@ -34,7 +34,7 @@ module.exports = function (grunt) {
["exec:generateConfig", "exec:opTests"]); ["exec:generateConfig", "exec:opTests"]);
grunt.registerTask("testui", grunt.registerTask("testui",
"A task which runs all the UI tests in the tests directory. Requires the dev server to be running.", "A task which runs all the UI tests in the tests directory. The prod task must already have been run.",
["connect:prod", "exec:browserTests"]); ["connect:prod", "exec:browserTests"]);
grunt.registerTask("docs", grunt.registerTask("docs",

View File

@ -1,12 +1,12 @@
/** /**
* Tests to ensure that the app loads correctly in a reasonable time and that operations can br run. * Tests to ensure that the app loads correctly in a reasonable time and that operations can be run.
* *
* @author n1474335 [n1474335@gmail.com] * @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018 * @copyright Crown Copyright 2018
* @license Apache-2.0 * @license Apache-2.0
*/ */
module.exports = { module.exports = {
before: function (browser) { before: browser => {
browser browser
.resizeWindow(1280, 800) .resizeWindow(1280, 800)
.url(browser.launchUrl); .url(browser.launchUrl);
@ -35,7 +35,7 @@ module.exports = {
"Operations loaded": browser => { "Operations loaded": browser => {
browser.useXpath(); browser.useXpath();
// Check an operation in every category // Check that an operation in every category has been populated
browser.expect.element("//li[contains(@class, 'operation') and text()='To Base64']").to.be.present; browser.expect.element("//li[contains(@class, 'operation') and text()='To Base64']").to.be.present;
browser.expect.element("//li[contains(@class, 'operation') and text()='To Binary']").to.be.present; browser.expect.element("//li[contains(@class, 'operation') and text()='To Binary']").to.be.present;
browser.expect.element("//li[contains(@class, 'operation') and text()='AES Decrypt']").to.be.present; browser.expect.element("//li[contains(@class, 'operation') and text()='AES Decrypt']").to.be.present;
@ -70,12 +70,12 @@ module.exports = {
.moveToElement(toHex, 10, 10) .moveToElement(toHex, 10, 10)
.useCss() .useCss()
.waitForElementVisible(".popover-body", 500) .waitForElementVisible(".popover-body", 500)
.doubleClick() .doubleClick();
.waitForElementVisible(op);
// Confirm that it has been added to the recipe // Confirm that it has been added to the recipe
browser browser
.useCss() .useCss()
.waitForElementVisible(op)
.expect.element(op).text.to.contain("To Hex"); .expect.element(op).text.to.contain("To Hex");
// Enter input // Enter input
@ -86,6 +86,7 @@ module.exports = {
// Check output // Check output
browser browser
.useCss() .useCss()
.waitForElementNotVisible("#stale-indicator", 100)
.expect.element("#output-text").to.have.value.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e"); .expect.element("#output-text").to.have.value.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
// Clear recipe // Clear recipe