/playwright-browserstack-demo

A repo I created to understand Playwright and Browserstack a little more. The 2 tests themselves are very basic. Useful if you want a repo you can clone and run locally with UI or headless and on Browserstack with a couple of variables adding.

Primary LanguageJavaScript

Playwright Browserstack Demo

This repository is a functional test framework using Playwright and BrowserStack with Node.js. It utilises the Page Object Model to run 2 basic tests of the login functionality at https://www.saucedemo.com/. The tests run on Firefox, Safari, and Chrome locally, and on additional devices through BrowserStack.

Getting Started

Prerequisites

Ensure you have Node.js and npm installed. If not, download and install them from Node.js.

Installation

Clone the repository and install the dependencies:

git clone https://github.com/yourusername/playwright-demo.git
cd playwright-demo
npm install

BrowserStack Setup

To run tests on BrowserStack, copy the browserstack.example.yml file to browserstack.yml and add your BrowserStack details.

cp browserstack.example.yml browserstack.yml
# Edit browserstack.yml to add your BrowserStack credentials

Running Tests

Locally

To run tests locally:

npm run local-test

To run tests locally with the Playwright Test UI:

npm run local-ui-test

On BrowserStack

To run tests on BrowserStack:

npm run browserstack-test

GitHub Actions

This repository includes a GitHub Action that runs the tests both locally and on BrowserStack. The workflows are defined in the .github/workflows folder.

Contributing

If you wish to contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.

License

This project is licensed under the MIT License.