Skip to content

Commit

Permalink
Add wait for close method (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
SketchingDev authored Feb 12, 2024
1 parent db2eed2 commit 9c31a7c
Show file tree
Hide file tree
Showing 21 changed files with 483 additions and 155 deletions.
1 change: 1 addition & 0 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Genesys Web Messaging Tester
- [Conversation](classes/Conversation.md)
- [ReorderedMessageDelayer](classes/ReorderedMessageDelayer.md)
- [SessionTranscriber](classes/SessionTranscriber.md)
- [TimeoutWaitingForDisconnectionError](classes/TimeoutWaitingForDisconnectionError.md)
- [TimeoutWaitingForResponseError](classes/TimeoutWaitingForResponseError.md)
- [WebMessageServerConnectionFixture](classes/WebMessageServerConnectionFixture.md)
- [WebMessageServerFixture](classes/WebMessageServerFixture.md)
Expand Down
20 changes: 15 additions & 5 deletions docs/api/classes/BotDisconnectedWaitingForResponseError.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

### constructor

**new BotDisconnectedWaitingForResponseError**(`_expectedResponse`, `_responsesReceived?`)
**new BotDisconnectedWaitingForResponseError**(`_expectedResponse`, `_responsesReceived?`): [`BotDisconnectedWaitingForResponseError`](BotDisconnectedWaitingForResponseError.md)

#### Parameters

Expand All @@ -44,6 +44,10 @@
| `_expectedResponse` | `string` | `undefined` |
| `_responsesReceived` | readonly (`StructuredMessageTextBody` \| `StructuredMessageStructuredBody`)[] | `[]` |

#### Returns

[`BotDisconnectedWaitingForResponseError`](BotDisconnectedWaitingForResponseError.md)

#### Overrides

Error.constructor
Expand All @@ -64,7 +68,7 @@ Error.message

#### Defined in

node_modules/typescript/lib/lib.es5.d.ts:1068
node_modules/typescript/lib/lib.es5.d.ts:1076

___

Expand All @@ -78,7 +82,7 @@ Error.name

#### Defined in

node_modules/typescript/lib/lib.es5.d.ts:1067
node_modules/typescript/lib/lib.es5.d.ts:1075

___

Expand All @@ -92,14 +96,20 @@ Error.stack

#### Defined in

node_modules/typescript/lib/lib.es5.d.ts:1069
node_modules/typescript/lib/lib.es5.d.ts:1077

___

### prepareStackTrace

`Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any`

Optional override for formatting stack traces

**`See`**

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

#### Type declaration

▸ (`err`, `stackTraces`): `any`
Expand Down Expand Up @@ -175,7 +185,7 @@ readonly (`StructuredMessageTextBody` \| `StructuredMessageStructuredBody`)[]

### captureStackTrace

`Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
**captureStackTrace**(`targetObject`, `constructorOpt?`): `void`

Create .stack property on a target object

Expand Down
83 changes: 64 additions & 19 deletions docs/api/classes/Conversation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ console.log(reply);

- [constructor](Conversation.md#constructor)

### Accessors

- [isDisconnected](Conversation.md#isdisconnected)

### Methods

- [sendText](Conversation.md#sendtext)
- [waitForConversationToClose](Conversation.md#waitforconversationtoclose)
- [waitForConversationToStart](Conversation.md#waitforconversationtostart)
- [waitForResponseText](Conversation.md#waitforresponsetext)
- [waitForResponseWithTextContaining](Conversation.md#waitforresponsewithtextcontaining)
Expand All @@ -43,7 +48,7 @@ console.log(reply);

### constructor

**new Conversation**(`messengerSession`, `timeoutSet?`, `timeoutClear?`)
**new Conversation**(`messengerSession`, `timeoutSet?`, `timeoutClear?`): [`Conversation`](Conversation.md)

#### Parameters

Expand All @@ -53,9 +58,29 @@ console.log(reply);
| `timeoutSet` | typeof `setTimeout` | `setTimeout` |
| `timeoutClear` | (`timeoutId`: `undefined` \| `string` \| `number` \| `Timeout`) => `void` | `clearTimeout` |

#### Returns

[`Conversation`](Conversation.md)

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:133](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L133)
[packages/genesys-web-messaging-tester/src/Conversation.ts:142](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L142)

## Accessors

### isDisconnected

`get` **isDisconnected**(): `boolean`

Returns whether the conversation has been disconnected

#### Returns

`boolean`

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:198](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L198)

## Methods

Expand All @@ -78,7 +103,27 @@ Sends text to the conversation

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:175](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L175)
[packages/genesys-web-messaging-tester/src/Conversation.ts:229](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L229)

___

### waitForConversationToClose

**waitForConversationToClose**(`timeoutInMs?`): `Promise`\<`void`\>

#### Parameters

| Name | Type | Default value |
| :------ | :------ | :------ |
| `timeoutInMs` | `number` | `2000` |

#### Returns

`Promise`\<`void`\>

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:168](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L168)

___

Expand All @@ -97,7 +142,7 @@ background. This method allows you to wait for this process to finish.

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:154](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L154)
[packages/genesys-web-messaging-tester/src/Conversation.ts:208](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L208)

___

Expand All @@ -115,7 +160,7 @@ If you want to wait for a specific message use [waitForResponseWithTextContainin

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:197](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L197)
[packages/genesys-web-messaging-tester/src/Conversation.ts:255](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L255)

___

Expand All @@ -134,20 +179,20 @@ use [waitForResponseText](Conversation.md#waitforresponsetext).

#### Parameters

| Name | Type |
| :------ | :------ |
| `text` | `string` |
| `«destructured»` | `Object` |
| › `caseInsensitive?` | `boolean` |
| › `timeoutInSeconds?` | `number` |
| Name | Type | Default value |
| :------ | :------ | :------ |
| `text` | `string` | `undefined` |
| `«destructured»` | `Object` | `{}` |
| › `caseInsensitive?` | `boolean` | `true` |
| › `timeoutInSeconds?` | `number` | `10` |

#### Returns

`Promise`\<`string`\>

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:255](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L255)
[packages/genesys-web-messaging-tester/src/Conversation.ts:313](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L313)

___

Expand All @@ -164,19 +209,19 @@ use [waitForResponseText](Conversation.md#waitforresponsetext).

#### Parameters

| Name | Type |
| :------ | :------ |
| `pattern` | `string` \| `RegExp` |
| `«destructured»` | `Object` |
| › `timeoutInSeconds?` | `number` |
| Name | Type | Default value |
| :------ | :------ | :------ |
| `pattern` | `string` \| `RegExp` | `undefined` |
| `«destructured»` | `Object` | `{}` |
| › `timeoutInSeconds?` | `number` | `10` |

#### Returns

`Promise`\<`string`\>

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:286](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L286)
[packages/genesys-web-messaging-tester/src/Conversation.ts:344](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L344)

___

Expand All @@ -198,4 +243,4 @@ Wait for all responses until there is a predefined amount of 'silence'.

#### Defined in

[packages/genesys-web-messaging-tester/src/Conversation.ts:213](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L213)
[packages/genesys-web-messaging-tester/src/Conversation.ts:271](https://github.com/ovotech/genesys-web-messaging-tester/blob/main/packages/genesys-web-messaging-tester/src/Conversation.ts#L271)
Loading

0 comments on commit 9c31a7c

Please sign in to comment.