Fix Bug 1410828 - Add a test to verify that the next top site in queue replaces a dismissed top site
This commit is contained in:
Родитель
d6edded289
Коммит
ead5539e4f
|
@ -4,12 +4,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test verifies the menu options for a default top site.
|
||||
*/
|
||||
|
||||
test_newtab({
|
||||
before: setDefaultTopSites,
|
||||
// Test verifies the menu options for a default top site.
|
||||
test: async function defaultTopSites_menuOptions() {
|
||||
await ContentTaskUtils.waitForCondition(() => content.document.querySelector(".top-site-icon"),
|
||||
"Topsite tippytop icon not found");
|
||||
|
@ -25,3 +22,32 @@ test_newtab({
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
test_newtab({
|
||||
before: setDefaultTopSites,
|
||||
// Test verifies that the next top site in queue replaces a dismissed top site.
|
||||
test: async function defaultTopSites_dismiss() {
|
||||
await ContentTaskUtils.waitForCondition(() => content.document.querySelector(".top-site-icon"),
|
||||
"Topsite tippytop icon not found");
|
||||
|
||||
let defaultTopSitesNumber = content.document.querySelector(".top-sites-list").querySelectorAll("[class=\"top-site-outer\"]").length;
|
||||
Assert.equal(defaultTopSitesNumber, 6, "6 top sites are loaded by default");
|
||||
|
||||
let secondTopSite = content.document.querySelector(".top-sites-list li:nth-child(2) a").getAttribute("href");
|
||||
|
||||
let contextMenuItems = content.openContextMenuAndGetOptions(".top-sites-list li:first-child");
|
||||
Assert.equal(contextMenuItems[4].textContent, "Dismiss", "'Dismiss' is the 5th item in the context menu list");
|
||||
|
||||
contextMenuItems[4].querySelector("a").click();
|
||||
|
||||
// Need to wait for dismiss action.
|
||||
await ContentTaskUtils.waitForCondition(() => content.document.querySelector(".top-sites-list li:first-child a").getAttribute("href") === secondTopSite,
|
||||
"First topsite was dismissed");
|
||||
|
||||
defaultTopSitesNumber = content.document.querySelector(".top-sites-list").querySelectorAll("[class=\"top-site-outer\"]").length;
|
||||
Assert.equal(defaultTopSitesNumber, 5, "5 top sites are displayed after one of them is dismissed");
|
||||
},
|
||||
async after() {
|
||||
await new Promise(resolve => NewTabUtils.undoAll(resolve));
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче