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.

test(e2e): a New Chat click right after onboarding no longer races the model list

purplefffe4dcccef8
diff --git a/e2e/builtin-ctx.spec.ts b/e2e/builtin-ctx.spec.ts
index 4f88a18e..6b4eff84 100644
--- a/e2e/builtin-ctx.spec.ts
+++ b/e2e/builtin-ctx.spec.ts
@@ -1,5 +1,6 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { openNewChat } from './support/ui'
/**
* ENG-5 acceptance — the built-in engine's context window is HONEST end to end:
@@ -42,9 +43,8 @@ test('context dropdown relaunches the built-in engine and the counter follows',
await completeBuiltinOnboarding(page)
// Chat once so the TokenCounter renders (it needs messages).
- await page.getByRole('button', { name: /New Chat/i }).click()
+ await openNewChat(page)
const composer = page.locator('textarea').first()
- await expect(composer).toBeVisible({ timeout: 20_000 })
await composer.fill('ping the built-in engine')
await page.getByRole('button', { name: /Send message/i }).click()
await expect(page.getByText(/PONG_BUILTIN_OK/)).toBeVisible({ timeout: 20_000 })
diff --git a/e2e/cloud-onboarding.spec.ts b/e2e/cloud-onboarding.spec.ts
index 68acf87f..2d6c0e24 100644
--- a/e2e/cloud-onboarding.spec.ts
+++ b/e2e/cloud-onboarding.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
import { routeCloud, seedOnboardingDone, signInViaGate, cloudSwitch } from './support/cloud-mock'
+import { openNewChat } from './support/ui'
/**
* 2.5.7 cloud onboarding — purple header switch → gate login → cloud mode.
@@ -40,7 +41,7 @@ test('Max account: switch → login → cloud mode with the hosted catalog', asy
await expect(page.getByRole('button', { name: /^Benchmark$/ })).toBeHidden()
// The chat picker lists the hosted catalog (and only it).
- await page.getByRole('button', { name: /New Chat/i }).click()
+ await openNewChat(page)
const picker = page.getByText(/Llama 3\.1 8B Turbo/i).first()
await expect(picker).toBeVisible({ timeout: 20_000 })
diff --git a/e2e/discover-split-download.spec.ts b/e2e/discover-split-download.spec.ts
index a9b412aa..b6428781 100644
--- a/e2e/discover-split-download.spec.ts
+++ b/e2e/discover-split-download.spec.ts
@@ -1,5 +1,6 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { openNewChat } from './support/ui'
/**
* Sharded-GGUF download flow, end to end on the real UI (2.6.0, DeepSeek V4
@@ -69,6 +70,12 @@ async function bootThroughBuiltinOnboarding(page: Page) {
await expect(page.getByRole('button', { name: /Skip for now/i })).toBeVisible({ timeout: 30_000 })
await page.getByRole('button', { name: /Skip for now/i }).click()
await page.getByRole('button', { name: /Get Started/i }).click()
+ // The download flow below branches on the ACTIVE provider (built-in →
+ // flat dir, LM Studio → <user>/<repo> nesting), and the active model is
+ // only set once the async model list lands. Prove the managed engine is
+ // live before touching Discover, or a slow machine tests the wrong branch.
+ await openNewChat(page)
+ await expect(page.getByText(/qwen2\.5-0\.5b/i).first()).toBeVisible()
}
test('0731 card resolves the real shard set, confirms 3 parts, starts all downloads into one dir', async ({ page }) => {
diff --git a/e2e/onboarding-builtin.spec.ts b/e2e/onboarding-builtin.spec.ts
index 1a8b7a61..b1bfdafe 100644
--- a/e2e/onboarding-builtin.spec.ts
+++ b/e2e/onboarding-builtin.spec.ts
@@ -1,5 +1,6 @@
import { test, expect, type Page } from '@playwright/test'
import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { openNewChat } from './support/ui'
/**
* P3b acceptance test — fresh onboarding → first chat over the built-in engine.
@@ -53,9 +54,8 @@ test('fresh onboarding boots the built-in engine and answers a chat', async ({ p
await page.getByRole('button', { name: /Get Started/i }).click()
// chat — open a fresh conversation, which reveals the composer
- await page.getByRole('button', { name: /New Chat/i }).click()
+ await openNewChat(page)
const composer = page.locator('textarea').first()
- await expect(composer).toBeVisible({ timeout: 20_000 })
await composer.fill('ping the built-in engine')
await page.getByRole('button', { name: /Send message/i }).click()
diff --git a/e2e/support/ui.ts b/e2e/support/ui.ts
new file mode 100644
index 00000000..1aa3b16c
--- /dev/null
+++ b/e2e/support/ui.ts
@@ -0,0 +1,24 @@
+import { expect, type Page } from '@playwright/test'
+
+/**
+ * Open a fresh conversation and wait for the composer to actually exist.
+ *
+ * Right after onboarding (or an appMode flip) the model list populates
+ * asynchronously, and Sidebar.handleNewChat treats a click without an
+ * active model as "nothing to chat with": local mode routes to the Models
+ * page (the mylogz guard), cloud mode ignores the click. A real user just
+ * clicks New Chat again once the list is in; this retry mirrors that user
+ * instead of racing the fetch. The race never fires on a fast machine but
+ * is near-deterministic on the slow Windows PW box, where the first click
+ * always loses against the model-list round trip.
+ */
+export async function openNewChat(page: Page): Promise<void> {
+ await expect(async () => {
+ // Land back in the chat view first in case an earlier losing click
+ // parked us on the Models page.
+ const back = page.getByRole('button', { name: /Back to chat/i })
+ if (await back.isVisible().catch(() => false)) await back.click()
+ await page.getByRole('button', { name: /New Chat/i }).click()
+ await expect(page.locator('textarea').first()).toBeVisible({ timeout: 2_000 })
+ }).toPass({ timeout: 30_000 })
+}