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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to write E2E tests for serverless applications? #629

janhesters opened this Issue Mar 15, 2019 · 2 comments


None yet
2 participants
Copy link

janhesters commented Mar 15, 2019

Hi Kent 馃憢馃徎

Serverless is a small but rapidly growing field. But because it's new, there isn't that much information out there. Since you are one of the loudest and most credible voices out there when it comes to testing, here is my question:

I'm building a serverless web app with React powered by AWS Amplify. I'm writing my E2E tests using Cypress. Up until now I only wrote container components and mocked the state. I wrote tests to ensure everything works fine.

Now I connected my containers with logic. I added auth and a GraphQL backend (amplify add auth & amplify add api). I now face two problems:

  1. The tests don't even start, because the user is logged out. In the cypress docs it says that going through the log-in steps using the UI is bad practice. You should instead make a direct request with credentials to log you in. So I looked at the network tabs when logging in and found out that Amplify makes 4 different requests to the cognito servers, none of which I understand (since the payload seems to be hashed). How would you automate login when using AWS Amplify with Auth, so that you do not have to go through the steps using the UI?
  2. Furthermore the docs say you should seed data, so that you control the state your application is in during the tests. How would you seed your data or control your state using AWS Amplify? I think it would be bad to constantly add or create resources during your tests, wouldn't it?

How would you write E2E tests for serverless applications?

Thank you very much 馃


This comment has been minimized.

Copy link

kentcdodds commented Mar 15, 2019

Hey @janhesters! Great question. I'll help with what I know: Episode 96


This comment has been minimized.

Copy link

janhesters commented Mar 16, 2019

@kentcdodds Thanks for answering! I will write shorter questions in the future so you will have it easier to read 馃

PS: The 'j' in Jan is pronounced as the 'y' in 'yes' and the 'a' is pronounced like the 'u' in 'bunny' 馃槈It's german 馃し鈥嶁檪锔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.