Skip to content

browserstack/robot-playwright-browserstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

BrowserStack Robot-Playwright Framework Robot python

Introduction

Robot Framework is a generic open source automation framework which can be used for test automation. It is open and extensible and can be integrated with many tools to create powerful and flexible automation solutions. Robot Framework has easy syntax, utilising human-readable keywords and its capabilities can be extended by libraries implemented with Python or Java.

This BrowserStack Example repository demonstrates a Playwright test library, called Browser written in Robot Framework with parallel testing capabilities. The test scripts are written for the open source BrowserStack Demo web application (Github). This BrowserStack Demo App is an e-commerce web application which showcases multiple real-world user scenarios. The app is bundled with offers data, orders data and products data that contains everything you need to start using the app and run tests out-of-the-box.

The tests in this repo are run on BrowserStack real device/browser using various run configurations and test capabilities.


BrowserStack

BrowserStack provides instant access to 3,000+ real mobile devices and browsers on a highly reliable cloud infrastructure that effortlessly scales as testing needs grow.

Repository setup

  • Clone the repository

    git clone https://github.com/browserstack/robot-playwright-browserstack.git
  • It is recommended to use a virtual environment to install dependencies. To create a virtual environment:

    python3 -m venv env
    source env/bin/activate # on Mac
    env\Scripts\activate # on Windows
  • Library installation requires both Python and NodeJs:

    Install Python™

    Install Node.js®

  • Ensure you have the dependencies installed on the machine as mentioned in the requirements.txt file

    To Install the requirements:

    pip install -r requirements.txt
  • rfbowser init:

    rfbrowser init

    This installs the NodeJS dependencies , installation is done by default to site-packages/Browser/wrapper/node_modules/ directory. This also install browser binaries under the node_modules folder, which easily can be +700Mb for each Browser library installation.

About the tests in this repository

Navigate to bstackdemo, Add an item to the card and Verify the item is added to the cart.

Running Your Tests on Browserstack

Prerequisites to run your tests on Browserstack

  • Create a new BrowserStack account or use an existing one.

  • Identify your BrowserStack username and access key from the BrowserStack Automate Dashboard and export them as environment variables using the below commands.

    • For unix based and Mac machines:
    export BROWSERSTACK_USERNAME=<browserstack-username> &&
    export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
    • For Windows:
    set BROWSERSTACK_USERNAME=<browserstack-username>
    set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>

Run the entire test suite in parallel

  • How to run the test?

    To run the entire test suite parallely in browserstack, you will require pabot dependency.

    Use the following command:

    pabot --pabotlib --testlevelsplit --processes 3 ./test/sample_test.robot

    You can also use the other combinations as described in pabot to run your tests parallely.

  • Output

    This run profile executes the entire test suite parallely in browserstack


Run tests in Parallel on BrowserStack which need Local Environment access

  • How to run the test?

    To run the entire test suite parallely in browserstack, you will require pabot dependency and pabotlib dependecy, PabotLib helps in parallel execution with pabot. These allow control to when and where a keyword will be executed.

    • Run Setup Only Once is used for starting the local testing connection
    • Run Teardown Only Once is used for killing the local testing connection

    Using Language Bindings

    Follow the steps below:

    pip install browserstack-local
    
    pabot --pabotlib --testlevelsplit --processes 3 ./test/sample_local_test.robot   

Additional Resources

About

Creating a sample repo for different Playwright languages and runners

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •