Skip to content

LinoHallerRios/google-maps-playwright

Repository files navigation

CI Coverage

Google Maps Playwright Tests

This project is a playground for me to learn how to use Playwright with C#.
I am currently using the Google Maps page for this purpose.

Set Up

Tools

In order to run the project in your local machine you will need the following:

Use the following command to install powershell.

Windows

winget install --id Microsoft.Powershell --source winget

If you do not have winget, you can download PowerShell here

MacOS

brew install powershell/tap/powershell

Project

Download the project or clone the repository using Git.

Once you have the project on your local computer, open a terminal in the project root:

  • Build the project

    dotnet build

    This will generate a new bin folder with the build.

  • Install the required browsers

    pwsh bin/Debug/net8.0/playwright.ps1 install --with-deps

Now you are ready to run the tests!

Usage

You can run the tests in three different browsers by using the following commands:

dotnet test --settings=chromium.runsettings
dotnet test --settings=firefox.runsettings
dotnet test --settings=webkit.runsettings

If you want to generate a coverage report:

dotnet test GoogleMapsPlaywright.csproj /p:CollectCoverage=true /p:IncludeTestAssembly=true /p:CoverletOutputFormat=cobertura --settings=chromium.runsettings

You will find a coverage.cobertura.xml file with the generated report.

Configuration

The tests are running in headful mode, which means that browsers will open when you run the tests.

If you want to run them in headless mode you can edit the .runsettings file for each browser.

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
    <Playwright>
        <BrowserName>chromium</BrowserName>
        <ExpectTimeout>30000</ExpectTimeout>
        <LaunchOptions>
            // Change this to True or False
            <Headless>true</Headless>
        </LaunchOptions>
    </Playwright>
</RunSettings>

The tests will now run in the background.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages