mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 15:25:01 -04:00
adding prettier
This commit is contained in:
parent
c5a1b69c30
commit
ab0bc52d3c
717 changed files with 29324 additions and 18602 deletions
|
@ -48,12 +48,12 @@ const ALL_BYTES = [
|
|||
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
|
||||
"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf",
|
||||
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
|
||||
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
|
||||
].join("");
|
||||
|
||||
const PUA_CHARS = "\ue000\ue001\uf8fe\uf8ff";
|
||||
|
||||
const MULTI_LINE_STRING =`"You know," said Arthur, "it's at times like this, when I'm trapped in a Vogon airlock with a man from Betelgeuse, and about to die of asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young."
|
||||
const MULTI_LINE_STRING = `"You know," said Arthur, "it's at times like this, when I'm trapped in a Vogon airlock with a man from Betelgeuse, and about to die of asphyxiation in deep space that I really wish I'd listened to what my mother told me when I was young."
|
||||
"Why, what did she tell you?"
|
||||
"I don't know, I didn't listen."`;
|
||||
|
||||
|
@ -91,7 +91,7 @@ const CONTROL_CHAR_NAMES = {
|
|||
};
|
||||
|
||||
module.exports = {
|
||||
before: browser => {
|
||||
before: (browser) => {
|
||||
browser
|
||||
.resizeWindow(1280, 800)
|
||||
.url(browser.launchUrl)
|
||||
|
@ -100,7 +100,7 @@ module.exports = {
|
|||
.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"CodeMirror has loaded correctly": browser => {
|
||||
"CodeMirror has loaded correctly": (browser) => {
|
||||
/* Editor has initialised */
|
||||
browser
|
||||
.useCss()
|
||||
|
@ -121,29 +121,45 @@ module.exports = {
|
|||
browser // Input
|
||||
.waitForElementVisible("#input-text .cm-status-bar")
|
||||
.waitForElementVisible("#input-text .cm-status-bar .stats-length-value")
|
||||
.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("0");
|
||||
browser.waitForElementVisible("#input-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("1");
|
||||
browser.waitForElementVisible("#input-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#input-text .cm-status-bar .chr-enc-value").text.to.equal("Raw Bytes");
|
||||
browser.waitForElementVisible("#input-text .cm-status-bar .eol-value")
|
||||
.expect.element("#input-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
.expect.element("#input-text .cm-status-bar .stats-length-value")
|
||||
.text.to.equal("0");
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value")
|
||||
.text.to.equal("1");
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#input-text .cm-status-bar .chr-enc-value")
|
||||
.text.to.equal("Raw Bytes");
|
||||
browser
|
||||
.waitForElementVisible("#input-text .cm-status-bar .eol-value")
|
||||
.expect.element("#input-text .cm-status-bar .eol-value")
|
||||
.text.to.equal("LF");
|
||||
|
||||
browser // Output
|
||||
.waitForElementVisible("#output-text .cm-status-bar")
|
||||
.waitForElementVisible("#output-text .cm-status-bar .stats-length-value")
|
||||
.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("0");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("1");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .baking-time-info")
|
||||
.expect.element("#output-text .cm-status-bar .baking-time-info").text.to.contain("ms");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#output-text .cm-status-bar .chr-enc-value").text.to.equal("Raw Bytes");
|
||||
browser.waitForElementVisible("#output-text .cm-status-bar .eol-value")
|
||||
.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
.expect.element("#output-text .cm-status-bar .stats-length-value")
|
||||
.text.to.equal("0");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .stats-lines-value")
|
||||
.expect.element("#output-text .cm-status-bar .stats-lines-value")
|
||||
.text.to.equal("1");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .baking-time-info")
|
||||
.expect.element("#output-text .cm-status-bar .baking-time-info")
|
||||
.text.to.contain("ms");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .chr-enc-value")
|
||||
.expect.element("#output-text .cm-status-bar .chr-enc-value")
|
||||
.text.to.equal("Raw Bytes");
|
||||
browser
|
||||
.waitForElementVisible("#output-text .cm-status-bar .eol-value")
|
||||
.expect.element("#output-text .cm-status-bar .eol-value")
|
||||
.text.to.equal("LF");
|
||||
},
|
||||
|
||||
"Adding content": browser => {
|
||||
"Adding content": (browser) => {
|
||||
/* Status bar updates correctly */
|
||||
utils.setInput(browser, MULTI_LINE_STRING);
|
||||
|
||||
|
@ -167,23 +183,32 @@ module.exports = {
|
|||
browser.expect.element("#output-text .cm-status-bar .eol-value").text.to.equal("LF");
|
||||
},
|
||||
|
||||
"Special content": browser => {
|
||||
"Special content": (browser) => {
|
||||
/* Special characters are rendered correctly */
|
||||
utils.setInput(browser, SPECIAL_CHARS, false);
|
||||
|
||||
// First line
|
||||
for (let i = 0x0; i <= 0x8; i++) {
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.text.to.equal(String.fromCharCode(0x2400 + i));
|
||||
}
|
||||
|
||||
// Tab \u0009
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/\u0009$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/\u0009$/);
|
||||
|
||||
// Line feed \u000a
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/^.{10}$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{10}$/);
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
// Second line
|
||||
|
@ -192,9 +217,12 @@ module.exports = {
|
|||
const name = CONTROL_CHAR_NAMES[index] || "0x" + index.toString(16);
|
||||
const value = index >= 32 ? "\u2022" : String.fromCharCode(0x2400 + index);
|
||||
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
.to.have.property("title").equals(`Control character ${name}`);
|
||||
browser.expect.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${name}`);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.text.to.equal(value);
|
||||
}
|
||||
|
||||
|
@ -204,17 +232,26 @@ module.exports = {
|
|||
|
||||
// First line
|
||||
for (let i = 0x0; i <= 0x8; i++) {
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i+1})`)
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.text.to.equal(String.fromCharCode(0x2400 + i));
|
||||
}
|
||||
|
||||
// Tab \u0009
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/\u0009$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/\u0009$/);
|
||||
|
||||
// Line feed \u000a
|
||||
browser.expect.element(`#output-text .cm-line:nth-of-type(1)`).to.have.property("textContent").match(/^.{10}$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-line:nth-of-type(1)`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{10}$/);
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
// Second line
|
||||
|
@ -223,20 +260,25 @@ module.exports = {
|
|||
const name = CONTROL_CHAR_NAMES[index] || "0x" + index.toString(16);
|
||||
const value = index >= 32 ? "\u2022" : String.fromCharCode(0x2400 + index);
|
||||
|
||||
browser.expect.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
.to.have.property("title").equals(`Control character ${name}`);
|
||||
browser.expect.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i-10})`)
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${name}`);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content .cm-line:nth-of-type(2) .cm-specialChar:nth-of-type(${i - 10})`)
|
||||
.text.to.equal(value);
|
||||
}
|
||||
|
||||
/* Bytes are rendered correctly */
|
||||
utils.setInput(browser, ALL_BYTES, false);
|
||||
// Expect length to be 255, since one character is creating a newline
|
||||
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^.{255}$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{255}$/);
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("256");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
|
||||
/* PUA \ue000-\uf8ff */
|
||||
utils.setInput(browser, PUA_CHARS, false);
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
|
@ -250,8 +292,14 @@ module.exports = {
|
|||
Therefore, PUA characters should be rendered normally in the Input but as control character
|
||||
pictures in the output.
|
||||
*/
|
||||
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^\ue000\ue001\uf8fe\uf8ff$/);
|
||||
browser.expect.element(`#output-text .cm-content`).to.have.property("textContent").match(/^\u2400\u2401\u3cfe\u3cff$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^\ue000\ue001\uf8fe\uf8ff$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^\u2400\u2401\u3cfe\u3cff$/);
|
||||
|
||||
/* Can be copied */
|
||||
utils.setInput(browser, SPECIAL_CHARS, false);
|
||||
|
@ -266,28 +314,28 @@ module.exports = {
|
|||
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
|
||||
|
||||
// Ensure that the values are as expected
|
||||
browser.expect.element("#search").to.have.value.that.equals("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008");
|
||||
browser.expect
|
||||
.element("#search")
|
||||
.to.have.value.that.equals("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008");
|
||||
browser.clearValue("#search");
|
||||
|
||||
// Raw copy
|
||||
browser
|
||||
.click("#copy-output")
|
||||
.pause(100);
|
||||
browser.click("#copy-output").pause(100);
|
||||
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
|
||||
|
||||
// Ensure that the values are as expected
|
||||
browser.expect.element("#search").to.have.value.that.matches(/^\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009/);
|
||||
browser.expect
|
||||
.element("#search")
|
||||
.to.have.value.that.matches(/^\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009/);
|
||||
browser.clearValue("#search");
|
||||
},
|
||||
|
||||
"HTML output": browser => {
|
||||
"HTML output": (browser) => {
|
||||
/* Displays correctly */
|
||||
utils.loadRecipe(browser, "Entropy", ALL_BYTES);
|
||||
utils.bake(browser);
|
||||
|
||||
browser
|
||||
.waitForElementVisible("#output-html")
|
||||
.waitForElementVisible("#output-html #chart-area");
|
||||
browser.waitForElementVisible("#output-html").waitForElementVisible("#output-html #chart-area");
|
||||
|
||||
/* Status bar widgets are disabled */
|
||||
browser.expect.element("#output-text .cm-status-bar .disabled .stats-length-value").to.be.visible;
|
||||
|
@ -300,17 +348,18 @@ module.exports = {
|
|||
utils.bake(browser);
|
||||
|
||||
for (let i = 0x0; i <= 0x4; i++) {
|
||||
browser.expect.element(`#output-html .cm-specialChar:nth-of-type(${i+1})`)
|
||||
.to.have.property("title").equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect.element(`#output-html .cm-specialChar:nth-of-type(${i+1})`)
|
||||
browser.expect
|
||||
.element(`#output-html .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.to.have.property("title")
|
||||
.equals(`Control character ${CONTROL_CHAR_NAMES[i] || "0x" + i.toString(16)}`);
|
||||
browser.expect
|
||||
.element(`#output-html .cm-specialChar:nth-of-type(${i + 1})`)
|
||||
.text.to.equal(String.fromCharCode(0x2400 + i));
|
||||
}
|
||||
|
||||
/* Can be copied */
|
||||
// Raw copy
|
||||
browser
|
||||
.click("#copy-output")
|
||||
.pause(100);
|
||||
browser.click("#copy-output").pause(100);
|
||||
utils.paste(browser, "#search"); // Paste into search box as this won't mess with the values
|
||||
|
||||
// Ensure that the values are as expected
|
||||
|
@ -318,7 +367,7 @@ module.exports = {
|
|||
browser.clearValue("#search");
|
||||
},
|
||||
|
||||
"Highlighting": browser => {
|
||||
"Highlighting": (browser) => {
|
||||
utils.setInput(browser, SELECTABLE_STRING);
|
||||
utils.bake(browser);
|
||||
|
||||
|
@ -376,14 +425,17 @@ module.exports = {
|
|||
browser.click("#auto-bake-label");
|
||||
},
|
||||
|
||||
"Character encoding": browser => {
|
||||
"Character encoding": (browser) => {
|
||||
const CHINESE_CHARS = "不要恐慌。";
|
||||
/* Dropup works */
|
||||
/* Selecting changes output correctly */
|
||||
utils.setInput(browser, CHINESE_CHARS, false);
|
||||
utils.setChrEnc(browser, "input", "UTF-8");
|
||||
utils.bake(browser);
|
||||
utils.expectOutput(browser, "\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u0081\u0090\u00E6\u0085\u008C\u00E3\u0080\u0082");
|
||||
utils.expectOutput(
|
||||
browser,
|
||||
"\u00E4\u00B8\u008D\u00E8\u00A6\u0081\u00E6\u0081\u0090\u00E6\u0085\u008C\u00E3\u0080\u0082"
|
||||
);
|
||||
|
||||
/* Changing output to match input works as expected */
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
|
@ -395,9 +447,7 @@ module.exports = {
|
|||
browser.assert.urlContains("oenc=65001");
|
||||
|
||||
/* Preserved when changing tabs */
|
||||
browser
|
||||
.click("#btn-new-tab")
|
||||
.waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.click("#btn-new-tab").waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.expect.element("#input-text .chr-enc-value").text.that.equals("Raw Bytes");
|
||||
browser.expect.element("#output-text .chr-enc-value").text.that.equals("Raw Bytes");
|
||||
|
||||
|
@ -435,7 +485,7 @@ module.exports = {
|
|||
utils.expectOutput(browser, "\u00A4\u0408\u00ADn\u00AE\u0408\u00B7W\u040EC");
|
||||
},
|
||||
|
||||
"Line endings": browser => {
|
||||
"Line endings": (browser) => {
|
||||
/* Dropup works */
|
||||
/* Selecting changes view in input */
|
||||
utils.setInput(browser, MULTI_LINE_STRING);
|
||||
|
@ -530,7 +580,9 @@ module.exports = {
|
|||
.waitForElementPresent("#input-text .cm-content .cm-line:nth-of-type(2)")
|
||||
.waitForElementNotPresent("#input-text .cm-content .cm-line:nth-of-type(3)")
|
||||
.waitForElementPresent("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)");
|
||||
browser.expect.element("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)").text.to.equal("␋");
|
||||
browser.expect
|
||||
.element("#input-text .cm-content .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(3)")
|
||||
.text.to.equal("␋");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("304");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
|
@ -549,9 +601,7 @@ module.exports = {
|
|||
browser.assert.urlContains("oeol=%0D");
|
||||
|
||||
/* Preserved when changing tabs */
|
||||
browser
|
||||
.click("#btn-new-tab")
|
||||
.waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.click("#btn-new-tab").waitForElementVisible("#input-tabs li:nth-of-type(2).active-input-tab");
|
||||
browser.expect.element("#input-text .eol-value").text.that.equals("LF");
|
||||
browser.expect.element("#output-text .eol-value").text.that.equals("LF");
|
||||
|
||||
|
@ -565,7 +615,7 @@ module.exports = {
|
|||
browser.expect.element("#output-text .eol-value").text.that.equals("CR");
|
||||
},
|
||||
|
||||
"File inputs": browser => {
|
||||
"File inputs": (browser) => {
|
||||
utils.clear(browser);
|
||||
|
||||
/* Side panel displays correct info */
|
||||
|
@ -589,16 +639,20 @@ module.exports = {
|
|||
.click("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.waitForElementNotPresent("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-hidden")
|
||||
.expect.element("#input-text .cm-file-details").to.have.css("width").which.equals("1px");
|
||||
.expect.element("#input-text .cm-file-details")
|
||||
.to.have.css("width")
|
||||
.which.equals("1px");
|
||||
|
||||
browser
|
||||
.click("#input-text .cm-file-details .file-details-toggle-hidden")
|
||||
.waitForElementNotPresent("#input-text .cm-file-details .file-details-toggle-hidden")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-toggle-shown")
|
||||
.expect.element("#input-text .cm-file-details").to.have.css("width").which.equals("200px");
|
||||
.expect.element("#input-text .cm-file-details")
|
||||
.to.have.css("width")
|
||||
.which.equals("200px");
|
||||
},
|
||||
|
||||
"Folder inputs": browser => {
|
||||
"Folder inputs": (browser) => {
|
||||
utils.clear(browser);
|
||||
|
||||
/* Side panel displays correct info */
|
||||
|
@ -619,19 +673,35 @@ module.exports = {
|
|||
.waitForElementVisible("#input-text .cm-file-details .file-details-type")
|
||||
.waitForElementVisible("#input-text .cm-file-details .file-details-loaded");
|
||||
|
||||
browser.getText("#input-text .cm-file-details .file-details-name", function(result) {
|
||||
browser.getText("#input-text .cm-file-details .file-details-name", function (result) {
|
||||
switch (result.value) {
|
||||
case "TowelDay.jpeg":
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-name").text.that.equals("TowelDay.jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-size").text.that.equals("61,379 bytes");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-type").text.that.equals("image/jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-loaded").text.that.equals("100%");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-name")
|
||||
.text.that.equals("TowelDay.jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-size")
|
||||
.text.that.equals("61,379 bytes");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-type")
|
||||
.text.that.equals("image/jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-loaded")
|
||||
.text.that.equals("100%");
|
||||
break;
|
||||
case "Hitchhikers_Guide.jpeg":
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-name").text.that.equals("Hitchhikers_Guide.jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-size").text.that.equals("36,595 bytes");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-type").text.that.equals("image/jpeg");
|
||||
browser.expect.element("#input-text .cm-file-details .file-details-loaded").text.that.equals("100%");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-name")
|
||||
.text.that.equals("Hitchhikers_Guide.jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-size")
|
||||
.text.that.equals("36,595 bytes");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-type")
|
||||
.text.that.equals("image/jpeg");
|
||||
browser.expect
|
||||
.element("#input-text .cm-file-details .file-details-loaded")
|
||||
.text.that.equals("100%");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -640,13 +710,18 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
"Loading from URL": browser => {
|
||||
"Loading from URL": (browser) => {
|
||||
/* Complex deep link populates the input correctly (encoding, eol, input) */
|
||||
browser
|
||||
.urlHash("recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=VGhlIHNoaXBzIGh1bmcgaW4gdGhlIHNreSBpbiBtdWNoIHRoZSBzYW1lIHdheSB0aGF0IGJyaWNrcyBkb24ndC4M&ienc=21866&oenc=1201&ieol=%0C&oeol=%E2%80%A9")
|
||||
.urlHash(
|
||||
"recipe=To_Base64('A-Za-z0-9%2B/%3D')&input=VGhlIHNoaXBzIGh1bmcgaW4gdGhlIHNreSBpbiBtdWNoIHRoZSBzYW1lIHdheSB0aGF0IGJyaWNrcyBkb24ndC4M&ienc=21866&oenc=1201&ieol=%0C&oeol=%E2%80%A9"
|
||||
)
|
||||
.waitForElementVisible("#rec-list li.operation");
|
||||
|
||||
browser.expect.element(`#input-text .cm-content`).to.have.property("textContent").match(/^.{65}$/);
|
||||
browser.expect
|
||||
.element(`#input-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{65}$/);
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("66");
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
|
||||
|
@ -658,14 +733,21 @@ module.exports = {
|
|||
|
||||
utils.bake(browser);
|
||||
|
||||
browser.expect.element(`#output-text .cm-content`).to.have.property("textContent").match(/^.{44}$/);
|
||||
browser.expect
|
||||
.element(`#output-text .cm-content`)
|
||||
.to.have.property("textContent")
|
||||
.match(/^.{44}$/);
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("44");
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-lines-value").text.to.equal("1");
|
||||
},
|
||||
|
||||
"Replace input with output": browser => {
|
||||
"Replace input with output": (browser) => {
|
||||
/* Input is correctly populated */
|
||||
utils.loadRecipe(browser, "XOR", "The ships hung in the sky in much the same way that bricks don't.", [{ "option": "Hex", "string": "65" }, "Standard", false]);
|
||||
utils.loadRecipe(browser, "XOR", "The ships hung in the sky in much the same way that bricks don't.", [
|
||||
{ "option": "Hex", "string": "65" },
|
||||
"Standard",
|
||||
false
|
||||
]);
|
||||
utils.setChrEnc(browser, "input", "UTF-32LE");
|
||||
utils.setChrEnc(browser, "output", "UTF-7");
|
||||
utils.setEOLSeq(browser, "input", "CRLF");
|
||||
|
@ -673,7 +755,8 @@ module.exports = {
|
|||
|
||||
browser
|
||||
.sendKeys("#input-text .cm-content", browser.Keys.RETURN)
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value").text.to.equal("2");
|
||||
.expect.element("#input-text .cm-status-bar .stats-lines-value")
|
||||
.text.to.equal("2");
|
||||
utils.bake(browser);
|
||||
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("67");
|
||||
|
@ -682,9 +765,7 @@ module.exports = {
|
|||
browser.expect.element("#input-text .eol-value").text.that.equals("CRLF");
|
||||
browser.expect.element("#output-text .cm-status-bar .stats-length-value").text.to.equal("268");
|
||||
|
||||
browser
|
||||
.click("#switch")
|
||||
.waitForElementVisible("#stale-indicator");
|
||||
browser.click("#switch").waitForElementVisible("#stale-indicator");
|
||||
|
||||
browser.expect.element("#input-text .cm-status-bar .stats-length-value").text.to.equal("268");
|
||||
|
||||
|
@ -693,12 +774,13 @@ module.exports = {
|
|||
browser.expect.element("#input-text .chr-enc-value").text.that.equals("UTF-7");
|
||||
browser.expect.element("#input-text .eol-value").text.that.equals("LS");
|
||||
browser.expect.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(1)").text.to.equal("␍");
|
||||
browser.expect.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(49)").text.to.equal("␑");
|
||||
browser.expect
|
||||
.element("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(49)")
|
||||
.text.to.equal("␑");
|
||||
browser.waitForElementNotPresent("#input-text .cm-line:nth-of-type(1) .cm-specialChar:nth-of-type(50)");
|
||||
},
|
||||
|
||||
|
||||
after: browser => {
|
||||
after: (browser) => {
|
||||
browser.end();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue