5. Test Hooks (beforeEach) & Suite Groups

Test Suite Hooks

test.describe("Navigation Suite", () => {
  test.beforeEach(async ({ page }) => {
    await page.goto("https://targetqa.com");
  });

test("checks header", async ({ page }) => {
await expect(page.locator("h1")).toBeVisible();
});
});

Task

  • Add the `test.beforeEach` hook to navigate to `"https://targetqa.com"`.
💡Common doubts
Did you like the problem?
Lesson 5 of 12
TypeScript
Loading code editor…
Next