[BUG] Playwright stalls before half of the test finished.
See original GitHub issueContext:
- Playwright Version: 1.21.0
- Operating System: Mac
- Node.js version: v14.19.0
- Browser: All
- Extra: [any specific details about your environment]
System:
- OS: macOS 12.3.1
- Memory: 14.22 GB / 64.00 GB
Binaries:
- Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node
- Yarn: 1.22.18 - /usr/local/bin/yarn
- npm: 8.5.5 - ~/.nvm/versions/node/v14.19.0/bin/npm
Languages:
- Bash: 5.1.16 - /usr/local/bin/bash
Code Snippet
// @ts-check
const {
test,
expect
} = require('@playwright/test');
const path = require('path');
const patternTool = require('../tools/get-test');
const patternsToTest = patternTool.getPatterns();
const testConfigJson = require('./localStorage.json');
let currentPattern;
const currentTheme = 'yellow'
test.beforeEach(async ({
page
}) => {
await page.goto(`${currentPattern.path}`);
await page.addInitScript(value => {
window.localStorage.setItem('availableThemes', value);
window.sessionStorage.setItem('currentTheme', currentTheme);
}, testConfigJson);
});
for (const currentTest in patternsToTest) {
// console.log(currentPattern);
currentPattern = patternsToTest[currentTest];
test.describe(`Theme ${currentTheme}`, () => {
test(`Test: ${currentTest} - ${currentPattern.name}`, async ({
page
}) => {
// await page.waitForLoadState('domcontentloaded');
const screenshotPath = `./screenshots/${currentTheme}/${path.basename(currentPattern.path, '.html')}.png`
expect(await page.screenshot()).toMatchSnapshot(screenshotPath, {
threshold: 0.01,
maxDiffPixelRatio: 0.1
});
});
});
};
Describe the bug
After nearly having the test seems to stall and I can wait for hours. Nothing moving forward anymore.

Is the bug on my side or is it really a bug.
Try to test a style guide and various themes. The style guide is based on https://patternlab.io Assets I like to test can be found here: https://lab.n8d.studio/htwoo/htwoo-core/?p=all
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Playwright test fails on Azure Devops Pipeline and pipeline ...
The reason is that your "CI" environment variable in the virtual server is not true at the moment you are running the tests....
Read more >Browser.Playwright — RPA Framework documentation
If automatic closing level is TEST, contexts and pages that are created during a single test are automatically closed when the test ends....
Read more >Testing HTTP - Artillery.io
If a response to any request takes longer than 10 seconds, Artillery will abort the request and raise an ETIMEDOUT error. To increase...
Read more >Avoiding hard waits in Playwright and Puppeteer
In this case, our hard wait terminates and our click action is attempted too early. The script terminates with an error, possibly of...
Read more >Playwright changelog - Awesome Node.js - LibHunt
It allows testing Chromium, Firefox and WebKit with a single API. All Versions ... #3499 - [BUG] Playwright does not see iframe element...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem is that
getPatterns
is not idempotent, on each call it will increase number of entries inallPatterns
. For 4 files it is called 4 times in the test runner and for each file it generates 163, 2163, 3163, 4*163 tests. But when worker picks up the same file it will rungetPatterns
in a fresh context and it will always return 163 tests. We should definitely fix it on the playwright side and provide a clear error message instead of hanging. On your end you can simply move https://github.com/n8design/htwoo/blob/f5e345adc428a50b4c72139233916bc44d6fc0a2/htwoo-core/tools/get-test.js#L49-L63 outside of the function to make sure it runs only once.I can reproduce it (on linux), investigating.