Skip to content

Commit 9db7547

Browse files
fix: add build step to CI and make tests more robust for slow environments
- Added 'pnpm build' step to GitHub Actions workflow before running tests - Fixed exports test by ensuring dist files are built in CI - Made framework animation tests more robust with polling approach - Added browser-specific timeouts for WebKit compatibility - Increased wait times and retry attempts for slow CI environments
1 parent 7b85fb5 commit 9db7547

File tree

2 files changed

+43
-11
lines changed

2 files changed

+43
-11
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
run: pnpm install --frozen-lockfile=false
2929
- name: Install Playwright Browsers
3030
run: pnpm exec playwright install --with-deps
31+
- name: Build project
32+
run: pnpm build
3133
- name: Run Playwright tests
3234
run: pnpm test:e2e
3335
- name: Upload Playwright report

tests/e2e/framework-animations.spec.ts

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from '@playwright/test'
2-
import { assertNoConsoleErrors, withAnimationObserver, waitForActiveAnimations } from './utils'
2+
import { assertNoConsoleErrors, withAnimationObserver } from './utils'
33

44
test.describe('Framework examples animate on interaction', () => {
55
test.beforeEach(async ({ page }) => {
@@ -9,10 +9,20 @@ test.describe('Framework examples animate on interaction', () => {
99

1010
test('Vue example animates on remove', async ({ page }) => {
1111
const assertNoErrorsLater = await assertNoConsoleErrors(page)
12+
await page.locator('.vue-example').scrollIntoViewIfNeeded()
13+
await page.waitForTimeout(100)
1214
const observer = await withAnimationObserver(page, '.vue-example ul')
1315
await page.locator('.vue-example ul li').first().click()
14-
await page.waitForTimeout(50)
15-
expect(await observer.count()).toBeGreaterThan(0)
16+
17+
// Check multiple times to catch animations on slow systems
18+
let animationCount = 0
19+
for (let i = 0; i < 10; i++) {
20+
animationCount = await observer.count()
21+
if (animationCount > 0) break
22+
await page.waitForTimeout(50)
23+
}
24+
25+
expect(animationCount).toBeGreaterThan(0)
1626
await assertNoErrorsLater()
1727
})
1828

@@ -34,16 +44,28 @@ test.describe('Framework examples animate on interaction', () => {
3444
await assertNoErrorsLater()
3545
})
3646

37-
test('Solid example animates on toggle', async ({ page }) => {
47+
test('Solid example animates on toggle', async ({ page, browserName }) => {
3848
const assertNoErrorsLater = await assertNoConsoleErrors(page)
3949
// Scroll to make sure the Solid example is visible
4050
await page.locator('.solid-example').scrollIntoViewIfNeeded()
41-
await page.waitForTimeout(200) // Give more time for any scroll-triggered layouts
51+
// WebKit needs more time on slow systems
52+
await page.waitForTimeout(browserName === 'webkit' ? 1000 : 500)
53+
54+
// Set up observer before clicking to catch animations
4255
const observer = await withAnimationObserver(page, '.solid-example .parent')
56+
57+
// Click and immediately start checking for animations
4358
await page.getByRole('button', { name: 'Toggle Drawer' }).click()
44-
await page.waitForTimeout(100) // Additional wait for animation to start
45-
await waitForActiveAnimations(page, '.solid-example .parent')
46-
expect(await observer.count()).toBeGreaterThan(0)
59+
60+
// Check multiple times to catch animations on slow systems
61+
let animationCount = 0
62+
for (let i = 0; i < 20; i++) { // More attempts for slow systems
63+
animationCount = await observer.count()
64+
if (animationCount > 0) break
65+
await page.waitForTimeout(50)
66+
}
67+
68+
expect(animationCount).toBeGreaterThan(0)
4769
await assertNoErrorsLater()
4870
})
4971

@@ -65,11 +87,19 @@ test.describe('Framework examples animate on interaction', () => {
6587
const assertNoErrorsLater = await assertNoConsoleErrors(page)
6688
// Scroll to make sure the Angular example is visible
6789
await page.locator('.angular-example').scrollIntoViewIfNeeded()
68-
await page.waitForTimeout(100) // Give time for any scroll-triggered layouts
90+
await page.waitForTimeout(200) // Give time for any scroll-triggered layouts
6991
const observer = await withAnimationObserver(page, '.angular-example')
7092
await page.locator('.angular-example .toggle-story-btn').first().click()
71-
await waitForActiveAnimations(page, '.angular-example')
72-
expect(await observer.count()).toBeGreaterThan(0)
93+
94+
// Check multiple times to catch animations on slow systems
95+
let animationCount = 0
96+
for (let i = 0; i < 10; i++) {
97+
animationCount = await observer.count()
98+
if (animationCount > 0) break
99+
await page.waitForTimeout(50)
100+
}
101+
102+
expect(animationCount).toBeGreaterThan(0)
73103
await assertNoErrorsLater()
74104
})
75105
})

0 commit comments

Comments
 (0)