|
| 1 | +import { join } from "path"; |
| 2 | +import { createNextTest } from "../../fixture"; |
| 3 | +import { expect } from '@playwright/test' |
| 4 | +import { getDirname } from "../../utils"; |
| 5 | + |
| 6 | +const { test } = createNextTest({ |
| 7 | + path: join(getDirname(import.meta.url), 'app'), |
| 8 | + dependencies: { |
| 9 | + "useflytrap": `link:${join(getDirname(import.meta.url), '..', '..', '..')}` |
| 10 | + } |
| 11 | +}) |
| 12 | + |
| 13 | +// @todo: we need to install `useflytrap` by path |
| 14 | +// to test out the bug fix. |
| 15 | +// "useflytrap": "link:/Users/rasmus/Desktop/DEV/Web/flytrap-libs", |
| 16 | + |
| 17 | + |
| 18 | +test("flood of captures are ignored and doesn't affect app performance", async ({ page }) => { |
| 19 | + await page.goto('/'); |
| 20 | + |
| 21 | + // Get the initial value of the counter |
| 22 | + const initialCounterValue = await page.getByRole('paragraph').textContent() |
| 23 | + |
| 24 | + if (initialCounterValue === null) { |
| 25 | + throw new Error(`Counter is null`) |
| 26 | + } |
| 27 | + |
| 28 | + // Trigger flood of captures |
| 29 | + await page.getByRole('button', { name: 'Trigger flood' }).click() |
| 30 | + |
| 31 | + // Then, click the increment button |
| 32 | + await page.getByRole('button', { name: 'Increment' }).click() |
| 33 | + |
| 34 | + // Get the updated value of the counter |
| 35 | + const updatedCounterValue = await page.getByRole("paragraph").textContent() |
| 36 | + |
| 37 | + // Check if the counter has incremented |
| 38 | + expect(updatedCounterValue).not.toBe(initialCounterValue); |
| 39 | +}) |
0 commit comments