Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,10 @@ function AcuantCapture(
);

refreshAcuantFailureCookie();
} else {
} else if (error === 'Camera not supported.') {
setOwnErrorMessage(t('doc_auth.errors.camera.failed'));
} else {
setOwnErrorMessage(t('errors.general'));
}

setIsCapturingEnvironment(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,35 @@ describe('document-capture/components/acuant-capture', () => {
expect(document.activeElement).to.equal(button);
});

it('shows a generic error if camera starts but cropping error occurs', 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().callsArgWithAsync(1, undefined, 'start-fail-code'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these parameters accurate for what is sent when a crop error occurs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @aduth, I am responding to feedback for this PR because Brittany will be out of office for a bit. Do you happen to know how to trigger a crop error? I wanted to follow up on your question. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not aware of how to trigger it. Part of the reason for the question was trying to understand where in the Acuant source this actually occurs, since the other error expected types were originally sourced by following all of the failure paths.

});

const button = getByLabelText('Image');
await userEvent.click(button);
await findByText('errors.general');

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: 'Cropping failure',
});
expect(document.activeElement).to.equal(button);
});

it('shows sequence break error', async () => {
const trackEvent = sinon.spy();
const { container, getByLabelText, findByText } = render(
Expand Down