Automatic update from web-platform-tests [wpt] Convert console manual tests to Bidi-based automation. Convert several manual WPT console tests to automated testharness.js tests using WebDriver BiDi log.entryAdded via testdriver.js?feature=bidi. Changes: - Remove manual tests: console-count-logging-manual.html console-countReset-logging-manual.html console-number-format-specifiers-symbol-manual.html console-timing-logging-manual.html - Add automated tests: console-count-logging.html console-countReset-logging.html console-number-format-specifiers-symbol.html console-timing-logging.html console-timing-missing-label-warnings.tentative.html - Update NeverFixTests accordingly. Bug: 489738791 Change-Id: Iba1718b4e423391cc8a186664a3889002e87c4fd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7657323 Commit-Queue: Minju Kim <mkim@igalia.com> Reviewed-by: Alex N. Jose <alexnj@chromium.org> Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/main@{#1607021} -- wpt-commits: be3f3ee1b16088d9d593119061578df45070a0fd wpt-pr: 58820
54 lines
2.0 KiB
HTML
54 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>Console Number Format Specifiers on Symbols - Automated Test</title>
|
|
<link rel="help" href="https://console.spec.whatwg.org/#formatter">
|
|
<meta name="assert" content="Console format specifiers on Symbols">
|
|
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js?feature=bidi"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script src="/console/helper.js"></script>
|
|
|
|
<script>
|
|
promise_test(async (t) => {
|
|
const unsubscribe = await test_driver.bidi.log.entry_added.subscribe({ contexts: [window] });
|
|
t.add_cleanup(async () => await unsubscribe());
|
|
|
|
const methods = ["log", "dirxml", "trace", "group", "groupCollapsed"];
|
|
const specifiers = ["%i", "%d", "%f"];
|
|
const expectedCount = methods.length * specifiers.length;
|
|
const sym = Symbol.for("description");
|
|
const entriesPromise = waitForConsoleEntries(t, {
|
|
count: expectedCount,
|
|
accept: (entry) => {
|
|
if (!Array.isArray(entry.args) || entry.args.length < 2) return false;
|
|
const arg = entry.args[0];
|
|
if (!arg || arg.type !== "string" || typeof arg.value !== "string") return false;
|
|
|
|
return specifiers.includes(arg.value);
|
|
}
|
|
});
|
|
|
|
for (const method of methods) {
|
|
for (const spec of specifiers) {
|
|
console[method](spec, sym);
|
|
if (method === "group" || method === "groupCollapsed")
|
|
console.groupEnd();
|
|
}
|
|
}
|
|
|
|
const entries = await entriesPromise;
|
|
assert_equals(entries.length, expectedCount);
|
|
|
|
for (const entry of entries) {
|
|
const firstLine = entry.text.split("\n", 1)[0].trim();
|
|
if (entry.method === "trace") {
|
|
assert_true(firstLine.endsWith("NaN"), `Expected trace first line to end with NaN, got: "${firstLine}"`);
|
|
} else {
|
|
assert_equals(firstLine, "NaN", `Expected first line to be "NaN", got: "${firstLine}"`);
|
|
}
|
|
}
|
|
}, "Console numeric format specifiers on Symbols produce NaN");
|
|
</script>
|