Skip to content
This repository has been archived by the owner. It is now read-only.

How to write E2E tests for serverless applications? #629

Closed
janhesters opened this issue Mar 15, 2019 · 2 comments
Closed

How to write E2E tests for serverless applications? #629

janhesters opened this issue Mar 15, 2019 · 2 comments

Comments

@janhesters
Copy link

@janhesters 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 馃

@kentcdodds
Copy link
Owner

@kentcdodds kentcdodds commented Mar 15, 2019

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

@janhesters
Copy link
Author

@janhesters 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants