mirror of
https://github.com/gchq/CyberChef
synced 2025-01-01 07:18:47 +00:00
Merge pull request #1783 from zb3/fix-expectOutput
This commit is contained in:
commit
8c283c7b19
2 changed files with 13 additions and 8 deletions
|
@ -383,13 +383,17 @@ module.exports = {
|
|||
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");
|
||||
|
||||
/* Changing output to match input works as expected */
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
utils.bake(browser);
|
||||
/* Output encoding should be autodetected */
|
||||
browser
|
||||
.waitForElementVisible("#snackbar-container .snackbar-content", 5000)
|
||||
.expect.element("#snackbar-container .snackbar-content").text.to.equal("Output character encoding has been detected and changed to UTF-8");
|
||||
|
||||
utils.expectOutput(browser, CHINESE_CHARS);
|
||||
|
||||
/* Change the output encoding manually to test for URL presence */
|
||||
utils.setChrEnc(browser, "output", "UTF-8");
|
||||
|
||||
/* Encodings appear in the URL */
|
||||
browser.assert.urlContains("ienc=65001");
|
||||
browser.assert.urlContains("oenc=65001");
|
||||
|
|
|
@ -176,13 +176,14 @@ function loadRecipe(browser, opName, input, args) {
|
|||
*/
|
||||
function expectOutput(browser, expected) {
|
||||
browser.execute(expected => {
|
||||
const output = window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
return window.app.manager.output.outputEditorView.state.doc.toString();
|
||||
}, [expected], function({value}) {
|
||||
if (expected instanceof RegExp) {
|
||||
return expected.test(output);
|
||||
browser.expect(value).match(expected);
|
||||
} else {
|
||||
return expected === output;
|
||||
browser.expect(value).to.be.equal(expected);
|
||||
}
|
||||
}, [expected]);
|
||||
});
|
||||
}
|
||||
|
||||
/** @function
|
||||
|
|
Loading…
Reference in a new issue