Skip to content

Commit 1272235

Browse files
authored
Update localized screenshots workflow to be more robust (#3371)
1 parent 3ef2056 commit 1272235

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/SIL.XForge.Scripture/ClientApp/e2e/workflows/localized-screenshots.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,12 @@ export async function localizedScreenshots(
156156
async function forEachLocale(callback: (localeCode: string) => Promise<void>): Promise<void> {
157157
for (let i = 0; i < preset.locales.length; i++) {
158158
const localeCode = preset.locales[i];
159+
// Only switch the language if not already on the default
159160
if (i !== 0) await switchLanguage(page, localeCode);
160161
await callback(localeCode);
161162
}
162-
await switchLanguage(page, 'en');
163+
// Only switch back to the default language if there was another locale to switch to
164+
if (preset.locales.length > 1) await switchLanguage(page, 'en');
163165
}
164166

165167
await forEachLocale(async locale => {
@@ -395,9 +397,10 @@ export async function localizedScreenshots(
395397
await expect(page.getByText('Your draft is ready')).toBeVisible({ timeout: 180_000 });
396398
await page.reload();
397399
await installMouseFollower(page);
398-
// Wait for the draft status to start updating
400+
// When the page first loads it will say "Your draft is ready", but then switch to saying it's finishing. Wait for a
401+
// few seconds for it to no longer say "Your draft is ready", and then wait for it to say it's ready again
399402
await page.waitForTimeout(5_000);
400-
await expect(page.getByText('Your draft is ready')).toBeVisible();
403+
await expect(page.getByText('Your draft is ready')).toBeVisible({ timeout: 10_000 });
401404
await expect(page.getByText('No books have any drafts')).not.toBeVisible();
402405
await expect(page.getByText('Draft is finishing')).not.toBeVisible();
403406

0 commit comments

Comments
 (0)