Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: asan
- Manifest: devtools/client/webconsole/test/browser/_webconsole.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
const TEST_URI =
"data:text/html,<!DOCTYPE html>Test copy to clipboard on the console output";
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
const smokeMessage = "Hello world!";
const onMessage = waitForMessageByType(hud, smokeMessage, ".console-api");
SpecialPowers.spawn(gBrowser.selectedBrowser, [smokeMessage], function (msg) {
content.wrappedJSObject.console.log(msg);
});
const { node } = await onMessage;
ok(true, "Message was logged");
const selection = selectNode(hud, node);
const selectionString = selection.toString().trim();
is(
selectionString,
smokeMessage,
`selection has expected "${smokeMessage}" value`
);
await waitForClipboardPromise(
() => {
// The focus is on the JsTerm, so we need to blur it for the copy comand to work.
node.ownerDocument.activeElement.blur();
goDoCommand("cmd_copy");
},
data => {
return data.trim() === smokeMessage;
}
);
});