<commit_before>#### Start your UI tests without headache

Created by [Manhhailua](https://github.com/manhhailua) with :heart:.

## Stack

* [Puppeteer](https://github.com/GoogleChrome/puppeteer)
* [Jest](https://facebook.github.io/jest/)

## Prerequisites

#### ENV variables

| Name | Usage | Type | Required? |
|---|---|---|---|
| **ROOT_HREF** | Root href of targeted site | String | Yes |
| PLO_IGNORE_HTTPS_ERRORS | Whether to ignore HTTPS errors during navigation. Defaults to `false`. | Boolean | No |
| PLO_HEADLESS | Whether to run Chromium in headless mode. Defaults to `true` unless the `devtools` option is `true`. | Boolean | No |
| PLO_EXECUTABLE_PATH | Path to a Chromium executable to run instead of bundled Chromium. If executablePath is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd) . | String | No |
| PLO_SLOW_MO | Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on. | Number | No |
| PLO_HANDLE_SIGINT | Close chrome process on Ctrl-C. Defaults to `true`. | Boolean | No |
| PLO_TIMEOUT | Maximum time in milliseconds to wait for the Chrome instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. | Number | No |
| PLO_DUMP_IO | Whether to pipe browser process stdout and stderr into `process.stdout` and `process.stderr`. Defaults to `false`. | Boolean | No |
| PLO_USER_DATA_DIR | Path to a [User Data Directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) . | String | No |
| PLO_DEV_TOOLS | Whether to auto-open DevTools panel for each tab. If this option is `true`, the `headless` option will be set `false`. | Boolean | No |

All prefixed by `PLO` ENV variables will be passed to [corresponding named options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)  param of `puppeteer.launch()`. Puppeteer launch options ENV variables can be override by hard coded options. Example:

```
puppeteer.launch({
  headless: false, // This overrides PLO_HEADLESS=true
});
```

Also check [Puppeteer's ENV variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables) for more.

#### `.env` file

For development, writing down all the ENV variables every commands is really painful. [dotenv](https://github.com/bkeepers/dotenv) is implemented so that you are able to create a `.env` file with content similar to below:

```
ROOT_HREF=https://github.com/
PLO_IGNORE_HTTPS_ERRORS=false
PLO_HEADLESS=true
```

## Getting started

Comprehensive test:<commit_msg>small update in readme<commit_after>#### Start your UI tests without headache

Created by [Manhhailua](https://github.com/manhhailua) with :heart:.

## Stack

* [Puppeteer](https://github.com/GoogleChrome/puppeteer)
* [Jest](https://facebook.github.io/jest/)

## Prerequisites

#### ENV variables

| Name | Usage | Type | Required? |
|---|---|---|---|
| **ROOT_HREF** | Root href of targeted site | String | Yes |
| PLO_IGNORE_HTTPS_ERRORS | Whether to ignore HTTPS errors during navigation. Defaults to `false`. | Boolean | No |
| PLO_HEADLESS | Whether to run Chromium in headless mode. Defaults to `true` unless the `devtools` option is `true`. | Boolean | No |
| PLO_EXECUTABLE_PATH | Path to a Chromium executable to run instead of bundled Chromium. If executablePath is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd) . | String | No |
| PLO_SLOW_MO | Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on. | Number | No |
| PLO_HANDLE_SIGINT | Close chrome process on Ctrl-C. Defaults to `true`. | Boolean | No |
| PLO_TIMEOUT | Maximum time in milliseconds to wait for the Chrome instance to start. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. | Number | No |
| PLO_DUMP_IO | Whether to pipe browser process stdout and stderr into `process.stdout` and `process.stderr`. Defaults to `false`. | Boolean | No |
| PLO_USER_DATA_DIR | Path to a [User Data Directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) . | String | No |
| PLO_DEV_TOOLS | Whether to auto-open DevTools panel for each tab. If this option is `true`, the `headless` option will be set `false`. | Boolean | No |

All prefixed by `PLO_` ENV variables will be passed to [corresponding named options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)  param of `puppeteer.launch()`. Puppeteer launch options ENV variables can be override by hard coded options. Example:

```
puppeteer.launch({
  headless: false, // This overrides PLO_HEADLESS=true
});
```

Also check [Puppeteer's ENV variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables) for more.

#### `.env` file

For development, writing down all the ENV variables every commands is really painful. [dotenv](https://github.com/bkeepers/dotenv) is implemented so that you are able to create a `.env` file with content similar to below:

```
ROOT_HREF=https://github.com/
PLO_IGNORE_HTTPS_ERRORS=false
PLO_HEADLESS=true
```

## Getting started

Comprehensive test:
{'fraction_non_alphanumeric': 0.11601796407185629, 'fraction_numerical': 0.0029940119760479044, 'mean_word_length': 4.591004184100418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2667251', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1637, 'n_words': 566}