cypress can't select authenticator inputs for @aws-amplify/ui-react
See original GitHub issueDescribe the bug cypress can’t select authenticator input in @aws-amplify/ui-react
To Reproduce Steps to reproduce the behavior:
- add amplify auth to a react app
- add amplify auth and cypress
- write simple test on authenticator, eg. login
Expected behavior
selectors in this blog can select right inputs,but it’s legacy amplify-ui-react …
export const selectors = {
// Auth component classes
usernameInput: '[data-test="username-input"]',
signInPasswordInput: '[data-test="sign-in-password-input"]',
signInSignInButton: '[data-test="sign-in-sign-in-button"]',
signOutButton: '[data-test="sign-out-button"]'
}
tried selectors on chrome developer tools console, it does not work
** Screenshots **
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Amazon Cognito Authentication - Cypress Documentation
What you'll learn Log in to Amazon Cognito through the UI with cy.origin() Programmatically authenticate with Amazon Cognito via a custom Cypress command....
Read more >How can I test AWS Amplify Angular Authenticator component ...
I want to be able to "type" testing input into the AWS Amplify Authenticator component (amplify-authenticator) in a cypress test like this:
Read more >Use Cypress to test AWS Amplify Apps with Authentication
Use Cypress to test AWS Amplify Apps with Authentication · We use the amplify Auth class to create a session for our user....
Read more >Amplify continuous integration/deployment with end-to-end tests
A tutorial for building and deploying an amplify app with cypress tests built into the deployment pipeline.
Read more >AWS Amplify: code lint & end-to-end testing with Cypress
The web application I created with AWS Amplify includes a React ... the AWS Amplify Cognito authentication backend and its UI components.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Cypress
5.2.0
added the configuration option includeShadowDom for enabling shadow DOM.In
cypress.json
setThen in your test select for example the login input field:
cy.get('[data-test="sign-in-username-input"]').first().type("DUMMY_USERNAME");
This works, not sure why the
first()
is necessary though.Hey @dfang, Cypress does now support shadow dom in their Experiments section
Could you try using this and report back?