Skip to content

Commit

Permalink
chore: work on webchat e2e fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-bo-davis committed Sep 7, 2023
1 parent 5e3492c commit 38fc66a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion e2e-tests/chatScripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const commonScripts: Record<string, ChatStatement[]> = {
botStatement(
'You are number 1 in line. To keep your chat active, please do not leave/refresh this window or hit the back button.',
),
counselorAutoStatement("Hi, you've reached a counsellor. What would you like to talk about?"),
// counselorAutoStatement("Hi, you've reached a counsellor. What would you like to talk about?"),
callerStatement('CALLER TEST CHAT MESSAGE'),
counselorStatement('COUNSELLOR TEST CHAT MESSAGE'),
],
Expand Down
14 changes: 4 additions & 10 deletions e2e-tests/tests/webchat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,17 @@ test.describe.serial('Web chat caller', () => {
const webchatProgress = chatPage.chat(chatScript);
const flexChatProgress: AsyncIterator<ChatStatement> = flexChat(pluginPage).chat(chatScript);

await statusIndicator(pluginPage).setStatus('AVAILABLE');
await tasks(pluginPage).acceptNextTask();

// Currently this loop handles the handing back and forth of control between the caller & counselor sides of the chat.
// Each time round the loop it allows the webchat to process statements until it yields control back to this loop
// And each time flexChatProgress.next(), the flex chat processes statements until it yields
// Should be moved out to it's own function in time, and a cleaner was of injecting actions to be taken partway through the chat should be implemented.
for await (const expectedCounselorStatement of webchatProgress) {
console.log('Statement for flex chat to process', expectedCounselorStatement);
if (expectedCounselorStatement) {
switch (expectedCounselorStatement.origin) {
case ChatStatementOrigin.COUNSELOR_AUTO:
await statusIndicator(pluginPage).setStatus('AVAILABLE');
await tasks(pluginPage).acceptNextTask();
await flexChatProgress.next();
break;
default:
await flexChatProgress.next();
break;
}
await flexChatProgress.next();
}
}

Expand Down

0 comments on commit 38fc66a

Please sign in to comment.