microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.43k stars 3.63k forks source link

Subfolders are not recognized in testDir configuration and thus test files are not found #31088

Closed Zumwaloro closed 4 months ago

Zumwaloro commented 4 months ago

Version

1.44.1

Steps to reproduce

If you have a configuration for a project where you specify a testDir, Playwright only finds testfiles if you explicitly provide the folder. If you provide a folder with sub-folders, you get the message Starting the run with 0 tests. Finished the run: failed.

Example 1: Playwright finds all .spec.ts tests that are directly saved in folder 'actions'.

projects: [
        {
            name: 'Example',
            testDir: 'tests/example/action',
            testMatch: '**/*.spec.ts',
            use: {
                ...devices['Desktop Chrome'],
                baseURL: baseURL,}
        }
]  

Example 2: Playwright does not find subfolders containing the tests if the subfolder is not specified.

projects: [
        {
            name: 'Example',
            testDir: 'tests/example',
            testMatch: '**/*.spec.ts',
            use: {
                ...devices['Desktop Chrome'],
                baseURL: baseURL,}
        }
]  

Expected behavior

Playwright should be able to find subfolders containing the .spec.ts files.

Actual behavior

I get the message

Starting the run with 0 tests:
Finished the run: failed

if I use a testDir that contains sub-folders.

Additional context

The path is correct as it runs with /actions.

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
    Memory: 48.22 GB / 63.73 GB
  Binaries:
    Node: 18.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.89.1 - C:\Users\wv755\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.1.16
  npmPackages:
    @playwright/test: ^1.44.1 => 1.44.1
dgozman commented 4 months ago

@Zumwaloro I cannot reproduce this. In fact, our own tests are scattered among many subfolders and everything works fine.

Also, Playwright never prints the following to the terminal. Are you using a custom reporter?

Starting the run with 0 tests:
Finished the run: failed

In order to process, we would need a full repro including your config and test files.

Zumwaloro commented 4 months ago

I just managed to find out what the problem was, it is fortunately not related but made it seems so. Closing this, thanks for the reply anyway.