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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: add maestro e2e testing library #69

Merged
merged 41 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
16c34f1
feat: maestro added as dependency
olafch Jul 1, 2024
bd9fd99
feat: meastro up to Components
olafch Jul 1, 2024
b5a4918
feat: meastro up to Components
olafch Jul 1, 2024
dd9da62
feat: maestro up to profile added as individual tests
olafch Jul 2, 2024
8559a6c
chore: improving auth and home
olafch Jul 2, 2024
57b97f2
fix: icomoon not working, searching for a solution
olafch Jul 2, 2024
d23f2d4
fix: half of maestro docs redone
olafch Jul 3, 2024
ba61f02
feat: maestro working on whole app
olafch Jul 3, 2024
82ad7c1
chore: update maestro tests
MateuszRostkowski Aug 13, 2024
3d522f8
Merge remote-tracking branch 'origin/main' into feat/maestro-e2e-testing
MateuszRostkowski Aug 13, 2024
b55e6de
refactor: add test IDs to sign-in screen components
MateuszRostkowski Aug 13, 2024
2949555
refactor: add test IDs to home screen components
MateuszRostkowski Aug 13, 2024
e235557
chore: add maestro e2e debug output to gitignore
MateuszRostkowski Aug 13, 2024
1dfe2b5
refactor: add test IDs to BottomBar component
MateuszRostkowski Aug 13, 2024
925ac4f
fix: properly set spacings in checkbox group component
MateuszRostkowski Aug 13, 2024
b5d68ae
fix: properly set spacings in radio group component
MateuszRostkowski Aug 13, 2024
c8a91d7
chore: update gitignore to exclude e2e-debug-output
MateuszRostkowski Aug 13, 2024
2c95bfd
chore: update maestro tests
MateuszRostkowski Aug 13, 2024
5cb3ecc
chore: run generate:query script
MateuszRostkowski Aug 13, 2024
fa30f7e
fix: properly start profile and settings tests
MateuszRostkowski Aug 13, 2024
1a2ec65
refactor: Add test IDs to Input and Select components
MateuszRostkowski Aug 13, 2024
07cee80
refactor: Simplify Text component by removing unnecessary code
MateuszRostkowski Aug 13, 2024
312dcf4
chore: Update default values in useSignInForm for production build
MateuszRostkowski Aug 13, 2024
8da3021
chore: Update packages and scripts
MateuszRostkowski Aug 13, 2024
ae95969
refactor: Add testID prop to TabBarItemWrapper component
MateuszRostkowski Aug 13, 2024
6bd05a4
chore: update maestro tests
MateuszRostkowski Aug 14, 2024
cd05902
fix: make mocking server work again
MateuszRostkowski Aug 14, 2024
1150e73
refactor: Add testID prop to usePasswordValidation component
MateuszRostkowski Aug 14, 2024
06e1c3b
chore: Update start:e2e script to include IS_MOCK flag
MateuszRostkowski Aug 14, 2024
002c0c1
chore: Add E2E testing documentation
MateuszRostkowski Aug 14, 2024
75c950a
chore: Enable mocked server and suppress console errors and warnings
MateuszRostkowski Aug 14, 2024
d011811
docs: update Mocking tutorial
MateuszRostkowski Aug 14, 2024
72343a3
Merge remote-tracking branch 'origin/main' into feat/maestro-e2e-testing
MateuszRostkowski Aug 14, 2024
0d3f0dc
Merge branch 'feat/maestro-e2e-testing' into fix/maestro-e2e
MateuszRostkowski Aug 14, 2024
e8100e0
chore: Update Maestro E2E testing documentation and fix server startu…
MateuszRostkowski Aug 14, 2024
53ffba9
chore: Update Button component test snapshot
MateuszRostkowski Aug 16, 2024
30d2cda
Merge pull request #72 from binarapps/fix/maestro-e2e
MateuszRostkowski Aug 21, 2024
40aef83
feat: maestro e2e docs
olafch Aug 22, 2024
cb909a5
chore: Add Platform-specific accessibility fix for BottomSheet component
MateuszRostkowski Aug 22, 2024
7300945
chore: Update e2e testing documentation slug and ID
MateuszRostkowski Aug 22, 2024
c8a6f5c
chore: docs translated to ENG
olafch Aug 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ env.json
# baca-cli build
scripts/cli/build/
scripts/cli/temp/

