Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

e2e: three mobile tests no longer race a slow runner; one retry on CI

purple0aac97118275
diff --git a/e2e/mobile/chat.mobile.ts b/e2e/mobile/chat.mobile.ts
index b74117e5..b74e6fd9 100644
--- a/e2e/mobile/chat.mobile.ts
+++ b/e2e/mobile/chat.mobile.ts
@@ -1851,11 +1851,16 @@ for (const size of SIZES) {
await back(page)
await expect(page.getByTestId('m-chats-screen')).toBeVisible()
await backend(page, (ctl) => { ctl.reply = 'Opened and answered.' })
- const opened = await page.evaluate(async (chatId) => {
- const { sendFromOutside } = await import(/* @vite-ignore */ `${location.origin}/src/mobile/screens/chat/parts/controller.ts`)
- return sendFromOutside(chatId, 'One more thing')
+ // The chat opens while the call runs and the history of the page moves with it, which can end an evaluate
+ // that still waits (seen on CI, about one run in three): the call starts on its own, its answer is read after.
+ await page.evaluate((chatId) => {
+ const w = window as unknown as { __luOpened?: string }
+ window.setTimeout(async () => {
+ const { sendFromOutside } = await import(/* @vite-ignore */ `${location.origin}/src/mobile/screens/chat/parts/controller.ts`)
+ w.__luOpened = await sendFromOutside(chatId, 'One more thing')
+ }, 0)
}, stored.chatId)
- expect(opened).toBe('opened')
+ await expect.poll(() => page.evaluate(() => (window as unknown as { __luOpened?: string }).__luOpened)).toBe('opened')
await expect(page.getByTestId('m-chat-screen')).toBeVisible()
await answerDone(page, 'Opened and answered.')
await expect(userMessages(page).last()).toContainText('One more thing')
@@ -4559,7 +4564,8 @@ test.describe('chat, round 3 on the small iPhone', () => {
await send(page, 'I live in Paris. Three?')
await expect(answers(page)).toHaveCount(3)
await answerDone(page, LONG)
- await expect.poll(async () => (await backend(page, (ctl) => ctl.bodies as string[])).length).toBe(before + 2)
+ // The answer and the silent call after it have left. A slow runner can add a request of its own (seen on CI: one more).
+ await expect.poll(async () => (await backend(page, (ctl) => ctl.bodies as string[])).length).toBeGreaterThanOrEqual(before + 2)
expect(await learning()).toBeGreaterThan(0)
// The answer is done, so the chat says so: no "Answering", and Send is not Stop.
await expect(page.getByTestId('m-chat-running')).toHaveCount(0)
diff --git a/e2e/mobile/cloudseite.mobile.ts b/e2e/mobile/cloudseite.mobile.ts
index b3b82ebf..c0407518 100644
--- a/e2e/mobile/cloudseite.mobile.ts
+++ b/e2e/mobile/cloudseite.mobile.ts
@@ -192,8 +192,8 @@ test.describe('LU Cloud page, signed out', () => {
await openCloud(page, 'appstore')
const show = page.getByTestId('m-cloud-showcase')
await expect(show).toHaveAttribute('data-still', '')
- const moving = await page.evaluate(() => document.getAnimations().filter((a) => ((a.effect as KeyframeEffect | null)?.target as Element | null)?.closest?.('[data-testid="m-cloud-showcase"]')).length)
- expect(moving).toBe(0)
+ // The way onto the page may still be fading in on a slow runner; after that nothing in the preview moves.
+ await expect.poll(() => page.evaluate(() => document.getAnimations().filter((a) => ((a.effect as KeyframeEffect | null)?.target as Element | null)?.closest?.('[data-testid="m-cloud-showcase"]')).length)).toBe(0)
await page.waitForTimeout(5000)
await expect(show).toHaveAttribute('data-scene', 'chat')
await page.getByTestId('m-cloud-showcase-image').tap()
diff --git a/playwright.config.ts b/playwright.config.ts
index 0a72be46..3976d808 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -42,7 +42,9 @@ export default defineConfig({
testDir: './e2e',
fullyParallel: false,
forbidOnly: !!process.env.CI,
- retries: 0,
+ // One more try on CI only: the full run takes over two hours on a shared runner, and a test that passes on its
+ // second try is still listed as flaky in the report. Locally a red test stays red.
+ retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: [['list']],
timeout: 60_000,