Skip to content

Commit

Permalink
Playwright improvements (#3065)
Browse files Browse the repository at this point in the history
## Description

I've noticed that our `e2e` tests don't work anymore. Well.. they (almost) did, I've just wrongly assumed that you can open web on standard metro port `8081` like in our example app. The only thing that required fix was default port number.

Nevertheless, this made me look into our `e2e` app and it resulted in few changes:

- Bumped expo version
- Added `.gitignore`
- Changed scripts:
    - `yarn start` - now this script opens `web` bu default. Also it starts expo without opening browser
    - `yarn test` - it is easier to use this instead of `npx playwright test`
- Changed default port to `19006`

>[!WARNING]
>Previously tests on `webkit` (i.e. `safari`) didn't work. Now after upgrading browsers they do... but tests on `firefox` fail. From what I've found, it is because for some reason [Locator.innerText](https://github.com/software-mansion/react-native-gesture-handler/blob/52c00e486c0637fa03d80c25d09edfab367dda38/e2e/web-tests/utils.ts#L29) returns empty string. Adding timeout doesn't fix it, so it doesn't seem like race condition. Maybe it will be fixed with new `firefox` update.

## Test plan

Go to `e2e/web-tests` and run:

1. `yarn start`
2. `yarn test`
  • Loading branch information
m-bert authored Aug 26, 2024
1 parent 5b28dcb commit 1f08299
Show file tree
Hide file tree
Showing 4 changed files with 1,631 additions and 1,545 deletions.
2 changes: 2 additions & 0 deletions e2e/web-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
playwright-report
test-results
28 changes: 13 additions & 15 deletions e2e/web-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
"start": "BROWSER=none expo start --web",
"test": "npx playwright test"
},
"dependencies": {
"@expo/webpack-config": "19.0.0",
"expo": "^49.0.11",
"expo-status-bar": "~1.6.0",
"@expo/webpack-config": "~19.0.1",
"expo": "^51.0.30",
"expo-status-bar": "~1.12.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "^0.72.4",
"react-native-reanimated": "~3.3.0",
"react-native-web": "^0.19.9"
"react-native": "0.74.5",
"react-native-reanimated": "~3.10.1",
"react-native-web": "~0.19.10"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@playwright/test": "^1.27.1",
"@types/react": "~18.2.14",
"@types/react-dom": "~18.0.10",
"@babel/core": "^7.24.0",
"@playwright/test": "^1.46.1",
"@types/react": "~18.2.79",
"@types/react-dom": "~18.2.25",
"@types/react-native": "~0.69.1",
"typescript": "^5.1.3"
"typescript": "~5.3.3"
},
"private": true
}
2 changes: 1 addition & 1 deletion e2e/web-tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface GHEvent {
timeStamp: number;
}

export const DEFAULT_PORT = 19007;
export const DEFAULT_PORT = 19006;

export const DOUBLE_TAP_FAIL_TIMEOUT = 500;
export const LONG_PRESS_ACTIVATION_TIME = 500;
Expand Down
Loading

0 comments on commit 1f08299

Please sign in to comment.