The afterAll
hook in @playwright/test might take 1.5 minutes to complete due to several reasons:
import { test } from '@playwright/test';
test.afterAll(async () => {
// Time-consuming teardown tasks
});
afterAll
hook has a separate timeout that can be changed using testInfo.setTimeout()
. If the timeout is set too high or too low, it could cause delays.import { test } from '@playwright/test';
test.afterAll(async ({ testInfo }) => {
testInfo.setTimeout(60000); // Set the timeout to 60 seconds
// Teardown tasks
});
afterAll
hook within the expected time.import { test } from '@playwright/test';
test.setTimeout(120000); // Set the global timeout to 2 minutes
To avoid unexpected delays in your test runs, review your code carefully and ensure you're using appropriate timeouts at each level.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].