-
Notifications
You must be signed in to change notification settings - Fork 166
LG-10287: Add Acuant SDK 11.9.1 files #8846
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
6611b05
9e8d351
464a973
54f00d6
4645957
3daecd9
5cf9af8
06d2211
1fe0b29
1e879da
e9c8c68
48eee2e
4f6a857
ea09c06
172f014
2c5100a
dbcb9a5
ccd2d6d
6174f3e
391ab30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ const ACUANT_CAPTURE_SUCCESS_RESULT = { | |
| width: 1748, | ||
| height: 1104, | ||
| }, | ||
| cardtype: AcuantDocumentType.ID, | ||
| cardType: AcuantDocumentType.ID, | ||
| dpi: 519, | ||
| moire: 99, | ||
| moireraw: 99, | ||
|
|
@@ -259,7 +259,7 @@ describe('document-capture/components/acuant-capture', () => { | |
| expect(window.AcuantCameraUI.end.called).to.be.false(); | ||
| }); | ||
|
|
||
| it('shows error if capture fails', async () => { | ||
| it('shows error if capture fails: legacy version of Acuant SDK', async () => { | ||
| const trackEvent = sinon.spy(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you clarify how this is selecting the legacy version? I'm not seeing version number differences in the two specs.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we look at line 275, we can see that the second argument for the start function is the To give a more general answer, I decided to test that both version 11.8.2 and version 11.9.1 are supported by stubbing the |
||
| const { container, getByLabelText, findByText } = render( | ||
| <AnalyticsContext.Provider value={{ trackEvent }}> | ||
|
|
@@ -288,7 +288,40 @@ describe('document-capture/components/acuant-capture', () => { | |
| expect(document.activeElement).to.equal(button); | ||
| }); | ||
|
|
||
| it('shows sequence break error', async () => { | ||
| it('shows error if capture fails: latest version of Acuant SDK', async () => { | ||
| const trackEvent = sinon.spy(); | ||
| const { container, getByLabelText, findByText } = render( | ||
| <AnalyticsContext.Provider value={{ trackEvent }}> | ||
| <DeviceContext.Provider value={{ isMobile: true }}> | ||
| <AcuantContextProvider sdkSrc="about:blank" cameraSrc="about:blank"> | ||
| <AcuantCapture label="Image" name="test" /> | ||
| </AcuantContextProvider> | ||
| </DeviceContext.Provider> | ||
| </AnalyticsContext.Provider>, | ||
| ); | ||
|
|
||
| const start = async ({ onFailure }) => { | ||
| await onFailure('Camera not supported.', 'start-fail-code'); | ||
| }; | ||
|
|
||
| initialize({ | ||
| start, | ||
| }); | ||
|
|
||
| const button = getByLabelText('Image'); | ||
| await userEvent.click(button); | ||
|
|
||
| await findByText('doc_auth.errors.camera.failed'); | ||
| expect(window.AcuantCameraUI.end).to.have.been.calledOnce(); | ||
| expect(container.querySelector('.full-screen')).to.be.null(); | ||
| expect(trackEvent).to.have.been.calledWith('IdV: Image capture failed', { | ||
| field: 'test', | ||
| error: 'Camera not supported', | ||
| }); | ||
| expect(document.activeElement).to.equal(button); | ||
| }); | ||
|
|
||
| it('shows sequence break error: legacy version of SDK', async () => { | ||
| const trackEvent = sinon.spy(); | ||
| const { container, getByLabelText, findByText } = render( | ||
| <AnalyticsContext.Provider value={{ trackEvent }}> | ||
|
|
@@ -306,6 +339,48 @@ describe('document-capture/components/acuant-capture', () => { | |
| const code = 'sequence-break-code'; | ||
| document.cookie = `AcuantCameraHasFailed=${code}`; | ||
| onError('iOS 15 sequence break', code); | ||
| }); | ||
| }), | ||
| }); | ||
|
|
||
| const button = getByLabelText('Image'); | ||
| await userEvent.click(button); | ||
|
|
||
| await findByText('doc_auth.errors.upload_error errors.messages.try_again'); | ||
| expect(window.AcuantCameraUI.end).to.have.been.calledOnce(); | ||
| expect(container.querySelector('.full-screen')).to.be.null(); | ||
| expect(trackEvent).to.have.been.calledWith('IdV: Image capture failed', { | ||
| field: 'test', | ||
| error: 'iOS 15 GPU Highwater failure (SEQUENCE_BREAK_CODE)', | ||
| }); | ||
| await waitFor(() => document.activeElement === button); | ||
|
|
||
| const defaultPrevented = !fireEvent.click(button); | ||
|
|
||
| window.AcuantCameraUI.start.resetHistory(); | ||
| expect(defaultPrevented).to.be.false(); | ||
| expect(window.AcuantCameraUI.start.called).to.be.false(); | ||
| }); | ||
|
|
||
| it('shows sequence break error: latest version of SDK', async () => { | ||
| const trackEvent = sinon.spy(); | ||
| const { container, getByLabelText, findByText } = render( | ||
| <AnalyticsContext.Provider value={{ trackEvent }}> | ||
| <DeviceContext.Provider value={{ isMobile: true }}> | ||
| <AcuantContextProvider sdkSrc="about:blank" cameraSrc="about:blank"> | ||
| <AcuantCapture label="Image" name="test" /> | ||
| </AcuantContextProvider> | ||
| </DeviceContext.Provider> | ||
| </AnalyticsContext.Provider>, | ||
| ); | ||
|
|
||
| initialize({ | ||
| start: sinon.stub().callsFake((callbacks) => { | ||
| const { onFailure } = callbacks; | ||
| setTimeout(() => { | ||
| const code = 'sequence-break-code'; | ||
| document.cookie = `AcuantCameraHasFailed=${code}`; | ||
| onFailure('iOS 15 sequence break', code); | ||
| }, 0); | ||
| }), | ||
| }); | ||
|
|
@@ -329,7 +404,7 @@ describe('document-capture/components/acuant-capture', () => { | |
| expect(window.AcuantCameraUI.start.called).to.be.false(); | ||
| }); | ||
|
|
||
| it('calls onCameraAccessDeclined if camera access is declined', async () => { | ||
| it('calls onCameraAccessDeclined if camera access is declined: legacy version of SDK', async () => { | ||
| const trackEvent = sinon.spy(); | ||
| const onCameraAccessDeclined = sinon.stub(); | ||
| const { container, getByLabelText } = render( | ||
|
|
@@ -365,6 +440,46 @@ describe('document-capture/components/acuant-capture', () => { | |
| expect(document.activeElement).to.equal(button); | ||
| }); | ||
|
|
||
| it('calls onCameraAccessDeclined if camera access is declined: latest version of SDK', async () => { | ||
| const trackEvent = sinon.spy(); | ||
| const onCameraAccessDeclined = sinon.stub(); | ||
| const { container, getByLabelText } = render( | ||
| <AnalyticsContext.Provider value={{ trackEvent }}> | ||
| <DeviceContext.Provider value={{ isMobile: true }}> | ||
| <AcuantContextProvider sdkSrc="about:blank" cameraSrc="about:blank"> | ||
| <AcuantCapture | ||
| label="Image" | ||
| name="test" | ||
| onCameraAccessDeclined={onCameraAccessDeclined} | ||
| /> | ||
| </AcuantContextProvider> | ||
| </DeviceContext.Provider> | ||
| </AnalyticsContext.Provider>, | ||
| ); | ||
|
|
||
| const start = async ({ onFailure }) => { | ||
| await onFailure(new Error()); | ||
| }; | ||
|
|
||
| initialize({ | ||
| start, | ||
| }); | ||
|
|
||
| const button = getByLabelText('Image'); | ||
| await userEvent.click(button); | ||
|
|
||
| await Promise.all([ | ||
| expect(onCameraAccessDeclined).to.eventually.be.called(), | ||
| expect(window.AcuantCameraUI.end).to.eventually.be.called(), | ||
| ]); | ||
| expect(container.querySelector('.full-screen')).to.be.null(); | ||
| expect(trackEvent).to.have.been.calledWith('IdV: Image capture failed', { | ||
| field: 'test', | ||
| error: 'User or system denied camera access', | ||
| }); | ||
| expect(document.activeElement).to.equal(button); | ||
| }); | ||
|
|
||
| it('blocks focus trap default focus return behavior if focus transitions during error', async () => { | ||
| let outsideInput; | ||
| const onCameraAccessDeclined = sinon.stub().callsFake(() => { | ||
|
|
@@ -384,8 +499,12 @@ describe('document-capture/components/acuant-capture', () => { | |
| ); | ||
| outsideInput = getByTestId('outside-input'); | ||
|
|
||
| const start = async ({ onFailure }) => { | ||
| await onFailure(new Error()); | ||
| }; | ||
|
|
||
| initialize({ | ||
| start: sinon.stub().callsArgWithAsync(1, new Error()), | ||
| start, | ||
| }); | ||
|
|
||
| const button = getByLabelText('Image'); | ||
|
|
@@ -567,7 +686,7 @@ describe('document-capture/components/acuant-capture', () => { | |
| await Promise.resolve(); | ||
| callbacks.onCropped({ | ||
| ...ACUANT_CAPTURE_SUCCESS_RESULT, | ||
| cardtype: AcuantDocumentType.PASSPORT, | ||
| cardType: AcuantDocumentType.PASSPORT, | ||
| }); | ||
| }), | ||
| }); | ||
|
|
@@ -822,7 +941,7 @@ describe('document-capture/components/acuant-capture', () => { | |
| await Promise.resolve(); | ||
| callbacks.onCaptured(); | ||
| await Promise.resolve(); | ||
| callbacks.onCropped({ ...ACUANT_CAPTURE_SUCCESS_RESULT, cardtype: incorrectCardType }); | ||
| callbacks.onCropped({ ...ACUANT_CAPTURE_SUCCESS_RESULT, cardType: incorrectCardType }); | ||
| }), | ||
| }); | ||
|
|
||
|
|
||
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.
Does it still work for the older version to remove this? Same on line 308 below.
Uh oh!
There was an error while loading. Please reload this page.
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.
Good point. I addressed this in my latest commits, with lots of help from Matt! 🙏🏻