summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_screenshot_node_warning.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/inspector/markup/test/browser_markup_screenshot_node_warning.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_screenshot_node_warning.js b/devtools/client/inspector/markup/test/browser_markup_screenshot_node_warning.js
new file mode 100644
index 0000000000..2ae713455a
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_screenshot_node_warning.js
@@ -0,0 +1,38 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_URL = `data:text/html;charset=utf8,
+ <div id="blue-node" style="width:30px;height:11000px;background:rgb(0, 0, 255)"></div>`;
+
+// Test taking a screenshot of a tall node displays a warning message in the notification box.
+add_task(async function () {
+ const { inspector, toolbox } = await openInspectorForURL(encodeURI(TEST_URL));
+
+ info("Select the blue node");
+ await selectNode("#blue-node", inspector);
+
+ info("Take a screenshot of the blue node and verify it looks as expected");
+ const blueScreenshot = await takeNodeScreenshot(inspector);
+ await assertSingleColorScreenshotImage(blueScreenshot, 30, 10000, {
+ r: 0,
+ g: 0,
+ b: 255,
+ });
+
+ info(
+ "Check that a warning message was displayed to indicate the screenshot was truncated"
+ );
+ const notificationBox = await waitFor(() =>
+ toolbox.doc.querySelector(".notificationbox")
+ );
+
+ const message = notificationBox.querySelector(".notification").textContent;
+ ok(
+ message.startsWith("The image was cut off"),
+ `The warning message is rendered as expected (${message})`
+ );
+
+ await toolbox.destroy();
+});