playwright/docs/src/running-tests-js.md
Debbie O'Brien 2b8198f1e3
docs: new getting started stucture (#15624)
Co-authored-by: Max Schmitt <max@schmitt.mx>
2022-07-14 14:17:24 +02:00

1.7 KiB

id title
running-tests Running Tests

You can run a single test, a set of tests or all tests. Tests can be run on one browser or multiple browsers. By default tests are run in a headless manner meaning no browser window will be opened while running the tests and results will be seen in the terminal. If you prefer you can run your tests in headed mode by using the --headed flag.

  • Running all tests

    npx playwright test
    
  • Running a single test file

    npx playwright test test-1
    
  • Run a set of test files

    npx playwright test tests/todo-page/ tests/landing-page/
    
  • Run files that have my-spec or my-spec-2 in the file name

    npx playwright test my-spec my-spec-2
    
  • Run the test with the title

    npx playwright test -g "add a todo item"
    
  • Running tests in headed mode

    npx playwright test test-1 --headed
    
  • Running Tests on specific browsers

    npx playwright test test-1.spec.ts --project=chromium
    

Test Reports

The HTML Reporter shows you a full report of your tests allowing you to filter the report by browsers, passed tests, failed tests, skipped tests and flaky tests. You can click on each test and explore the tests errors as well as each step of the test. By default, the HTML report is opened automatically if some of the tests failed.

npx playwright show-report
image

What's Next