Skip to content

Commit ec4481d

Browse files
committed
fix tests
1 parent 466c8c5 commit ec4481d

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

.github/workflows/playwright.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Playwright Browsers
1616
run: npx playwright install --with-deps
1717
- name: Run Playwright tests
18-
run: npx playwright test
18+
run: npx playwright test --project replay-chromium
1919
env:
2020
BASE_URL: ${{ github.event.deployment_status.target_url }}
2121
REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}

playwright.config.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PlaywrightTestConfig } from '@playwright/test'
1+
import { PlaywrightTestConfig, devices } from '@playwright/test'
22
import { devices as replayDevices } from '@replayio/playwright'
33
import dotenv from 'dotenv';
44
dotenv.config();
@@ -22,6 +22,10 @@ const config: PlaywrightTestConfig = {
2222
name: 'replay-chromium',
2323
use: { ...(replayDevices['Replay Chromium'] as any) },
2424
},
25+
{
26+
name: 'chromium',
27+
use: { ...devices['Desktop Chrome'] },
28+
},
2529
],
2630
}
2731
export default config

src/components/Zoom.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const Zoom = ({ children }: {children: React.ReactNode}) => {
8181
onClick={closeWrapper}
8282
/>
8383
) : null}
84-
<div data-testid="zoomed-out-player" style={styles} ref={containerRef} onClick={handleImageZoom}>
84+
<div data-testid="image-with-zoom" style={styles} ref={containerRef} onClick={handleImageZoom}>
8585
{children}
8686
</div>
8787
</>

tests/navigation.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ test('navigation expanding works', async ({ page }) => {
44

55
await page.goto('/')
66
await page.getByText('Intro to time travel').click()
7-
const navigationItem = page.getByText('What is time travel?', {exact: true})
7+
const navigationItem = page.getByText('Why time travel?')
88
await expect(navigationItem).toBeVisible()
99

1010
})
1111

1212
test('navigation collapsing works', async ({ page }) => {
1313

14-
await page.goto('/time-travel-intro/what-is-time-travel')
14+
await page.goto('/time-travel-intro/why-time-travel')
1515
// sidebar items are expanded
1616
const navigationItem = page.getByText('Annotate the timeline', {exact: true})
1717
await expect(navigationItem).toBeVisible()

tests/zoomPlayer.spec.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { test, expect } from '@playwright/test'
22

3-
test.skip('player zoom in', async ({ page }) => {
3+
test('player zoom in', async ({ page }) => {
44

55
await page.goto('/test-runners/playwright/debugging-tests')
66

7-
const playerZoomedOut = page.locator('[data-testid="zoomed-out-player"]').first()
8-
await playerZoomedOut.click()
7+
const image = page.locator('[data-testid="image-with-zoom"]').first()
8+
await image.scrollIntoViewIfNeeded()
9+
await image.click()
910

1011
const playerZoomedIn = page.locator('[data-testid="zoomed-in-player"]')
12+
await playerZoomedIn.scrollIntoViewIfNeeded()
1113
await expect(playerZoomedIn).toHaveCount(1)
1214

13-
playerZoomedIn.click()
15+
await image.click()
1416
await expect(playerZoomedIn).toHaveCount(0)
1517

1618
})

0 commit comments

Comments
 (0)