# maestro
e2e-debug-output
55 changes: 55 additions & 0 deletions .maestro/auth/login-with-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
appId: ${APP_ID}
tags:
- auth
---
# Check if the login screen is visible
- assertVisible:
id: 'sign_in:title'
- assertVisible:
id: 'sign_in:sub_title'
- assertVisible:
id: 'sign_in:email_input:label'

# Check if empty email input is invalid
- tapOn:
id: 'sign_in:submit_button'
- assertVisible:
id: 'sign_in:email_input:error_message'
- assertVisible:
id: 'sign_in:password_input:error_message'

# Check if invalid email input and empty password is invalid
- tapOn:
id: 'sign_in:email_input:input'
- inputText: 'invalid-email'
- hideKeyboard
- tapOn:
id: 'sign_in:submit_button'
- assertVisible:
id: 'sign_in:email_input:error_message'
- assertVisible:
id: 'sign_in:password_input:error_message'

# Check if valid email input and empty password is invalid
- tapOn:
id: 'sign_in:email_input:input'
- eraseText
- inputText: 'email@test.com'
- hideKeyboard
- tapOn:
id: 'sign_in:submit_button'
- assertVisible:
id: 'sign_in:password_input:error_message'

# Check if valid email input and password is valid
- tapOn:
id: 'sign_in:password_input:input'
- eraseText
- inputText: 'password'
- hideKeyboard
- tapOn:
id: 'sign_in:submit_button'

# Check if login is successful
- assertVisible:
id: 'home_screen:title'
11 changes: 11 additions & 0 deletions .maestro/auth/logout-when-needed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
appId: ${APP_ID}
tags:
- auth
---
- stopApp
- openLink: exp://127.0.0.1:8081/--/sign-in
- runFlow:
when:
visible:
id: 'home_screen:title'
file: ../utils/logout.yaml
25 changes: 25 additions & 0 deletions .maestro/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
flows:
- 'auth/*'
- 'home/*'
- 'settings/*'
- 'profile/*'

includeTags:
- 'auth'
- 'home'
- 'settings'
- 'profile'

executionOrder:
continueOnFailure: false
flowsOrder:
- 'logout-when-needed'
- 'login-with-validation'
- 'details'
- 'full-screen-form'
- 'settings'
# https://github.com/mobile-dev-inc/maestro/issues/1484
# Wait for it to be resolved and then remove blog from the list
# blog is not implemented, it's just a placeholder, to make tests run
- 'blog'
- 'profile'
16 changes: 16 additions & 0 deletions .maestro/home/details.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
appId: ${APP_ID}
tags:
- home
---
- assertVisible:
id: 'home_screen:details'
- tapOn:
id: 'home_screen:details'
- extendedWaitUntil:
visible: 'Open BottomSheetModal'
timeout: 10000
- tapOn: 'Open BottomSheetModal'
- tapOn:
point: 50%,50%
- assertVisible: 'Home'
- tapOn: 'Home'
77 changes: 77 additions & 0 deletions .maestro/home/full-screen-form.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
appId: ${APP_ID}
tags:
- home
---
- assertVisible:
id: 'home_screen:full_screen_form'
- tapOn:
id: 'home_screen:full_screen_form'
- extendedWaitUntil:
visible: 'Contact data'
timeout: 10000
- assertVisible: 'Name* Name'
- tapOn: 'Name* Name'
- inputText: 'RandomName'
- assertVisible: 'Surname* Surname'
- tapOn: 'Surname* Surname'
- inputText: 'RandomSurname'
- assertVisible: 'E-mail* E-mail'
- tapOn: 'E-mail* E-mail'
- inputRandomEmail
- assertVisible: 'Phone number* Phone number'
- tapOn: 'Phone number* Phone number'
- inputText: '600-000-000'
- assertVisible: 'Postal code* Postal code'
- tapOn: 'Postal code* Postal code'
- inputText: '00-000'
- hideKeyboard
- assertVisible: 'City* City'
- tapOn: 'City* City'
- inputRandomText
- hideKeyboard
- assertVisible: 'Age* 18-30 31-40 41-50 51-60 61-70 71-80 81-90 91-100'
- tapOn: '18-30'
- scrollUntilVisible:
element:
text: 'what kind of music do you listen ?* Metal Heavy Metal Rock Pop Rap'
direction: DOWN
timeout: 15000
speed: 40
visibilityPercentage: 100
- assertVisible: 'Sex* Male Female'
- tapOn: 'Male'
- assertVisible: 'Education* Education '
- tapOn: 'Education* Education '
- assertVisible: 'Bottom sheet handle'
- tapOn:
point: 6%,91%
- assertVisible: 'Shoe size* Shoe size '
- tapOn: 'Shoe size* Shoe size '
- assertVisible: 'Bottom sheet handle'
- tapOn:
point: 6%,91%
- scrollUntilVisible:
element:
text: 'Additional comment'
direction: DOWN
timeout: 15000
speed: 40
visibilityPercentage: 100
- assertVisible: 'what kind of music do you listen ?* Metal Heavy Metal Rock Pop Rap'
- tapOn: 'Rock'
- tapOn: 'Pop'
- tapOn: 'Rap'
- scrollUntilVisible:
element:
text: 'Submit'
direction: DOWN
timeout: 15000
speed: 40
visibilityPercentage: 100
- assertVisible: 'Interests* IT Cooking Sport Games Dancing'
- tapOn: 'IT'
- tapOn: 'Sport'
- assertVisible: 'Submit'
- tapOn: 'Submit'
- assertVisible: '(tabs)'
- tapOn: '(tabs)'
36 changes: 36 additions & 0 deletions .maestro/profile/profile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
appId: ${APP_ID}
tags:
- profile
---
- tapOn:
id: 'bottom_tab_button:profile'
# TODO: Properly implement the profile flow

