Jelajahi Sumber

Tidied up UI tests

n1474335 6 tahun lalu
induk
melakukan
840e44deac
2 mengubah file dengan 7 tambahan dan 6 penghapusan
  1. 1 1
      Gruntfile.js
  2. 6 5
      tests/browser/nightwatch.js

+ 1 - 1
Gruntfile.js

@@ -34,7 +34,7 @@ module.exports = function (grunt) {
         ["exec:generateConfig", "exec:opTests"]);
 
     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"]);
 
     grunt.registerTask("docs",

+ 6 - 5
tests/browser/nightwatch.js

@@ -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]
  * @copyright Crown Copyright 2018
  * @license Apache-2.0
  */
 module.exports = {
-    before: function (browser) {
+    before: browser => {
         browser
             .resizeWindow(1280, 800)
             .url(browser.launchUrl);
@@ -35,7 +35,7 @@ module.exports = {
 
     "Operations loaded": browser => {
         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 Binary']").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)
             .useCss()
             .waitForElementVisible(".popover-body", 500)
-            .doubleClick()
-            .waitForElementVisible(op);
+            .doubleClick();
 
         // Confirm that it has been added to the recipe
         browser
             .useCss()
+            .waitForElementVisible(op)
             .expect.element(op).text.to.contain("To Hex");
 
         // Enter input
@@ -86,6 +86,7 @@ module.exports = {
         // Check output
         browser
             .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");
 
         // Clear recipe