browser_application_panel_sidebar.js (2663B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Check that the manifest is being properly shown 8 */ 9 10 add_task(async function () { 11 info("Test that we are displaying correctly the sidebar"); 12 13 await enableApplicationPanel(); 14 const { panel, tab, commands } = await openNewTabAndApplicationPanel(); 15 const doc = panel.panelWin.document; 16 17 info("Waiting for the sidebar to be displayed"); 18 await waitUntil(() => doc.querySelector(".js-sidebar") !== null); 19 ok(true, "Sidebar is being displayed"); 20 21 await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null); 22 ok(true, "Service Workers page was loaded per default."); 23 24 // close the tab 25 info("Closing the tab."); 26 await commands.client.waitForRequestsToSettle(); 27 await BrowserTestUtils.removeTab(tab); 28 }); 29 30 add_task(async function () { 31 info("Test that we are displaying correctly the selected page - manifest"); 32 33 await enableApplicationPanel(); 34 const { panel, tab, commands } = await openNewTabAndApplicationPanel(); 35 const doc = panel.panelWin.document; 36 37 info("Select service worker page"); 38 selectPage(panel, "service-workers"); 39 await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null); 40 await unregisterAllWorkers(commands.client, doc); 41 42 info("Select manifest page in the sidebar"); 43 const link = doc.querySelector(".js-sidebar-manifest"); 44 link.click(); 45 46 await waitUntil(() => doc.querySelector(".js-manifest-page") !== null); 47 ok(true, "Manifest page was selected."); 48 49 // close the tab 50 info("Closing the tab."); 51 await commands.client.waitForRequestsToSettle(); 52 await BrowserTestUtils.removeTab(tab); 53 }); 54 55 add_task(async function () { 56 info( 57 "Test that we are displaying correctly the selected page - service workers" 58 ); 59 const url = URL_ROOT + "resources/manifest/load-ok.html"; 60 61 await enableApplicationPanel(); 62 const { panel, tab, commands } = await openNewTabAndApplicationPanel(url); 63 const doc = panel.panelWin.document; 64 65 selectPage(panel, "manifest"); 66 67 info("Waiting for the manifest to load"); 68 await waitUntil(() => doc.querySelector(".js-manifest-page") !== null); 69 ok(true, "Manifest page was selected."); 70 71 info("Select service worker page in the sidebar"); 72 const link = doc.querySelector(".js-sidebar-service-workers"); 73 link.click(); 74 75 await waitUntil(() => doc.querySelector(".js-service-workers-page") !== null); 76 ok(true, "Service workers page was selected."); 77 78 // close the tab 79 info("Closing the tab."); 80 await commands.client.waitForRequestsToSettle(); 81 await BrowserTestUtils.removeTab(tab); 82 });