0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Fixed some flaky portal browser tests (#22133)

no issue

- The i18n browser test was setting the site language to 'fr', and this
state was carrying over to other tests which broke assertions based on
the english text in portal. This caused portal tests to generally be
flaky, since it would break a somewhat random test based on the order
they are executed in.
- This resets the language back to english, so we are in a consistent
state for future tests.
This commit is contained in:
Chris Raible 2025-02-06 11:39:24 -08:00 committed by GitHub
parent 9dd48f9d83
commit bf35f09826
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,15 @@ async function setLanguage(sharedPage, language) {
await expect(section.getByLabel('Site language')).toHaveValue(language);
}
async function resetLanguage(sharedPage) {
await sharedPage.goto('/ghost/#/settings/publication-language');
const section = sharedPage.getByTestId('publication-language');
await section.getByLabel('Site language').fill('en');
await section.getByRole('button', {name: 'Save'}).click();
await expect(section.getByLabel('Site language')).toHaveValue('en');
}
test.describe('i18n', () => {
test.describe('Newsletter', () => {
test('changing the site language immediately translates strings in newsletters', async ({sharedPage}) => {
@ -35,6 +44,11 @@ test.describe('i18n', () => {
await expect(metaText).toContain('Par Joe Bloggs');
await expect(metaText).not.toContain('By Joe Bloggs');
// close the email preview modal
await sharedPage.keyboard.press('Escape');
// reset language to en
await resetLanguage(sharedPage);
});
});
});