Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
solnsubuga committed Aug 15, 2024
1 parent 4006f37 commit 6cdf4f0
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/embed/cypress/fixtures/valid_documents.json
Original file line number Diff line number Diff line change
Expand Up @@ -9715,12 +9715,13 @@
"name": "Identity Card",
"has_back": true,
"code": "IDENTITY_CARD",
"example": [
"National IDs",
"Green Book",
"Consular IDs",
"Diplomat IDs"
]
"example": ["National IDs", "Consular IDs", "Diplomat IDs"]
},
{
"name": "Green Book",
"has_back": false,
"code": "IDENTITY_CARD",
"example": ["Green Book"]
},
{
"name": "Passport",
Expand Down
47 changes: 47 additions & 0 deletions packages/embed/cypress/pages/document-verification-za.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!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.usesmileid.com/api/v2/007/postback/update_status',
environment: 'sandbox',
id_selection: {
ZA: ['IDENTITY_CARD'],
},
partner_details: {
name: 'Test Org',
logo_url: 'https://portal.usesmileid.com/favicon.ico',
partner_id: '007',
policy_url: 'https://usesmileid.com/privacy-policy',
theme_color: '#000',
},
onSuccess: () => {},
onClose: () => {},
});
</script>
</body>
</html>
38 changes: 38 additions & 0 deletions packages/embed/cypress/tests/id-selection.cy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,44 @@ describe('Preselected Country', () => {
.should('contain', 'Bank Verification');
});

it('should have the correct country and id_types if IDENTITY CARD is pre-selected', () => {
cy.visit('/document-verification-za');

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.getIFrameBody().find('#country').should('contain', 'South Africa');

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

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

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

it('document_verification', () => {
cy.visit('/document-verification-pre-select-country');

Expand Down

0 comments on commit 6cdf4f0

Please sign in to comment.