From a72086d8eb385d3b197351e9bdeba051a63c96f3 Mon Sep 17 00:00:00 2001 From: Jarrod Flesch Date: Mon, 17 Nov 2025 11:17:26 -0500 Subject: [PATCH 1/3] test: deflakes localization e2e suite --- test/localization/e2e.spec.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/localization/e2e.spec.ts b/test/localization/e2e.spec.ts index 42f014e5e4b..1993b540095 100644 --- a/test/localization/e2e.spec.ts +++ b/test/localization/e2e.spec.ts @@ -2,6 +2,7 @@ import type { BrowserContext, Page } from '@playwright/test' import type { GeneratedTypes } from 'helpers/sdk/types.js' import { expect, test } from '@playwright/test' +import { englishLocale } from 'globals/config.js' import { addArrayRow } from 'helpers/e2e/fields/array/index.js' import { addBlock } from 'helpers/e2e/fields/blocks/addBlock.js' import { navigateToDoc } from 'helpers/e2e/navigateToDoc.js' @@ -38,6 +39,7 @@ import { arrayWithFallbackCollectionSlug, defaultLocale, englishTitle, + hungarianLocale, localizedDraftsSlug, localizedPostsSlug, relationshipLocalizedSlug, @@ -404,7 +406,7 @@ describe('Localization', () => { await createAndSaveDoc(page, url, { title }) await openCopyToLocaleDrawer(page) await setToLocale(page, 'Spanish') - await runCopy(page) + await runCopy({ page, toLocale: spanishLocale }) await expect(page.locator('#field-title')).toHaveValue(title) await changeLocale(page, defaultLocale) }) @@ -419,7 +421,7 @@ describe('Localization', () => { await openCopyToLocaleDrawer(page) await setToLocale(page, 'Spanish') - await runCopy(page) + await runCopy({ page, toLocale: spanishLocale }) await expect(richTextField).toContainText(richTextContent) }) @@ -438,7 +440,7 @@ describe('Localization', () => { await openCopyToLocaleDrawer(page) await setToLocale(page, 'English') - await runCopy(page) + await runCopy({ page, toLocale: englishLocale }) await expect(arrayField).toHaveValue(sampleText) }) @@ -465,7 +467,7 @@ describe('Localization', () => { await setToLocale(page, 'Spanish') const overwriteCheckbox = page.locator('#field-overwriteExisting') await expect(overwriteCheckbox).not.toBeChecked() - await runCopy(page) + await runCopy({ page, toLocale: spanishLocale }) await expect(page.locator('#field-title')).toHaveValue(spanishTitle) await expect(page.locator('#field-description')).toHaveValue('Spanish description') @@ -482,7 +484,7 @@ describe('Localization', () => { await setToLocale(page, 'Spanish') const overwriteCheckbox = page.locator('#field-overwriteExisting') await overwriteCheckbox.click() - await runCopy(page) + await runCopy({ page, toLocale: spanishLocale }) await expect(page.locator('#field-title')).toHaveValue(englishTitle) await changeLocale(page, defaultLocale) }) @@ -508,7 +510,7 @@ describe('Localization', () => { await openCopyToLocaleDrawer(page) await setToLocale(page, 'Spanish') - await runCopy(page) + await runCopy({ page, toLocale: spanishLocale }) await expect(page.locator('#field-title')).toHaveValue(title) const regexPattern = /locale=es/ @@ -516,7 +518,7 @@ describe('Localization', () => { await openCopyToLocaleDrawer(page) await setToLocale(page, 'Hungarian') - await runCopy(page) + await runCopy({ page, toLocale: hungarianLocale }) await expect(page.locator('#field-title')).toHaveValue(title) }) @@ -797,8 +799,11 @@ async function fillValues(data: Partial) { } } -async function runCopy(page) { +async function runCopy({ page, toLocale }: { page: Page; toLocale: string }) { await page.locator('.copy-locale-data__sub-header button').click() + + const regexPattern = new RegExp(`locale=${toLocale}`) + await expect(page).toHaveURL(regexPattern) } async function createAndSaveDoc(page, url, values) { From 72d54968ac21e27ac249a0f03ce86f1ce94558aa Mon Sep 17 00:00:00 2001 From: Jarrod Flesch Date: Mon, 17 Nov 2025 16:04:37 -0500 Subject: [PATCH 2/3] chore: trigger CI From d1339bde8082861f726e31ef7602e911f92d7d44 Mon Sep 17 00:00:00 2001 From: Jarrod Flesch Date: Tue, 18 Nov 2025 08:50:19 -0500 Subject: [PATCH 3/3] adjust import --- test/localization/e2e.spec.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/localization/e2e.spec.ts b/test/localization/e2e.spec.ts index 1993b540095..a50cc24a024 100644 --- a/test/localization/e2e.spec.ts +++ b/test/localization/e2e.spec.ts @@ -2,7 +2,6 @@ import type { BrowserContext, Page } from '@playwright/test' import type { GeneratedTypes } from 'helpers/sdk/types.js' import { expect, test } from '@playwright/test' -import { englishLocale } from 'globals/config.js' import { addArrayRow } from 'helpers/e2e/fields/array/index.js' import { addBlock } from 'helpers/e2e/fields/blocks/addBlock.js' import { navigateToDoc } from 'helpers/e2e/navigateToDoc.js' @@ -440,7 +439,7 @@ describe('Localization', () => { await openCopyToLocaleDrawer(page) await setToLocale(page, 'English') - await runCopy({ page, toLocale: englishLocale }) + await runCopy({ page, toLocale: defaultLocale }) await expect(arrayField).toHaveValue(sampleText) })