Skip to content

Commit

Permalink
test(browser): add waitForElementToBeRemoved at overlay test
Browse files Browse the repository at this point in the history
  • Loading branch information
minuukang committed Dec 29, 2024
1 parent 6cb845b commit 1b07d64
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/browser/test/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cleanup, render, screen } from '@testing-library/react';
import { cleanup, render, screen, waitForElementToBeRemoved } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import { afterEach, describe, expect, test } from 'vitest';
import { useFunnel } from '../src/index.js';
Expand Down Expand Up @@ -110,6 +110,8 @@ describe('Test useFunnel browser router', () => {
// close overlay
await user.click(screen.getByText('Close Overlay'));

await waitForElementToBeRemoved(() => screen.queryAllByText('overlay: vitest'));

expect(screen.queryByText('Go A')).toBeNull();
expect(screen.queryByText('Go B')).not.toBeNull();
expect(screen.queryByText('overlay: vitest')).toBeNull();
Expand Down

0 comments on commit 1b07d64

Please sign in to comment.