Giter Site home page Giter Site logo

antonrosh / checkers-game-ts-playwright Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 10 KB

Checkers Game automated tests using Playwright and TypeScript. Implements Page Object Model and utilizes GitHub Actions for CI. Managed with Node.js and npm.

Home Page: https://www.gamesforthebrain.com/game/checkers/

TypeScript 100.00%

checkers-game-ts-playwright's Introduction

The Checkers Game - UI Automated Tests

This repository contains automated tests for the Checkers Game. The tests were written using Playwright and TypeScript and implemented following steps:

  1. Navigate to https://www.gamesforthebrain.com/game/checkers/
  2. Confirm that the site is up
  3. Make attempt to move blue.
  4. Make five legal moves as orange
  5. Restart the game after five moves
  6. Confirm that the restarting had been successful

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Setup

  1. Clone the repository to your local machine.
git clone https://github.com/antonrosh/checkers-game-ts-playwright.git
cd checkers-game-automation
  1. Install the project dependencies.
npm install
  1. Create .env file in the root of your project and insert your key/value pairs in the following format of KEY=VALUE:
BASE_URL="https://www.gamesforthebrain.com"

⚠️ The .env file is included in .gitignore to prevent commiting secrets into the repository. In pipeline uses GitHub secrets to store sensitive information like the BASE_URL.

Running the Tests

This project uses Playwright, so it allows testing with multiple browser types (Chromium, Firefox, and WebKit). To run the tests locally, execute the following command:

npx playwright test

This command will run the tests in a headless browser. Setting for headed mode is in playwright.config.ts file.

CI/CD

This project is configured with GitHub Actions for Continuous Integration.

The current configuration (.github/workflows/playwright.yml) is setup to run tests on both push and pull_request events against the main and master branches. The job will setup Node.js environment, install dependencies, and run tests using Playwright. After the tests are completed, it uploads the test report as an artifact.

Reports

The Playwright HTML report for the tests is available here. You can download the report by clicking on the "playwright-report" link under the "Artifacts" section in each workflow run.

Implementation

This project uses Playwright for writing end-to-end tests in JavaScript/TypeScript. Playwright is a Node.js library for browser automation. It provides a high-level API to control headless or non-headless browsers.

A page object model is used to structure the tests, making the test code more readable, maintainable, and reusable.

Project Structure

├── .github/                       # Contains GitHub files
│   └── workflows/                 # Contains GitHub Action files
│       └── playwright.yml         # GitHub Actions Playwright workflow
├── pages/                         # Contains page classes
│   ├── games/
│   │   └── checker.page.ts        # CheckersPage class
│   └── home.page.ts               # HomePage class
├── tests/                         # Contains all tests
│   ├── games/
│   │   └── checker.test.ts        # Tests for CheckersPage
│   └── home.test.ts               # Tests for HomePage
├── .env                           # Contains environment variables
├── .gitignore                     # Specifies intentionally untracked files to ignore
├── package-lock.json              # Locks down the versions of a project's dependencies
├── package.json                   # Contains scripts and dependencies of the project
├── playwright.config.ts           # Playwright test runner configuration file
└── README.md                      # README file with a template for your project

Contact

checkers-game-ts-playwright's People

Contributors

antonrosh avatar

Watchers

 avatar

Forkers

hassan4412

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.