Added more UI tests to ensure all modules load, categories can be viewed, and operations can be dragged

This commit is contained in:
n1474335 2019-08-30 11:43:30 +01:00
parent 572f035877
commit 7dfecc38f6

View file

@ -75,7 +75,7 @@ module.exports = {
// Confirm that it has been added to the recipe
browser
.useCss()
.waitForElementVisible(op)
.waitForElementVisible(op, 100)
.expect.element(op).text.to.contain("To Hex");
// Enter input
@ -107,6 +107,10 @@ module.exports = {
loadOp("BSON deserialise", browser)
.waitForElementNotVisible("#output-loader", 5000);
// Charts
loadOp("Entropy", browser)
.waitForElementNotVisible("#output-loader", 5000);
// Ciphers
loadOp("AES Encrypt", browser)
.waitForElementNotVisible("#output-loader", 5000);
@ -135,6 +139,10 @@ module.exports = {
loadOp("Encode text", browser)
.waitForElementNotVisible("#output-loader", 5000);
// Hashing
loadOp("Streebog", browser)
.waitForElementNotVisible("#output-loader", 5000);
// Image
loadOp("Extract EXIF", browser)
.waitForElementNotVisible("#output-loader", 5000);
@ -162,6 +170,62 @@ module.exports = {
// UserAgent
loadOp("Parse User Agent", browser)
.waitForElementNotVisible("#output-loader", 5000);
// YARA
loadOp("YARA Rules", browser)
.waitForElementNotVisible("#output-loader", 5000);
browser.click("#clr-recipe");
},
"Move around the UI": browser => {
const otherCat = "//a[contains(@class, 'category-title') and contains(@data-target, '#catOther')]",
genUUID = "//li[contains(@class, 'operation') and text()='Generate UUID']";
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;
// Drag and drop op into recipe
browser
.getLocationInView(genUUID)
.moveToElement(genUUID, 10, 10)
.mouseButtonDown("left")
.pause(100)
.useCss()
.moveToElement("#rec-list", 10, 10)
.waitForElementVisible(".sortable-ghost", 100)
.mouseButtonUp("left")
/* 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 the drop, we double click on the op to load it. */
.useXpath()
.moveToElement(genUUID, 10, 10)
.doubleClick()
.useCss()
.waitForElementVisible(".operation .op-title", 1000)
.waitForElementNotVisible("#stale-indicator", 1000)
.expect.element("#output-text").to.have.value.which.matches(/[\da-f-]{36}/);
browser.click("#clr-recipe");
},
"Search": browser => {
// Search for an op
browser
.useCss()
.clearValue("#search")
.setValue("#search", "md5")
.useXpath()
.waitForElementVisible("//ul[@id='search-results']//u[text()='MD5']", 1000);
},
after: browser => {