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

The Cloud Apps should be testable in "Desktop Mode" #739

Closed
willmcvay opened this issue Mar 26, 2020 · 1 comment · Fixed by #784
Closed

The Cloud Apps should be testable in "Desktop Mode" #739

willmcvay opened this issue Mar 26, 2020 · 1 comment · Fixed by #784
Assignees
Labels
aml-checklist Relates to Anti-money laundering app front-end Relates to front end issues geo-diary Relates to GEO Diary app lifetime-legal Relates to Lifetime Legal App marketplace Relates to the Marketplace smb-onboarder Relates to Small Medium Business onboarding app

Comments

@willmcvay
Copy link
Contributor

willmcvay commented Mar 26, 2020

  • We need to be able to test desktop functionality in standalone mode as a team
  • As "desktop mode" relies on a global variable window.__REAPIT_MARKETPLACE_GLOBALS__ we should be able to apply this variable locally for testing without a code change
  • Because the apps re-direct to Reapit Connect, and rely on Desktop injecting it at each load, we can't just set this variable manually in the console.
  • Suggestion would be to set localstorage as it is persistent, then if a local storage variable is present, execute the set global variable script in the index.ts of each app.
    eg
const setMarketplaceGlobals = () => {
    const globals = window.localStorage.getItem('reapit-deskop-globals')
    if (globals) {
        Object.defineProperty(window, '__REAPIT_MARKETPLACE_GLOBALS__', {
            value: JSON.parse(globals),
        })
    }
}

Then we can test desktop mode by

window.localStorage.setItem('reapit-deskop-globals', JSON.stringify({
    cntCode: 'SomeCode'
}))

And we can revert to normal mode by

window.localStorage.clear()
  • Should be exported from elements as a re-usable script (DynamicLinks component), so we can document it for people who also want to test desktop mode.
  • Should be applied to all Apps: LTL, AML, Marketplace, Geo Diary, SMB
@willmcvay willmcvay added aml-checklist Relates to Anti-money laundering app geo-diary Relates to GEO Diary app lifetime-legal Relates to Lifetime Legal App marketplace Relates to the Marketplace smb-onboarder Relates to Small Medium Business onboarding app labels Mar 26, 2020
@HollyJoyPhillips HollyJoyPhillips added the front-end Relates to front end issues label Mar 27, 2020
@vuhuucuong vuhuucuong assigned vuhuucuong and unassigned vuhuucuong Mar 27, 2020
@vuhuucuong
Copy link
Contributor

How to switch mode:

  • Open Browser's Developer Tools -> Console tab
  • typing desktopMode() to switch to DESKTOP mode. If you want to pass data in, use
desktopMode({cntCode: 'code'})
  • typing webMode() to switch back to WEB mode

vuhuucuong pushed a commit that referenced this issue Apr 3, 2020
vuhuucuong pushed a commit that referenced this issue Apr 3, 2020
* feat: #739 cloud apps now testable in desktop mode
vuhuucuong pushed a commit that referenced this issue Apr 3, 2020
vuhuucuong pushed a commit that referenced this issue Apr 3, 2020
vuhuucuong pushed a commit that referenced this issue Apr 3, 2020
nphivu414 pushed a commit that referenced this issue Apr 29, 2020
* feat: #739 cloud apps now testable in desktop mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aml-checklist Relates to Anti-money laundering app front-end Relates to front end issues geo-diary Relates to GEO Diary app lifetime-legal Relates to Lifetime Legal App marketplace Relates to the Marketplace smb-onboarder Relates to Small Medium Business onboarding app
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants