# neeto-playwright-commons

A library that packages common boilerplate Playwright code necessary for all
neeto products.

## Installation Instructions

Install from npm:

```bash
yarn add "@bigbinary/neeto-playwright-commons@latest"
```

## Dependencies

**neetoPlaywrightCommons** has some peer dependencies which can be installed
using the commands listed below:

### `neeto-cist`

A collection of common utility functions used across all our
[neeto](https://www.neeto.com/) products. Try out the utility functions live at
[neetoCommons REPL](https://neeto-cist.neeto.com/).

```
yarn add @bigbinary/neeto-cist
```

### `faker`

Faker is used to generate fake data.

```
yarn add @faker-js/faker
```

### `playwright/test`

```
yarn add @playwright/test
```

### `lint-staged`

Run linters against staged git files.

```
yarn add lint-staged
```

### `dotenv-webpack`

`dotenv-webpack` is a secure webpack plugin that supports
[dotenv](https://www.npmjs.com/package/dotenv) and other environment variables.

```
yarn add dotenv-webpack
```

### `mailosaur`

Using `Mailosaur` you can automate email and SMS tests.

```
yarn add mailosaur
```

### `dayjs`

Dayjs is a JavaScript library that parses, validates, manipulates, and displays
dates and times.

```
yarn add dayjs
```

### `ramda`

Ramda is a JavaScript library that facilitates functional programming in
JavaScript. It provides a collection of utility functions that operate on data.

```
yarn add ramda
```

### `playwright-i18next-fixture`

Use your `i18next` translations in Playwright to create multi-language
selectors.

```
yarn add playwright-i18next-fixture
```

We can install all the above peer dependencies by running a single command.

```
yarn add @bigbinary/neeto-cist @faker-js/faker @playwright/test lint-staged dotenv-webpack mailosaur dayjs ramda playwright-i18next-fixture
```

## External dependencies

### Methods

## mailosaurUtils

Note: ENV variables `MAILOUSAUR_KEY` and `MAILOSAUR_SERVER_ID` are required for
this methods to work.

We can find `MAILOUSAUR_KEY` by visiting https://mailosaur.com/app/account/keys
and `MAILOSAUR_SERVER_ID` by visiting https://mailosaur.com/app/servers

## Slack integration methods

Note: Either ENV variables `SLACK_WORKSPACE`, `SLACK_LOGIN_PASSWORD` and
`SLACK_LOGIN_EMAIL` is required for this method to work or custom credentials
`workspace`, `loginPassword` and `loginEmail` must be passed.

## Zapier integration methods

Note: ENV variables `INTEGRATION_MAILOSAUR_API_KEY`,
`INTEGRATION_MAILOSAUR_SERVER_ID`, `ZAPIER_LOGIN_PASSWORD`,
`ZAPIER_LOGIN_EMAIL`, and `ZAP_ID` are required for this methods to work.

We can find `INTEGRATION_MAILOSAUR_SERVER_ID` by visiting
https://mailosaur.com/app/servers and `INTEGRATION_MAILOSAUR_API_KEY` by
visiting https://mailosaur.com/app/servers/ymn2s6kt/keys

## Usage

You can import the utility functions and constants from the
`@bigbinary/neeto-playwright-commons` wherever required.

```js
import { COMMON_SELECTORS } from "@bigbinary/neeto-playwright-common";
```

## Exported Functions

- [Common default configurations](./docs/default-configurations.md)
- [Custom commands](./docs/custom-commands.md)
- [Util functions](./docs/util-functions.md)
- [Selectors and texts](./docs/selectors-and-texts.md)

## Other references

- [Development instructions](./docs/general/development-instructions.md)
- [Building and releasing](./docs/general/building-and-releasing.md)
