Skip to content

Turn one illustration into an animated 2D mesh avatar with a coding agent and a local editor

Retry flaky e2e tests once and time the kana phrase on the preview clock

shinshin868239660b2eb6
diff --git a/AGENTS.md b/AGENTS.md
index a152249..ff5b5da 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -29,6 +29,9 @@ uv run tools/test_agent_tools.py
```
The numerical deformation regression must remain 0 px (physics has floating-point tolerance).
+If an e2e test is reported as flaky (it passed on retry) and is unrelated to your change,
+mention it in your report instead of investigating it. In tests, do not assert on fixed
+wall-clock durations; wait for a state, or measure on the clock the app itself uses.
## Runtime compatibility
diff --git a/e2e/lip-sync-settings.spec.ts b/e2e/lip-sync-settings.spec.ts
index 30fc3bb..3654498 100644
--- a/e2e/lip-sync-settings.spec.ts
+++ b/e2e/lip-sync-settings.spec.ts
@@ -75,10 +75,25 @@ test('presets preview immediately, fine-tuning becomes custom and user kana keep
await page.getByLabel('Kana text', { exact: true }).fill('あーーーーーーー');
await page.getByLabel('Morae per second', { exact: true }).fill('4');
await page.getByRole('checkbox', { name: 'Loop', exact: true }).uncheck();
+ // The preview advances lip sync by at most 50 ms per frame, so measure the phrase on that
+ // clock instead of wall time: a slow page stretches both, and a restart would add a second.
+ await page.locator('.lip-text-row').getByRole('button', { name: 'Play', exact: true }).evaluate(play => play.addEventListener('click', () => {
+ const stopButton = play.nextElementSibling as HTMLButtonElement, clock = { elapsed: 0, done: false };
+ Object.assign(window, { lipClock: clock });
+ let previous = performance.now();
+ const frame = (now: number) => {
+ clock.elapsed += Math.min(50, Math.max(0, now - previous)); previous = now;
+ if (stopButton.disabled) clock.done = true; else requestAnimationFrame(frame);
+ };
+ requestAnimationFrame(frame);
+ }, { once: true }));
+ const lipClock = () => page.evaluate(() => (window as Window & { lipClock?: { elapsed: number; done: boolean } }).lipClock ?? { elapsed: 0, done: false });
await page.locator('.lip-text-row').getByRole('button', { name: 'Play', exact: true }).click();
- await page.waitForTimeout(1000);
+ await expect.poll(async () => (await lipClock()).elapsed).toBeGreaterThan(1000);
await settings.getByRole('button', { name: 'Expressive', exact: true }).click();
- await expect(stop).toBeDisabled({ timeout: 1600 });
+ await expect.poll(async () => (await lipClock()).done, { timeout: 10000 }).toBe(true);
+ expect((await lipClock()).elapsed).toBeLessThan(2600);
+ await expect(stop).toBeDisabled();
await page.getByRole('tab', { name: 'Pose test', exact: true }).click();
await expect(settings).toBeHidden();
});
diff --git a/playwright.config.ts b/playwright.config.ts
index 493c226..35f5399 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -7,6 +7,8 @@ export default defineConfig({
testDir: 'e2e',
// Real layer builds and pixel comparisons must not compete for GPU/CPU resources.
workers: 1,
+ // A test that passes on retry is reported as flaky instead of failing the run.
+ retries: 1,
use: {
baseURL,
viewport: { width: 1440, height: 1000 },