Playwright · Junior · Question 47 of 75

Where would you put page.goto('/') that every test in a file needs?

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.

Further reading

Problem with a question

Playwright · Junior · question 47

Test yourself

Take the Playwright · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz