Playwright · Junior · Question 47 of 75
Where would you put page.goto('/') that every test in a file needs?
- 1In
test.beforeEach - 2At the top of the file, outside tests
- 3In
test.afterAll
Show the answer
Correct answer: In test.beforeEach
Explanation
beforeEach runs before every test with that test's fixtures, such as page. Code at file top level runs once while collecting tests and has no page.