playwright: [BUG] Global teardown of Playwright takes timeout time
System info
- Playwright Version: [v1.36]
- Operating System: [All, Windows 11, Ubuntu 20, macOS 13.2, etc.]
- Browser: [All, Chromium, Firefox, WebKit]
- Other info:
Source code
- I provided exact source code that allows reproducing the issue locally.
Looks like global teardown takes about 30 sec, but test execution takes 1 sec. I took a simple test from CLI tools and added just the project to the config file.
Important to notice: if I execute by
testMatch =/.*.spec.ts/, all work as required
https://github.com/AlexeyCL/Playwright-teardown
Link to the GitHub repository with the repro
[https://github.com/your_profile/playwright_issue_title]
or
Config file
// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';
/**
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig = {
projects: [
{
name: 'test',
testMatch: '*tests/*.spec.ts',
},
],
testMatch: /.*.spec.ts/,
/* Maximum time one test can run for. */
timeout: 60 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 20000,
},
/* Run tests in files in parallel */
fullyParallel: !!process.env.CI,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 0 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 5 : 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [['list']],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
channel: process.env.DOCKER ? 'chromium' : 'chrome',
headless: !!process.env.CI,
viewport: { width: 1280, height: 720 },
ignoreHTTPSErrors: true,
baseURL: 'https://playwright.dev/',
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: 30000,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'retain-on-failure',
video: 'retain-on-failure',
screenshot: 'only-on-failure',
},
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: 'test-results/',
};
export default config;
Test file (self-contained)
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});
test('get started link', async ({ page }) => {
await page.goto('https://playwright.dev/');
// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();
// Expects the URL to contain intro.
await expect(page).toHaveURL(/.*intro/);
});
Steps
- [Run the test] pnpm run test
- […]
Expected
[Describe expected behavior]
Actual
[Describe actual behavior]
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16
@AlexeyCL can you try launching your stable chrome and try closing it? I expect it to hang as well.