Bug 1609906 - add test for about:downloads so we can't completely break it without noticing, r=mak

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2020-02-17 21:12:00 +00:00
parent 676b1a533d
commit fe5e0de70a
2 changed files with 39 additions and 0 deletions

View File

@ -1,6 +1,7 @@
[DEFAULT]
support-files = head.js
[browser_about_downloads.js]
[browser_basic_functionality.js]
[browser_first_download_panel.js]
skip-if = os == "linux" # Bug 949434

View File

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Ensure about:downloads actually works.
*/
add_task(async function test_about_downloads() {
await task_resetState();
registerCleanupFunction(task_resetState);
await setDownloadDir();
await task_addDownloads([
{ state: DownloadsCommon.DOWNLOAD_FINISHED },
{ state: DownloadsCommon.DOWNLOAD_PAUSED },
]);
await BrowserTestUtils.withNewTab("about:downloads", async function(browser) {
await SpecialPowers.spawn(browser, [], async function() {
let box = content.document.getElementById("downloadsRichListBox");
ok(box, "Should have list of downloads");
is(box.children.length, 2, "Should have 2 downloads.");
for (let kid of box.children) {
let desc = kid.querySelector(".downloadTarget");
is(
desc.value,
"dm-ui-test.file",
"Should have listed the file name for this download."
);
}
info("Wait for the first item to be selected.");
await ContentTaskUtils.waitForCondition(() => {
return box.firstChild.selected;
}, "Timed out waiting for the first item to be selected.");
});
});
});