mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 15:25:01 -04:00
Revert "181 responsive UI"
This commit is contained in:
parent
4cb0d2b82b
commit
2ecdd67208
66 changed files with 2084 additions and 3255 deletions
|
@ -9,10 +9,9 @@
|
|||
const utils = require("./browserUtils.js");
|
||||
|
||||
module.exports = {
|
||||
// desktop UI
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(1024, 800)
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl);
|
||||
},
|
||||
|
||||
|
@ -27,18 +26,12 @@ module.exports = {
|
|||
browser.useCss();
|
||||
// Check that various important elements are loaded
|
||||
browser.expect.element("#operations").to.be.visible;
|
||||
browser.expect.element("#operations-dropdown").to.be.visible;
|
||||
browser.expect.element("#search").to.be.visible;
|
||||
browser.expect.element("#categories").to.be.visible;
|
||||
browser.expect.element("c-category-list").to.be.visible;
|
||||
browser.expect.element("c-category-li").to.be.present;
|
||||
browser.expect.element("c-operation-list").to.be.present;
|
||||
browser.expect.element("c-operation-li").to.be.present;
|
||||
browser.expect.element("#recipe").to.be.visible;
|
||||
browser.expect.element("#input").to.be.present;
|
||||
browser.expect.element("#output").to.be.present;
|
||||
browser.expect.element(".op-list").to.be.present;
|
||||
browser.expect.element("#rec-list").to.be.visible;
|
||||
browser.expect.element("#controls").to.be.visible;
|
||||
browser.expect.element("#input").to.be.visible;
|
||||
browser.expect.element("#output").to.be.visible;
|
||||
browser.expect.element("#input-text").to.be.visible;
|
||||
browser.expect.element("#output-text").to.be.visible;
|
||||
},
|
||||
|
@ -46,27 +39,27 @@ module.exports = {
|
|||
"Operations loaded": browser => {
|
||||
browser.useXpath();
|
||||
// Check that an operation in every category has been populated
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='To Base64']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='To Binary']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='AES Decrypt']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='PEM to Hex']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Power Set']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Parse IP range']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Remove Diacritics']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Sort']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='To UNIX Timestamp']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Extract dates']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Gzip']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Keccak']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='JSON Beautify']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Detect File Type']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Play Media']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Disassemble x86']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation')]/span[text()='Register']").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()='AES Decrypt']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='PEM to Hex']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Power Set']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Parse IP range']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Remove Diacritics']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Sort']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='To UNIX Timestamp']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Extract dates']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Gzip']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Keccak']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='JSON Beautify']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Detect File Type']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Play Media']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Disassemble x86']").to.be.present;
|
||||
browser.expect.element("//li[contains(@class, 'operation') and text()='Register']").to.be.present;
|
||||
},
|
||||
|
||||
"Recipe can be run": browser => {
|
||||
const toHex = "//li[contains(@class, 'operation')]/span[text()='To Hex']";
|
||||
const toHex = "//li[contains(@class, 'operation') and text()='To Hex']";
|
||||
const op = "#rec-list .operation .op-title";
|
||||
|
||||
// Check that operation is visible
|
||||
|
@ -190,7 +183,7 @@ module.exports = {
|
|||
|
||||
"Move around the UI": browser => {
|
||||
const otherCat = "//a[contains(@class, 'category-title') and contains(@data-target, '#catOther')]",
|
||||
genUUID = "//li[contains(@class, 'operation')]/span[text()='Generate UUID']";
|
||||
genUUID = "//li[contains(@class, 'operation') and text()='Generate UUID']";
|
||||
|
||||
browser.useXpath();
|
||||
|
||||
|
@ -227,7 +220,7 @@ module.exports = {
|
|||
.clearValue("#search")
|
||||
.setValue("#search", "md5")
|
||||
.useXpath()
|
||||
.waitForElementVisible("//div[@id='search-results']//strong[text()='MD5']", 1000);
|
||||
.waitForElementVisible("//ul[@id='search-results']//b[text()='MD5']", 1000);
|
||||
},
|
||||
|
||||
"Alert bar": browser => {
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
/**
|
||||
* 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 = {
|
||||
// desktop UI
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(500, 800)
|
||||
.url(browser.launchUrl);
|
||||
},
|
||||
|
||||
"Loading screen": browser => {
|
||||
// Check that the loading screen appears and then disappears within a reasonable time
|
||||
browser
|
||||
.waitForElementVisible("#preloader", 300)
|
||||
.waitForElementNotPresent("#preloader", 10000);
|
||||
},
|
||||
|
||||
"App loaded": browser => {
|
||||
browser.useCss();
|
||||
// Check that various important elements are loaded
|
||||
browser.expect.element("#operations").to.be.visible;
|
||||
browser.expect.element("#operations-dropdown").to.be.present;
|
||||
browser.expect.element("#search").to.be.visible;
|
||||
browser.expect.element("#categories").to.be.present;
|
||||
browser.expect.element("c-category-list").to.be.present;
|
||||
browser.expect.element("c-category-li").to.be.present;
|
||||
browser.expect.element("c-operation-list").to.be.present;
|
||||
browser.expect.element("c-operation-li").to.be.present;
|
||||
browser.expect.element("#recipe").to.be.visible;
|
||||
browser.expect.element("#rec-list").to.be.visible;
|
||||
browser.expect.element("#controls").to.be.visible;
|
||||
browser.expect.element("#input").to.be.visible;
|
||||
browser.expect.element("#output").to.be.visible;
|
||||
browser.expect.element("#input-text").to.be.visible;
|
||||
browser.expect.element("#output-text").to.be.visible;
|
||||
},
|
||||
|
||||
"Recipe can be run": browser => {
|
||||
const toHex = "//li[contains(@class, 'operation')]/span[text()='To Hex']";
|
||||
const op = "#rec-list .operation .op-title";
|
||||
|
||||
browser
|
||||
.useCss()
|
||||
.click("#search")
|
||||
.expect.element("#categories").to.be.visible;
|
||||
|
||||
// Check that operation is visible
|
||||
browser
|
||||
.useXpath()
|
||||
.expect.element(toHex).to.be.visible;
|
||||
|
||||
// Add it to the recipe by double clicking
|
||||
browser
|
||||
.useXpath()
|
||||
.moveToElement(toHex, 10, 10)
|
||||
.doubleClick("xpath", toHex)
|
||||
.expect.element("//li[contains(@class, 'selected')]").to.be.visible;
|
||||
|
||||
browser
|
||||
.useCss()
|
||||
.click("#close-ops-dropdown-icon")
|
||||
.waitForElementNotVisible("#categories", 1000);
|
||||
|
||||
// Confirm that it has been added to the recipe
|
||||
browser
|
||||
.useCss()
|
||||
.waitForElementVisible(op, 100)
|
||||
.expect.element(op).text.to.contain("To Hex");
|
||||
|
||||
// Enter input
|
||||
browser
|
||||
.useCss()
|
||||
.sendKeys("#input-text .cm-content", "Don't Panic.")
|
||||
.pause(1000)
|
||||
.click("#bake");
|
||||
|
||||
// Check output
|
||||
browser
|
||||
.useCss()
|
||||
.waitForElementNotVisible("#stale-indicator", 1000)
|
||||
.expect.element("#output-text .cm-content").text.that.equals("44 6f 6e 27 74 20 50 61 6e 69 63 2e");
|
||||
|
||||
// Clear recipe
|
||||
browser
|
||||
.useCss()
|
||||
.moveToElement(op, 10, 10)
|
||||
.click("#clr-recipe")
|
||||
.waitForElementNotPresent(op);
|
||||
},
|
||||
|
||||
"Move around the UI": browser => {
|
||||
const otherCat = "//a[contains(@class, 'category-title') and contains(@data-target, '#catOther')]",
|
||||
genUUID = "//li[contains(@class, 'operation')]/span[text()='Generate UUID']";
|
||||
|
||||
browser
|
||||
.useCss()
|
||||
.setValue("#search", "")
|
||||
.click("#search")
|
||||
.expect.element("#categories").to.be.visible;
|
||||
|
||||
browser.useXpath();
|
||||
|
||||
// Scroll to a lower category
|
||||
browser
|
||||
.getLocationInView(otherCat)
|
||||
.expect.element(otherCat).to.be.visible;
|
||||
|
||||
// Open category
|
||||
browser
|
||||
.click(otherCat)
|
||||
.expect.element(genUUID).to.be.visible;
|
||||
|
||||
// Add op to recipe
|
||||
/* mouseButtonUp drops wherever the actual cursor is, not necessarily in the right place,
|
||||
so we can't test Sortable.js properly using Nightwatch. html-dnd doesn't work either.
|
||||
Instead of relying on drag and drop, we double click on the op to load it. */
|
||||
browser
|
||||
.getLocationInView(genUUID)
|
||||
.doubleClick("xpath", genUUID)
|
||||
.useCss()
|
||||
.click("#close-ops-dropdown-icon")
|
||||
.waitForElementNotVisible("#categories", 1000)
|
||||
.waitForElementVisible(".operation .op-title", 1000)
|
||||
.waitForElementNotVisible("#stale-indicator", 1000)
|
||||
.expect.element("#output-text .cm-content").text.which.matches(/[\da-f-]{36}/);
|
||||
|
||||
browser.click("#clr-recipe");
|
||||
},
|
||||
|
||||
"Search": browser => {
|
||||
// Search for an op
|
||||
browser
|
||||
.useCss()
|
||||
.clearValue("#search")
|
||||
.setValue("#search", "md5")
|
||||
.useXpath()
|
||||
.waitForElementVisible("//div[@id='search-results']//strong[text()='MD5']", 1000)
|
||||
.useCss()
|
||||
.setValue("#search", "")
|
||||
.click("#close-ops-dropdown-icon")
|
||||
.waitForElementNotVisible("#categories", 1000);
|
||||
|
||||
},
|
||||
|
||||
after: browser => {
|
||||
browser.end();
|
||||
}
|
||||
};
|
|
@ -93,7 +93,7 @@ const CONTROL_CHAR_NAMES = {
|
|||
module.exports = {
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(1024, 800)
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
.useCss()
|
||||
.waitForElementNotPresent("#preloader", 10000)
|
||||
|
|
|
@ -18,7 +18,7 @@ const utils = require("./browserUtils.js");
|
|||
module.exports = {
|
||||
before: browser => {
|
||||
browser
|
||||
.resizeWindow(1024, 800)
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
.useCss()
|
||||
.waitForElementNotPresent("#preloader", 10000)
|
||||
|
|
|
@ -17,7 +17,7 @@ function clear(browser) {
|
|||
.click("#clr-recipe")
|
||||
.click("#clr-io")
|
||||
.waitForElementNotPresent("#rec-list li.operation")
|
||||
.expect.element("#input-text .cm-content .cm-line").text.that.equals("");
|
||||
.expect.element("#input-text .cm-content").text.that.equals("");
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue