summaryrefslogtreecommitdiffstats
path: root/browser/components/screenshots/tests/browser/browser_test_element_picker.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/screenshots/tests/browser/browser_test_element_picker.js')
-rw-r--r--browser/components/screenshots/tests/browser/browser_test_element_picker.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/browser/components/screenshots/tests/browser/browser_test_element_picker.js b/browser/components/screenshots/tests/browser/browser_test_element_picker.js
new file mode 100644
index 0000000000..17ed2a0190
--- /dev/null
+++ b/browser/components/screenshots/tests/browser/browser_test_element_picker.js
@@ -0,0 +1,56 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+add_task(async function test_element_picker() {
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url: TEST_PAGE,
+ },
+ async browser => {
+ await clearAllTelemetryEvents();
+ let helper = new ScreenshotsHelper(browser);
+
+ helper.triggerUIFromToolbar();
+ await helper.waitForOverlay();
+
+ await helper.clickTestPageElement();
+
+ let rect = await helper.getTestPageElementRect();
+ let region = await helper.getSelectionRegionDimensions();
+
+ is(
+ region.left,
+ rect.left,
+ "The selected region left is the same as the element left"
+ );
+ is(
+ region.right,
+ rect.right,
+ "The selected region right is the same as the element right"
+ );
+ is(
+ region.top,
+ rect.top,
+ "The selected region top is the same as the element top"
+ );
+ is(
+ region.bottom,
+ rect.bottom,
+ "The selected region bottom is the same as the element bottom"
+ );
+
+ mouse.click(10, 10);
+ await helper.waitForStateChange("crosshairs");
+
+ let hoverElementRegionValid = await helper.isHoverElementRegionValid();
+
+ ok(!hoverElementRegionValid, "Hover element rect is null");
+
+ mouse.click(10, 10);
+ await helper.waitForStateChange("crosshairs");
+ }
+ );
+});