Skip to content

Commit 4eaef65

Browse files
committed
test: attempt to find a reason of freezing test #4
1 parent 252a0bb commit 4eaef65

File tree

2 files changed

+63
-26
lines changed

2 files changed

+63
-26
lines changed

src/test/docsComponent/DocsComp.test.tsx

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { act, fireEvent, render, screen, waitForElementToBeRemoved } from '@testing-library/react';
1+
// import { act, fireEvent, render, screen, waitForElementToBeRemoved } from '@testing-library/react';
22
import { describe, expect, it } from 'vitest';
33

4-
import App from '@/app/App';
4+
// import App from '@/app/App';
55

66
describe('Testing for docs component', () => {
77
// it('Should render docs components after clicking on show docs btn', async () => {
@@ -19,30 +19,30 @@ describe('Testing for docs component', () => {
1919
// await screen.findByText('A GraphQL schema provides a root type for each kind of operation.'),
2020
// ).toBeInTheDocument();
2121
// });
22-
it('Should close docs section after clicking on overlay', async () => {
23-
render(<App />);
24-
const showDocsBtn = screen.getByText('show docs');
25-
expect(screen.queryByTestId('overlay')).toBeNull();
26-
expect(screen.queryByText('Docs')).toBeNull();
27-
expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation')).toBeNull();
28-
await act(async () => {
29-
fireEvent.click(showDocsBtn);
30-
});
31-
const overlay = await screen.findByTestId('overlay');
32-
expect(overlay).toBeInTheDocument();
33-
expect(await screen.findByText('Docs')).toBeInTheDocument();
34-
expect(
35-
await screen.findByText('A GraphQL schema provides a root type for each kind of operation.'),
36-
).toBeInTheDocument();
37-
await act(async () => {
38-
fireEvent.click(overlay);
39-
});
40-
waitForElementToBeRemoved(() => {
41-
expect(overlay).toBeNull();
42-
expect(screen.queryByText('Docs')).toBeNull();
43-
expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation.')).toBeNull();
44-
}).catch(() => {});
45-
});
22+
// it('Should close docs section after clicking on overlay', async () => {
23+
// render(<App />);
24+
// const showDocsBtn = screen.getByText('show docs');
25+
// expect(screen.queryByTestId('overlay')).toBeNull();
26+
// expect(screen.queryByText('Docs')).toBeNull();
27+
// expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation')).toBeNull();
28+
// await act(async () => {
29+
// fireEvent.click(showDocsBtn);
30+
// });
31+
// const overlay = await screen.findByTestId('overlay');
32+
// expect(overlay).toBeInTheDocument();
33+
// expect(await screen.findByText('Docs')).toBeInTheDocument();
34+
// expect(
35+
// await screen.findByText('A GraphQL schema provides a root type for each kind of operation.'),
36+
// ).toBeInTheDocument();
37+
// await act(async () => {
38+
// fireEvent.click(overlay);
39+
// });
40+
// waitForElementToBeRemoved(() => {
41+
// expect(overlay).toBeNull();
42+
// expect(screen.queryByText('Docs')).toBeNull();
43+
// expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation.')).toBeNull();
44+
// }).catch(() => {});
45+
// });
4646
// it('Should close docs section after clicking on close docs button', async () => {
4747
// render(<App />);
4848
// const showDocsBtn = screen.getByText('show docs');
@@ -132,4 +132,7 @@ describe('Testing for docs component', () => {
132132
// await screen.findByText('A GraphQL schema provides a root type for each kind of operation.'),
133133
// ).toBeInTheDocument();
134134
// });
135+
it('fake', () => {
136+
expect(1).toBe(1);
137+
});
135138
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { act, fireEvent, render, screen, waitForElementToBeRemoved } from '@testing-library/react';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import App from '@/app/App';
5+
6+
describe('Testing for docs component', () => {
7+
it('Should close docs section after clicking on overlay', async () => {
8+
render(<App />);
9+
const showDocsBtn = screen.getByText('show docs');
10+
expect(screen.queryByTestId('overlay')).toBeNull();
11+
expect(screen.queryByText('Docs')).toBeNull();
12+
expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation')).toBeNull();
13+
await act(async () => {
14+
fireEvent.click(showDocsBtn);
15+
});
16+
const overlay = await screen.findByTestId('overlay');
17+
expect(overlay).toBeInTheDocument();
18+
expect(await screen.findByText('Docs')).toBeInTheDocument();
19+
expect(
20+
await screen.findByText('A GraphQL schema provides a root type for each kind of operation.'),
21+
).toBeInTheDocument();
22+
await act(async () => {
23+
fireEvent.click(overlay);
24+
});
25+
waitForElementToBeRemoved(() => {
26+
expect(overlay).toBeNull();
27+
expect(screen.queryByText('Docs')).toBeNull();
28+
expect(screen.queryByText('A GraphQL schema provides a root type for each kind of operation.')).toBeNull();
29+
}).catch(() => {});
30+
});
31+
it('fake', () => {
32+
expect(1).toBe(1);
33+
});
34+
});

0 commit comments

Comments
 (0)