# automated-screenshots-client

> The client you install in your applications to take automated screenshots

Latest version **1.1.0** (published 2021-01-15) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install automated-screenshots-client
pnpm add automated-screenshots-client
yarn add automated-screenshots-client
bun add automated-screenshots-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-01-15 |
| First published | 2021-01-13 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 100.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fándly Gergő-Zoltán |
| Maintainers | gergof |
| Keywords | screenshot, automated, react-native, typescript |

## Links

- npm: https://www.npmjs.com/package/automated-screenshots-client
- Repository: https://github.com/gergof/automated-screenshots-client
- Homepage: https://github.com/gergof/automated-screenshots-client#readme
- Issues: https://github.com/gergof/automated-screenshots-client/issues
- npm.io page: https://npm.io/package/automated-screenshots-client

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-01-15
- 1.0.0 — 2021-01-13
- 0.1.0 — 2021-01-13

## README

# automated-screenshots-client

[![Build Status](https://ci.systest.eu/api/badges/gergof/automated-screenshots-client/status.svg?ref=refs/heads/master)](https://ci.systest.eu/gergof/automated-screenshots-client)
[![NPM Version](https://img.shields.io/npm/v/automated-screenshots-client)](https://www.npmjs.com/package/automated-screenshots-client)
[![License](https://img.shields.io/npm/l/automated-screenshots-client)](https://www.gnu.org/licenses/gpl-3.0.html)
[![Typescript](https://img.shields.io/npm/types/automated-screenshots-client)](https://www.typescriptlang.org/)
[![Chat](https://img.shields.io/matrix/automated-screenshots:systemtest.tk)](https://matrix.to/#/#automated-screenshots:systemtest.tk)

The client you install in your applications to take automated screenshots with [automated-screenshots](https://github.com/gergof/automated-screenshots).

### automated-screenshots

For more info please check out [this repo](https://github.com/gergof/automated-screenshots).

### Usage

You can check out [this dummy example](https://github.com/gergof/automated-screenshots-client/blob/master/src/examples/example.ts).

```js
// import the client
import AutomatedScreenshotsClient from 'automated-screenshots-client';

// create an instance
const screenshots = new AutomatedScreenshotsClient({
	wsAddress: 'ws://localhost:8700' // the address of the host software
});

// define a suite
screenshots.suite(
	'suite name',
	({ beforeAll, afterAll, beforeEach, afterEach, screenshot }) => {
		beforeAll(async () => {
			await MyApp.login();
		});

		afterEach(async () => {
			await MyApp.navigateToHome();
		});

		// define screenshots
		screenshot('Users menu', async () => {
			await MyApp.navigate('users-menu');
		});

		screenshot('Updates', async () => {
			await MyApp.navigate('updated');
		});
	}
);

screenshots.start().then(() => {
	console.log('Starting to take screenshots');
});
```

Screenshots in different suites will be placed in different subdirectories. Suite names and screenshot names **MUST NOT** contain `/` characters.

When defining a suite you get access to a bunch of lifecycle methods:

-   `beforeAll` will run when the suite begins
-   `afterAll` will run when the suite finishes
-   `beforeEach` will run before each screenshot
-   `afterEach` will run after each screenshot

These functions all need to return a `Promise<void>`.

The `screenshot(name: string, prepare: () => Promise<void>)` function can be used to define screenshots. It accepts a name as the first parameter and an async function as the second one.

You have to call the `.start()` function to connect to the host software.

##### Lifecycle method call timings

-   Capture Suite
    -   `suite.beforeAll()`
    -   Capture screenshot
        -   `suite.beforeEach()`
        -   `screenshot()`
        -   Take the actual screenshot
        -   `suite.afterEach()`
    -   `suite.afterAll()`

### Need help?

If you have any questions feel free to contact me using Matrix on [#automated-screenshots:systemtest.tk](https://matrix.to/#/#automated-screenshots:systemtest.tk).

---
_Source: https://npm.io/package/automated-screenshots-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
