-
Notifications
You must be signed in to change notification settings - Fork 166
LG-7277 Acuant Not Working for iPads #6865
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
Changes from all commits
a2e8d5d
422c79a
af8aad9
7dfd8b1
dd2b71d
69dda0f
1c3d6bf
8b9fbb3
339d170
6c8131a
d3cde0b
2d25960
6b2a499
1c2eec4
f24deca
7dab8e2
7be3100
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
|
|
||
| before do | ||
| sign_in_and_2fa_user | ||
| allow_any_instance_of(Idv::Steps::UploadStep).to receive(:mobile_device?).and_return(true) | ||
|
||
| complete_doc_auth_steps_before_upload_step | ||
| allow_any_instance_of(ApplicationController).to receive(:analytics).and_return(fake_analytics) | ||
| allow_any_instance_of(ApplicationController).to receive(:irs_attempts_api_tracker). | ||
|
|
@@ -55,6 +56,10 @@ | |
| end | ||
|
|
||
| context 'on a desktop device' do | ||
| before do | ||
| allow_any_instance_of(Idv::Steps::UploadStep).to receive(:mobile_device?).and_return(false) | ||
| end | ||
|
|
||
| it 'is on the correct page' do | ||
| expect(page).to have_current_path(idv_doc_auth_upload_step) | ||
| expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_id')) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,101 @@ | ||
| import { isLikelyMobile, hasMediaAccess, isCameraCapableMobile } from '@18f/identity-device'; | ||
| import { | ||
| isLikelyMobile, | ||
| hasMediaAccess, | ||
| isCameraCapableMobile, | ||
| isIPad, | ||
| } from '@18f/identity-device'; | ||
|
|
||
| describe('isIPad', () => { | ||
| let originalUserAgent; | ||
| let originalTouchPoints; | ||
|
|
||
| beforeEach(() => { | ||
| originalUserAgent = navigator.userAgent; | ||
| originalTouchPoints = navigator.maxTouchPoints; | ||
| navigator.maxTouchPoints = 0; | ||
| Object.defineProperty(navigator, 'userAgent', { | ||
|
||
| configurable: true, | ||
| writable: true, | ||
| }); | ||
| Object.defineProperty(navigator, 'maxTouchPoints', { | ||
| writable: true, | ||
| }); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| navigator.userAgent = originalUserAgent; | ||
| navigator.maxTouchPoints = originalTouchPoints; | ||
| }); | ||
|
|
||
| it('returns true if ipad is in the user agent string (old format)', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'; | ||
|
|
||
| expect(isIPad()).to.be.true(); | ||
| }); | ||
|
|
||
| it('returns false if the user agent is Macintosh but with 0 maxTouchPoints', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36'; | ||
|
|
||
| expect(isIPad()).to.be.false(); | ||
| }); | ||
|
|
||
| it('returns true if the user agent is Macintosh but with 5 maxTouchPoints', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36'; | ||
| navigator.maxTouchPoints = 5; | ||
|
||
|
|
||
| expect(isIPad()).to.be.true(); | ||
| }); | ||
|
|
||
| it('returns false for non-Apple userAgent, even with 5 macTouchPoints', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.5195.58 Mobile Safari/537.36'; | ||
| navigator.maxTouchPoints = 5; | ||
|
|
||
| expect(isIPad()).to.be.false(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('isLikelyMobile', () => { | ||
| let originalUserAgent; | ||
| let originalTouchPoints; | ||
|
|
||
| beforeEach(() => { | ||
| originalUserAgent = navigator.userAgent; | ||
| originalTouchPoints = navigator.maxTouchPoints; | ||
| navigator.maxTouchPoints = 0; | ||
| Object.defineProperty(navigator, 'userAgent', { | ||
| configurable: true, | ||
| writable: true, | ||
| }); | ||
| Object.defineProperty(navigator, 'maxTouchPoints', { | ||
| writable: true, | ||
| }); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| navigator.userAgent = originalUserAgent; | ||
| navigator.maxTouchPoints = originalTouchPoints; | ||
| }); | ||
|
|
||
| it('returns false if not mobile', () => { | ||
| it('returns false if not mobile and has no touchpoints', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36'; | ||
| navigator.maxTouchPoints = 0; | ||
|
|
||
| expect(isLikelyMobile()).to.be.false(); | ||
| }); | ||
|
|
||
| it('returns true if there is an Apple user agent and 5 maxTouchPoints', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36'; | ||
| navigator.maxTouchPoints = 5; | ||
|
|
||
| expect(isLikelyMobile()).to.be.true(); | ||
| }); | ||
|
|
||
| it('returns true if likely mobile', () => { | ||
| navigator.userAgent = | ||
| 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add / update specs for this file.
https://github.com/18F/identity-idp/blob/main/spec/javascripts/packages/device/index-spec.js