From cea28b2df9192bd60a55fb6d5f4e553748f83758 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 27 Nov 2023 16:37:30 -0800 Subject: [PATCH] docs: clarify beforeAll execution on exception (#28361) Reference https://github.com/microsoft/playwright/issues/28285 --- docs/src/test-api/class-test.md | 24 ++++++++++++++++++++++++ packages/playwright/types/test.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/docs/src/test-api/class-test.md b/docs/src/test-api/class-test.md index 6c3ac71d07..4fde7bb576 100644 --- a/docs/src/test-api/class-test.md +++ b/docs/src/test-api/class-test.md @@ -55,6 +55,8 @@ When called in the scope of a test file, runs after all tests in the file. When 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). +Playwright will continue running all applicable hooks even if some of them have failed. + **Usage** ```js @@ -76,6 +78,10 @@ Hook function that takes one or two arguments: an object with worker fixtures an Declares an `afterAll` hook with a title that is executed once per worker after all tests. +**Details** + +See [`method: Test.afterAll#1`]. + **Usage** ```js @@ -110,6 +116,8 @@ When called in the scope of a test file, runs after each test in the file. When 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. +Playwright will continue running all applicable hooks even if some of them have failed. + **Usage** ```js title="example.spec.ts" @@ -139,6 +147,10 @@ Hook function that takes one or two arguments: an object with fixtures and optio Declares an `afterEach` hook with a title that is executed after each test. +**Details** + +See [`method: Test.afterEach#1`]. + **Usage** ```js title="example.spec.ts" @@ -181,6 +193,8 @@ When called in the scope of a test file, runs before all tests in the file. When Note that worker process is restarted on test failures, and `beforeAll` hook runs again in the new worker. Learn more about [workers and failures](../test-retries.md). +Playwright will continue running all applicable hooks even if some of them have failed. + You can use [`method: Test.afterAll#1`] to teardown any resources set up in `beforeAll`. **Usage** @@ -213,6 +227,10 @@ Hook function that takes one or two arguments: an object with worker fixtures an Declares a `beforeAll` hook with a title that is executed once per worker process before all tests. +**Details** + +See [`method: Test.beforeAll#1`]. + **Usage** ```js title="example.spec.ts" @@ -252,6 +270,8 @@ When called in the scope of a test file, runs before each test in the file. When 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. +Playwright will continue running all applicable hooks even if some of them have failed. + You can use [`method: Test.afterEach#1`] to teardown any resources set up in `beforeEach`. **Usage** @@ -281,6 +301,10 @@ Hook function that takes one or two arguments: an object with fixtures and optio Declares a `beforeEach` hook with a title that is executed before each test. +**Details** + +See [`method: Test.beforeEach#1`]. + **Usage** ```js title="example.spec.ts" diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index bbf9da8314..d8a7d5b8bd 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -3072,6 +3072,8 @@ export interface TestType