# @ovotech/genesys-web-messaging-tester

Latest version **2.0.7** (published 2024-02-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ovotech/genesys-web-messaging-tester
pnpm add @ovotech/genesys-web-messaging-tester
yarn add @ovotech/genesys-web-messaging-tester
bun add @ovotech/genesys-web-messaging-tester
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2024-02-12 |
| First published | 2021-12-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 52.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Lucas Woodward |
| Maintainers | ovox, oep-accounts-bot, ovo.backstage.admins, bookings-team, orion-bot, bizval-bot, oeptariffs, props, metering-reads-health-bot, ovotech-identity, paceteamkaluza, trading-and-dispatch, retail-payg-tech, accrecovo, ovo.trading.tech, qe-team, ovotech-smart-thermostat, rise-team, engagement-insights, myovo-self-serve-service-account, mars-rover, ape-team, kaluza-devex, ohs-aurora, kaluza-rnr, ipa-bot, kawbot, data.discovery.ovo, ovotech-sg, ovotech-qs, ovoenergyapps, homemoves, ovo-oot-bot, cp-ui-tooling, ovo-bit-tech, sir_hiss |
| Keywords | genesys, web-messaging, messenger, test |

## Links

- npm: https://www.npmjs.com/package/@ovotech/genesys-web-messaging-tester
- Repository: git@github.com:ovotech/genesys-web-messaging-tester.git
- Homepage: https://github.com/ovotech/genesys-web-messaging-tester/tree/main/packages/genesys-web-messaging-tester#readme
- npm.io page: https://npm.io/package/@ovotech/genesys-web-messaging-tester

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) ^8.13.0
- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [debug](https://npm.io/package/debug.md) ^4.3.3

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 2.0.7 (latest) — 2024-02-12
- 2.0.6-beta.0 (beta) — 2023-11-12
- 2.0.6 — 2023-11-12
- 2.0.5 — 2023-09-08
- 2.0.4-beta.4 — 2023-08-18
- 2.0.4-beta.3 — 2023-08-05
- 2.0.4 — 2023-08-04
- 2.0.5-beta.2 — 2023-07-28
- 2.0.5-beta.1 — 2023-07-28
- 2.0.3 — 2023-07-18
- 2.0.2 — 2023-04-18
- 2.0.1 — 2023-04-13
- 2.0.0 — 2023-02-28
- 1.2.0 — 2022-10-05
- 1.1.8 — 2022-09-21
- … 16 more at https://npm.io/package/@ovotech/genesys-web-messaging-tester/versions

## README

# Genesys Web Messaging Tester

[![npm](https://img.shields.io/npm/v/@ovotech/genesys-web-messaging-tester)](https://www.npmjs.com/package/@ovotech/genesys-web-messaging-tester)

Easily write automated, and repeatable tests
for [Genesys' Web Messenger](https://help.mypurecloud.com/articles/web-messaging-overview/)
flows. The library provides a simple API for interacting with conversations, allowing you to send messages and set
expectations on replies. It has been designed to run in test frameworks
(e.g. [Jest](https://jestjs.io/)) and standalone scripts.

[Documentation](https://github.com/ovotech/genesys-web-messaging-tester/tree/main/docs/api/README.md)

```typescript
const session = new WebMessengerGuestSession({
  deploymentId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
  region: 'xxxx.pure.cloud',
});

const convo = new Conversation(session);
await convo.waitForConversationToStart();

await convo.sendText('hi');

await convo.waitForResponseContaining('Please enter your account number');

await convo.sendText('123');

await convo.waitForResponseContaining('Your account number is too short. It is the 6 digit number on your bills');
```

## Getting Started

Install using [`npm`](https://www.npmjs.com/package/@ovotech/genesys-web-messaging-tester):

```bash
npm install -g @ovotech/genesys-web-messaging-tester
```

Then write a test. In the example below we test the validation of an account number:

> [examples/api/src/js-script.js:(test-section)](https://github.com/ovotech/genesys-web-messaging-tester/tree/main/examples/api/src/js-script.js#L5-L33)

```javascript
const WebMsgTester = require('@ovotech/genesys-web-messaging-tester');

(async () => {
  const session = new WebMsgTester.WebMessengerGuestSession({
    deploymentId: process.env.DEPLOYMENT_ID,
    region: process.env.REGION,
  });

  const convo = new WebMsgTester.Conversation(session);
  await convo.waitForConversationToStart();

  await convo.sendText('hi');

  await convo.waitForResponseWithTextContaining(
    'Can we ask you some questions about your experience today?',
  );

  await convo.sendText('Yes');

  await convo.waitForResponseWithTextMatchingPattern(/Thank you! Now for the next question[.]+/im, {
    timeoutInSeconds: 10,
  });

  session.close();
})().catch((e) => {
  throw e;
});
```

Finally, run the test by executing the script:

```shell
node examples/api/src/js-script.js
```

## Debugging

Messages sent between the client and Genesys' server can be output by setting the environment variable:

```shell
DEBUG=WebMessengerGuestSession
```

---
_Source: https://npm.io/package/@ovotech/genesys-web-messaging-tester · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
