Issue 1:
System info

Playwright Version: "^1.34.0"

Operating System: Windows 11

Browser: Chromium

Other info:

Source code

I provided exact source code that allows reproducing the issue locally.

test("Sample visual testing", async ({ page }) => {
await page.goto(`siteurl`, { waitUntil: "domcontentloaded" });
await page.waitForTimeout(10000);
const shot = await page.getByTestId('data-testid-value').screenshot();
expect(shot).toMatchSnapshot("sampletest.png", {maxDiffPixels: 1000});
});

PLease run provided test method with any of the sample test you have (website)

Link to the GitHub repository with the repro

[https://github.com/your_profile/playwright_issue_title]

or

Config file

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], },
},
});

Steps

[Run the test]

[...]

Expected

It should take a screenshot of specific element located by locator and match it with existing screenshot

Actual

Screenshot() method is not taking any screenshot as it gets stuck and doesn't move to next step.

Issue 2:
System info

Playwright Version: 1.30.0

Operating System: Linux (Ubuntu 22.10)

Node.js version: 14.21.3

Visual Studio Code version: 1.76.2

Playwright for VSCode extension version: 1.0.9

Browser: Chromium

Source code

I provided exact source code that allows reproducing the issue locally.

Here is a minimal reproducible example :

Config file

import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';

const config: PlaywrightTestConfig = {
/* Configure projects for major browsers */
projects: [
{
name: 'Desktop Chrome',
use: {
...devices['Desktop Chrome']
}
}
]
};

export default config;

Test file (self-contained)

import { test as base, expect } from '@playwright/test';

const keywords = ['foo', 'bar', 'playwright'];

const test = base.extend<{ keyword: string }>({
keyword: 'foo'
});

test.describe(`Test suite`, () => {
for (const kw of keywords) {
test.use({ keyword: kw });
test(`Test for : ${kw}`, async ({ keyword }) => {
await expect(kw).toBe(keyword);
});
}
});

Steps

Run the test suite

Expected

Expect to have the fixture correctly set for each test inside the for loop.

Actual

When I run this test suite, the first two tests fail and the last one succeeds. For all of them keyword fixture is equal to playwright. Here is the resulting log :

Running 3 tests using 1 worker
1) [Desktop Chrome] › specs/simpler-test.spec.ts:12:9 › Test suite › Test for : foo ==============

Error: expect(received).toBe(expected) // Object.is equality

Expected: "playwright"
Received: "foo"

11 | test.use({ keyword: kw });
12 | test(`Test for : ${kw}`, async ({ keyword }) => {
> 13 | await expect(kw).toBe(keyword);
| ^
14 | });
15 | }
16 | });

2) [Desktop Chrome] › specs/simpler-test.spec.ts:12:9 › Test suite › Test for : bar ==============

Error: expect(received).toBe(expected) // Object.is equality

Expected: "playwright"
Received: "bar"

11 | test.use({ keyword: kw });
12 | test(`Test for : ${kw}`, async ({ keyword }) => {
> 13 | await expect(kw).toBe(keyword);
| ^
14 | });
15 | }
16 | });

2 failed
[Desktop Chrome] › specs/simpler-test.spec.ts:12:9 › Test suite › Test for : foo ===============
[Desktop Chrome] › specs/simpler-test.spec.ts:12:9 › Test suite › Test for : bar ===============
1 passed (1.5s)

Notes

My actual use case has a page object used as a fixture, depending on a "constant fixture" that is updated in a for loop with test.use. Also I use the constant fixture to pick various values from a test data set. If there is another way to achieve this than a for loop and test.use, glad to switch to it.