Bug 1855787 - Persist translation panel intro until first translation is complete r=nordzilla,translations-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D243346
This commit is contained in:
@@ -655,19 +655,10 @@ var FullPageTranslationsPanel = new (class {
|
||||
"full-page-translations-panel-view-default"
|
||||
);
|
||||
|
||||
if (!this._hasShownPanel) {
|
||||
actor.firstShowUriSpec = gBrowser.currentURI.spec;
|
||||
}
|
||||
|
||||
if (
|
||||
this._hasShownPanel &&
|
||||
gBrowser.currentURI.spec !== actor.firstShowUriSpec
|
||||
) {
|
||||
document.l10n.setAttributes(header, "translations-panel-header");
|
||||
actor.firstShowUriSpec = null;
|
||||
if (TranslationsParent.hasUserEverTranslated()) {
|
||||
intro.hidden = true;
|
||||
document.l10n.setAttributes(header, "translations-panel-header");
|
||||
} else {
|
||||
Services.prefs.setBoolPref("browser.translations.panelShown", true);
|
||||
intro.hidden = false;
|
||||
document.l10n.setAttributes(header, "translations-panel-intro-header");
|
||||
}
|
||||
@@ -1450,11 +1441,9 @@ var FullPageTranslationsPanel = new (class {
|
||||
async #showEngineError(actor) {
|
||||
const { button } = this.buttonElements;
|
||||
await this.#ensureLangListsBuilt();
|
||||
if (!this.#isShowingDefaultView()) {
|
||||
await this.#showDefaultView(actor).catch(e => {
|
||||
this.console?.error(e);
|
||||
});
|
||||
}
|
||||
await this.#showDefaultView(actor).catch(e => {
|
||||
this.console?.error(e);
|
||||
});
|
||||
this.elements.error.hidden = false;
|
||||
this.#showError({
|
||||
message: "translations-panel-error-translating",
|
||||
@@ -1647,10 +1636,7 @@ var FullPageTranslationsPanel = new (class {
|
||||
|
||||
// Follow the same rules for displaying the first-run intro text for the
|
||||
// button's accessible tooltip label.
|
||||
if (
|
||||
this._hasShownPanel &&
|
||||
gBrowser.currentURI.spec !== actor.firstShowUriSpec
|
||||
) {
|
||||
if (TranslationsParent.hasUserEverTranslated()) {
|
||||
document.l10n.setAttributes(
|
||||
button,
|
||||
"urlbar-translations-button2"
|
||||
@@ -1688,10 +1674,3 @@ var FullPageTranslationsPanel = new (class {
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
FullPageTranslationsPanel,
|
||||
"_hasShownPanel",
|
||||
"browser.translations.panelShown",
|
||||
false
|
||||
);
|
||||
|
||||
@@ -27,7 +27,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton();
|
||||
|
||||
@@ -27,7 +27,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton();
|
||||
|
||||
@@ -26,7 +26,7 @@ add_task(async function test_browser_translations_full_page_multiple_windows() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
@@ -36,14 +36,14 @@ add_task(async function test_translations_moz_extension() {
|
||||
"The button is available."
|
||||
);
|
||||
|
||||
is(button.getAttribute("data-l10n-id"), "urlbar-translations-button2");
|
||||
is(button.getAttribute("data-l10n-id"), "urlbar-translations-button-intro");
|
||||
|
||||
await FullPageTranslationsTestUtils.assertPageIsUntranslated(runInPage);
|
||||
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -29,7 +29,7 @@ add_task(async function test_browser_translations_full_page_multiple_windows() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
downloadHandler: testPage1.resolveDownloads,
|
||||
|
||||
@@ -21,7 +21,7 @@ add_task(async function test_translations_panel_a11y_focus() {
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
openWithKeyboard: true,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
is(
|
||||
|
||||
@@ -16,7 +16,7 @@ add_task(async function test_always_translate_with_bad_data() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "en",
|
||||
expectedToLanguage: "",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
openFromAppMenu: true,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -24,7 +24,7 @@ add_task(async function test_toggle_always_translate_language_menuitem() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ add_task(async function test_uncheck_never_translate_language_shows_button() {
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
openFromAppMenu: true,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ add_task(async function test_uncheck_never_translate_site_shows_button() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -42,7 +42,7 @@ add_task(async function test_uncheck_never_translate_site_shows_button() {
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
openFromAppMenu: true,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ add_task(async function test_translations_panel_basics() {
|
||||
"The button is available."
|
||||
);
|
||||
|
||||
is(button.getAttribute("data-l10n-id"), "urlbar-translations-button2");
|
||||
is(button.getAttribute("data-l10n-id"), "urlbar-translations-button-intro");
|
||||
|
||||
await FullPageTranslationsTestUtils.assertPageIsUntranslated(runInPage);
|
||||
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton();
|
||||
|
||||
@@ -20,7 +20,7 @@ add_task(async function test_translations_panel_cancel() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
@@ -23,7 +23,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
const { fromMenuList, toMenuList } = FullPageTranslationsPanel.elements;
|
||||
@@ -51,7 +51,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
is(
|
||||
|
||||
@@ -21,7 +21,7 @@ add_task(
|
||||
openFromAppMenu: true,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
@@ -86,7 +86,7 @@ add_task(
|
||||
openFromAppMenu: true,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -20,7 +20,7 @@ add_task(async function test_panel_closes_on_toggle_never_translate_language() {
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
openFromAppMenu: true,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
@@ -58,7 +58,7 @@ add_task(
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
openFromAppMenu: true,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
@@ -77,7 +77,7 @@ add_task(
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
openFromAppMenu: true,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
await FullPageTranslationsTestUtils.assertIsNeverTranslateSite(
|
||||
|
||||
@@ -20,7 +20,7 @@ add_task(async function test_panel_closes_on_toggle_never_translate_site() {
|
||||
openFromAppMenu: true,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
@@ -60,7 +60,7 @@ add_task(
|
||||
openFromAppMenu: true,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -128,7 +128,7 @@ add_task(
|
||||
openFromAppMenu: true,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
@@ -145,7 +145,7 @@ add_task(
|
||||
openFromAppMenu: true,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ add_task(async function test_translations_engine_destroy() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(async function test_translations_engine_destroy_pending() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -4,19 +4,19 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Tests that the first run message is displayed.
|
||||
* Tests that the first run message is displayed prior to performing a
|
||||
* translation, but is no longer displayed after a translation occurs.
|
||||
*/
|
||||
add_task(async function test_translations_panel_firstrun() {
|
||||
const { cleanup } = await loadTestPage({
|
||||
const { cleanup, resolveDownloads, runInPage } = await loadTestPage({
|
||||
page: SPANISH_PAGE_URL,
|
||||
languagePairs: LANGUAGE_PAIRS,
|
||||
prefs: [["browser.translations.panelShown", false]],
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewFirstShow,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
@@ -28,10 +28,28 @@ add_task(async function test_translations_panel_firstrun() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
downloadHandler: resolveDownloads,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.assertPageIsTranslated({
|
||||
fromLanguage: "es",
|
||||
toLanguage: "en",
|
||||
runInPage,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewRevisit,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickRestoreButton();
|
||||
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
await cleanup();
|
||||
});
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
/**
|
||||
* Tests that the first-show intro message message is displayed
|
||||
* when viewing the panel subsequent times on the same URL,
|
||||
* but is no longer displayed after navigating to new URL,
|
||||
* or when returning to the first URL after navigating away.
|
||||
* when navigating to new URL, and when returning to the first URL
|
||||
* after navigating away.
|
||||
*/
|
||||
add_task(async function test_translations_panel_firstrun() {
|
||||
const { cleanup } = await loadTestPage({
|
||||
page: SPANISH_PAGE_URL,
|
||||
languagePairs: LANGUAGE_PAIRS,
|
||||
prefs: [["browser.translations.panelShown", false]],
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.assertTranslationsButton(
|
||||
@@ -24,7 +23,7 @@ add_task(async function test_translations_panel_firstrun() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewFirstShow,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
@@ -32,7 +31,7 @@ add_task(async function test_translations_panel_firstrun() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewFirstShow,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
@@ -44,7 +43,7 @@ add_task(async function test_translations_panel_firstrun() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
@@ -56,7 +55,7 @@ add_task(async function test_translations_panel_firstrun() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
@@ -22,7 +22,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
@@ -117,7 +117,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -15,7 +15,7 @@ add_task(async function test_translations_panel_manage_languages() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -28,7 +28,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
ok(
|
||||
!fromMenuList.querySelector('[value="ja"]'),
|
||||
@@ -53,7 +53,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
ok(
|
||||
fromMenuList.querySelector('[value="ja"]'),
|
||||
@@ -75,7 +75,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
ok(
|
||||
!fromMenuList.querySelector('[value="ja"]'),
|
||||
@@ -97,7 +97,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
ok(
|
||||
!fromMenuList.querySelector('[value="ja"]'),
|
||||
@@ -119,7 +119,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
ok(
|
||||
fromMenuList.querySelector('[value="ja"]'),
|
||||
|
||||
@@ -24,7 +24,7 @@ add_task(async function test_toggle_never_translate_language_menuitem() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -74,7 +74,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
@@ -133,7 +133,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(async function test_toggle_never_translate_site_menuitem() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -22,7 +22,7 @@ add_task(async function test_translations_panel_retry() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -27,7 +27,7 @@ add_task(async function test_translations_panel_source_lang_has_script_tag() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedFromLanguage({
|
||||
@@ -76,7 +76,7 @@ add_task(async function test_translations_panel_target_lang_has_script_tag() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
@@ -125,7 +125,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedFromLanguage({
|
||||
|
||||
@@ -29,7 +29,7 @@ add_task(async function test_unsupported_language_settings_menu_checkboxes() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ add_task(async function test_translations_panel_switch_language() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
const { translateButton } = FullPageTranslationsPanel.elements;
|
||||
|
||||
@@ -44,7 +44,7 @@ add_task(async function test_button_does_not_update_when_button_is_not_shown() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton();
|
||||
@@ -132,7 +132,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
@@ -204,7 +204,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
@@ -38,7 +38,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "uk",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await cleanup();
|
||||
|
||||
@@ -22,8 +22,10 @@ add_task(async function test_unsupported_lang() {
|
||||
FullPageTranslationsTestUtils.assertPanelViewUnsupportedLanguage,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickChangeSourceLanguageButton();
|
||||
FullPageTranslationsTestUtils.assertPanelViewDefault();
|
||||
await FullPageTranslationsTestUtils.clickChangeSourceLanguageButton({
|
||||
intro: true,
|
||||
});
|
||||
FullPageTranslationsTestUtils.assertPanelViewIntro();
|
||||
FullPageTranslationsTestUtils.assertSelectedFromLanguage({ langTag: "" });
|
||||
FullPageTranslationsTestUtils.assertSelectedToLanguage({ langTag: "en" });
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ add_task(async function test_weblanguage_differs_app_locale() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "en",
|
||||
expectedToLanguage: "fr",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
|
||||
@@ -75,7 +75,7 @@ add_task(async function test_translations_persist_in_reader_mode() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -24,7 +24,7 @@ add_task(async function test_translations_telemetry_auto_translate() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewFirstShow,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
await FullPageTranslationsTestUtils.clickAlwaysTranslateLanguage({
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(async function test_translations_telemetry_basics() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewFirstShow,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
@@ -57,7 +57,7 @@ add_task(async function test_translations_telemetry_basics() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewFirstShow,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
@@ -24,7 +24,7 @@ add_task(async function test_translations_telemetry_open_panel() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
@@ -56,7 +56,7 @@ add_task(async function test_translations_telemetry_open_panel() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
@@ -50,7 +50,7 @@ add_task(async function test_translations_panel_auto_offer() {
|
||||
|
||||
await navigate("Navigate to a page on a different domain.", {
|
||||
url: SPANISH_PAGE_URL_DOT_ORG,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickCancelButton();
|
||||
|
||||
@@ -27,7 +27,7 @@ add_task(async function test_translations_panel_auto_offer_settings() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.openTranslationsSettingsMenu();
|
||||
await FullPageTranslationsTestUtils.assertIsAlwaysOfferTranslationsEnabled(
|
||||
@@ -61,7 +61,7 @@ add_task(async function test_translations_panel_auto_offer_settings() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
await FullPageTranslationsTestUtils.assertIsAlwaysOfferTranslationsEnabled(
|
||||
true
|
||||
@@ -97,7 +97,7 @@ add_task(async function test_translations_panel_auto_offer_settings() {
|
||||
"Wait for the popup to be shown when navigating to a different host.",
|
||||
{
|
||||
url: SPANISH_PAGE_URL_DOT_ORG,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ add_task(async function test_translations_telemetry_retranslate() {
|
||||
await FullPageTranslationsTestUtils.assertPageIsUntranslated(runInPage);
|
||||
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedFromLanguage({
|
||||
|
||||
@@ -22,7 +22,7 @@ add_task(async function test_translations_telemetry_switch_from_language() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedFromLanguage({
|
||||
@@ -117,7 +117,7 @@ add_task(async function test_translations_telemetry_switch_to_language() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
|
||||
@@ -34,7 +34,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await TestTranslationsTelemetry.assertEvent(Glean.translationsPanel.open, {
|
||||
|
||||
@@ -29,7 +29,7 @@ add_task(async function test_translations_telemetry_manual_translation() {
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -35,7 +35,7 @@ add_task(async function test_translations_telemetry_unsupported_lang() {
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickChangeSourceLanguageButton({
|
||||
firstShow: true,
|
||||
intro: true,
|
||||
});
|
||||
|
||||
await TestTranslationsTelemetry.assertEvent(
|
||||
@@ -124,7 +124,7 @@ add_task(async function test_translations_telemetry_unsupported_lang() {
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickChangeSourceLanguageButton({
|
||||
firstShow: true,
|
||||
intro: true,
|
||||
});
|
||||
|
||||
await TestTranslationsTelemetry.assertEvent(
|
||||
|
||||
@@ -26,7 +26,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
|
||||
@@ -36,7 +36,7 @@ add_task(
|
||||
win: window1,
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
|
||||
@@ -25,7 +25,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
|
||||
@@ -24,7 +24,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.changeSelectedToLanguage({
|
||||
|
||||
@@ -38,7 +38,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
@@ -121,7 +121,7 @@ add_task(
|
||||
await FullPageTranslationsTestUtils.openPanel({
|
||||
expectedFromLanguage: "es",
|
||||
expectedToLanguage: "en",
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
|
||||
onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewIntro,
|
||||
});
|
||||
|
||||
await FullPageTranslationsTestUtils.clickTranslateButton({
|
||||
|
||||
@@ -1531,10 +1531,10 @@ class FullPageTranslationsTestUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that panel element visibility matches the panel first-show view.
|
||||
* Asserts that panel element visibility matches the panel intro view.
|
||||
*/
|
||||
static assertPanelViewFirstShow() {
|
||||
info("Checking that the panel shows the first-show view");
|
||||
static assertPanelViewIntro() {
|
||||
info("Checking that the panel shows the intro view");
|
||||
FullPageTranslationsTestUtils.#assertPanelMainViewId(
|
||||
"full-page-translations-panel-view-default"
|
||||
);
|
||||
@@ -1549,10 +1549,10 @@ class FullPageTranslationsTestUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that panel element visibility matches the panel first-show error view.
|
||||
* Asserts that panel element visibility matches the panel intro error view.
|
||||
*/
|
||||
static assertPanelViewFirstShowError() {
|
||||
info("Checking that the panel shows the first-show error view");
|
||||
static assertPanelViewIntroError() {
|
||||
info("Checking that the panel shows the intro error view");
|
||||
FullPageTranslationsTestUtils.#assertPanelMainViewId(
|
||||
"full-page-translations-panel-view-default"
|
||||
);
|
||||
@@ -1742,11 +1742,11 @@ class FullPageTranslationsTestUtils {
|
||||
* Simulates clicking the change-source-language button.
|
||||
*
|
||||
* @param {object} config
|
||||
* @param {boolean} config.firstShow
|
||||
* - True if the first-show view should be expected
|
||||
* @param {boolean} config.intro
|
||||
* - True if the intro view should be expected
|
||||
* False if the default view should be expected
|
||||
*/
|
||||
static async clickChangeSourceLanguageButton({ firstShow = false } = {}) {
|
||||
static async clickChangeSourceLanguageButton({ intro = false } = {}) {
|
||||
logAction();
|
||||
const { changeSourceLanguageButton } = FullPageTranslationsPanel.elements;
|
||||
assertVisibility({ visible: { changeSourceLanguageButton } });
|
||||
@@ -1758,8 +1758,8 @@ class FullPageTranslationsTestUtils {
|
||||
"Click the change-source-language button"
|
||||
);
|
||||
},
|
||||
firstShow
|
||||
? FullPageTranslationsTestUtils.assertPanelViewFirstShow
|
||||
intro
|
||||
? FullPageTranslationsTestUtils.assertPanelViewIntro
|
||||
: FullPageTranslationsTestUtils.assertPanelViewDefault
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1078,6 +1078,15 @@ export class TranslationsParent extends JSWindowActorParent {
|
||||
return TranslationsParent.#mostRecentTargetLanguages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the active user has ever triggered a translation request, otherwise false.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
static hasUserEverTranslated() {
|
||||
return !!TranslationsParent.#getMostRecentTargetLanguages().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the user's preferred languages from the settings based on:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user