Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: enhance hooks example to illustrate after hooks behavior (#26846)
Andrey Lushnikovafd4363aab3b
diff --git a/docs/src/test-retries-js.md b/docs/src/test-retries-js.mdindex 92ec79ca88..13bdabf938 100644--- a/docs/src/test-retries-js.md+++ b/docs/src/test-retries-js.md@@ -19,6 +19,7 @@ test.describe('suite', () => {test('first good', async ({ page }) => { /* ... */ });test('second flaky', async ({ page }) => { /* ... */ });test('third good', async ({ page }) => { /* ... */ });+ test.afterAll(async () => { /* ... */ });});```@@ -28,25 +29,30 @@ When **all tests pass**, they will run in order in the same worker process.* `first good` passes* `second flaky` passes* `third good` passes+ * `afterAll` hook runsShould **any test fail**, Playwright Test will discard the entire worker process along with the browser and will start a new one. Testing will continue in the new worker process starting with the next test.* Worker process #1 starts* `beforeAll` hook runs* `first good` passes* `second flaky` fails+ * `afterAll` hook runs* Worker process #2 starts* `beforeAll` hook runs again* `third good` passes+ * `afterAll` hook runsIf you **enable [retries](#retries)**, second worker process will start by retrying the failed test and continue from there.* Worker process #1 starts* `beforeAll` hook runs* `first good` passes* `second flaky` fails+ * `afterAll` hook runs* Worker process #2 starts* `beforeAll` hook runs again* `second flaky` is retried and passes* `third good` passes+ * `afterAll` hook runsThis scheme works perfectly for independent tests and guarantees that failing tests can't affect healthy ones.