npm package: @pumpo5.dev/core
Description: The Pumpo5 client to be used with a Selenoid test farm
Author: Alvaro A. de Souza Silva
Latest version: 0.0.133

# Pumpo no.5 for Playwright

> This is a package for running Playwright tests in a Selenoid test farm.
> 
> It will start an instance of Chrome in a test farm for each test case, send commands using the Chrome DevTools Protocol, and close the session in the end.
> 
> At the moment only Chrome browser is supported. Firefox and Webkit (Safari) browsers are not supported.

## Getting Started

Assuming that you already have one or more Playwright test suites ready in your system, all you need to do is:

* Install this package in your project.
* Import the **test** and **expect** functions from the **'@pumpo5.dev/core'** package

## Installation

Install this package in your project which includes the Playwright tests:

```sh
$ npm install --save-dev @pumpo5.dev/core
```

Or if you prefer Yarn:

```sh
$ yarn add --dev @pumpo5.dev/core
```

Import the functions in your tests:

```sh
...

import { test, expect } from '@pumpo5.dev/core'

...
```

And just write your tests using the **test** and **expect** functions like you usually do.

## Usage

In order connect to a test farm, you need to create a configuration file. **This file must be named _config.conf_**.

Before any tests are executed, the package will load and look for this file in three ways:

* First, it will check if an environment variable named **CONFIG_PATH** is set. 
    
  If it is, it will then check its value and verify if it is a path that points to a file named **config.conf**.

  In case positive, it will then try to load the configuration by reading this file.


* Second, if no **CONFIG_PATH** environment variable is set, the package will check if a command line argument was passed to NodeJS contaning a path to any file named **config.conf**.
  In case positive, it will then try to load the configuration by reading the file pointed by this command line argument.


* Third and last, in case the other methods failed, the reporter will look for a **config.conf** file  in the project's root folder and directories above.

  In case it finds a **config.conf** in any of those directories it will proceed to load it and use it to set its internal configuration.

The keys that could or should be included in this configuration file are as follows:

Key | Type   | Mandatory | Description
---|--------|---|---
webdriverUrl | String | Yes | The URL where the test farm is running. For example, if you have it running in your _localhost_, it could be _http://localhost:4444_
chromeOptions | Object | No | The initialization options for the Chrome browser, passed as desired capabilities (e.g. **goog:chromeOptions**. Must be contained in one line. For example _chromeOptions={"args": ["--start-fullscreen"]}_). Default value is an empty object _{}_. 
browserName | String | No | The browser name to be passed in capabilities to Selenoid. For example, _browserName="chrome". Default value is _chrome_
browserVersion | String | No | The browser version to be passed in capabilities to Selenoid. For example, _browserVersion="latest"_. Default value is _latest_
timeZone | String | No | The time zone to be used in the browser session. For example, _timeZone="Europe/Warsaw"_. Default value is _UTC_
sessionTimeout | String | No | How long a session can stay idle before being closed. Provide a value using the Golang duration format e.g. _30m_ or _10s_ or _1h5m_. For example, _sessionTimeout="1m"_. Default value is _1m_
testerName | String | No | The tester's name, to be displayed in Selenoid UI. For example, _testerName="John Doe"_. Default value is _No tester name_

## Other versions

If you like this project, please check **Pumpo#5 in Java** as well, [here](https://pumpo5.dev/#/) and [here](https://dev.azure.com/pumpitup/pumpo-number-five/_git/pumpo-number-five) :)

## Authors

* **Alvaro  Silva** - *Initial work* - [Linkedin](https://www.linkedin.com/in/alvarosouzasilva/)

## License

[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) © [PumpITup](https://pumpitup.cz)