summaryrefslogtreecommitdiffstats
path: root/browser/components/uitour/test/browser_UITour_resetProfile.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/uitour/test/browser_UITour_resetProfile.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/uitour/test/browser_UITour_resetProfile.js')
-rw-r--r--browser/components/uitour/test/browser_UITour_resetProfile.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/browser/components/uitour/test/browser_UITour_resetProfile.js b/browser/components/uitour/test/browser_UITour_resetProfile.js
new file mode 100644
index 0000000000..921b4bcefe
--- /dev/null
+++ b/browser/components/uitour/test/browser_UITour_resetProfile.js
@@ -0,0 +1,46 @@
+"use strict";
+
+var gTestTab;
+var gContentAPI;
+
+add_task(setup_UITourTest);
+
+// Test that a reset profile dialog appears when "resetFirefox" event is triggered
+add_UITour_task(async function test_resetFirefox() {
+ let canReset = await getConfigurationPromise("canReset");
+ ok(
+ !canReset,
+ "Shouldn't be able to reset from mochitest's temporary profile."
+ );
+ let dialogPromise = BrowserTestUtils.promiseAlertDialog(
+ "cancel",
+ "chrome://global/content/resetProfile.xhtml",
+ {
+ isSubDialog: true,
+ }
+ );
+
+ // make reset possible.
+ let profileService = Cc["@mozilla.org/toolkit/profile-service;1"].getService(
+ Ci.nsIToolkitProfileService
+ );
+ let currentProfileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ let profileName = "mochitest-test-profile-temp-" + Date.now();
+ let tempProfile = profileService.createProfile(
+ currentProfileDir,
+ profileName
+ );
+ canReset = await getConfigurationPromise("canReset");
+ ok(
+ canReset,
+ "Should be able to reset from mochitest's temporary profile once it's in the profile manager."
+ );
+ await gContentAPI.resetFirefox();
+ await dialogPromise;
+ tempProfile.remove(false);
+ canReset = await getConfigurationPromise("canReset");
+ ok(
+ !canReset,
+ "Shouldn't be able to reset from mochitest's temporary profile once removed from the profile manager."
+ );
+});