Loading toolkit/mozapps/extensions/test/browser/browser_html_mlmodel_addons.js +8 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ add_task(async function testModelHubProvider() { .getElementById("categories") .getButtonByName("mlmodel"); await BrowserTestUtils.waitForCondition(async () => { return modelHubCategory.hidden; }, "Wait for the mlmodel category button to be hidden"); ok(modelHubCategory.hidden, "Model hub category is hidden"); await closeView(win); Loading Loading @@ -74,6 +78,10 @@ add_task(async function testModelHubProvider() { .getElementById("categories") .getButtonByName("mlmodel"); await BrowserTestUtils.waitForCondition(async () => { return !modelHubCategory.hidden; }, "Wait for the mlmodel category button to not be hidden"); ok(!modelHubCategory.hidden, "Model hub category is shown"); let mlmodelLoaded = waitForViewLoad(win); Loading toolkit/mozapps/extensions/test/browser/browser_sidebar_hidden_categories.js +28 −2 Original line number Diff line number Diff line Loading @@ -27,13 +27,17 @@ function installLocale() { }); } async function checkCategory(win, category, { expectHidden, expectSelected }) { async function getCategoryButton(win, category) { await win.customElements.whenDefined("categories-box"); let categoriesBox = win.document.getElementById("categories"); await categoriesBox.promiseRendered; return categoriesBox.getButtonByName(category); } async function checkCategory(win, category, { expectHidden, expectSelected }) { let button = await getCategoryButton(win, category); let button = categoriesBox.getButtonByName(category); is( button.hidden, expectHidden, Loading Loading @@ -112,6 +116,18 @@ add_task(async function testLocalesHiddenWhenUninstalled() { }); let win = await viewLoaded; // CategoriesBox updateHiddenCategories method is async // and it calls AddonManager getAddonsByTypes and // getInstallsByTypes async methods to determine which // of the hidden categories may need to be shown // and so the assertion may hit a race if any of the // providers is taking longer to resolve the getAddonsByTypes // async call. await BrowserTestUtils.waitForCondition(async () => { const button = await getCategoryButton(win, "locale"); return button.hidden; }, "Wait for the locale category button to be hidden"); await checkCategory(win, "locale", { expectHidden: true }); await closeView(win); Loading @@ -128,6 +144,11 @@ add_task(async function testLocalesHiddenWithoutDelay() { }); let win = await viewLoaded; await BrowserTestUtils.waitForCondition(async () => { const button = await getCategoryButton(win, "locale"); return button.hidden; }, "Wait for the locale category button to be hidden"); await checkCategory(win, "locale", { expectHidden: true }); await closeView(win); Loading @@ -146,6 +167,11 @@ add_task(async function testLocalesShownAfterDelay() { }); let win = await viewLoaded; await BrowserTestUtils.waitForCondition(async () => { const button = await getCategoryButton(win, "locale"); return !button.hidden; }, "Wait for the locale category button to be shown"); await checkCategory(win, "locale", { expectHidden: false, expectSelected: false, Loading Loading
toolkit/mozapps/extensions/test/browser/browser_html_mlmodel_addons.js +8 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ add_task(async function testModelHubProvider() { .getElementById("categories") .getButtonByName("mlmodel"); await BrowserTestUtils.waitForCondition(async () => { return modelHubCategory.hidden; }, "Wait for the mlmodel category button to be hidden"); ok(modelHubCategory.hidden, "Model hub category is hidden"); await closeView(win); Loading Loading @@ -74,6 +78,10 @@ add_task(async function testModelHubProvider() { .getElementById("categories") .getButtonByName("mlmodel"); await BrowserTestUtils.waitForCondition(async () => { return !modelHubCategory.hidden; }, "Wait for the mlmodel category button to not be hidden"); ok(!modelHubCategory.hidden, "Model hub category is shown"); let mlmodelLoaded = waitForViewLoad(win); Loading
toolkit/mozapps/extensions/test/browser/browser_sidebar_hidden_categories.js +28 −2 Original line number Diff line number Diff line Loading @@ -27,13 +27,17 @@ function installLocale() { }); } async function checkCategory(win, category, { expectHidden, expectSelected }) { async function getCategoryButton(win, category) { await win.customElements.whenDefined("categories-box"); let categoriesBox = win.document.getElementById("categories"); await categoriesBox.promiseRendered; return categoriesBox.getButtonByName(category); } async function checkCategory(win, category, { expectHidden, expectSelected }) { let button = await getCategoryButton(win, category); let button = categoriesBox.getButtonByName(category); is( button.hidden, expectHidden, Loading Loading @@ -112,6 +116,18 @@ add_task(async function testLocalesHiddenWhenUninstalled() { }); let win = await viewLoaded; // CategoriesBox updateHiddenCategories method is async // and it calls AddonManager getAddonsByTypes and // getInstallsByTypes async methods to determine which // of the hidden categories may need to be shown // and so the assertion may hit a race if any of the // providers is taking longer to resolve the getAddonsByTypes // async call. await BrowserTestUtils.waitForCondition(async () => { const button = await getCategoryButton(win, "locale"); return button.hidden; }, "Wait for the locale category button to be hidden"); await checkCategory(win, "locale", { expectHidden: true }); await closeView(win); Loading @@ -128,6 +144,11 @@ add_task(async function testLocalesHiddenWithoutDelay() { }); let win = await viewLoaded; await BrowserTestUtils.waitForCondition(async () => { const button = await getCategoryButton(win, "locale"); return button.hidden; }, "Wait for the locale category button to be hidden"); await checkCategory(win, "locale", { expectHidden: true }); await closeView(win); Loading @@ -146,6 +167,11 @@ add_task(async function testLocalesShownAfterDelay() { }); let win = await viewLoaded; await BrowserTestUtils.waitForCondition(async () => { const button = await getCategoryButton(win, "locale"); return !button.hidden; }, "Wait for the locale category button to be shown"); await checkCategory(win, "locale", { expectHidden: false, expectSelected: false, Loading