Skip to content
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

enh(DocVerification): support global document verification #57

Merged
merged 46 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
04bd46a
refactor: remove development environment
tamssokari Sep 11, 2023
1956dd8
redesign: use `valid_documents` for global doc v
tamssokari Sep 14, 2023
44cf42f
tests: fix flaxy tests by loading fixtures early
tamssokari Sep 14, 2023
d63f68a
assets: change the chevron-down icon, add chevron-up
tamssokari Sep 18, 2023
4427caa
enh: add `Combobox` component for autocomplete, custom dropdown
tamssokari Sep 18, 2023
3e3fe42
enh: use `Combobox in document verification
tamssokari Sep 18, 2023
ae41719
tests: rewrite tests for a combobox world
tamssokari Sep 18, 2023
444086c
temp: use preview build of updated smart-camera-web for global doc v
Sep 20, 2023
2a1dc0e
enh(Combobox): add button next to input for text
Sep 20, 2023
1dbedc7
enh: handle single country case
Sep 20, 2023
5cbf2c4
tests: select id type using direct descendant selector
Sep 20, 2023
3ec7094
enh(Combobox): add `value` and `disabled` attributes
Sep 20, 2023
84eef9b
redesign(Combobox): remove focus / blur listeners on input, fix spaces
Sep 20, 2023
f160776
redesign: fix preselection state for document verification
Sep 20, 2023
7961f75
tests: load id options in before each hooks
Sep 20, 2023
3976c9e
tests: fix test names for verification-method-selection
Sep 20, 2023
b2ee67d
enh: change back / close buttons
Sep 20, 2023
9b7f3c4
Merge branch 'main' into enh/global-doc-verification
Sep 22, 2023
5fae2f7
styles: add hover styles for combobox-option
Sep 26, 2023
24bd5bc
refactor: remove search icon from Combobox
Sep 26, 2023
5c68bea
styles(combobox): listbox inline-size should match trigger, add .5rem…
Sep 26, 2023
52560ce
fix: reload id types on country change
Sep 27, 2023
3aa3929
refactor: use function and not arrow function
Sep 27, 2023
683ee79
refactor: close combobox on external click or focus event
Sep 27, 2023
3df7d47
tests: fix failing test
Sep 28, 2023
639322e
Merge branch 'main' into enh/global-doc-verification
Sep 29, 2023
2f184b1
version: bump version number for global docv
Sep 29, 2023
7268399
redesign: support legacy id types
Sep 30, 2023
d23eeae
Merge branch 'main' into enh/global-doc-verification
tamssokari Oct 2, 2023
ab10a8e
Merge branch 'main' into enh/global-doc-verification
tamssokari Oct 3, 2023
347604a
Merge branch 'main' into enh/global-doc-verification
Oct 3, 2023
aa5a9ef
fix: fix lint errors
Oct 3, 2023
1c9bfa1
Merge branch 'main' into enh/global-doc-verification
Oct 3, 2023
807086f
refactor: rename eslintrc as cjs
Oct 3, 2023
ff5bca2
fix: reference minified file
Oct 3, 2023
dd8a56f
refactor: reinstate global doc v changes
Oct 3, 2023
1571fe2
tests: fix broken test
Oct 3, 2023
ebf0afe
tmp: use unminified versions for debugging
Oct 4, 2023
cd24022
Revert "tmp: use unminified versions for debugging"
Oct 4, 2023
48cd8ea
enh: allow "Others" in id_selection
Oct 4, 2023
9433199
format: use spaces and not tabs
Oct 5, 2023
c490b59
enh: make "others" check in id_selection case insensitive
Oct 5, 2023
2642bfb
fix: fix lint error
Oct 5, 2023
dd3c6d3
Merge branch 'main' into enh/global-doc-verification
tamssokari Oct 5, 2023
5d964b5
fix: fix "others" case insensitive bug
Oct 5, 2023
d3d7d13
version: bump version for global doc v
Oct 5, 2023
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
15,877 changes: 15,877 additions & 0 deletions cypress/fixtures/valid_documents.json

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions cypress/pages/document-verification-legacy-id_types.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
max-width: 100%;
min-height: 100%;
}
</style>
</head>

<body>
<script src="js/script.min.js"></script>

<script>
SmileIdentity({
token:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVyX3BhcmFtcyI6eyJ1c2VyX2lkIjoidXNlci1mZTIwY2JkYS1jMjJiLTRmZmUtOWRlZC05YjZhZGI2MDE1ZmIiLCJqb2JfaWQiOiJqb2ItNjYzY2VhNTUtZWIxYy00MjI2LWI1N2YtOGEwMTAwOTc4ZjViIiwiam9iX3R5cGUiOjF9LCJjYWxsYmFja191cmwiOiJodHRwczovL3dlYmhvb2suc2l0ZS9iZTM0YzkzZC1hOTFmLTQzZGItYWVmMi05MDZjNWNkOTVkNDciLCJpYXQiOjE2MzQyODE0MTAsImV4cCI6MTYzNTkxNTY4NH0.B4JaP4UWbNs38hV9nQ_9_Pnpos0fM3qu2nGG7Eymjs8",
product: "doc_verification",
callback_url:
"https://portal.smileidentity.com/api/v2/007/postback/update_status",
environment: "sandbox",
id_selection: {
NG: ["DRIVERS_LICENSE", "VOTER_ID", "PASSPORT"],
ZA: ["NATIONAL_ID", "GREEN_BOOK", "Others"],
GH: ["SSNIT"],
},
partner_details: {
name: "Test Org",
logo_url: "https://portal.smileidentity.com/favicon.ico",
partner_id: "007",
policy_url: "https://smileidentity.com/privacy-policy",
theme_color: "#000",
},
onSuccess: () => {},
onClose: () => {},
});
</script>
</body>
</html>
32 changes: 30 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Cypress.Commands.add("loadIDOptions", () => {

cy.intercept("GET", "**/v1/services", { fixture: "services.json" });

cy.intercept("POST", "**/v1/valid_documents", {
fixture: "valid_documents.json",
});

cy.intercept("POST", "**/v1/products_config", {
fixture: "products_config.json",
});
Expand Down Expand Up @@ -133,9 +137,33 @@ Cypress.Commands.add("selectPASSPORTIDType", () => {

cy.log("selectingPASSPORTIDType");

cy.getIFrameBody().find("#country").select("NG");
cy.getIFrameBody().find("smileid-combobox-trigger input").type("Nigeria");

cy.getIFrameBody().find('smileid-combobox-option[value="NG"]').click();

cy.getIFrameBody().find("smileid-combobox-trigger > button").click();

cy.getIFrameBody().find("#id_type").select("PASSPORT");
cy.getIFrameBody().find('smileid-combobox-option[value="PASSPORT"]').click();

cy.getIFrameBody().find("#submitConfig").click();
});

Cypress.Commands.add("selectZAGREENBOOKIDType", () => {
cy.loadIDOptions();

cy.log("selectingPASSPORTIDType");

cy.getIFrameBody()
.find("smileid-combobox-trigger input")
.type("South Africa");

cy.getIFrameBody().find('smileid-combobox-option[value="ZA"]').click();

cy.getIFrameBody().find("smileid-combobox-trigger > button").click();

cy.getIFrameBody()
.find('smileid-combobox-option[value="GREEN_BOOK"]')
.click();

cy.getIFrameBody().find("#submitConfig").click();
});
Expand Down
74 changes: 43 additions & 31 deletions cypress/tests/consent-required.cy.cjs
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
it("should show consent screen for the required id type", () => {
cy.visit("/consent-required");
describe("consent required", () => {
beforeEach(() => {
cy.loadIDOptions();
});

cy.selectBVNIDType();
it("should show consent screen for the required id type", () => {
cy.visit("/consent-required");

cy.getIFrameBody()
.find("end-user-consent")
.shadow()
.find("#consent-screen")
.should("be.visible");
});
cy.selectBVNIDType();

it("should NOT show consent screen for the non-required id type", () => {
cy.visit("/consent-required");
cy.getIFrameBody()
.find("end-user-consent")
.shadow()
.find("#consent-screen")
.should("be.visible");
});

cy.loadIDOptions();
it("should NOT show consent screen for the non-required id type", () => {
cy.visit("/consent-required");

cy.getIFrameBody()
.find("#country")
.select("Nigeria")
.should("have.value", "NG");
cy.loadIDOptions();

cy.getIFrameBody().find("#id_type").select("NIN").should("have.value", "NIN");
cy.getIFrameBody()
.find("#country")
.select("Nigeria")
.should("have.value", "NG");

cy.getIFrameBody().find("#submitConfig").click();
cy.getIFrameBody()
.find("#id_type")
.select("NIN")
.should("have.value", "NIN");

cy.getIFrameBody().find("end-user-consent").should("not.exist");
});
cy.getIFrameBody().find("#submitConfig").click();

cy.getIFrameBody().find("end-user-consent").should("not.exist");
});

it("should NOT show consent screen when configuration is absent", () => {
cy.visit("/consent-not-required");
it("should NOT show consent screen when configuration is absent", () => {
cy.visit("/consent-not-required");

cy.loadIDOptions();
cy.loadIDOptions();

cy.getIFrameBody()
.find("#country")
.select("Nigeria")
.should("have.value", "NG");
cy.getIFrameBody()
.find("#country")
.select("Nigeria")
.should("have.value", "NG");

cy.getIFrameBody().find("#id_type").select("NIN").should("have.value", "NIN");
cy.getIFrameBody()
.find("#id_type")
.select("NIN")
.should("have.value", "NIN");

cy.getIFrameBody().find("#submitConfig").click();
cy.getIFrameBody().find("#submitConfig").click();

cy.getIFrameBody().find("end-user-consent").should("not.exist");
cy.getIFrameBody().find("end-user-consent").should("not.exist");

cy.getIFrameBody().find("smart-camera-web").should("exist");
cy.getIFrameBody().find("smart-camera-web").should("exist");
});
});
2 changes: 2 additions & 0 deletions cypress/tests/data-input.cy.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe("id-info screen", () => {
beforeEach(() => {
cy.loadIDOptions();

cy.visit("/");

cy.selectNINIDType();
Expand Down
112 changes: 106 additions & 6 deletions cypress/tests/document-verification.cy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ describe("document verification", () => {

cy.visit("/document-verification");

cy.getIFrameBody().find("#country").select("NG");

cy.getIFrameBody().find("#id_type").select("NATIONAL_ID");

cy.getIFrameBody().find("#submitConfig").click();
cy.selectPASSPORTIDType();

cy.navigateThroughCameraScreens();
});
Expand All @@ -38,7 +34,111 @@ describe("document verification", () => {
cy.getIFrameBody()
.find("smart-camera-web")
.invoke("attr", "document-type")
.should("eq", "NATIONAL_ID");
.should("eq", "PASSPORT");

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#id-entry-screen")
.should("be.visible");

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#id-entry-screen #take-photo")
.click();

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#id-camera-screen")
.should("be.visible");

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#capture-id-image")
.click();

cy.wait(2000);

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#id-camera-screen")
.should("not.be.visible");

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#select-id-image")
.click();

cy.getIFrameBody()
.find("smart-camera-web")
.shadow()
.find("#id-review-screen")
.should("not.be.visible");

cy.wait("@getUploadURL");

cy.wait("@successfulUpload");

cy.getIFrameBody().find("#complete-screen").should("be.visible");
});
});

describe("legacy support - preselected country / id_types", () => {
beforeEach(() => {
cy.intercept(
{
method: "POST",
url: "*upload*",
},
{
upload_url:
"https://smile-uploads-development01.s3.us-west-2.amazonaws.com/videos/212/212-0000060103-0gdzke3mdtlco5k0sdfh6vifzcrd3n/ekyc_smartselfie.zip",
},
).as("getUploadURL");

cy.intercept(
{
method: "PUT",
url: "https://smile-uploads-development01.s3.us-west-2.amazonaws.com/videos/212/212-0000060103-0gdzke3mdtlco5k0sdfh6vifzcrd3n/ekyc_smartselfie.zip",
},
{
statusCode: 200,
},
).as("successfulUpload");

cy.loadIDOptions();

cy.visit("/document-verification-legacy-id_types");
});

it("should show the Others input when selected", () => {
cy.getIFrameBody()
.find("smileid-combobox-trigger input")
.type("South Africa");

cy.getIFrameBody().find('smileid-combobox-option[value="ZA"]').click();

cy.getIFrameBody().find("smileid-combobox-trigger > button").click();

cy.getIFrameBody()
.find('smileid-combobox-option[value=""]')
.should("be.visible");
});

it("should allow legacy id_types without capturing the back", () => {
cy.selectZAGREENBOOKIDType();

cy.navigateThroughCameraScreens();

cy.getIFrameBody()
.find("smart-camera-web")
.invoke("attr", "document-type")
.should("eq", "GREEN_BOOK");

cy.getIFrameBody()
.find("smart-camera-web")
Expand Down
18 changes: 14 additions & 4 deletions cypress/tests/id-selection.cy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ describe("No ID Selection", () => {
});

describe("Preselected Country", () => {
beforeEach(() => {
cy.loadIDOptions();
});

it("basic_kyc", () => {
cy.visit("/basic_kyc_pre_select_country");

Expand Down Expand Up @@ -326,7 +330,11 @@ describe("Preselected Country", () => {

cy.getIFrameBody().find("#country").should("contain", "Nigeria");

cy.getIFrameBody().find("#id_type").select("PASSPORT");
cy.getIFrameBody().find("smileid-combobox-trigger > button").click();

cy.getIFrameBody()
.find('smileid-combobox-option[value="PASSPORT"]')
.click();

cy.getIFrameBody().find("#submitConfig").click();

Expand Down Expand Up @@ -429,6 +437,10 @@ describe("Preselected Country", () => {
});

describe("Preselected Country and ID Type", () => {
beforeEach(() => {
cy.loadIDOptions();
});

it("basic_kyc", () => {
cy.visit("/basic_kyc_pre_select_id_type");

Expand Down Expand Up @@ -556,9 +568,7 @@ describe("Preselected Country and ID Type", () => {

cy.loadIDOptions();

cy.getIFrameBody().find("#country").should("not.be.visible");

cy.getIFrameBody().find("#id_type").should("not.be.visible");
cy.getIFrameBody().find("#id_type").should("not.exist");

cy.getIFrameBody().find("smart-camera-web").should("be.visible");

Expand Down
1 change: 1 addition & 0 deletions cypress/tests/kra-verification.cy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe("KRA PIN verification enhanced kyc", () => {
},
).as("submitIdVerification");

cy.loadIDOptions();
cy.visit("/kra-verification-ekyc");

cy.selectKRAType();
Expand Down
10 changes: 7 additions & 3 deletions cypress/tests/verification-method-selection.cy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ describe("Verification Method Selection", () => {
});

describe("doc_verification", () => {
it("should redirect to the biometric kyc sequence in a nested iframe", () => {
cy.selectPASSPORTIDType();
it("should redirect to the document verification sequence in a nested iframe", () => {
cy.getIFrameBody().find("#country").select("NG");

cy.getIFrameBody().find("#id_type").select("PASSPORT");

cy.getIFrameBody().find("#submitConfig").click();

cy.getIFrameBody()
.find(
Expand All @@ -37,7 +41,7 @@ describe("Verification Method Selection", () => {
});

describe("enhanced_kyc", () => {
it("should redirect to the biometric kyc sequence in a nested iframe", () => {
it("should redirect to the enhanced kyc sequence in a nested iframe", () => {
cy.selectNINIDType();

cy.getIFrameBody()
Expand Down
Loading