summaryrefslogtreecommitdiffstats
path: root/browser/components/translations/tests/browser/browser_translations_full_page_panel_basics.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/translations/tests/browser/browser_translations_full_page_panel_basics.js')
-rw-r--r--browser/components/translations/tests/browser/browser_translations_full_page_panel_basics.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/browser/components/translations/tests/browser/browser_translations_full_page_panel_basics.js b/browser/components/translations/tests/browser/browser_translations_full_page_panel_basics.js
new file mode 100644
index 0000000000..30880553f0
--- /dev/null
+++ b/browser/components/translations/tests/browser/browser_translations_full_page_panel_basics.js
@@ -0,0 +1,69 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Tests a basic panel open, translation, and restoration to the original language.
+ */
+add_task(async function test_translations_panel_basics() {
+ const { cleanup, resolveDownloads, runInPage } = await loadTestPage({
+ page: SPANISH_PAGE_URL,
+ languagePairs: LANGUAGE_PAIRS,
+ });
+
+ const { button } =
+ await FullPageTranslationsTestUtils.assertTranslationsButton(
+ { button: true, circleArrows: false, locale: false, icon: true },
+ "The button is available."
+ );
+
+ is(button.getAttribute("data-l10n-id"), "urlbar-translations-button2");
+
+ await FullPageTranslationsTestUtils.assertPageIsUntranslated(runInPage);
+
+ await FullPageTranslationsTestUtils.openPanel({
+ onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewDefault,
+ });
+
+ const panel = document.getElementById("full-page-translations-panel");
+ const label = document.getElementById(panel.getAttribute("aria-labelledby"));
+ ok(label, "The a11y label for the panel can be found.");
+ assertVisibility({ visible: { label } });
+
+ await FullPageTranslationsTestUtils.clickTranslateButton();
+
+ await FullPageTranslationsTestUtils.assertTranslationsButton(
+ { button: true, circleArrows: true, locale: false, icon: true },
+ "The icon presents the loading indicator."
+ );
+
+ await FullPageTranslationsTestUtils.openPanel({
+ onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewLoading,
+ });
+
+ await FullPageTranslationsTestUtils.clickCancelButton();
+
+ await resolveDownloads(1);
+
+ await FullPageTranslationsTestUtils.assertPageIsTranslated(
+ "es",
+ "en",
+ runInPage
+ );
+
+ await FullPageTranslationsTestUtils.openPanel({
+ onOpenPanel: FullPageTranslationsTestUtils.assertPanelViewRevisit,
+ });
+
+ await FullPageTranslationsTestUtils.clickRestoreButton();
+
+ await FullPageTranslationsTestUtils.assertPageIsUntranslated(runInPage);
+
+ await FullPageTranslationsTestUtils.assertTranslationsButton(
+ { button: true, circleArrows: false, locale: false, icon: true },
+ "The button is reverted to have an icon."
+ );
+
+ await cleanup();
+});