Skip to content

gitstua/playwright-gh

Repository files navigation

Purpose

Example Playwright script to login to GitHub

⚠️ It is not recommeded to automate GitHub UI since GitHub can change the format of pages at any time. The best way to automate GitHub is via REST API, GraphQL or GitHub CLI.

Usage

There is a GitHub workflow that runs this script on push to main.

You need to create the following Actions secrets in your GitHub repo where this workflow is located:

  • GH_TOTP This is the 2FA token for of the GitHub machine user. You can get this setup key when you setup 2fa as per the docs.
  • GITHUB_USERNAME This is the GitHub username of the machine user.
  • GITHUB_PASSWORD This is your GitHub password of the machine user.

Development

Create a .env file with the following variables:

GH_USERNAME=username
GH_PASSWORD=pwd
GH_TOTP=AAAXXXBBBXXXCCCA

To run locally, you can use the Playwright extension for VSCode or the following command: npx playwright test

Recording new playwright scripts

You can record tests as per these instructions

Notes

It is recommended to use a GitHub personal access token instead of your password for interactions with GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published