diff --git a/cypress/e2e/skip-back-of-id.cy.js b/cypress/e2e/skip-back-of-id.cy.js new file mode 100644 index 00000000..74e81a3f --- /dev/null +++ b/cypress/e2e/skip-back-of-id.cy.js @@ -0,0 +1,163 @@ +context('SmartCameraWeb - Skip Back of ID Document Capture', () => { + beforeEach(() => { + cy.visit('/capture-back-of-id'); + }); + + context('when a document type does not exist', () => { + it('should switch from the back of ID entry screen to the thanks screen on clicking the "Skip this step" button', () => { + cy + .get('smart-camera-web') + .shadow() + .find('#request-camera-access') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#start-image-capture') + .click(); + + cy + .wait(8000); + + cy + .get('smart-camera-web') + .shadow() + .find('#select-selfie') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#id-entry-screen') + .should('be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#id-entry-screen #take-photo') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#id-entry-screen') + .should('not.be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#capture-id-image') + .click(); + + cy + .wait(2000); + + cy + .get('smart-camera-web') + .shadow() + .find('#select-id-image') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#back-of-id-entry-screen') + .should('be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#back-of-id-entry-screen #skip-this-step') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#back-of-id-entry-screen') + .should('not.be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#thanks-screen') + .should('be.visible'); + }); + }); + + context('when a document-type exists', () => { + beforeEach(() => { + cy + .get('smart-camera-web') + .invoke('attr', 'document-type', 'GREEN_BOOK'); + }); + + it('should not show the "skip this step" button', () => { + cy + .get('smart-camera-web') + .shadow() + .find('#request-camera-access') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#start-image-capture') + .click(); + + cy + .wait(8000); + + cy + .get('smart-camera-web') + .shadow() + .find('#select-selfie') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#id-entry-screen') + .should('be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#id-entry-screen #take-photo') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#id-entry-screen') + .should('not.be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#capture-id-image') + .click(); + + cy + .wait(2000); + + cy + .get('smart-camera-web') + .shadow() + .find('#select-id-image') + .click(); + + cy + .get('smart-camera-web') + .shadow() + .find('#back-of-id-entry-screen') + .should('be.visible'); + + cy + .get('smart-camera-web') + .shadow() + .find('#back-of-id-entry-screen #skip-this-step') + .should('not.exist'); + }); + }); +}); diff --git a/package-lock.json b/package-lock.json index f9f8eb69..3962e959 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@smile_identity/smart-camera-web", - "version": "1.0.0-beta.22", + "version": "1.0.0-beta.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@smile_identity/smart-camera-web", - "version": "1.0.0-beta.22", + "version": "1.0.0-beta.23", "license": "ISC", "dependencies": { "@cypress/code-coverage": "^3.11.0", diff --git a/package.json b/package.json index 393f67c2..d337d255 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@smile_identity/smart-camera-web", - "version": "1.0.0-beta.22", + "version": "1.0.0-beta.23", "description": "WebComponent for smartly capturing images on the web, for use with SmileIdentity", "main": "smart-camera-web.js", "scripts": { diff --git a/smart-camera-web.js b/smart-camera-web.js index 6a52a082..4522809a 100644 --- a/smart-camera-web.js +++ b/smart-camera-web.js @@ -1,4 +1,4 @@ -const VERSION = '1.0.0-beta.22'; +const VERSION = '1.0.0-beta.23'; const DEFAULT_NO_OF_LIVENESS_FRAMES = 8; const PORTRAIT_ID_PREVIEW_WIDTH = 396; const PORTRAIT_ID_PREVIEW_HEIGHT = 527; @@ -264,6 +264,7 @@ function scwTemplateString() { } .button[data-variant~='ghost'] { + padding: 0px; color: var(--button-color); background-color: transparent; } @@ -286,13 +287,19 @@ function scwTemplateString() { display: flex; justify-content: space-between; } + + .back-wrapper { + display: flex; + align-items: center; + } + .back-button { display: block !important; } .back-button-text { font-size: 11px; line-height: 11px; - color: #3886F7; + color: rgb(21, 31, 114); } .section { border: 1px solid #f4f4f4; @@ -604,16 +611,18 @@ function scwTemplateString() { ${this.hideBackToHost ? '' : `
Back
`} @@ -640,16 +649,18 @@ function scwTemplateString() { ${this.hideBackToHost ? '' : `
Back
`} @@ -688,8 +699,9 @@ function scwTemplateString() { ${this.showNavigation ? ` -
+
${this.supportBothCaptureModes || this.documentCaptureModes === 'camera' ? `
Back
@@ -881,8 +897,9 @@ function scwTemplateString() { ${this.showNavigation ? `