-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 📜 Description Added e2e-test 🤓 ## 💡 Motivation and Context E2E tests are needed to assure quality of the package. I decided to use detox for that (mainly because of the speed and familiarity with it). Also I added checks in CI. Everything is pretty standard for iOS. For Android I added API 28 + AOSP image (because test-butler works only with AOSP). I think later I'll try to integrate `google_apis` image, and maybe matrix strategy to test across different API versions. It was hard to test functionality of this library (because we don't have `toHaveStyle` matchers, but even if we had them it also would be difficult to test because of different keyboard sizes etc.). So I've decided to go with UI snapshot approach - I take a screenshot in certain cycle of test and compare it with original screenshot (thus I assure there is no visual regressions). Last but not least - all tests are written in TS 🤓 ## 📢 Changelog ### E2E - added detox for e2e testing; - added helpers; - added tests for `KeyboardAnimation`/`AwareScrollView`/`EnabledDisabled` ### CI - added e2e tests run on iOS; - added e2e tests run on Android; ### Example app #### JS - added `testID` for various elements; #### Android - updated `build.gradle`; ## 🤔 How Has This Been Tested? Tested locally and on CI. ## 📸 Screenshots (if appropriate): |Android|iOS| |--------|----| |<video src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/9a35a72b-2b6e-40c2-8661-9c796714df70">|<video src="https://github.com/kirillzyusko/react-native-keyboard-controller/assets/22820318/b45830ad-6ba1-49b7-82a7-9b86a61a0b85">| ## 📝 Checklist - [x] CI successfully passed
- Loading branch information
1 parent
d8a312d
commit 35d0ada
Showing
59 changed files
with
3,638 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: 🛠 Android e2e tests | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/android-e2e-test.yml' | ||
- 'package.json' | ||
- 'android/**' | ||
- 'example/**' | ||
- 'e2e/**' | ||
- 'src/**' | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: ⚙️ Automated test cases | ||
runs-on: macos-12 | ||
timeout-minutes: 60 | ||
env: | ||
WORKING_DIRECTORY: example | ||
concurrency: | ||
group: android-e2e-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
cache: 'yarn' | ||
- name: Setup JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'microsoft' | ||
java-version: '11' | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- name: Restore node_modules from cache | ||
uses: actions/cache@v3 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install root dependencies | ||
run: yarn install | ||
- name: Install node_modules for example/ | ||
run: yarn install --frozen-lockfile --cwd example | ||
- name: Install e2e dependencies | ||
run: yarn install --cwd e2e | ||
- name: Restore Gradle cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-e2e-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-e2e-gradle- | ||
- name: Build app | ||
working-directory: e2e | ||
run: yarn build-example:android | ||
- name: Run emulator and tests | ||
uses: reactivecircus/android-emulator-runner@v2.28.0 | ||
with: | ||
working-directory: e2e | ||
api-level: 28 | ||
target: default | ||
profile: pixel_2 | ||
ram-size: '4096M' | ||
disk-size: '10G' | ||
disable-animations: false | ||
avd-name: e2e_emulator | ||
arch: x86_64 | ||
script: yarn test-example:android | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: android-fail-screen-shoots | ||
path: e2e/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: 🛠 iOS e2e tests | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/ios-e2e-test.yml' | ||
- 'react-native-keyboard-controller.podspec' | ||
- 'package.json' | ||
- 'ios/**' | ||
- 'example/**' | ||
- 'e2e/**' | ||
- 'src/**' | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: ⚙️ Automated test cases | ||
runs-on: macos-12 | ||
timeout-minutes: 60 | ||
env: | ||
WORKING_DIRECTORY: example | ||
concurrency: | ||
group: ios-e2e-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
cache: 'yarn' | ||
- name: Get Xcode version | ||
run: xcodebuild -version | ||
- name: Install AppleSimulatorUtils | ||
run: brew tap wix/brew && brew install applesimutils | ||
- name: Install root dependencies | ||
run: yarn install | ||
- name: Install example project dependencies | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
run: yarn | ||
- name: Install e2e dependencies | ||
run: yarn install --cwd e2e | ||
- name: Restore buildcache | ||
uses: mikehardy/buildcache-action@v2 | ||
continue-on-error: true | ||
with: | ||
cache_key: react-native-keyboard-controller-e2e | ||
- name: Restore Pods cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
example/ios/Pods | ||
~/Library/Caches/CocoaPods | ||
~/.cocoapods | ||
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-pods- | ||
- name: Install pods | ||
working-directory: ${{ env.WORKING_DIRECTORY }}/ios | ||
run: pod install | ||
- name: Build app | ||
working-directory: e2e | ||
run: yarn build-example:ios | ||
- name: Use software keyboard | ||
run: defaults write com.apple.iphonesimulator ConnectHardwareKeyboard -bool NO | ||
- name: Test app | ||
working-directory: e2e | ||
run: yarn test-example:ios | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ failure() }} | ||
with: | ||
name: ios-fail-screen-shoots | ||
path: e2e/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.