diff --git a/test/localization/e2e.spec.ts b/test/localization/e2e.spec.ts index 42f014e5e4b..a50cc24a024 100644 --- a/test/localization/e2e.spec.ts +++ b/test/localization/e2e.spec.ts @@ -38,6 +38,7 @@ import { arrayWithFallbackCollectionSlug, defaultLocale, englishTitle, + hungarianLocale, localizedDraftsSlug, localizedPostsSlug, relationshipLocalizedSlug, @@ -404,7 +405,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 +420,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 +439,7 @@ describe('Localization', () => { await openCopyToLocaleDrawer(page) await setToLocale(page, 'English') - await runCopy(page) + await runCopy({ page, toLocale: defaultLocale }) await expect(arrayField).toHaveValue(sampleText) }) @@ -465,7 +466,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 +483,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 +509,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 +517,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 +798,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) {