webtestpractice/PlaywrightTests/README.md

1.3 KiB

PlayWright Tests

A simple test framework to experiment with PlayWright on .NET

It is designed to work in conjunction with the generic "MyWebApp" ASP.NET project, set up here. There are instructions there, on how to fire up the site locally.

Prerequisites

Before running the tests, you will want to pre-install the webdriver binaries for the PlayWright test suite. This assumes you already have powershell for macOS installed.

$ cd ~/root/of/your/project
$ pwsh bin/Debug/net7.0/playwright.ps1 install

Run

Once the ASP site is running, and your browser prerequisites are in place, then you can run these tests:

 $ dotnet test 
  Determining projects to restore...
  All projects are up-to-date for restore.
  PlaywrightTests -> /Users/YOU/Projects/YOUR_PROJECTS/PlaywrightTests/bin/Debug/net7.0/PlaywrightTests.dll
Test run for /Users/YOU/Projects/YOUR_PROJECTS/PlaywrightTests/bin/Debug/net7.0/PlaywrightTests.dll (.NETCoreApp,Version=v7.0)
Microsoft (R) Test Execution Command Line Tool Version 17.4.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     2, Skipped:     0, Total:     2, Duration: 2 s - PlaywrightTests.dll (net7.0)