From f7a96d60211ec174f570ef6641c9d36c3952ae5d Mon Sep 17 00:00:00 2001 From: Vijay Budhram Date: Wed, 19 Aug 2026 13:44:26 -0400 Subject: [PATCH] test(functional): assert the de l10n bundle is delivered ## Because - FXA-14361 served English to every locale and nothing failed. Every response was a 200, and the only symptom was untranslated copy. - `packages/functional-tests` has no l10n coverage, so neither PR CI nor the stage and production smoke runs would have caught it. ## This pull request - Adds `l10nBundleDelivery.spec.ts` under `tests/misc/`. It forces `de` with Playwright's `locale` context option, waits for the `main.ftl` response, then asserts a 200 and a body that parses as FTL. - Matches the plain path and the hashed manifest path, for example `locales/de/main.ebcab539.ftl`. - Tags the block `severity-1`. That is what the stage and production Playwright runs grep for. ## Issue that this pull request solves Closes: https://mozilla-hub.atlassian.net/browse/FXA-14366 --- .../tests/misc/l10nBundleDelivery.spec.ts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 packages/functional-tests/tests/misc/l10nBundleDelivery.spec.ts diff --git a/packages/functional-tests/tests/misc/l10nBundleDelivery.spec.ts b/packages/functional-tests/tests/misc/l10nBundleDelivery.spec.ts new file mode 100644 index 00000000000..314696e81d3 --- /dev/null +++ b/packages/functional-tests/tests/misc/l10nBundleDelivery.spec.ts @@ -0,0 +1,45 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import { expect, test } from '../../lib/fixtures/standard'; + +// German is well translated. Avoid the EN_GB_LOCALES set, en-NZ, en-SG and +// en-MY: AppLocalizationProvider sources those from the en-GB bundle, so they +// would not prove delivery. +const LOCALE = 'de'; + +// Matches the plain path and the hashed path the static asset manifest points +// at, for example locales/de/main.ebcab539.ftl. +const MAIN_FTL = new RegExp(`/locales/${LOCALE}/main(\\.[0-9a-f]+)?\\.ftl$`); + +test.describe('severity-1', () => { + test.use({ locale: LOCALE }); + + test(`delivers the ${LOCALE} main.ftl bundle`, async ({ target, page }) => { + // Register the wait before navigating. A request that never happens leaves + // this pending, so it rejects on timeout and the test fails. + const ftlResponse = page.waitForResponse((response) => + MAIN_FTL.test(new URL(response.url()).pathname) + ); + + const [response] = await Promise.all([ + ftlResponse, + page.goto(target.contentServerUrl), + ]); + + const context = `If ${LOCALE} was dropped from the shipping locale set, this failure is correct and the fix is the locale set, not the test.`; + + expect( + response.status(), + `The ${LOCALE} main.ftl bundle did not return 200. ${context}` + ).toBe(200); + + // Any message line proves the body is a bundle rather than an error page + // served with a 200. No message id is named, so l10n churn cannot fail it. + expect( + await response.text(), + `The ${LOCALE} main.ftl bundle did not look like FTL. ${context}` + ).toMatch(/^[\w-]+\s*=/m); + }); +});