I've seen an issue this week where the tests appear to be hanging when they get about 3/4 of the way through (of 180 tests). I'm simply trying to get the html output to gather data about the tests but it doesn’t run them all. Is this a common issue? Has anyone any experience of running 100-200 locally & it not crashing? Thanks!
This thread is trying to answer question "Why are the tests hanging when they reach about 3/4 of the way through and how can this be resolved?"
Related Ask AI answer for "What are some reasons for tests hanging when running a large number of tests locally with @playwright/test and how can these issues be mitigated?".
Running a large number of tests locally can sometimes cause your tests to hang. This can be due to resource limitations, flaky tests, or long-running operations.
Your system might not have enough CPU, memory, or network bandwidth to handle a large number of tests. Make sure your machine has enough resources.
Flaky tests pass and fail unpredictably. They can cause your tests to hang intermittently. You can identify and fix these tests by analyzing historical data from previous runs or through continuous integration (CI) runs. Check out this blog post for more on handling flaky tests.
If a test waits for an element to appear on the page with no timeout or a long timeout, it can cause the entire test run to hang. Ensure that each action and navigation has reasonable timeouts defined.
import { test } from '@playwright/test';
test('should have reasonable timeouts', async ({ page }) => {
await page.goto('https://ray.run/');
await page.waitForSelector('text=Ray', { timeout: 5000 });
});
To ensure smooth execution of your tests, follow these best practices:
By following these best practices, you can ensure that your testing process is efficient and reliable.
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].