# CHANING USER DATA FLOW
# Change first name
# Change last name
# Save data
# Reload app
# Check if the changes are saved

# CHANGING PASSWORD FLOW
# Input old password
# Input new password

# Input wrong new password
# TODO: Finish the password flow
# - tapOn:
# id: 'passwordInput:input'
# - inputText: 'invalidpassword'
# - assertVisible:
# id: 'change_password:min_8_chars:success'
# - assertVisible:
# id: 'change_password:min_1_special_char:error'
# - tapOn:
# id: 'passwordInput:input'
# - inputText: 'invalidpassword!'
# - hideKeyboard
# - assertVisible:
# id: 'change_password:min_8_chars:success'
# - assertVisible:
# id: 'change_password:min_1_special_char:success'
14 changes: 14 additions & 0 deletions .maestro/settings/settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
appId: ${APP_ID}
tags:
- settings
---
- tapOn:
id: 'bottom_tab_button:settings'

# TODO: Check if after changing the theme it really changes
- assertVisible: 'light'
- tapOn: 'light'
- assertVisible: 'dark'
- tapOn: 'dark'
- assertVisible: 'system'
- tapOn: 'system'
15 changes: 15 additions & 0 deletions .maestro/utils/logout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
appId: ${APP_ID}
tags:
- util
---
- tapOn:
id: 'bottom_tab_button:settings'

- extendedWaitUntil:
visible:
id: 'settings:logout'
timeout: 1000
- tapOn:
id: 'settings:logout'
- assertVisible:
id: 'sign_in:title'
5 changes: 4 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import 'core-js/stable/atob'

// Rest imports
import '@baca/i18n'
import { isMock } from '@baca/constants'
import { enableAndroidBackgroundNotificationListener, startMockedServer } from '@baca/services'
import * as Device from 'expo-device'
import 'expo-router/entry'

const ENABLE_MOCKED_SERVER = false
const ENABLE_MOCKED_SERVER = isMock

if (ENABLE_MOCKED_SERVER) {
startMockedServer()
console.error = () => {}
console.warn = () => {}
}

// TODO: Uncomment reactotron setup when using
Expand Down
12 changes: 11 additions & 1 deletion docs/docs/data-management/MOCKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ Mocks are automatically generated with orval script - you can check [docs here](

## Enabling mocks

You have two types of enabling mocks in the app

1. Start server and set mock on start

```
IS_MOCK=true yarn start
```

2. Enable mock manually

Go to `App.tsx` and change `ENABLE_MOCKED_SERVER` variable from false to true

```tsx title="/App.tsx"
// FIXME: moking not working on mobile app - follow this discussion https://github.com/mswjs/msw/issues/2026
// error-line
const ENABLE_MOCKED_SERVER = false
const ENABLE_MOCKED_SERVER = isMock
// success-line
const ENABLE_MOCKED_SERVER = true

Expand Down
Loading
Loading