-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: attempt to find a reason of freezing test #4
- Loading branch information
Showing
2 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { act, fireEvent, render, screen, waitForElementToBeRemoved } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import App from '@/app/App'; | ||
|
||
describe('Testing for docs component', () => { | ||
it('Should close docs section after clicking on overlay', async () => { | ||
render(<App />); | ||
const showDocsBtn = screen.getByText('show docs'); | ||
expect(screen.queryByTestId('overlay')).toBeNull(); | ||
expect(screen.queryByText('Docs')).toBeNull(); | ||
expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation')).toBeNull(); | ||
await act(async () => { | ||
fireEvent.click(showDocsBtn); | ||
}); | ||
const overlay = await screen.findByTestId('overlay'); | ||
expect(overlay).toBeInTheDocument(); | ||
expect(await screen.findByText('Docs')).toBeInTheDocument(); | ||
expect( | ||
await screen.findByText('A GraphQL schema provides a root type for each kind of operation.'), | ||
).toBeInTheDocument(); | ||
await act(async () => { | ||
fireEvent.click(overlay); | ||
}); | ||
waitForElementToBeRemoved(() => { | ||
expect(overlay).toBeNull(); | ||
expect(screen.queryByText('Docs')).toBeNull(); | ||
expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation.')).toBeNull(); | ||
}).catch(() => {}); | ||
}); | ||
it('fake', () => { | ||
expect(1).toBe(1); | ||
}); | ||
}); |