GithubHelp home page GithubHelp logo

ishitadogra / puppeteer-browserstack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from browserstack/puppeteer-browserstack

0.0 0.0 0.0 91 KB

Sample repo for Puppeteer samples with BrowserStack.

JavaScript 100.00%

puppeteer-browserstack's Introduction

puppeteer-browserstack

Sample Puppeteer tests to run on BrowserStack

Introduction

You can now run your Puppeteer tests on the BrowserStack infrastructure. Porting your existing Puppeteer tests to run on BrowserStack, can be done in a matter of minutes.

This guide walks you through running a sample Puppeteer test on BrowserStack and then goes on to run tests on privately hosted websites.

Pre-requisites

You need BrowserStack credentials to be able to run Puppeteer tests and also you need to be included in the Beta group so that we can enable Puppeteer access for you in our infra while the integration is in closed-beta.

If you have already been included in the beta group, proceed ahead. Else, you can reach out to support to get included in the beta group.

You have to replace YOUR_USERNAME and YOUR_ACCESS_KEY in the sample scripts in this repository with your BrowserStack credentials which can be found in your Account Settings page.

Alternatively, you can set the environment variables BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY with your credentials and all the scripts in this repository should work fine

Run your first Playwright test on BrowserStack

  1. Clone this repository
  2. Install the dependencies using npm install
  3. Replace YOUR_USERNAME and YOUR_ACCESS_KEY in google_search.js with your BrowserStack credentials
  4. Run the sample script using node google_search.js

Test across multiple browser and OS versions in parallel

  1. Clone this repository (if not already done)
  2. Install the dependencies using npm install (if not already done)
  3. Replace YOUR_USERNAME and YOUR_ACCESS_KEY in parallel_test.js file, with your BrowserStack credentials
  4. Run across 8 different browser and OS combinations in parallel using node parallel_test.js

Run sample test on privately hosted websites

  1. You have to download the BrowserStack Local binary from the links below (depending on your local machine's environment):
  2. Once you have downloaded and unzipped the file, you can initiate the binary by running the command: ./BrowserStackLocal --key YOUR_ACCESS_KEY
  3. Once you see the terminal say “[SUCCESS] You can now access your local server(s) in our remote browser”, your local testing connection is considered established.
  4. You can then replace YOUR_USERNAME and YOUR_ACCESS_KEY in local_test.js with your BrowserStack credentials and run the sample Local test using node local_test.js

Supported browser versions

Puppeteer tests can be run on BrowserStack in the following browsers (including versions):

  1. chrome browser version 72 and above across different versions of Windows and macOS operating systems mentioned below.
  2. firefox browser version 86 and above across all supported OS versions as mentioned below.
  3. edge browser version 80 and above across all supported OS versions as mentioned below.

You can use the browser_version capability to specify the version of the browser where you want to run your tests. We support values like latest-beta, latest, latest-1, latest-2 and so on, in the browser_version capability so specify the current beta, latest or latest-n browser version to run your tests.

You can specify the browser and browser_version capability as follows:
('browser': 'chrome', 'browser_version': 'latest-beta')

OS (with versions) supported

  1. Windows 10 ('os': 'Windows', 'os_version': '10')
  2. Windows 8.1 ('os': 'Windows', 'os_version': '8.1')
  3. Windows 8 ('os': 'Windows', 'os_version': '8')
  4. Windows 7 ('os': 'Windows', 'os_version': '7')
  5. macOS Big Sur ('os': 'osx', 'os_version': 'Big Sur')
  6. macOS Catalina ('os': 'osx', 'os_version': 'Catalina')
  7. macOS High Sierra ('os': 'osx', 'os_version': 'High Sierra')
  8. macOS Sierra ('os': 'osx', 'os_version': 'Sierra')
  9. macOS El Capitan ('os': 'osx', 'os_version': 'El Capitan')

Get Puppeteer session details

While your Puppeteer session runs on BrowserStack, we generate a unique ID for the session, build and also generate URLs for the various types of logs which you can use to build your own reporting or for any other purpose that you might like.

A sample script with the use of the API to fetch all the relevant session details is shown in the sample_session_details_API.js.

You can see the documentation for marking test status using REST API using the session ID for the session, any time even after the session has completed its execution.

Facing issues?

If you are facing any issue with any of the above or any other issue in trying to run your Puppeteer tests on BrowserStack, you can reach out to support, select product as Automate and send us your query.

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.