Skip to content

Commit

Permalink
confirm ttvc is not affected by animation delay (#88)
Browse files Browse the repository at this point in the history
### Summary
I want to ensure that css animations don't affect TTVC in its current implementation, so I've added a small test to verify this


### Test plan
can be run with `npx playwright test test/e2e/animation1/index.spec.ts --ui`

Co-authored-by: Rich Hong <[email protected]>
  • Loading branch information
NotDustyPayne and hongrich authored May 24, 2024
1 parent 40aa9ce commit 3d059d3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/e2e/animation1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<head>
<script src="/dist/index.min.js"></script>
<script src="/analytics.js"></script>
</head>
<style>
@keyframes test-fade-in {
from {
opacity: 0;
}

to {
opacity: 1;
}
}
</style>

<body>
<div style="opacity: 0; animation: test-fade-in 300ms 3000ms forwards">Delayed animation</div>
</body>
18 changes: 18 additions & 0 deletions test/e2e/animation1/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {test, expect} from '@playwright/test';

import {getEntriesAndErrors} from '../../util/entries';

const ANIMATION_DELAY = 3000;

test.describe('TTVC', () => {
test('an animation delay', async ({page}) => {
await page.goto(`/test/animation1`, {
waitUntil: 'networkidle',
});

const {entries} = await getEntriesAndErrors(page);

expect(entries.length).toBe(1);
expect(entries[0].duration).toBeLessThan(ANIMATION_DELAY);
});
});

0 comments on commit 3d059d3

Please sign in to comment.