@@ -181,14 +181,14 @@
Recipe
-
From 0f0efefbf7e890c594daefe0436f38d7b0b73a8a Mon Sep 17 00:00:00 2001
From: zb3
Date: Fri, 5 Apr 2024 17:13:05 +0200
Subject: [PATCH 3/4] Make expectOutput actually check the output
---
tests/browser/browserUtils.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tests/browser/browserUtils.js b/tests/browser/browserUtils.js
index 4a559758..18a56b49 100644
--- a/tests/browser/browserUtils.js
+++ b/tests/browser/browserUtils.js
@@ -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
From 4652608297f88e5bbf4c7cae7c1e91bcdb4eef92 Mon Sep 17 00:00:00 2001
From: zb3
Date: Fri, 5 Apr 2024 17:14:05 +0200
Subject: [PATCH 4/4] Fix character encoding io test
Since the output encoding autodetection was introduced, this test was no longer correct.
That wasn't detected because of the expectOutput bug.
---
tests/browser/01_io.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tests/browser/01_io.js b/tests/browser/01_io.js
index 6791c88e..c139afa9 100644
--- a/tests/browser/01_io.js
+++ b/tests/browser/01_io.js
@@ -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");