Skip to content

update getSignInUrl() to have consistent return type#3459

Merged
corinagum merged 6 commits intomasterfrom
stgum/3439
Sep 28, 2020
Merged

update getSignInUrl() to have consistent return type#3459
corinagum merged 6 commits intomasterfrom
stgum/3439

Conversation

@stevengum
Copy link
Copy Markdown
Member

@stevengum stevengum commented Sep 9, 2020

Fixes #3439
Fixes #2693

Changelog Entry

  • Fixes #3439. Use consistent return type in default CardActionContext.getSignInUrl(), by @stevengum in PR #3459

Description

DirectLine instances/objects that do not implement getSessionId() results in a codepath that returns a string when the calling code expects a Promise.resolve(). This PR wraps the changes the default CardActionContext.getSignInUrl() to always return Promise.resolve(), regardless of whether or not the DirectLine object implements getSessionId().

Specific Changes

  • Update getSignInUrl() to have consistent return type (Promise<string>)
  • Update warning message when directLine.getSessionId is falsy in the default CardActionContextMiddleware to indicate no-magic-code OAuth flows are not supported
  • Add test for CardActionContextMiddleware changes
  • Add disableNoMagicCode option to __tests__/setup/web/index.html for testing bugfix
  • Add getConsoleErrors() and getConsoleWarnings() to pageObjects
  • Refactor speech.synthesis.js to use getConsoleErrors() instead of getConsoleLogs()
  • Add internal helper consoleLogFlattener() for flattening the data structure returned in getConsoleErrors() and getConsoleWarnings()
    • getConsoleLogs() still returns Array<Array<string>> e.g.
      • [["error", "error-message"], ["warn", "some-warning-message"]]
    • getConsoleErrors() and getConsoleWarnings() returns <Array<string>, e.g.
      • ["error-message"] or ["some-warning-message"].

Repro steps

  1. Connect to bot using a DirectLineStreaming connection (i.e., DL-ASE, DLS)
  2. Begin OAuth flow in bot
  3. Click on login button, observe new tab open without a login URL
  4. Go back to Web Chat tab, open console and see following error:
    image

  • [ ] I have added tests and executed them locally Incomplete
  • I have updated CHANGELOG.md
  • [ ] I have updated documentation Not applicable

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

stevengum and others added 5 commits September 8, 2020 20:39
* add getConsoleErrors, getConsoleWarnings
* update speech.synthesis.js to use getConsoleErrors
* update warning in falsy directLine.getSessionId path
@stevengum
Copy link
Copy Markdown
Member Author

@compulim, @corinagum, @cwhitten this PR is ready for review, thanks!

Comment thread __tests__/setup/web/index.html
Copy link
Copy Markdown
Contributor

@corinagum corinagum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@corinagum corinagum merged commit 50f6cee into master Sep 28, 2020
@corinagum corinagum deleted the stgum/3439 branch September 28, 2020 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent return types in CardActionContext.getSignInUrl() [DLS] OAuth card SignIn button doesn't work

3 participants