Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): share settings-panel e2e budgets across specs (PRD-8208) (#3796)

Andrew Mikofalvya282157549f0
diff --git a/packages/app/tests/stress/_helpers/index.ts b/packages/app/tests/stress/_helpers/index.ts
index 762a0ddfd..202be5840 100644
--- a/packages/app/tests/stress/_helpers/index.ts
+++ b/packages/app/tests/stress/_helpers/index.ts
@@ -56,6 +56,13 @@ export {
tailServerLog,
waitForHttpReady,
} from './server-process.ts';
+export {
+ openProjectPluginsPanel,
+ openSettingsSection,
+ SETTINGS_PANEL_TIMEOUT_MS,
+ setPluginEnabled,
+ waitForSettingsPanel,
+} from './settings.ts';
export { createFileViaSidebar, createFolderViaSidebar, sidebarFileButton } from './sidebar.ts';
export {
getSelectedItemSnapshot,
diff --git a/packages/app/tests/stress/_helpers/settings.ts b/packages/app/tests/stress/_helpers/settings.ts
new file mode 100644
index 000000000..323ac1b7b
--- /dev/null
+++ b/packages/app/tests/stress/_helpers/settings.ts
@@ -0,0 +1,126 @@
+/**
+ * Settings-dialog helpers.
+ *
+ * The dialog straddles a bundle boundary that every spec reaching a settings
+ * panel has to budget for. `SettingsDialogShell` ships in the main bundle, so
+ * the frame and the sidebar paint on the same frame as the hash write, while
+ * the entire body sits behind ONE `React.lazy` chunk under a single Suspense
+ * boundary. A worker's first open therefore pays a cold dev-server transform of
+ * the whole schema-form graph, an order of magnitude slower than the warm
+ * reopen and well past the config's default expect budget.
+ *
+ * That cost is a property of the chunk, not of any one spec, so the budget for
+ * it lives here rather than in each caller. A visible `settings-dialog` proves
+ * only that the shell painted; it says nothing about the body.
+ */
+
+import type { Locator, Page } from '@playwright/test';
+import { expect } from './fixtures.ts';
+
+/**
+ * Budget for any wait on content INSIDE the lazy settings body: a panel's own
+ * test id, a field row, a scope badge.
+ *
+ * NOT for a plugin toggle's readiness. That is a distinct budget owned by
+ * `setPluginEnabled`, which gates on the config binding rather than the lazy
+ * chunk -- putting this constant on a toggle wait re-conflates the two.
+ *
+ * Sized for the cold transform above rather than for the warm case, and
+ * deliberately generous, because putting the long budget on the outcome a test
+ * actually needs is what keeps every later assertion short and failing by name.
+ * Waits on the shell (`settings-dialog`, sidebar rows, search results) do NOT
+ * belong here, since those are main-bundle and paint immediately.
+ */
+export const SETTINGS_PANEL_TIMEOUT_MS = 30_000;
+
+/**
+ * Budget for a plugin toggle to leave the `disabled` state it renders in until
+ * the project config binding syncs. Separate from the chunk budget because it
+ * is a CRDT round-trip rather than a transform, and it only starts once the
+ * body has already painted.
+ *
+ * Shaped like `CREATE_CONVERGED_TIMEOUT` in `sidebar.ts`, for the reason stated
+ * there: an inline `timeout:` OVERRIDES the config's `expect.timeout`, so any
+ * number below the platform budget is a NARROWING. On CI this is deliberately
+ * EQUAL to that budget, which makes the override inert there and leaves its only
+ * real effect the widening of the 5s local default. Raise it if the config's CI
+ * budget is ever raised — left behind, it would quietly become the very defect
+ * this module exists to prevent.
+ */
+const PLUGIN_BINDING_TIMEOUT_MS = process.env.CI ? 15_000 : 10_000;
+
+/** Wait for a lazily-rendered settings panel body to paint. */
+export async function waitForSettingsPanel(page: Page, panelTestId: string): Promise<void> {
+ await expect(page.getByTestId(panelTestId)).toBeVisible({
+ timeout: SETTINGS_PANEL_TIMEOUT_MS,
+ });
+}
+
+/**
+ * Deep-link to a settings section and wait for its panel body.
+ *
+ * `#settings/<section>` is the app's own navigation surface and the body
+ * dispatches on the section id alone, so the panel is selected on the dialog's
+ * open edge, with no sidebar interaction and no dependency on the THIS PROJECT
+ * group staying `disabled` until `collabUrl` resolves.
+ *
+ * `panelTestId` is explicit rather than derived, because a panel's test id is
+ * authored inside its own section component: `preferences` renders
+ * `settings-project-preferences`, so a string transform of the section id would
+ * silently wait on an id that never attaches.
+ */
+export async function openSettingsSection(
+ page: Page,
+ sectionId: string,
+ panelTestId: string,
+): Promise<void> {
+ await page.goto(`/#settings/${sectionId}`);
+ await waitForSettingsPanel(page, panelTestId);
+}
+
+/**
+ * Deep-link to the project Plugins panel and wait for its body.
+ *
+ * This REPLACES the page: it is a plain `goto`, so nothing in session history
+ * precedes the dialog. A spec that asserts on the dialog's `history.back()`
+ * close needs the land-then-push-the-hash variant instead — see
+ * `openProjectPluginsViaHashPush` in `plugin-enable-notice.e2e.ts`. The two are
+ * not merged because the difference IS the thing that spec asserts on.
+ */
+export async function openProjectPluginsPanel(page: Page): Promise<void> {
+ await openSettingsSection(page, 'plugins-manage', 'settings-plugins-manage');
+}
+
+/**
+ * The enable/disable switch for one plugin on the project Plugins panel.
+ *
+ * Module-private on purpose. Every caller wants a plugin driven to a KNOWN
+ * state, which is `setPluginEnabled`; handing out the bare locator invites the
+ * ungated `aria-checked` read that function exists to prevent.
+ */
+function pluginToggle(page: Page, pluginId: string): Locator {
+ return page.getByTestId(`settings-plugin-toggle-${pluginId}`);
+}
+
+/**
+ * Drive a plugin's switch to `on`, tolerating whatever state a sibling test
+ * left behind.
+ *
+ * The enabled gate is load-bearing, not defensive. The switch renders
+ * `disabled` and unchecked until its binding is ready, so an `aria-checked`
+ * read before then reports `false` even for a plugin that is already ON. The
+ * branch below would then skip its click and wait out an assertion on a value
+ * moving the other way, which is a deterministic wrong outcome rather than
+ * merely a slow one. Gating on enabled subsumes a visibility wait too, since a
+ * toggle inside an unresolved chunk is not enabled either.
+ *
+ * Callers must already be on the Plugins panel: this gate is budgeted for the
+ * config binding, not for the lazy chunk. The confirming assertion inherits the
+ * config expect budget, which is higher on CI than a short inline override.
+ */
+export async function setPluginEnabled(page: Page, pluginId: string, on: boolean): Promise<void> {
+ const toggle = pluginToggle(page, pluginId);
+ await expect(toggle).toBeEnabled({ timeout: PLUGIN_BINDING_TIMEOUT_MS });
+ if ((await toggle.getAttribute('aria-checked')) !== String(on)) await toggle.click();
+ await expect(toggle).toHaveAttribute('aria-checked', String(on));
+}
diff --git a/packages/app/tests/stress/language-picker.e2e.ts b/packages/app/tests/stress/language-picker.e2e.ts
index 02ac994b3..9adfa8312 100644
--- a/packages/app/tests/stress/language-picker.e2e.ts
+++ b/packages/app/tests/stress/language-picker.e2e.ts
@@ -21,7 +21,7 @@ import { mkdtempSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import type { Page } from '@playwright/test';
-import { expect, test } from './_helpers';
+import { expect, SETTINGS_PANEL_TIMEOUT_MS, test } from './_helpers';
// The picker writes a USER-scope preference, which lands in `~/.ok/global.yml`.
// Node resolves `homedir()` from `HOME` on POSIX, so pointing the dev server at
@@ -42,8 +42,13 @@ const SYSTEM_OPTION = /^(System|Sistema|跟随系统|시스템)$/;
async function openLanguagePicker(page: Page) {
await page.goto('/#settings');
await expect(page.getByTestId('settings-dialog')).toBeVisible({ timeout: 10_000 });
+ // The trigger is body content: LanguageSelect renders inside field-controls,
+ // reached only through SettingsDialogBodyLazy behind the shell's single
+ // Suspense boundary. A worker's first open pays the cold chunk transform, so
+ // this takes the shared body budget. The `settings-dialog` wait above stays
+ // at 10s -- that one is shell, main-bundle, and paints immediately.
const trigger = page.getByRole('combobox', { name: TRIGGER_NAME });
- await expect(trigger).toBeVisible({ timeout: 10_000 });
+ await expect(trigger).toBeVisible({ timeout: SETTINGS_PANEL_TIMEOUT_MS });
await trigger.click();
await expect(page.getByRole('listbox')).toBeVisible();
return trigger;
diff --git a/packages/app/tests/stress/markdown-lint.e2e.ts b/packages/app/tests/stress/markdown-lint.e2e.ts
index 4b8b7196c..fa2996895 100644
--- a/packages/app/tests/stress/markdown-lint.e2e.ts
+++ b/packages/app/tests/stress/markdown-lint.e2e.ts
@@ -33,6 +33,7 @@ import {
expect,
filterCriticalErrors,
type LogEntry,
+ SETTINGS_PANEL_TIMEOUT_MS,
test,
waitForActiveProviderSynced as waitForProvider,
} from './_helpers';
@@ -363,7 +364,10 @@ test.describe('markdown lint — settings rule browser', () => {
await page.goto('/#settings');
await page.getByTestId('settings-sidebar-item-plugin:markdownlint').click();
const search = page.getByTestId('markdownlint-rule-search');
- await expect(search).toBeVisible({ timeout: 10_000 });
+ // First render of the lazy settings body in this page, so it carries the
+ // shared cold-chunk budget. The 10s it replaced was below the config's own
+ // CI expect budget, i.e. a narrowing rather than a margin.
+ await expect(search).toBeVisible({ timeout: SETTINGS_PANEL_TIMEOUT_MS });
await search.fill('MD001');
const toggle = page.getByTestId('markdownlint-rule-toggle-MD001');
await expect(toggle).toHaveAttribute('aria-checked', 'true');
@@ -407,7 +411,10 @@ test.describe('markdown lint — settings rule browser', () => {
await page.goto('/#settings');
await page.getByTestId('settings-sidebar-item-plugin:markdownlint').click();
const search = page.getByTestId('markdownlint-rule-search');
- await expect(search).toBeVisible({ timeout: 10_000 });
+ // First render of the lazy settings body in this page, so it carries the
+ // shared cold-chunk budget. The 10s it replaced was below the config's own
+ // CI expect budget, i.e. a narrowing rather than a margin.
+ await expect(search).toBeVisible({ timeout: SETTINGS_PANEL_TIMEOUT_MS });
await search.fill('MD013');
await page.getByTestId('markdownlint-rule-expand-MD013').click();
diff --git a/packages/app/tests/stress/okf-generated-index-settings.e2e.ts b/packages/app/tests/stress/okf-generated-index-settings.e2e.ts
index ff64657c3..d102b10db 100644
--- a/packages/app/tests/stress/okf-generated-index-settings.e2e.ts
+++ b/packages/app/tests/stress/okf-generated-index-settings.e2e.ts
@@ -14,7 +14,13 @@ import { join } from 'node:path';
import AxeBuilder from '@axe-core/playwright';
import type { Page } from '@playwright/test';
import { parse } from 'yaml';
-import { expect, test } from './_helpers';
+import {
+ expect,
+ openProjectPluginsPanel,
+ openSettingsSection,
+ setPluginEnabled,
+ test,
+} from './_helpers';
test.use({
workerServerEnv: { OK_TEST_OKF_GENERATED_INDEX_SETTINGS: 'isolated-content-v1' },
@@ -35,18 +41,9 @@ function readProjectConfig(configPath: string): OkfProjectConfig {
}
async function openOkfSettings(page: Page): Promise<void> {
- await page.goto('/#settings/plugins-manage');
- await expect(page.getByTestId('settings-plugins-manage')).toBeVisible({ timeout: 30_000 });
-
- const okfToggle = page.getByTestId('settings-plugin-toggle-okf');
- await expect(okfToggle).toBeVisible();
- if ((await okfToggle.getAttribute('aria-checked')) !== 'true') {
- await okfToggle.click();
- }
- await expect(okfToggle).toHaveAttribute('aria-checked', 'true');
-
- await page.goto('/#settings/plugin:okf');
- await expect(page.getByTestId('settings-plugin-okf')).toBeVisible({ timeout: 30_000 });
+ await openProjectPluginsPanel(page);
+ await setPluginEnabled(page, 'okf', true);
+ await openSettingsSection(page, 'plugin:okf', 'settings-plugin-okf');
}
async function expectDisclosureContrast(page: Page, theme: 'light' | 'dark'): Promise<void> {
diff --git a/packages/app/tests/stress/okf-recommended-skill-install.e2e.ts b/packages/app/tests/stress/okf-recommended-skill-install.e2e.ts
index 0f9b785f2..3dd9023b9 100644
--- a/packages/app/tests/stress/okf-recommended-skill-install.e2e.ts
+++ b/packages/app/tests/stress/okf-recommended-skill-install.e2e.ts
@@ -9,23 +9,23 @@
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import type { Page } from '@playwright/test';
-import { expect, test } from './_helpers';
+import {
+ expect,
+ openProjectPluginsPanel,
+ openSettingsSection,
+ setPluginEnabled,
+ test,
+ waitForSettingsPanel,
+} from './_helpers';
test.use({
workerServerEnv: { OK_TEST_OKF_RECOMMENDED_SKILL: 'isolated-content-v1' },
});
async function openOkfSettings(page: Page): Promise<void> {
- await page.goto('/#settings/plugins-manage');
- await expect(page.getByTestId('settings-plugins-manage')).toBeVisible({ timeout: 30_000 });
-
- const okfToggle = page.getByTestId('settings-plugin-toggle-okf');
- await expect(okfToggle).toBeVisible();
- if ((await okfToggle.getAttribute('aria-checked')) !== 'true') await okfToggle.click();
- await expect(okfToggle).toHaveAttribute('aria-checked', 'true');
-
- await page.goto('/#settings/plugin:okf');
- await expect(page.getByTestId('settings-plugin-okf')).toBeVisible({ timeout: 30_000 });
+ await openProjectPluginsPanel(page);
+ await setPluginEnabled(page, 'okf', true);
+ await openSettingsSection(page, 'plugin:okf', 'settings-plugin-okf');
}
test('installs the recommended skill through the real endpoint and recognizes it after reload', async ({
@@ -63,7 +63,7 @@ test('installs the recommended skill through the real endpoint and recognizes it
await expect(card).toContainText('Installed');
await page.reload();
- await expect(page.getByTestId('settings-plugin-okf')).toBeVisible({ timeout: 30_000 });
+ await waitForSettingsPanel(page, 'settings-plugin-okf');
const reloadedCard = page.getByTestId('settings-okf-recommended-skill');
await expect(reloadedCard).toContainText('Installed');
await expect(reloadedCard.getByRole('button', { name: 'Open skill' })).toBeVisible();
diff --git a/packages/app/tests/stress/plugin-enable-notice.e2e.ts b/packages/app/tests/stress/plugin-enable-notice.e2e.ts
index 4e190ebc6..1d59937ed 100644
--- a/packages/app/tests/stress/plugin-enable-notice.e2e.ts
+++ b/packages/app/tests/stress/plugin-enable-notice.e2e.ts
@@ -18,9 +18,15 @@
*/
import type { Page } from '@playwright/test';
-import { expect, test } from './_helpers';
+import { expect, setPluginEnabled, test, waitForSettingsPanel } from './_helpers';
-async function openProjectPluginsPage(page: Page): Promise<void> {
+/**
+ * Reach the Plugins panel while KEEPING a prior history entry, which the shared
+ * `openProjectPluginsPanel` does not: it is a plain `goto`, so the dialog's
+ * single `history.back()` close would leave the SPA. This file asserts on that
+ * close, so the navigation strategy is the difference and the two stay separate.
+ */
+async function openProjectPluginsViaHashPush(page: Page): Promise<void> {
// Land on the app FIRST, then push the settings hash, so the dialog's
// `history.back()` close returns to the doc view instead of leaving the SPA
// (which a `goto('/#settings/...')` deep link would do — there is no prior
@@ -37,52 +43,36 @@ async function openProjectPluginsPage(page: Page): Promise<void> {
// group being `disabled` until `collabUrl` resolves, since the body dispatches
// on the section id alone.
//
- // The single wait below is deliberately generous: the whole settings body is
- // one `React.lazy` chunk, and a worker's first open pays a cold dev-server
- // transform of the entire schema-form graph, an order of magnitude slower
- // than the warm reopen and well past the config's default expect budget.
- // Putting the long budget here — on the outcome the test actually needs —
- // keeps every later assertion short and failing by name.
- await expect(page.getByTestId('settings-plugins-manage')).toBeVisible({ timeout: 30_000 });
-}
-
-/** Drive the real toggle to `on`, tolerating whatever state a sibling test left. */
-async function setMarkdownlintEnabled(page: Page, on: boolean): Promise<void> {
- const toggle = page.getByTestId('settings-plugin-toggle-markdownlint');
- await expect(toggle).toBeVisible({ timeout: 5_000 });
- // The switch renders disabled and unchecked until the project config binding
- // syncs. Reading `aria-checked` before then reports `false` even for a plugin
- // a sibling test left ON, and the branch below would skip its click and then
- // wait out an assertion on a value that is about to move the other way.
- await expect(toggle).toBeEnabled({ timeout: 15_000 });
- if ((await toggle.getAttribute('aria-checked')) !== String(on)) await toggle.click();
- await expect(toggle).toHaveAttribute('aria-checked', String(on), { timeout: 5_000 });
+ // The panel wait carries the shared cold-chunk budget rather than a local
+ // number — see `_helpers/settings.ts` for why the settings body is the
+ // expensive part and every spec that reaches it needs the same margin.
+ await waitForSettingsPanel(page, 'settings-plugins-manage');
}
-// The waits in the helpers above are diagnostic budgets: each is sized so a
-// stall fails by name instead of as a bare test timeout. Both helpers run again
-// in `afterEach`, and Playwright charges hook time to the same per-test slot, so
-// their worst case (~120s of body budget plus ~55s of cleanup) does not fit the
-// config's 120s. A larger slot keeps those named assertions reachable. It cannot
-// mask a regression: the assertion that stalls still exhausts its own budget and
-// fails first.
+// The waits in the helper above and in `setPluginEnabled` are diagnostic
+// budgets: each is sized so a stall fails by name instead of as a bare test
+// timeout. Both run again in `afterEach`, and Playwright charges hook time to
+// the same per-test slot, so their worst case does not fit the config's 120s. A
+// larger slot keeps those named assertions reachable. It cannot mask a
+// regression: the assertion that stalls still exhausts its own budget and fails
+// first.
test.setTimeout(180_000);
test.describe('plugin enable → settings notice', () => {
// The toggle writes the shared per-worker project config; leave it off so a
// sibling stress file on this worker starts from the documented default.
test.afterEach(async ({ page }) => {
- await openProjectPluginsPage(page);
- await setMarkdownlintEnabled(page, false);
+ await openProjectPluginsViaHashPush(page);
+ await setPluginEnabled(page, 'markdownlint', false);
});
test('the enable notice is clickable under the modal dialog and lands on the plugin panel', async ({
page,
}) => {
- await openProjectPluginsPage(page);
- await setMarkdownlintEnabled(page, false);
+ await openProjectPluginsViaHashPush(page);
+ await setPluginEnabled(page, 'markdownlint', false);
- await setMarkdownlintEnabled(page, true);
+ await setPluginEnabled(page, 'markdownlint', true);
// The notice names the plugin and offers its settings.
const notice = page.locator('[data-sonner-toast]').filter({ hasText: 'markdownlint enabled' });
@@ -102,10 +92,10 @@ test.describe('plugin enable → settings notice', () => {
test('the notice still lands the user on the panel after Settings is closed', async ({
page,
}) => {
- await openProjectPluginsPage(page);
- await setMarkdownlintEnabled(page, false);
+ await openProjectPluginsViaHashPush(page);
+ await setPluginEnabled(page, 'markdownlint', false);
- await setMarkdownlintEnabled(page, true);
+ await setPluginEnabled(page, 'markdownlint', true);
const notice = page.locator('[data-sonner-toast]').filter({ hasText: 'markdownlint enabled' });
await expect(notice).toBeVisible({ timeout: 5_000 });
@@ -121,8 +111,8 @@ test.describe('plugin enable → settings notice', () => {
});
test('each plugin panel links its docs', async ({ page }) => {
- await openProjectPluginsPage(page);
- await setMarkdownlintEnabled(page, true);
+ await openProjectPluginsViaHashPush(page);
+ await setPluginEnabled(page, 'markdownlint', true);
// The plugin's own sidebar row only renders once the config binding
// reflects the enable, so it can lag the assertion above. Without a bounded
@@ -142,14 +132,14 @@ test.describe('plugin enable → settings notice', () => {
test.describe('plugin enable notice — repeat use while Settings is open', () => {
test.afterEach(async ({ page }) => {
- await openProjectPluginsPage(page);
- await setMarkdownlintEnabled(page, false);
+ await openProjectPluginsViaHashPush(page);
+ await setPluginEnabled(page, 'markdownlint', false);
});
test('one Escape closes Settings after the notice navigated in-dialog', async ({ page }) => {
- await openProjectPluginsPage(page);
- await setMarkdownlintEnabled(page, false);
- await setMarkdownlintEnabled(page, true);
+ await openProjectPluginsViaHashPush(page);
+ await setPluginEnabled(page, 'markdownlint', false);
+ await setPluginEnabled(page, 'markdownlint', true);
const notice = page.locator('[data-sonner-toast]').filter({ hasText: 'markdownlint enabled' });
await notice.getByRole('button', { name: 'Open settings' }).click();
diff --git a/packages/app/tests/stress/prd-7627-default-swatch.e2e.ts b/packages/app/tests/stress/prd-7627-default-swatch.e2e.ts
index d76d981da..f9f8fc1a2 100644
--- a/packages/app/tests/stress/prd-7627-default-swatch.e2e.ts
+++ b/packages/app/tests/stress/prd-7627-default-swatch.e2e.ts
@@ -16,7 +16,7 @@
* here would rewrite the developer's own theme. Poking the attribute drives the
* identical cascade with no write and no dependence on incoming config.
*/
-import { expect, test } from './_helpers';
+import { expect, SETTINGS_PANEL_TIMEOUT_MS, test } from './_helpers';
/** Dracula's `--background`, as the generated stylesheet sets it. */
const DRACULA_BG = 'rgb(40, 42, 54)';
@@ -36,7 +36,11 @@ test('the Default tile does not inherit the applied palette', async ({ page }) =
.first()
.evaluate((el) => getComputedStyle(el).backgroundColor);
- await expect(page.getByRole('group', { name: /Default/ })).toBeVisible({ timeout: 10_000 });
+ // The tile picker is the first panel-BODY render here: every wait above is
+ // shell (dialog frame, search box, results), which ships in the main bundle.
+ await expect(page.getByRole('group', { name: /Default/ })).toBeVisible({
+ timeout: SETTINGS_PANEL_TIMEOUT_MS,
+ });
await page.evaluate(() => document.documentElement.setAttribute('data-color-theme', 'dracula'));
// The palette really is cascading — the Dracula tile paints Dracula's canvas.
diff --git a/packages/app/tests/stress/settings-search.e2e.ts b/packages/app/tests/stress/settings-search.e2e.ts
index 94e918f31..77e97a0cc 100644
--- a/packages/app/tests/stress/settings-search.e2e.ts
+++ b/packages/app/tests/stress/settings-search.e2e.ts
@@ -18,8 +18,20 @@
* wired into the CI `test:e2e` subset (packages/app/package.json).
*/
-import { expect, test } from './_helpers';
+import {
+ expect,
+ SETTINGS_PANEL_TIMEOUT_MS,
+ setPluginEnabled,
+ test,
+ waitForSettingsPanel,
+} from './_helpers';
+/**
+ * Open the dialog only. The frame and sidebar ship in the main bundle, so this
+ * wait is cheap and stays short — every wait BELOW that reaches panel-body
+ * content carries `SETTINGS_PANEL_TIMEOUT_MS` instead, because the body is one
+ * lazy chunk whose first resolve on a worker is an order of magnitude slower.
+ */
async function openSettings(page: import('@playwright/test').Page) {
await page.goto('/#settings');
await expect(page.getByTestId('settings-dialog')).toBeVisible({ timeout: 10_000 });
@@ -57,7 +69,9 @@ test.describe('Settings search — navigation + pinned layout', () => {
await result.click();
// Real body swapped to the Hotkeys section; query cleared → group nav back.
- await expect(page.getByTestId('settings-hotkeys')).toBeVisible({ timeout: 5_000 });
+ await expect(page.getByTestId('settings-hotkeys')).toBeVisible({
+ timeout: SETTINGS_PANEL_TIMEOUT_MS,
+ });
await expect(page.getByTestId('settings-sidebar-item-preferences')).toBeVisible();
});
@@ -76,7 +90,7 @@ test.describe('Settings search — navigation + pinned layout', () => {
await result.click();
const field = page.locator('[data-field="editor.wordWrap"]');
- await expect(field).toBeVisible({ timeout: 5_000 });
+ await expect(field).toBeVisible({ timeout: SETTINGS_PANEL_TIMEOUT_MS });
// Rendered outcome: the field is scrolled into the viewport…
await expect(field).toBeInViewport();
// …and the real CSS flash keyframe is applied, then clears.
@@ -97,7 +111,7 @@ test.describe('Settings search — navigation + pinned layout', () => {
await result.click();
const block = page.locator('[data-field="section:sharing"]');
- await expect(block).toBeVisible({ timeout: 5_000 });
+ await expect(block).toBeVisible({ timeout: SETTINGS_PANEL_TIMEOUT_MS });
await expect(block).toBeInViewport();
await expect(block).toHaveClass(/animate-settings-nav-flash/, { timeout: 2_000 });
});
@@ -116,7 +130,7 @@ test.describe('Settings search — navigation + pinned layout', () => {
await result.click();
const field = page.locator('[data-field="editor.previewTabs"]');
- await expect(field).toBeVisible({ timeout: 5_000 });
+ await expect(field).toBeVisible({ timeout: SETTINGS_PANEL_TIMEOUT_MS });
await expect(field).toBeInViewport();
}
});
@@ -127,7 +141,9 @@ test.describe('Settings search — scope badges + markdownlint rules', () => {
await openSettings(page);
// Themes is a user-scope plugin, enabled by default.
await page.getByTestId('settings-sidebar-item-plugin:theme').click();
- await expect(page.getByTestId('settings-scope-badge-user')).toBeVisible({ timeout: 5_000 });
+ await expect(page.getByTestId('settings-scope-badge-user')).toBeVisible({
+ timeout: SETTINGS_PANEL_TIMEOUT_MS,
+ });
await expect(page.getByTestId('settings-scope-badge-project')).toHaveCount(0);
});
@@ -136,14 +152,13 @@ test.describe('Settings search — scope badges + markdownlint rules', () => {
}) => {
await openSettings(page);
- // Ensure markdownlint is ENABLED via the real project-plugins toggle.
+ // Ensure markdownlint is ENABLED via the real project-plugins toggle. The
+ // panel wait is the caller's job: it is this page's first body render, so it
+ // pays the cold chunk, while the helper's own gate is budgeted only for the
+ // config binding that leaves the switch disabled.
await page.getByTestId('settings-sidebar-item-plugins-manage').click();
- const toggle = page.getByTestId('settings-plugin-toggle-markdownlint');
- await expect(toggle).toBeVisible({ timeout: 5_000 });
- if ((await toggle.getAttribute('aria-checked')) !== 'true') {
- await toggle.click();
- }
- await expect(toggle).toHaveAttribute('aria-checked', 'true', { timeout: 5_000 });
+ await waitForSettingsPanel(page, 'settings-plugins-manage');
+ await setPluginEnabled(page, 'markdownlint', true);
// A rule is now searchable from the sidebar search; the result opens the
// panel pre-filtered to that rule, and the header shows the Project badge.
@@ -152,18 +167,17 @@ test.describe('Settings search — scope badges + markdownlint rules', () => {
await expect(ruleResult).toBeVisible({ timeout: 5_000 });
await ruleResult.click();
- await expect(page.getByTestId('settings-plugin-markdownlint')).toBeVisible({ timeout: 5_000 });
+ await expect(page.getByTestId('settings-plugin-markdownlint')).toBeVisible();
await expect(page.getByTestId('settings-scope-badge-project')).toBeVisible();
await expect(page.getByTestId('markdownlint-rule-search')).toHaveValue('MD013');
await expect(page.getByTestId('markdownlint-rule-row-MD013')).toBeVisible();
await expect(page.getByTestId('markdownlint-rule-row-MD001')).toHaveCount(0);
- // Now DISABLE markdownlint; its rules drop out of the search index.
+ // Now DISABLE markdownlint; its rules drop out of the search index. No
+ // panel wait here: the body chunk resolved above, so the helper's binding
+ // gate is the only readiness left to wait on.
await page.getByTestId('settings-sidebar-item-plugins-manage').click();
- const toggleAgain = page.getByTestId('settings-plugin-toggle-markdownlint');
- await expect(toggleAgain).toBeVisible({ timeout: 5_000 });
- await toggleAgain.click();
- await expect(toggleAgain).toHaveAttribute('aria-checked', 'false', { timeout: 5_000 });
+ await setPluginEnabled(page, 'markdownlint', false);
await page.getByTestId('settings-search-input').fill('MD013');
await expect(page.getByTestId('settings-search-result-rule:MD013')).toHaveCount(0);
diff --git a/packages/app/tests/stress/unified-problems.e2e.ts b/packages/app/tests/stress/unified-problems.e2e.ts
index 676017fa0..b676d6718 100644
--- a/packages/app/tests/stress/unified-problems.e2e.ts
+++ b/packages/app/tests/stress/unified-problems.e2e.ts
@@ -24,6 +24,8 @@ import {
expect,
filterCriticalErrors,
type LogEntry,
+ openProjectPluginsPanel,
+ setPluginEnabled,
test,
waitForActiveProviderSynced as waitForProvider,
} from './_helpers';
@@ -303,6 +305,14 @@ test.describe('unified Problems — file-tree indicators', () => {
});
test('enabling the plugin from Settings lights up an UNOPENED doc row', async ({ page, api }) => {
+ // The settings panel now carries the shared cold-chunk budget, and this
+ // test already spends three 30s freshness polls around it, so the sum of
+ // its long budgets no longer fits the config's 120s slot. Sizing the slot
+ // keeps each of those assertions able to reach its own budget and fail by
+ // name; it cannot mask a regression, because whichever wait stalls still
+ // exhausts that budget first.
+ test.setTimeout(180_000);
+
// The report's headline symptom: "you enable the plugin, nothing lights up."
// Driven through the real Settings switch rather than an API call, because
// the plugin toggle takes a DIFFERENT route to the freshness trigger than a
@@ -321,19 +331,22 @@ test.describe('unified Problems — file-tree indicators', () => {
await expect.poll(problemAttr, { timeout: 30_000 }).toBe('warning');
- // The same deep link the Problems panel's "Enable plugins" pointer uses.
- await page.goto('/#settings/plugins-manage');
- await expect(page.getByTestId('settings-plugins-manage')).toBeVisible({ timeout: 10_000 });
- const toggle = page.getByTestId('settings-plugin-toggle-markdownlint');
- await expect(toggle).toBeVisible({ timeout: 10_000 });
-
- // Off: the doc's only finding was MD010, so its row must go bare.
- await toggle.click();
+ // The same deep link the Problems panel's "Enable plugins" pointer uses,
+ // via the shared helper so the settings body's cold-chunk budget is stated
+ // once. The 10s it replaced was below the config's own CI expect budget, so
+ // it narrowed the margin rather than widening it.
+ await openProjectPluginsPanel(page);
+
+ // Off: the doc's only finding was MD010, so its row must go bare. Driven to
+ // a known state rather than clicked blind, because the switch is disabled
+ // until the config binding syncs and a blind click would block on
+ // actionability and burn the whole slot as a bare click timeout.
+ await setPluginEnabled(page, 'markdownlint', false);
await expect.poll(problemAttr, { timeout: 30_000 }).toBeNull();
// Back on — the reported scenario. The row must light up again with the doc
// still never opened. Left ON so the file's config state matches beforeEach.
- await toggle.click();
+ await setPluginEnabled(page, 'markdownlint', true);
await expect.poll(problemAttr, { timeout: 30_000 }).toBe('warning');
});
@@ -342,6 +355,9 @@ test.describe('unified Problems — file-tree indicators', () => {
api,
workerServer,
}) => {
+ // Same slot sizing as the markdownlint case above, for the same reason.
+ test.setTimeout(180_000);
+
// The report's FIRST symptom names frontmatter specifically ("files with
// frontmatter issues don't turn yellow until you click into them one at a
// time"). markdownlint and frontmatter are separate plugins reaching the
@@ -392,11 +408,8 @@ test.describe('unified Problems — file-tree indicators', () => {
// Plugin off: the row is bare even though the doc violates the schema.
await expect.poll(problemAttr, { timeout: 20_000 }).toBeNull();
- await page.goto('/#settings/plugins-manage');
- await expect(page.getByTestId('settings-plugins-manage')).toBeVisible({ timeout: 10_000 });
- const toggle = page.getByTestId('settings-plugin-toggle-frontmatter');
- await expect(toggle).toBeVisible({ timeout: 10_000 });
- await toggle.click();
+ await openProjectPluginsPanel(page);
+ await setPluginEnabled(page, 'frontmatter', true);
// Enabling the plugin must light the row up with the doc never opened.
await expect.poll(problemAttr, { timeout: 30_000 }).toBe('warning');
@@ -406,7 +419,7 @@ test.describe('unified Problems — file-tree indicators', () => {
// down, so a sibling test could otherwise inherit frontmatter validation.
// The schema mapping itself goes inert once the plugin is off (the audit
// skips schema resolution and appliesTo checks entirely when disabled).
- await toggle.click();
+ await setPluginEnabled(page, 'frontmatter', false);
await expect.poll(problemAttr, { timeout: 30_000 }).toBeNull();
});