diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /browser/components/migration/tests | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/migration/tests')
6 files changed, 266 insertions, 12 deletions
diff --git a/browser/components/migration/tests/browser/browser_file_migration.js b/browser/components/migration/tests/browser/browser_file_migration.js index 04241d29d5..c73dfc4456 100644 --- a/browser/components/migration/tests/browser/browser_file_migration.js +++ b/browser/components/migration/tests/browser/browser_file_migration.js @@ -68,7 +68,7 @@ add_setup(async () => { // We use MockFilePicker to simulate a native file picker, and prepare it // to return a dummy file pointed at TEST_FILE_PATH. The file at // TEST_FILE_PATH is not required (nor expected) to exist. - MockFilePicker.init(window); + MockFilePicker.init(window.browsingContext); registerCleanupFunction(() => { MockFilePicker.cleanup(); }); diff --git a/browser/components/migration/tests/browser/browser_safari_passwords.js b/browser/components/migration/tests/browser/browser_safari_passwords.js index c005342b46..e9ebd05e0a 100644 --- a/browser/components/migration/tests/browser/browser_safari_passwords.js +++ b/browser/components/migration/tests/browser/browser_safari_passwords.js @@ -18,7 +18,7 @@ const TEST_FILE_PATH = getTestFilePath("dummy_file.csv"); const { MockFilePicker } = SpecialPowers; add_setup(async function () { - MockFilePicker.init(window); + MockFilePicker.init(window.browsingContext); registerCleanupFunction(() => { MockFilePicker.cleanup(); }); diff --git a/browser/components/migration/tests/chrome/test_migration_wizard.html b/browser/components/migration/tests/chrome/test_migration_wizard.html index d991cce114..cc2d8a0363 100644 --- a/browser/components/migration/tests/chrome/test_migration_wizard.html +++ b/browser/components/migration/tests/chrome/test_migration_wizard.html @@ -725,6 +725,10 @@ EXTENSIONS_INFO_HREF ); is( + extensionsGroup.querySelector("a.message-text").target, + "_blank" + ); + is( extensionsGroup.querySelector(".support-text").textContent, EXTENSIONS_SUPPORT_STRING ); @@ -732,6 +736,10 @@ extensionsGroup.querySelector(".support-text").href, EXTENSIONS_SUPPORT_HREF ); + is( + extensionsGroup.querySelector(".support-text").target, + "_blank" + ); // With progress being complete, the header should be using the completed // migration string. @@ -792,6 +800,10 @@ extensionsGroup.querySelector(".support-text").href, EXTENSIONS_SUPPORT_HREF ); + is( + extensionsGroup.querySelector(".support-text").target, + "_blank" + ); // With progress being complete, the header should be using the completed // migration string. @@ -1521,6 +1533,248 @@ let getPermissionButton = gShadowRoot.querySelector("#get-permissions"); ok(isHidden(getPermissionButton), "Get permissions button hiddne."); }); + + add_task(async function hide_option_expander_subtitle() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + gWiz.setAttribute("hide-option-expander-subtitle", "true"); + let subtitle = selectionPage.querySelector("#resource-selection-summary > .selected-data"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + ok(gWiz.hasAttribute("hide-option-expander-subtitle"), "hide option expander subtitle attribute is present on migration wizard"); + + ok(isHidden(subtitle), "subtitle is hidden"); + + gWiz.removeAttribute("hide-option-expander-subtitle"); + }); + + add_task(async function update_option_expander_title_string() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + + let title = selectionPage.querySelector(".selected-data-header"); + gWiz.setAttribute("option-expander-title-string", "test"); + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + await BrowserTestUtils.waitForMutationCondition( + title, + {childList: true}, + () => title.textContent == "test" + ) + is(title.textContent, "test", "resource selection expander subtitle has been changed"); + + gWiz.removeAttribute("option-expander-title-string"); + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + await BrowserTestUtils.waitForMutationCondition( + title, + {childList: true}, + () => title.textContent != "test" + ) + isnot(title.textContent, "test", "resource selection expander subtitle was reverted"); + }); + + add_task(async function hide_select_all_checkbox() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + + let selectAll = selectionPage.querySelector("#select-all"); + gWiz.setAttribute("hide-select-all", true); + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + ok(isHidden(selectAll), "select all is not displayed"); + + gWiz.removeAttribute("hide-select-all"); + }); + + add_task(async function update_import_button_string() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + gWiz.setAttribute("import-button-string", "test"); + let button = selectionPage.querySelector(".migration-import-button"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + is(button.textContent, "test", "button text is expected"); + + gWiz.removeAttribute("import-button-string"); + }); + + add_task(async function update_checkbox_margins() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + + gWiz.setAttribute("checkbox-margin-inline", "27px 42px"); + gWiz.setAttribute("checkbox-margin-block", "42px 27px"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + let checkboxLabels = selectionPage.querySelectorAll(".resource-type-label"); + for(let label of checkboxLabels) { + let computedStyle = getComputedStyle(label); + let marginInline = computedStyle.getPropertyValue("margin-inline"); + let marginBlock = computedStyle.getPropertyValue("margin-block"); + is(marginInline, "27px 42px", "margin inline is set to expected value"); + is(marginBlock, "42px 27px", "margin block is set to expected value"); + } + + gWiz.removeAttribute("checkbox-margin-inline"); + gWiz.removeAttribute("checkbox-margin-block"); + }); + + add_task(async function update_import_button_class() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let importButton = selectionPage.querySelector("#import"); + + gWiz.setAttribute("import-button-class", "primary"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + ok(importButton.classList.contains("primary"), "import button has the primary class"); + + gWiz.removeAttribute("import-button-class"); + }); + + add_task(async function update_header_font_size() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let header = selectionPage.querySelector("h1"); + + gWiz.setAttribute("header-font-size", "24px"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + let computedStyle = getComputedStyle(header); + + is(computedStyle.getPropertyValue("font-size"), "24px", "header font size is changed to correct value"); + gWiz.removeAttribute("header-font-size"); + }); + + add_task(async function update_header_margin_block() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let header = selectionPage.querySelector("h1"); + + gWiz.setAttribute("header-margin-block", "20px 30px"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + let computedStyle = getComputedStyle(header); + + is(computedStyle.getPropertyValue("margin-block"), "20px 30px", "header margin block is changed to correct value"); + gWiz.removeAttribute("header-margin-block"); + }); + + add_task(async function update_header_string() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let header = selectionPage.querySelector("h1"); + + gWiz.setAttribute("selection-header-string", "test string"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + is(header.textContent, "test string", "header text content is changed to correct value"); + gWiz.removeAttribute("selection-header-string"); + }); + + add_task(async function update_subheader_font_size() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let subheader = selectionPage.querySelector("h1"); + + gWiz.setAttribute("subheader-font-size", "24px"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + let computedStyle = getComputedStyle(subheader); + + is(computedStyle.getPropertyValue("font-size"), "24px", "subheader font size is changed to correct value"); + gWiz.removeAttribute("subheader-font-size"); + }); + + add_task(async function update_subheader_margin_block() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let subheader = selectionPage.querySelector("h1"); + + gWiz.setAttribute("subheader-margin-block", "20px 30px"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + let computedStyle = getComputedStyle(subheader); + + is(computedStyle.getPropertyValue("margin-block"), "20px 30px", "subheader margin block is changed to correct value"); + gWiz.removeAttribute("subheader-margin-block"); + }); + + add_task(async function update_subheader_string() { + let selectionPage = gShadowRoot.querySelector("div[name='page-selection']"); + let subheader = selectionPage.querySelector(".migration-wizard-subheader"); + + gWiz.setAttribute("selection-subheader-string", "test string"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + is(subheader.textContent, "test string", "subheader text content is changed to correct value"); + + gWiz.removeAttribute("selection-subheader-string"); + gWiz.setState({ + page: MigrationWizardConstants.PAGES.SELECTION, + migrators: MIGRATOR_PROFILE_INSTANCES, + }); + + ok(isHidden(subheader), "subheader is hidden") + }); + + add_task(async function update_data_import_success_string() { + let progressPage = gShadowRoot.querySelector("div[name='page-progress']"); + let header = progressPage.querySelector("h1"); + + gWiz.setAttribute("data-import-complete-success-string", "test string"); + + gWiz.setState({ + page: MigrationWizardConstants.PAGES.PROGRESS, + key: "chrome", + progress: { + [MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.EXTENSIONS]: { + value: MigrationWizardConstants.PROGRESS_VALUE.SUCCESS, + }, + [MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.FORMDATA]: { + value: MigrationWizardConstants.PROGRESS_VALUE.SUCCESS, + }, + }, + }); + + is(header.textContent, "test string", "import success header text content is changed to correct value"); + gWiz.removeAttribute("data-import-complete-success-string"); + }); </script> </head> <body> diff --git a/browser/components/migration/tests/marionette/test_refresh_firefox.py b/browser/components/migration/tests/marionette/test_refresh_firefox.py index ea5d6bce99..2ffcd4f099 100644 --- a/browser/components/migration/tests/marionette/test_refresh_firefox.py +++ b/browser/components/migration/tests/marionette/test_refresh_firefox.py @@ -224,8 +224,8 @@ class TestFirefoxRefresh(MarionetteTestCase): self.runAsyncCode( """ let resolve = arguments[arguments.length - 1]; - let { FxAccountsStorageManager } = ChromeUtils.import( - "resource://gre/modules/FxAccountsStorage.jsm" + let { FxAccountsStorageManager } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsStorage.sys.mjs" ); let storage = new FxAccountsStorageManager(); let data = {email: "test@test.com", uid: "uid", keyFetchToken: "top-secret"}; @@ -448,8 +448,8 @@ class TestFirefoxRefresh(MarionetteTestCase): def checkFxA(self): result = self.runAsyncCode( """ - let { FxAccountsStorageManager } = ChromeUtils.import( - "resource://gre/modules/FxAccountsStorage.jsm" + let { FxAccountsStorageManager } = ChromeUtils.importESModule( + "resource://gre/modules/FxAccountsStorage.sys.mjs" ); let resolve = arguments[arguments.length - 1]; let storage = new FxAccountsStorageManager(); @@ -528,16 +528,16 @@ class TestFirefoxRefresh(MarionetteTestCase): global.Preferences = ChromeUtils.importESModule( "resource://gre/modules/Preferences.sys.mjs" ).Preferences; - global.FormHistory = ChromeUtils.import( - "resource://gre/modules/FormHistory.jsm" + global.FormHistory = ChromeUtils.importESModule( + "resource://gre/modules/FormHistory.sys.mjs" ).FormHistory; """ # NOQA: E501 ) self._formAutofillAvailable = self.runCode( """ try { - global.formAutofillStorage = ChromeUtils.import( - "resource://formautofill/FormAutofillStorage.jsm" + global.formAutofillStorage = ChromeUtils.importESModule( + "resource://formautofill/FormAutofillStorage.sys.mjs" ).formAutofillStorage; } catch(e) { return false; diff --git a/browser/components/migration/tests/unit/test_Chrome_permissions.js b/browser/components/migration/tests/unit/test_Chrome_permissions.js index 6dfd8bcceb..04bded3c8e 100644 --- a/browser/components/migration/tests/unit/test_Chrome_permissions.js +++ b/browser/components/migration/tests/unit/test_Chrome_permissions.js @@ -35,7 +35,7 @@ add_setup(async () => { gTempDir = do_get_tempdir(); await IOUtils.writeJSON(PathUtils.join(gTempDir.path, "Local State"), []); - MockFilePicker.init(globalThis); + MockFilePicker.init(/* mock BrowsingContext */ { window: globalThis }); registerCleanupFunction(() => { MockFilePicker.cleanup(); }); diff --git a/browser/components/migration/tests/unit/test_Safari_permissions.js b/browser/components/migration/tests/unit/test_Safari_permissions.js index eaa6c7788e..3e11adc3d8 100644 --- a/browser/components/migration/tests/unit/test_Safari_permissions.js +++ b/browser/components/migration/tests/unit/test_Safari_permissions.js @@ -30,7 +30,7 @@ add_setup(async () => { registerFakePath("ULibDir", tempDir); - MockFilePicker.init(globalThis); + MockFilePicker.init(/* mock BrowsingContext */ { window: globalThis }); registerCleanupFunction(() => { MockFilePicker.cleanup(); }); |