Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(tests): update selectors and event names for Tailwind v4 migration

Steven Enamakel417a5fb43bfb
diff --git a/app/src/components/MeshGradient.test.tsx b/app/src/components/MeshGradient.test.tsx
index 8e9553bfb4..0956f4ab77 100644
--- a/app/src/components/MeshGradient.test.tsx
+++ b/app/src/components/MeshGradient.test.tsx
@@ -143,7 +143,7 @@ describe('<MeshGradient />', () => {
// Window backgrounded (occluded/blurred) → the shader must stop rendering.
hasFocus.mockReturnValue(false);
act(() => {
- window.dispatchEvent(new Event('blur-sm'));
+ window.dispatchEvent(new Event('blur'));
});
expect(gradientMock.pause).toHaveBeenCalledTimes(1);
expect(gradientMock.conf.playing).toBe(false);
@@ -178,7 +178,7 @@ describe('<MeshGradient />', () => {
// (previously this crashed on the next animation frame).
hasFocus.mockReturnValue(false);
act(() => {
- window.dispatchEvent(new Event('blur-sm'));
+ window.dispatchEvent(new Event('blur'));
});
hasFocus.mockReturnValue(true);
act(() => {
diff --git a/app/src/components/MeshGradient.tsx b/app/src/components/MeshGradient.tsx
index f4062ed39b..cac150ec13 100644
--- a/app/src/components/MeshGradient.tsx
+++ b/app/src/components/MeshGradient.tsx
@@ -157,7 +157,7 @@ export default function MeshGradient() {
removeMotionListener?.();
document.removeEventListener('visibilitychange', onPlayStateChange);
window.removeEventListener('focus', onPlayStateChange);
- window.removeEventListener('blur-sm', onPlayStateChange);
+ window.removeEventListener('blur', onPlayStateChange);
window.cancelAnimationFrame(raf);
disconnectGradient();
};
diff --git a/app/src/components/settings/panels/__tests__/AIPanel.omlx.test.tsx b/app/src/components/settings/panels/__tests__/AIPanel.omlx.test.tsx
index 2c84817401..96c828f05d 100644
--- a/app/src/components/settings/panels/__tests__/AIPanel.omlx.test.tsx
+++ b/app/src/components/settings/panels/__tests__/AIPanel.omlx.test.tsx
@@ -138,6 +138,15 @@ const baseUsage = {
};
describe('AIPanel OMLX connect', () => {
+ const openOmlxConnectDialog = async () => {
+ fireEvent.click(await screen.findByTestId('add-provider-open'));
+ const trigger = await screen.findByTestId('add-provider-select-local');
+ trigger.focus();
+ fireEvent.keyDown(trigger, { key: 'Enter' });
+ fireEvent.keyDown(await screen.findByTestId('add-provider-option-omlx'), { key: 'Enter' });
+ return await screen.findByRole('dialog', { name: /Connect OMLX/i });
+ };
+
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(loadAISettings).mockResolvedValue(baseSettings);
@@ -158,21 +167,18 @@ describe('AIPanel OMLX connect', () => {
vi.mocked(listComposioConnections).mockResolvedValue({ connections: [] });
});
- it('renders an OMLX local-runtime chip', async () => {
+ it('offers OMLX in the local-provider catalogue', async () => {
renderWithProviders(<AIPanel />);
- await waitFor(() =>
- expect(screen.getByRole('switch', { name: /Connect OMLX/i })).toBeInTheDocument()
- );
+ fireEvent.click(await screen.findByTestId('add-provider-open'));
+ const trigger = await screen.findByTestId('add-provider-select-local');
+ trigger.focus();
+ fireEvent.keyDown(trigger, { key: 'Enter' });
+ expect(await screen.findByTestId('add-provider-option-omlx')).toBeInTheDocument();
});
it('toggling OMLX ON shows BOTH an endpoint field (localhost:8000) and an API key field', async () => {
renderWithProviders(<AIPanel />);
- await waitFor(() =>
- expect(screen.getByRole('switch', { name: /Connect OMLX/i })).toBeInTheDocument()
- );
- fireEvent.click(screen.getByRole('switch', { name: /Connect OMLX/i }));
-
- const dialog = await screen.findByRole('dialog', { name: /Connect OMLX/i });
+ const dialog = await openOmlxConnectDialog();
const urlInput = within(dialog).getByLabelText(/Endpoint URL/i) as HTMLInputElement;
expect(urlInput).toBeInTheDocument();
expect(urlInput.value).toBe('http://localhost:8000/v1');
@@ -181,12 +187,7 @@ describe('AIPanel OMLX connect', () => {
it('persists provider=omlx with base_url + api_key on confirm', async () => {
renderWithProviders(<AIPanel />);
- await waitFor(() =>
- expect(screen.getByRole('switch', { name: /Connect OMLX/i })).toBeInTheDocument()
- );
- fireEvent.click(screen.getByRole('switch', { name: /Connect OMLX/i }));
-
- const dialog = await screen.findByRole('dialog', { name: /Connect OMLX/i });
+ const dialog = await openOmlxConnectDialog();
fireEvent.change(within(dialog).getByLabelText(/Endpoint URL/i), {
target: { value: 'http://localhost:8000/v1' },
});
diff --git a/app/src/components/ui/Dialog.centering.test.tsx b/app/src/components/ui/Dialog.centering.test.tsx
index 57c05447ef..f62baed015 100644
--- a/app/src/components/ui/Dialog.centering.test.tsx
+++ b/app/src/components/ui/Dialog.centering.test.tsx
@@ -9,7 +9,7 @@
* so the centering transform was dropped while the animation ran.
*
* Asserting the class name alone would only catch a literal revert. These tests
- * assert the RULE instead, against the real tailwind config: any entrance
+ * assert the RULE instead, against the real Tailwind v4 theme: any entrance
* animation used by a transform-centered element must carry the centering in
* every one of its own keyframes, and must land exactly where the utility
* classes leave it so nothing moves when the animation hands the element back.
@@ -22,26 +22,26 @@ import { describe, expect, it } from 'vitest';
import AlertDialogRoot, { AlertDialogContent } from './AlertDialog';
import { DialogContent, DialogRoot } from './Dialog';
-/** The animation registrations and keyframes, read from the real config. */
+/** The animation registrations and keyframes, read from the real theme. */
const tailwindSource = readFileSync(
- join(__dirname, '..', '..', '..', 'tailwind.config.js'),
+ join(__dirname, '..', '..', 'index.css'),
'utf8'
);
-/** `'dialog-in': 'dialogIn 0.2s …'` → the keyframe name `dialogIn`. */
+/** `--animate-dialog-in: dialogIn 0.2s …` → the keyframe name `dialogIn`. */
const keyframeNameFor = (animation: string): string => {
- const match = tailwindSource.match(new RegExp(`'${animation}':\\s*'(\\w+)`));
+ const match = tailwindSource.match(new RegExp(`--animate-${animation}:\\s*(\\w+)`));
if (!match) throw new Error(`no animation registered as '${animation}'`);
return match[1];
};
/** Every `transform:` value inside the named keyframe block. */
const transformsIn = (keyframe: string): string[] => {
- const start = tailwindSource.indexOf(` ${keyframe}: {`);
+ const start = tailwindSource.indexOf(` @keyframes ${keyframe} {`);
if (start === -1) throw new Error(`no keyframes named ${keyframe}`);
- const end = tailwindSource.indexOf('\n },', start);
+ const end = tailwindSource.indexOf('\n }', start);
const block = tailwindSource.slice(start, end);
- return Array.from(block.matchAll(/transform:\s*'([^']+)'/g)).map(m => m[1]);
+ return Array.from(block.matchAll(/transform:\s*([^;]+);/g)).map(m => m[1].trim());
};
const centeringClassesOf = (el: HTMLElement) => ({
diff --git a/app/src/lib/cn.test.ts b/app/src/lib/cn.test.ts
index ef90183953..0914006097 100644
--- a/app/src/lib/cn.test.ts
+++ b/app/src/lib/cn.test.ts
@@ -4,35 +4,12 @@ import { describe, expect, it } from 'vitest';
import { cn } from './cn';
-/**
- * `tailwind.config.js` is CommonJS in a `"type": "module"` package, and it
- * calls `require()` for its plugins — so neither a plain import nor
- * `createRequire` loads it under Vite. Evaluate it in a sandbox that stubs
- * `module`/`require` instead, which is the same "read the config as data"
- * approach `flows/canvas/__tests__/flowCanvasOutlines.test.ts` takes with
- * `index.css`.
- */
-function loadTailwindConfig(): { theme: { extend: Record<string, Record<string, unknown>> } } {
- // Vitest runs with `app/` as cwd (see test/vitest.config.ts).
- const configPath = resolve(process.cwd(), 'tailwind.config.js');
- const source = readFileSync(configPath, 'utf8');
- const sandboxedModule = { exports: {} as Record<string, unknown> };
- const evaluate = new Function(
- 'module',
- 'exports',
- 'require',
- `${source}\nreturn module.exports;`
- ) as (
- module: typeof sandboxedModule,
- exports: Record<string, unknown>,
- require: () => unknown
- ) => { theme: { extend: Record<string, Record<string, unknown>> } };
-
- // Plugins are irrelevant here — only `theme.extend` is under test.
- return evaluate(sandboxedModule, sandboxedModule.exports, () => ({}));
-}
+// Tailwind v4 keeps project tokens in CSS rather than a JS config. Read the
+// real theme source so this drift guard follows the same values the build sees.
+const themeSource = readFileSync(resolve(process.cwd(), 'src/index.css'), 'utf8');
-const tailwindConfig = loadTailwindConfig();
+const themeKeys = (prefix: string): string[] =>
+ Array.from(themeSource.matchAll(new RegExp(`--${prefix}-([\\w-]+):`, 'g')), match => match[1]);
describe('cn', () => {
it('flattens conditionals like clsx', () => {
@@ -77,12 +54,12 @@ describe('cn', () => {
});
/**
- * The drift guard. Every custom scale key in `tailwind.config.js` for the
+ * The drift guard. Every custom scale key in the Tailwind v4 `@theme` for the
* groups tailwind-merge would otherwise misclassify must be registered in
* `cn.ts`. Adding `rounded-6xl` to the config and not to `cn.ts` fails here
* rather than silently producing a component whose radius never applies.
*/
-describe('cn stays in sync with tailwind.config.js', () => {
+describe('cn stays in sync with the Tailwind theme', () => {
const STOCK = {
fontSize: ['xs', 'sm', 'base', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl'],
borderRadius: ['none', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', 'full', 'DEFAULT'],
@@ -91,6 +68,14 @@ describe('cn stays in sync with tailwind.config.js', () => {
backdropBlur: ['none', 'sm', 'md', 'lg', 'xl'],
} as const;
+ const PREFIX = {
+ fontSize: 'text',
+ borderRadius: 'radius',
+ boxShadow: 'shadow',
+ backgroundImage: 'background-image',
+ backdropBlur: 'backdrop-blur',
+ } as const;
+
// Keys the cn.ts config registers, per group.
const REGISTERED = {
fontSize: ['micro'],
@@ -114,7 +99,7 @@ describe('cn stays in sync with tailwind.config.js', () => {
for (const group of Object.keys(REGISTERED) as (keyof typeof REGISTERED)[]) {
it(`registers every non-stock ${group} key`, () => {
- const configured = Object.keys(tailwindConfig.theme.extend[group] ?? {});
+ const configured = themeKeys(PREFIX[group]);
const needsRegistering = configured.filter(
key => !(STOCK[group] as readonly string[]).includes(key)
);
diff --git a/app/src/pages/__tests__/Conversations.sidebarOverflow.test.tsx b/app/src/pages/__tests__/Conversations.sidebarOverflow.test.tsx
index 78adb56a7e..6726828980 100644
--- a/app/src/pages/__tests__/Conversations.sidebarOverflow.test.tsx
+++ b/app/src/pages/__tests__/Conversations.sidebarOverflow.test.tsx
@@ -263,7 +263,7 @@ describe('Conversations — sidebar composer footer overflow (#3785)', () => {
expect(footer).not.toHaveClass('shrink-0');
});
- it('keeps the floating page-variant composer absolutely positioned (no regression)', async () => {
+ it('keeps the assistant-ui page composer in flow (no legacy floating footer)', async () => {
const store = buildStore({ thread: emptyThreadState });
const { default: Conversations } = await import('../../features/conversations/Conversations');
@@ -281,11 +281,11 @@ describe('Conversations — sidebar composer footer overflow (#3785)', () => {
));
});
- const footer = container.querySelector('[data-walkthrough="home-cta"]');
- expect(footer).not.toBeNull();
- // Page variant floats over the message fade; it must NOT adopt the sidebar's
- // in-flow scroll cap.
- expect(footer).toHaveClass('absolute');
- expect(footer).not.toHaveClass('overflow-y-auto');
+ const composer = container.querySelector('[data-slot="aui_composer-shell"]');
+ expect(composer).not.toBeNull();
+ // The assistant-ui thread owns an in-flow composer. The old absolute
+ // home-cta footer must not reappear and cover the message viewport.
+ expect(composer?.closest('.aui-composer-root')).not.toHaveClass('absolute');
+ expect(container.querySelector('[data-walkthrough="home-cta"]')).toBeNull();
});
});
diff --git a/app/src/pages/__tests__/Skills.channels-grid.test.tsx b/app/src/pages/__tests__/Skills.channels-grid.test.tsx
index af95df1dcd..a157e73492 100644
--- a/app/src/pages/__tests__/Skills.channels-grid.test.tsx
+++ b/app/src/pages/__tests__/Skills.channels-grid.test.tsx
@@ -115,7 +115,7 @@ describe('Skills page — Channels grid', () => {
renderWithProviders(<Skills />, { initialEntries: ['/connections'], preloadedState });
fireEvent.click(screen.getByTestId('two-pane-nav-channels'));
- const channelsCard = screen.getByRole('heading', { name: 'Messaging' }).closest('.rounded-2xl');
+ const channelsCard = screen.getByRole('heading', { name: 'Messaging' }).closest('[data-slot="card"]');
const order = within(channelsCard as HTMLElement)
.getAllByTestId(/^skill-row-channel-/)
.map(el => el.getAttribute('data-testid'));
@@ -135,7 +135,7 @@ describe('Skills page — Channels grid', () => {
const { store } = renderWithProviders(<Skills />, { initialEntries: ['/connections'] });
fireEvent.click(screen.getByTestId('two-pane-nav-channels'));
- const channelsCard = screen.getByRole('heading', { name: 'Messaging' }).closest('.rounded-2xl');
+ const channelsCard = screen.getByRole('heading', { name: 'Messaging' }).closest('[data-slot="card"]');
const within$ = within(channelsCard as HTMLElement);
// The redux default starts on Telegram, so its tile shows the "Default"
@@ -164,7 +164,7 @@ describe('Skills page — Channels grid', () => {
const channelsHeading = screen.getByRole('heading', { name: 'Messaging' });
expect(channelsHeading).toBeInTheDocument();
- const channelsCard = channelsHeading.closest('.rounded-2xl');
+ const channelsCard = channelsHeading.closest('[data-slot="card"]');
expect(channelsCard).not.toBeNull();
const within$ = within(channelsCard as HTMLElement);
@@ -228,7 +228,7 @@ describe('Skills page — Channels grid', () => {
fireEvent.click(screen.getByTestId('two-pane-nav-channels'));
const channelsCard = screen
.getByRole('heading', { name: 'Messaging' })
- .closest('.rounded-2xl');
+ .closest('[data-slot="card"]');
const telegramTile = within(channelsCard as HTMLElement).getByRole('button', {
name: new RegExp(`Telegram.*${labelPattern.source}`, 'i'),
});