Add mock ThreatMetrix Javascript implementation (LG-7174)#7018
Add mock ThreatMetrix Javascript implementation (LG-7174)#7018zachmargolis merged 21 commits intomainfrom
Conversation
| profiling behavior | ||
| </label> | ||
| <select | ||
| className="border-05 border-accent-warm-dark" |
There was a problem hiding this comment.
I ran the UI by @nickttng, who suggested square corners (aka not using usa-select) as well as the thicker border to hint "this is not part of normal Login.gov"
| const { value } = event.target; | ||
|
|
||
| if (value === 'chaotic') { | ||
| document.body.style.transform = 'rotate(180deg)'; |
There was a problem hiding this comment.
I would like to have more easter eggs to show what we can do with JS like this. My first idea was to slowly rotate the whole page... but this was faster. I am open to removing if anybody feels that's better.
changelog: Internal, Device Profiling, Add ability to select mock device profiling response
| @@ -0,0 +1,52 @@ | |||
| module Idv | |||
| module Steps | |||
| module ThreatMetrixStepHelper | |||
There was a problem hiding this comment.
@theabrad this might overlap with some of the refactoring / cleanup work you're doing
| newrelic_browser_app_id: '' | ||
| newrelic_browser_key: '' | ||
| newrelic_license_key: '' | ||
| no_sp_device_profiling_enabled: true |
| ) | ||
|
|
||
| result.response_body = JSON.parse( | ||
| response_body.gsub('REVIEW_STATUS', result.review_status.to_s), |
There was a problem hiding this comment.
I think this is not wired up correctly--I'm not seeing REVIEW_STATUS in that file. In an case, can we do this without a gsub (parse the JSON, modify, then re-serialize?)
|
Looks like this also covers LG-7233 and the changes I was working on. |
| return device_status | ||
| end | ||
|
|
||
| case SsnFormatter.format(ssn) |
There was a problem hiding this comment.
I vote for removing these magic SSNs and having the dropdown by the One True Way to trigger a certain device profiling result.
There was a problem hiding this comment.
cool I'll do that! My initial thought was to preserve any testing instructions we'd already sent people
| } | ||
|
|
||
| document.addEventListener('DOMContentLoaded', () => { | ||
| const ssnInput = document.getElementsByName('doc_auth[ssn]')[0]; |
There was a problem hiding this comment.
Might be nice to output some debugging info to the console here:
| const ssnInput = document.getElementsByName('doc_auth[ssn]')[0]; | |
| console.log(`Mock device profiling started for session ID ${loadSessionId()}`); | |
| const ssnInput = document.getElementsByName('doc_auth[ssn]')[0]; |
There was a problem hiding this comment.
We have some ESLints that discourage console logging, and we have the UI element for the dropdown, would this be like to help us detect if the DOM elements we look for move and the UI fails to load?
There was a problem hiding this comment.
I think I'm going to skip this:
- we have code in our feature specs that fails if it notices console.log output (which we usually only get in the case of errors) so adding an exception for this on every SSN page would be noisy
- I added steps to the feature specs for the SSN step that select debug options from here and verify the result in redis, so if the JS breaks, our test suite should tell us
so I think we have guards that cover the things this helps with already
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Co-authored-by: Andrew Duthie <aduth@users.noreply.github.com>
- no more magic ssns, only results from redis - set response_body.review_status correctly
Background
Right now, in some sandbox environments, we're loading real JS from a 3rd party. Ideally, we'd mock this so we can control the behavior, or add clearer ways to test reject paths, etc
This adds that
no_resultjust like the actual vendorScreenshots