2.0.7 • Published 3 months ago

@ovotech/genesys-web-messaging-tester v2.0.7

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
3 months ago

Genesys Web Messaging Tester

npm

Easily write automated, and repeatable tests for Genesys' Web Messenger 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) and standalone scripts.

Documentation

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:

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)

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:

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

Debugging

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

DEBUG=WebMessengerGuestSession
2.0.7

3 months ago

2.0.4-beta.3

9 months ago

2.0.4-beta.4

9 months ago

2.0.5-beta.1

10 months ago

2.0.5-beta.2

10 months ago

2.0.6-beta.0

6 months ago

2.0.3

10 months ago

2.0.5

8 months ago

2.0.4

9 months ago

2.0.6

6 months ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.2.0

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago