Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support locale at StartConversation #3296

Closed
timenick opened this issue Jul 8, 2020 · 1 comment · Fixed by #3306
Closed

Support locale at StartConversation #3296

timenick opened this issue Jul 8, 2020 · 1 comment · Fixed by #3306
Assignees
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete.

Comments

@timenick
Copy link
Contributor

timenick commented Jul 8, 2020

##Issue
Original issue: microsoft/botframework-obi#75

This issue tracks a frequently requested feature to allow a user locale when starting new conversations. The user locale is needed so that bots can send a properly localized Greeting Message to users.

##Proposed change
WebChat - update the protocol to support locale and userId aligned with DirectLineJS

Tracking DirectLineJS issue: microsoft/BotFramework-DirectLineJS#292

@timenick timenick self-assigned this Jul 8, 2020
@compulim compulim added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. Enhancement labels Jul 8, 2020
@compulim
Copy link
Contributor

compulim commented Jul 8, 2020

Thanks @timenick. We will implement the startConversation.locale options.

Work items

Adding locale option

Update createDirectLine to accept and pass locale option.

  const directLine = window.WebChat.createDirectLine({
+   locale: 'en-US',
    token
  });

Add a sample to show how it works

We need a bot to show the greetings. Please update the MockBot2. Expecting:

  1. When the user join the conversation, currently, it will say "Hello and welcome!"
    • Please update it with zh-Hans and say another message
    • You may need to bump Bot Builder SDK
    • This bot has CI/CD, will do automatic deployment via GitHub Actions
  2. Test the bot at https://compulim.github.io/webchat-loader/, click "MockBot 2 (Preview)"

Add tests

  1. Clone /__tests__/html/simple.html and simple.js
  2. Add tests
    • (We always use visual regression test, you can look at the code, and run it under Docker to get the screenshots)
    • Test "no locale is sent", should return "Hello and welcome!"
    • Test "send en-US", should return "Hello and welcome!"
    • Test "send zh-Hans", should return the message in Simplified Chinese
    • Test "send xx-YY" (non-existing), should return "Hello and welcome!"
    • Test "send 1a2b3c" (non-ISO format), should return "Hello and welcome!"

To run tests locally

  1. npm start
  2. Navigate to http://localhost:5001/ and click on the test
  3. Open F12 to see the test result
    • This route don't capture the screenshot although it said it is

To run tests in Docker

You must capture screenshots in Docker for cross-platform compatibility.

  1. Install Docker
    • On Windows, we currently run on WSL1 but not WSL2 yet
  2. Run docker-compose up --build to start the Selenium Grid
  3. Run npm test (or npm test -- --testPathPattern __tests__/html/simple to scope down)
    • When the new tests are run, the screenshot will be saved to disk automatically

@compulim compulim added the customer-reported Required for internal Azure reporting. Do not delete. label Jul 8, 2020
@timenick timenick changed the title Support locale and userId at StartConversation Support locale at StartConversation Jul 15, 2020
@compulim compulim added the R10 label Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants