Skip to content
Writing UI tests with Selenium Web Driver and Puppeteer
C# TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs/assets
puppeteer
selenium-csharp
LICENSE
README.md
puppeteer.yml
selenium-csharp.yml

README.md

UI testing

I want to learn how to write UI tests. Selenium WebDriver seems to be the most commonly used platform. I also stumbled upon Puppeteer and decided to use both libraries.

I decided to test GitHub as this is where this repository is hosted.

Over time I hope to see my tests' brittleness exposed which will give me the opportunity to make them more resilient.

As this project is a learning experience I wouldn't recommend being inspired by it (this is even more true for the Puppeteer / TypeScript tests where I've no idea what I'm doing 😹).

Configuration

Some tests require a GitHub account to run. I recommend creating a testing one as - hopefully - you've got 2FA enabled on your personal account (if not please follow Securing your account with two-factor authentication (2FA)).

The configuration of secrets is explained in the Selenium C# and Puppeteer READMEs.

Tests

  • Load a user profile and assert the full name
  • Sign-in with a test user and assert that the "Pull requests" header link is present

Continuous Integration

I'm using Azure pipelines to run the tests on every commit to master.

Build Status

Build Status

The builds steps are versioned with the code as YAML:

All builds are also scheduled to run at 2AM AEST seven days a week. This is to prevent the tests from rotting when no changes are committed to them.

Common build properties

  • Builds are only triggered when the code changes. The Puppeteer build will not trigger when there are changes to the Selenium C# tests
  • When a test fail, the test suite takes a screenshot which is then uploaded as an artifact
  • Test results are uploaded to Azure DevOps (see screenshot below)
  • Secret variables are passed as environment variables

Test results in Azure DevOps:

Test results in Azure DevOps

You can’t perform that action at this time.