Bug 1407945: Add a test for the tooltip in RDM. r=pbro

Differential Revision: https://phabricator.services.mozilla.com/D38827

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daisuke Akatsuka 2019-07-23 13:54:32 +00:00
Родитель 7ddb98f9d5
Коммит 43bb97631f
2 изменённых файлов: 28 добавлений и 0 удалений

Просмотреть файл

@ -76,6 +76,7 @@ skip-if = fission
skip-if = os == "linux" || os == "mac" # Bug 1498336
[browser_toolbox_swap_browsers.js]
[browser_toolbox_swap_inspector.js]
[browser_tooltip.js]
[browser_touch_device.js]
[browser_touch_does_not_trigger_hover_states.js]
[browser_touch_simulation.js]

Просмотреть файл

@ -0,0 +1,27 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_CONTENT = `<h1 title="test title">test h1</h1>`;
const TEST_URL = `data:text/html;charset=utf-8,${ encodeURIComponent(TEST_CONTENT) }`;
// Test for the tooltip coordinate on the browsing document in RDM.
addRDMTask(TEST_URL, async ({ ui }) => {
info("Show a tooltip");
await spawnViewportTask(ui, {}, () => {
const target = content.document.querySelector("h1");
const { x: targetX, y: targetY } = target.getClientRects()[0];
content.windowUtils.sendMouseEvent("mouseover", targetX, targetY, 0, 0, 0);
content.windowUtils.sendMouseEvent("mousemove", targetX + 1, targetY, 0, 0, 0);
});
info("Wait for showing the tooltip");
const tooltip =
ui.browserWindow.gBrowser.ownerDocument.getElementById("remoteBrowserTooltip");
await waitUntil(() => tooltip.state === "open");
info("Test the X coordinate of the tooltip");
isnot(tooltip.screenX, 0, "The X coordinate of tooltip should not be 0");
});