Issue 1:
Context:

Playwright Version: 1.18.1

Operating System: Windows 10

Node.js Version: 16.13.2

Browser: Chromium

Issue

When running a test which imports a module from a different file which also contains a test, the test on the imported file is run instead of the test from the expected test file.

Code

package.json

{
"name": "playwright-test-issue",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "npx playwright test"
},
"type": "module",
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.18.1"
}
}

test1.spec.js

import { test } from "@playwright/test";

test("test 1", async ({page}) => {
console.log("running test 1");
})

export function utilityFunction() {
console.log("running utility function");
}

test2.spec.js

import { test } from "@playwright/test";
import { utilityFunction } from "./test1.spec.js";

test("test 2", async ({page}) => {
utilityFunction();
console.log("running test 2");
})

Output

Upon running the command npm run test we get the following output

> playwright-test-issue@1.0.0 test
> npx playwright test

Running 2 tests using 2 workers

ok test1.spec.js:3:1 › test 1 (2s)
ok test2.spec.js:4:1 › test 2 (2s)
running test 1
running test 1

2 passed (3s)

It is clear that the output above is reporting that test2 has been run. If this was actually the case, we wouldn't see running test 1 repeated twice in the output.

Expected Output

> playwright-test-issue@1.0.0 test
> npx playwright test

Running 2 tests using 2 workers

ok test1.spec.js:3:1 › test 1 (2s)
ok test2.spec.js:4:1 › test 2 (2s)
running test 1
running test 2
running utility function

2 passed (3s)

Notes

I'm aware that this isn't exactly a good way to structure a project, and I was able to side-step this by refactoring utility functions into their own files which don't contain tests. My main issue here was that the incorrect reporting of which tests had been run made this difficult to diagnose.

Apologies if this is a duplicate, I had a look and couldn't find anything like this.

Also I appreciate all of the hard work you all do for this project, playwright is an absolute joy to work with and this is the only issue I've encountered in my whole time working with it.

Issue 2:
System info

Playwright Version: [v1.33, v1.34, v1.35]

Operating System: [Linux]

Browser: [Chromium]

Other info: Teamcity CI, Docker Wrapper via Node.js-Task

Description

Nearly all tests fail with in CI most of the time (running docker image playwright:v1.35.0-jammy, tried as well with 1.34 and 1.33).

The Traces show a blank screen after 'page.goto' and the subsequent locator fails to find anything and times out.

Sometimes (rarely) tests succeed on initial run or on the second or third retry.

Testsuite is running perfectly fine locally in Windows via VSCode or in Docker (using the same image and parameters as the CI does).

Unfortunately I was not able to reproduce the issue locally. Do you have on suggestions on how I could proceed to pinpoint the issue a little bit better?.

Expected

Runs in Docker using the same docker-image and -parameters should work the same no matter whether they are run on a laptop or a build agent.

Actual

Nearly all tests fail with in CI most of the time and Traces show a blank screen after 'page.goto' with subsequent locator fails to find anything.

Possible relevant runtime information

docker.server.osType	linux

docker.server.version	20.10.23

docker.version	20.10.23

teamcity.agent.hardware.cpuCount	4

teamcity.agent.hardware.memorySizeMb	6949

teamcity.agent.jvm.os.arch	amd64

teamcity.agent.jvm.os.name	Linux

teamcity.agent.jvm.os.version	5.4.0-147-generic

system.teamcity.version	2022.10.3 (build 117072)

script

npm install

npx playwright test --update-snapshots

docker-images used

playwright:v1.33.0-jammy

playwright:v1.34.0-jammy

playwright:v1.35.0-jammy

additional docker parameter

--env DEBUG=pw:browser*,pw:api --network host -v %teamcity.build.checkoutDir%/zimdbvwgui:/work/ -w /work/

build-output.log