зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730273 - Test for Pocket panel closing unexpectedly. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D125486
This commit is contained in:
Родитель
8761eb8cee
Коммит
f702f05fde
|
@ -6,5 +6,6 @@ support-files =
|
|||
[browser_pocket_ui_check.js]
|
||||
[browser_pocket_context_menu_action.js]
|
||||
[browser_pocket_panel.js]
|
||||
[browser_pocket_panel_closemenu.js]
|
||||
[browser_pocket_home_panel.js]
|
||||
[browser_pocket_button_icon_state.js]
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
// This is testing the fix in bug 1729847, specifically
|
||||
// clicking enter while the pocket panel is open should not close the panel.
|
||||
add_task(async function() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"https://example.com/browser/browser/components/pocket/test/test.html"
|
||||
);
|
||||
|
||||
info("clicking on pocket button in toolbar");
|
||||
let pocketButton = document.getElementById("save-to-pocket-button");
|
||||
// The panel is created on the fly, so we can't simply wait for focus
|
||||
// inside it.
|
||||
let pocketPanelShowing = BrowserTestUtils.waitForEvent(
|
||||
document,
|
||||
"popupshowing",
|
||||
true
|
||||
);
|
||||
pocketButton.click();
|
||||
await pocketPanelShowing;
|
||||
|
||||
let pocketPanel = document.getElementById("customizationui-widget-panel");
|
||||
let pocketFrame = pocketPanel.querySelector("browser");
|
||||
|
||||
const getReadyState = async frame =>
|
||||
SpecialPowers.spawn(frame, [], () => content.document.readyState);
|
||||
|
||||
// Ensure Pocket panel is ready to avoid intermittency.
|
||||
await TestUtils.waitForCondition(
|
||||
async () => (await getReadyState(pocketFrame)) == "complete"
|
||||
);
|
||||
|
||||
// Ensure that the document layout has been flushed before triggering the focus event
|
||||
// (See Bug 1519808 for a rationale).
|
||||
await pocketFrame.ownerGlobal.promiseDocumentFlushed(() => {});
|
||||
|
||||
// The panelview should have closemenu="none".
|
||||
// Without closemenu="none", the following sequence of
|
||||
// frame focus then enter would close the panel,
|
||||
// but we don't want it to close, we want it to stay open.
|
||||
let focusEventPromise = BrowserTestUtils.waitForEvent(pocketFrame, "focus");
|
||||
pocketFrame.focus();
|
||||
await focusEventPromise;
|
||||
EventUtils.synthesizeKey("VK_RETURN");
|
||||
|
||||
// Is the Pocket panel still open?
|
||||
is(pocketPanel.state, "open", "pocket panel is showing");
|
||||
|
||||
// We're done now, we can close the panel.
|
||||
info("closing pocket panel");
|
||||
let pocketPanelHidden = BrowserTestUtils.waitForEvent(
|
||||
pocketPanel,
|
||||
"popuphidden"
|
||||
);
|
||||
pocketPanel.hidePopup();
|
||||
await pocketPanelHidden;
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
Загрузка…
Ссылка в новой задаче