Skip to content

Commit 0d29bfa

Browse files
committed
docs: extend example with a before hook
1 parent 4d5b174 commit 0d29bfa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/browser-load-testing-playwright/browser-load-test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ export const config = {
1313
}
1414
};
1515

16+
export const before = {
17+
engine: 'playwright',
18+
testFunction: async function beforeFunctionHook(_page, userContext, _events) {
19+
// Any scenario variables we add via userContext.vars in this before hook will be available in every VU
20+
userContext.vars.testStartTime = new Date();
21+
}
22+
};
23+
1624
export const scenarios = [
1725
{
1826
engine: 'playwright',

0 commit comments

Comments
 (0)