-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
packages/web-components/cypress/e2e/smart-camera-web-agent-mode.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
context('SmartCameraWeb', () => { | ||
beforeEach(() => { | ||
cy.visit('/smart-camera-web-agent-mode'); | ||
}); | ||
it('should switch from the selfie mode to agent mode"', () => { | ||
cy.log('Enable agent mode for tests'); | ||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.invoke('attr', 'disable-for-tests', 'true'); | ||
|
||
cy.clock(); | ||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture-instructions') | ||
.shadow() | ||
.find('#allow') | ||
.click(); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.should('be.visible'); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.shadow() | ||
.should('contain.text', 'Agent Mode'); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.shadow() | ||
.find('#switch-camera') | ||
.click(); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.shadow() | ||
.should('contain.text', 'Selfie Mode'); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.shadow() | ||
.should('contain.text', 'Take a Selfie'); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.shadow() | ||
.find('#start-image-capture') | ||
.click(); | ||
|
||
cy.tick(8000); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture') | ||
.shadow() | ||
.should('not.be.visible'); | ||
|
||
cy.get('smart-camera-web') | ||
.shadow() | ||
.find('selfie-capture-review') | ||
.should('be.visible'); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
packages/web-components/cypress/pages/smart-camera-web-agent-mode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<style> | ||
*, | ||
*::before, | ||
*::after { | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
max-width: 100%; | ||
min-height: 100%; | ||
} | ||
|
||
smart-camera-web { | ||
margin-left: auto; | ||
margin-right: auto; | ||
max-width: 40ch; | ||
padding: 1rem; | ||
width: auto; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<smart-camera-web | ||
disable-image-tests | ||
allow-agent-mode="true" | ||
></smart-camera-web> | ||
|
||
<script src="./js/components/smart-camera-web/src/SmartCameraWeb.js"></script> | ||
<script> | ||
const app = document.querySelector('smart-camera-web'); | ||
app.addEventListener('smart-camera-web.published', async (e) => { | ||
console.log(e.detail); | ||
}); | ||
</script> | ||
</body> | ||
</html> |