Skip to content

Commit 315945c

Browse files
Copilothotlong
andcommitted
Add setup and postVisit hooks to test-runner config
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 6fa3f5e commit 315945c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.storybook/test-runner.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type { TestRunnerConfig } from '@storybook/test-runner';
22

33
const config: TestRunnerConfig = {
4+
// Hook that is executed once before all tests
5+
async setup() {
6+
// Global setup if needed
7+
},
8+
49
// Hook that is executed before the test runner starts running tests
510
async preVisit(page) {
611
// Set up any global variables or configurations needed for tests
@@ -9,6 +14,11 @@ const config: TestRunnerConfig = {
914
(window as any).__test = true;
1015
});
1116
},
17+
18+
// Hook that is executed after the test runner finishes running tests
19+
async postVisit(page) {
20+
// Clean up if needed
21+
},
1222
};
1323

1424
export default config;

0 commit comments

Comments
 (0)