From 176846672fb204f2eb90269cb6f5b4d41a1df54c Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 8 Mar 2022 17:42:50 -0800 Subject: [PATCH] docs: clarify multiple before/after hooks execution order (#12606) --- docs/src/test-api/class-test.md | 8 ++++---- packages/playwright-test/types/test.d.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md index f02813bd58..59ae8bcd97 100644 --- a/docs/src/test-api/class-test.md +++ b/docs/src/test-api/class-test.md @@ -61,7 +61,7 @@ Test function that takes one or two arguments: an object with fixtures and optio ## method: Test.afterAll -Declares an `afterAll` hook that is executed once per worker after all tests. When called in the scope of a test file, runs after all tests in the file. When called inside a [`method: Test.describe`] group, runs after all tests in the group. +Declares an `afterAll` hook that is executed once per worker after all tests. When called in the scope of a test file, runs after all tests in the file. When called inside a [`method: Test.describe`] group, runs after all tests in the group. If multiple `afterAll` hooks are added, they will run in the order of their registration. Note that worker process is restarted on test failures, and `afterAll` hook runs again in the new worker. Learn more about [workers and failures](./test-retries.md). @@ -74,7 +74,7 @@ Hook function that takes one or two arguments: an object with worker fixtures an ## method: Test.afterEach -Declares an `afterEach` hook that is executed after each test. When called in the scope of a test file, runs after each test in the file. When called inside a [`method: Test.describe`] group, runs after each test in the group. +Declares an `afterEach` hook that is executed after each test. When called in the scope of a test file, runs after each test in the file. When called inside a [`method: Test.describe`] group, runs after each test in the group. If multiple `afterEach` hooks are added, they will run in the order of their registration. You can access all the same [Fixtures] as the test function itself, and also the [TestInfo] object that gives a lot of useful information. For example, you can check whether the test succeeded or failed. @@ -118,7 +118,7 @@ Hook function that takes one or two arguments: an object with fixtures and optio ## method: Test.beforeAll -Declares a `beforeAll` hook that is executed once per worker process before all tests. When called in the scope of a test file, runs before all tests in the file. When called inside a [`method: Test.describe`] group, runs before all tests in the group. +Declares a `beforeAll` hook that is executed once per worker process before all tests. When called in the scope of a test file, runs before all tests in the file. When called inside a [`method: Test.describe`] group, runs before all tests in the group. If multiple `beforeAll` hooks are added, they will run in the order of their registration. ```js js-flavor=js // example.spec.js @@ -167,7 +167,7 @@ Hook function that takes one or two arguments: an object with worker fixtures an ## method: Test.beforeEach -Declares a `beforeEach` hook that is executed before each test. When called in the scope of a test file, runs before each test in the file. When called inside a [`method: Test.describe`] group, runs before each test in the group. +Declares a `beforeEach` hook that is executed before each test. When called in the scope of a test file, runs before each test in the file. When called inside a [`method: Test.describe`] group, runs before each test in the group. If multiple `beforeEach` hooks are added, they will run in the order of their registration. You can access all the same [Fixtures] as the test function itself, and also the [TestInfo] object that gives a lot of useful information. For example, you can navigate the page before starting the test. diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index 3591e63d4d..e2fb8eb313 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -2467,7 +2467,7 @@ export interface TestType