4. REQUIREMENTS
„Fast, reliable UI tests
„Test should be used during development
„Tests should run and pass even if BE is down
„Tests should not require much maintenance
5. THE PROBLEMS WE HAD WITH E2E
„No Predictable Data
„Human review of Events
„UI tests are unstable
„Some daemons are running once in 2 minutes
7. THE RESULTS WE GOT
„Tests are finished in 73 seconds
„Tests are finding errors
„Tests help develop faster
8. MAIN FUNCTIONS OF UI
1. Send correct requests to BE
2. Calculate or prepare data using helper
functions or Redux
3. Correctly render information from BE
4. Respond to user interaction through Event
Listeners
14. TECHNOLOGY BASICS
Important to know about Redux:
„Manages global state for all the application
„Uses pure functions
„State is always immutable
„New state is created using Actions
40. HOW TO TEST
Async Action Creators testing steps:
„Mock Store
„Mock Fetch/Async action
„Dispatch Action
„Check what Actions were emitted
„Check how fetch was called
41. HOW TO TEST
Use async to make your tests asynchronous in
order to test requests that are being sent
54. HOW TO TEST
Steps to test Reducer
„Mock all the needed parts of state
„Prepare resulting state for each action
„Call reducer with mocked state
„Check the result
65. HOW TO TEST
Steps to test Component
„Use render to render component
„Use getByTestId or getByText to locate elements
„ Use fireEvent to interact with elements