playwright
playwright copied to clipboard
[Question] Custom assertion timeout run out
System info
- Playwright Version: [v1.XX]
- Operating System: [Ubuntu 20]
- Browser: [Chromium]
- Other info:
['reporter junit'](reporter: [['junit', { outputFile: 'results.xml' }]],)
. There are 77 other test cases
Source code
test('should open abc', async ({ page }) => {
test.setTimeout(120 * 1000);
await broadcastEditor.goto(
'/Content/Edit?id=227548201&isEvent=true')
const contentContainer = page.locator('.editor-content');
let shouldScroll = true;
while (shouldScroll) {
await expect(page).toMatchScreenshot({timeout: 15 * 1000});
shouldScroll = await contentContainer.evaluate((node) => {
const { clientHeight, scrollHeight, scrollTop } = node;
node.scrollBy(0, clientHeight);
return scrollHeight - scrollTop - clientHeight > 1;
});
}
});
Function toMatchScreenshot
export const expect = baseExpect.extend<{
toMatchScreenshot(page: Page, options?: MatchScreenshotOptions): Promise<{
message: () => string;
pass: boolean;
}>,
}>({
async toMatchScreenshot(page, { hide = [], ...options } = {}) {
for (const locator of hide) {
await locator.evaluateAll((nodes) => {
for (const node of nodes) {
node.style.visibility = 'hidden';
}
});
}
await baseExpect(page).toHaveScreenshot(options);
return { message: () => '', pass: true };
},
});
Steps To reach timeout u need run all test cases
Question
- await expect(page).toMatchScreenshot({timeout: 15 * 1000}), timeout assertion is for each assertion or all assertion is test case?
- each assertion is included in timeout, or there are treat as one?
If you believe this is a Playwright bug, please follow the BUG template and provide a scenario I could reproduce locally (without external dependencies and pages specific to your app)
Closing as per above.