Skip to content

How do I import Playwright tests from a specific folder?

To import Playwright tests from a specific folder, use file patterns and environment variables to scope the import.

  1. Set the folder with the pattern

    Use a file pattern to specify which files to scan. Include the folder path:

    Terminal window
    TESTOMATIO={API_KEY} npx check-tests@latest Playwright "tests/smoke/**/*.spec.ts" --typescript

    This command scans only tests/smoke/ and its subfolders.

  2. Set the working folder with TESTOMATIO_WORKDIR

    Use TESTOMATIO_WORKDIR to specify the folder for import and avoid redundant nesting in Testomat.io:

    Terminal window
    TESTOMATIO_WORKDIR=src/tests TESTOMATIO={API_KEY} npx check-tests@latest Playwright "**/*.spec.ts" --typescript

    This is useful in a monorepo to import tests from a specific app without parent paths:

    Terminal window
    TESTOMATIO_WORKDIR=apps/frontend TESTOMATIO={API_KEY} npx check-tests@latest Playwright "**/*.spec.ts" --typescript
  • Useful options
    • --typescript — for TypeScript projects.
    • --update-ids — writes test IDs back into your source code.
    • TESTOMATIO_PREPEND_DIR="API Tests" — groups imported tests under a specified folder.
  • Run the command from your project root to ensure correct path resolution.
  • If no tests are found, check the folder path and file pattern.