Add a new test to verify that when the pref is enabled the notification bar is not shown, and run both tests with built-in version enabled and disabled
This commit is contained in:
Родитель
2dd145320e
Коммит
07269c3d83
|
@ -9,8 +9,46 @@ const baseURL = getRootDirectory(gTestPath).replace(
|
|||
"https://example.com"
|
||||
);
|
||||
|
||||
add_task(async function testTranslationBarNotDisplayed() {
|
||||
info("Test the Translation functionality when the built-in version is enabled");
|
||||
|
||||
if (!Services.prefs.getBoolPref("browser.translations.enable", false)) {
|
||||
ok(true, "Built-in version is disabled, skipping test.");
|
||||
return;
|
||||
}
|
||||
|
||||
info("Waiting 10s until the engines are loaded");
|
||||
// let's wait until the engines are loaded
|
||||
await new Promise(resolve => setTimeout(resolve, 10000));
|
||||
|
||||
info("Opening the test page");
|
||||
|
||||
// open the test page.
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
`${baseURL }browser_translation_test.html`
|
||||
);
|
||||
|
||||
// wait for the translation bar to be displayed.
|
||||
let neverShown = false;
|
||||
await TestUtils.waitForCondition(() => gBrowser
|
||||
.getNotificationBox()
|
||||
.getNotificationWithValue("fxtranslation-notification"))
|
||||
.catch(() => {
|
||||
neverShown = true;
|
||||
});
|
||||
ok(neverShown, "Translation notification bar was not displayed.");
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function testTranslationBarDisplayed() {
|
||||
info("Test the Translation functionality");
|
||||
info("Test the Translation functionality when the built-in version is disabled");
|
||||
|
||||
if (Services.prefs.getBoolPref("browser.translations.enable", false)) {
|
||||
ok(true, "Built-in version is enabled, skipping test.");
|
||||
return;
|
||||
}
|
||||
|
||||
info("Waiting 10s until the engines are loaded");
|
||||
// let's wait until the engines are loaded
|
||||
|
|
|
@ -91,6 +91,7 @@ try:
|
|||
subprocess.check_output("./mach build", stderr=subprocess.STDOUT, shell=True, universal_newlines=True, cwd="gecko")
|
||||
print("Running test with faster gemm")
|
||||
subprocess.check_output("./mach test --setpref=fxtranslations.running.mochitest=true browser/extensions/translations/test/browser/browser_translation_test.js", stderr=subprocess.STDOUT, shell=True, universal_newlines=True, cwd="gecko")
|
||||
subprocess.check_output("./mach test --setpref=fxtranslations.running.mochitest=true --setpref=browser.translations.enable=false browser/extensions/translations/test/browser/browser_translation_test.js", stderr=subprocess.STDOUT, shell=True, universal_newlines=True, cwd="gecko")
|
||||
print("Test with faster gemm Succeeded")
|
||||
except CalledProcessError as cpe:
|
||||
print(cpe.output)
|
||||
|
|
Загрузка…
Ссылка в новой задаче