Skip to content
Merged
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
4 changes: 2 additions & 2 deletions app/javascript/packages/document-capture/context/acuant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ const getActualAcuantCamera = (): AcuantCameraInterface => {
};

function AcuantContextProvider({
sdkSrc = '/acuant/11.8.1/AcuantJavascriptWebSdk.min.js',
cameraSrc = '/acuant/11.8.1/AcuantCamera.min.js',
sdkSrc,
cameraSrc,
credentials = null,
endpoint = null,
glareThreshold = DEFAULT_ACCEPTABLE_GLARE_SCORE,
Expand Down
4 changes: 2 additions & 2 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ idv_available: true
idv_contact_phone_number: (844) 555-5555
idv_max_attempts: 5
idv_min_age_years: 13
idv_acuant_sdk_version_default: '11.8.1'
idv_acuant_sdk_version_alternate: '11.8.0'
idv_acuant_sdk_version_default: '11.8.2'
idv_acuant_sdk_version_alternate: '11.8.1'
idv_acuant_sdk_upgrade_a_b_testing_enabled: false
idv_acuant_sdk_upgrade_a_b_testing_percent: 50
idv_send_link_attempt_window_in_minutes: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,61 @@
* Acuant SDK Loading Tests
*
*/
import fs from 'node:fs/promises';
import path from 'node:path';

import { JSDOM } from 'jsdom';
import AcuantJavascriptWebSdk from '../../../../../public/acuant/11.8.1/AcuantJavascriptWebSdk.min.js';

const sdkPaths = {
'11.8.1': '../../../../../public/acuant/11.8.1/AcuantJavascriptWebSdk.min.js',
};

const TEST_URL = `file://${__dirname}/index.html`;

const { window } = new JSDOM(
'<!doctype html><html lang="en"><head><title>JSDOM</title></head></html>',
{
url: TEST_URL,
runScripts: 'dangerously',
resources: 'usable',
},
);
const { document } = window;

describe('Acuant SDK Loading Tests', () => {
it('Can load something from the SDK file', () => {
expect(AcuantJavascriptWebSdk).to.exist();
});
describe('DOM Loading 11.8.1', () => {
before((done) => {
const scriptEl = document.createElement('script');
scriptEl.id = 'test-acuant-sdk-script';
scriptEl.onload = () => {
done();
};
scriptEl.src = sdkPaths['11.8.1'];
document.body.append(scriptEl);
});
it('There is a script element in the DOM', () => {
const found = document.getElementById('test-acuant-sdk-script');
expect(found).to.exist();
});
it('Has a global loadAcuantSdk object on the window', () => {
expect(window.loadAcuantSdk).to.exist();
});
it('Calling loadAcuantSdk gives us AcuantJavascriptWebSdk in the global scope and as a prop of the window', () => {
window.loadAcuantSdk();
expect(AcuantJavascriptWebSdk).to.exist();
expect(window.AcuantJavascriptWebSdk).to.exist();

const ACUANT_PUBLIC_DIR = '../../../../../public/acuant';
const VERSION_REGEX = /^\d+\.\d+\.\d+$/;

describe('Acuant SDK Loading Tests', async () => {
const sdks = (await fs.readdir(path.join(__dirname, ACUANT_PUBLIC_DIR))).filter((dir) =>
VERSION_REGEX.test(dir),
);

if (!sdks.length) {
throw new Error('Expected to find at least one SDK version, but found none');
}

sdks.forEach((version) => {
describe(version, () => {
const TEST_URL = `file://${__dirname}/index.html`;

const { window } = new JSDOM(
'<!doctype html><html lang="en"><head><title>JSDOM</title></head></html>',
{
url: TEST_URL,
runScripts: 'dangerously',
resources: 'usable',
},
);

const { document } = window;

before((done) => {
const scriptEl = document.createElement('script');
scriptEl.id = 'test-acuant-sdk-script';
scriptEl.onload = () => {
done();
};
scriptEl.src = `${ACUANT_PUBLIC_DIR}/${version}/AcuantJavascriptWebSdk.min.js`;
document.body.append(scriptEl);
});

it('There is a script element in the DOM', () => {
const found = document.getElementById('test-acuant-sdk-script');
expect(found).to.exist();
});

it('Has a global loadAcuantSdk object on the window', () => {
expect(window.loadAcuantSdk).to.exist();
});

it('Calling loadAcuantSdk gives us AcuantJavascriptWebSdk as a prop of the window', () => {
window.loadAcuantSdk();
expect(window).to.have.property('AcuantJavascriptWebSdk');
});
});
});
});
2 changes: 1 addition & 1 deletion spec/views/idv/shared/_document_capture.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let(:back_image_upload_url) { nil }
let(:acuant_sdk_upgrade_a_b_testing_enabled) { false }
let(:use_alternate_sdk) { false }
let(:acuant_version) { '11.8.1' }
let(:acuant_version) { '1.3.3.7' }
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.

👏

let(:in_person_cta_variant_testing_enabled) { false }
let(:in_person_cta_variant_active) { '' }

Expand Down