Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3db00d8
fix(plugin-utils): prevent YAML errors caused by inconsistent indenta…
piotrski Mar 20, 2025
f65a60f
feat: add end-to-end test flows for Android and iOS in Expo example
piotrski Mar 19, 2025
788ae72
chore: add GH workflows
piotrski Mar 19, 2025
c4abb8d
fix: remove expo cli install
piotrski Mar 19, 2025
eb49786
chore: add new e2e setup
piotrski Mar 19, 2025
34ec9ad
fix: remove working directory specification from Android e2e test wor…
piotrski Mar 19, 2025
8172b5c
chore: will this work?
piotrski Mar 19, 2025
89ed528
chore: update iOS E2E test workflow to enable push and pull request t…
piotrski Mar 20, 2025
a472d5c
fix: wait for Metro to bundle the App
piotrski Mar 20, 2025
ca6dc93
fix: remove debug steps
piotrski Mar 20, 2025
6377c2a
chore: simplify e2e workflow
piotrski Mar 24, 2025
2d2eae4
chore: add EXPO_TOKEN env var
piotrski Mar 24, 2025
36a85c7
chore: update Android E2E workflow
piotrski Mar 24, 2025
e8c70bd
chore: enhance iOS E2E workflow to capture build output and improve i…
piotrski Mar 24, 2025
90fd85e
chore: refine android e2e workflow
piotrski Mar 24, 2025
af13864
chore: remove broken E2E test workflows for Expo
piotrski Mar 24, 2025
61b428c
chore: add RNEF configuration
piotrski Mar 24, 2025
573afdf
chore: add E2E test workflow for bare example with Android and iOS co…
piotrski Mar 24, 2025
cec8d98
fix: forgot to commit lockfile
piotrski Mar 24, 2025
0888e11
chore: remove cache-dependency-path from e2e workflow for bare example
piotrski Mar 25, 2025
e2dd840
chore: remove bare example e2e test workflow (until gh action got fixed)
piotrski Mar 25, 2025
3b12831
chore: add Expo e2e test workflow
piotrski Mar 25, 2025
26f475e
chore: enhance Android emulator setup and Maestro install
piotrski Mar 25, 2025
490a6b5
chore: fix android emulator
piotrski Mar 25, 2025
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
5 changes: 5 additions & 0 deletions .changeset/lazy-pugs-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-native-legal': patch
---

Fixes an issue where licenses with unusual indentation caused YAML errors, breaking the LicencePlist script during the build. This ensures proper processing and prevents build failures.
127 changes: 127 additions & 0 deletions .github/workflows/expo-example-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Expo Example E2E Tests

on:
push:
branches: [main]
paths:
- 'packages/react-native-legal/**'
- 'examples/expo-example/**'
- '.github/workflows/expo-example-e2e.yml'
pull_request:
paths:
- 'packages/react-native-legal/**'
- 'examples/expo-example/**'
- '.github/workflows/expo-example-e2e.yml'

jobs:
android-e2e:
name: Android E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 45
defaults:
run:
working-directory: examples/expo-example
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Prebuild
run: yarn expo prebuild --platform android

- name: Build Android
run: |
cd android && ./gradlew assembleRelease || {
echo "Error: Failed to build Android app"
exit 1
}

- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
source $HOME/.bash_profile
maestro --version

- name: Run Android E2E tests
uses: reactivecircus/android-emulator-runner@v2
with:
profile: pixel_7
api-level: 34
target: google_apis
arch: x86_64
disable-animations: true
script: |
adb install -r android/app/build/outputs/apk/release/app-release.apk || {
echo "Error: Failed to install Android APK"
exit 1
}
yarn test:e2e:android

ios-e2e:
name: iOS E2E Tests
runs-on: macos-latest
timeout-minutes: 45
defaults:
run:
working-directory: examples/expo-example
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Prebuild
run: yarn expo prebuild --platform ios

- name: Setup iOS Simulator
uses: futureware-tech/simulator-action@v2
with:
model: 'iPhone 15'

- name: Build iOS
run: |
xcodebuild -workspace ios/ReactNativeLegalExpoExample.xcworkspace \
-scheme ReactNativeLegalExpoExample \
-sdk iphonesimulator \
-configuration Release \
-derivedDataPath build || {
echo "Error: Failed to build iOS app"
exit 1
}

- name: Install iOS app
run: |
xcrun simctl install booted ./build/Build/Products/Release-iphonesimulator/ReactNativeLegalExpoExample.app || {
echo "Error: Failed to install iOS app"
exit 1
}

- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
source $HOME/.bash_profile
maestro --version

- name: Run iOS E2E tests
run: yarn test:e2e:ios
3 changes: 3 additions & 0 deletions examples/bare-example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ yarn-error.log

# testing
/coverage

# RNEF
.rnef/
2 changes: 1 addition & 1 deletion examples/bare-example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const BUTTON_RIPPLE_COLOR = '#8232ffba';

export default function App() {
function launchNotice() {
ReactNativeLegal.launchLicenseListScreen('OSS Notice');
ReactNativeLegal.launchLicenseListScreen('Licences');
}

return (
Expand Down
45 changes: 45 additions & 0 deletions examples/bare-example/e2e/android-flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
appId: com.reactnativelegalbareexample
---
# Launch the app fresh to avoid cached state
- launchApp:
clearState: true

# Wait for the app to be ready
- extendedWaitUntil:
visible: "Tap to see list of OSS libraries"
timeout: 30000

# Open the OSS libraries list
- tapOn: "Tap to see list of OSS libraries"
- assertVisible: "Licences"

# Scroll to find "react-native-legal"
- scrollUntilVisible:
centerElement: true
element:
text: "react-native-legal"
direction: DOWN
speed: 75
timeout: 100000

# Verify contributor information
- assertVisible: "Mateusz Mędrek <luigimario1913@gmail.com> (https://github.com/mateusz1913)"

# Open license details
- tapOn:
text: "MIT License"
below: "react-native-legal"


# Verify MIT license text is displayed
- assertVisible: ".*MIT License.*"
- assertVisible: ".*Permission is hereby granted.*"
- assertVisible: ".*THE SOFTWARE IS PROVIDED \"AS IS\".*"

# Navigate back to the list
- back
- assertVisible: "Licences"

# Navigate back to home screen
- back
- assertVisible: "Tap to see list of OSS libraries"
52 changes: 52 additions & 0 deletions examples/bare-example/e2e/ios-flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
appId: org.reactjs.native.example.ReactNativeLegalBareExample
---
# Launch the app fresh to avoid cached state
- launchApp:
clearState: true

# Wait for the app to be ready
- extendedWaitUntil:
visible: "Tap to see list of OSS libraries"
timeout: 30000

# Open the OSS libraries list
- tapOn: "Tap to see list of OSS libraries"
- assertVisible: "Licences"

# Scroll to find "react-native-legal"
- scrollUntilVisible:
element:
text: "react-native-legal"
direction: DOWN
speed: 100

# Open license details
- tapOn: "react-native-legal"

# Verify MIT license text is displayed
- assertVisible: "MIT"

# Navigate back to the list
- tapOn: "Licences"
- assertVisible: "Licences"

# Test React-Core license
- scrollUntilVisible:
element: "React-Core"
direction: DOWN
speed: 100

# Open license details
- tapOn: "React-Core"

# Verify React-Core license text is displayed
- assertVisible: "Copyright (c) Meta Platforms, Inc. and affiliates."

# Navigate back to the list
- tapOn: "Licences"
- assertVisible: "Licences"

# Navigate back to home screen
- tapOn:
id: "UICloseButtonBackground"
- assertVisible: "Tap to see list of OSS libraries"
2 changes: 1 addition & 1 deletion examples/bare-example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if linkage != nil
end

target 'ReactNativeLegalBareExample' do
config = use_native_modules!
config = use_native_modules!(['npx', 'rnef', 'config', '-p', 'ios'])

use_react_native!(
:path => config[:reactNativePath],
Expand Down
6 changes: 3 additions & 3 deletions examples/bare-example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ PODS:
- React-logger (= 0.76.7)
- React-perflogger (= 0.76.7)
- React-utils (= 0.76.7)
- ReactNativeLegal (1.0.0):
- ReactNativeLegal (1.1.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1803,10 +1803,10 @@ SPEC CHECKSUMS:
React-utils: 9f9a6a31d703b136eb1614d914c10a3c96b1e6dd
ReactCodegen: 5d7e2d2948a6629a51a59ebc99f620e2afb13ee5
ReactCommon: 04292c6f596181ebf755e7929d96d2148542b0e8
ReactNativeLegal: 3514fb143867dc60703a0a04af5d9c200c8ae83f
ReactNativeLegal: 9ef07788333fd105354eeafd6892a29e52cfaae0
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 90d80701b27946c4b23461c00a7207f300a6ff71

PODFILE CHECKSUM: d8cf13800dea3fa1eb0928883853c6b37979b1d5
PODFILE CHECKSUM: 281ef88fa74b8505eb17a64f6c9548afb72d4104

COCOAPODS: 1.15.2
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "set -e\n\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\nsource \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\nsource \"$PODS_ROOT/../.xcode.env.local\"\nfi\nexport CONFIG_CMD=\"dummy-workaround-value\"\nexport CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@rnef/cli/package.json')) + '/dist/src/bin.js'\")\"\n\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
11 changes: 9 additions & 2 deletions examples/bare-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"lint": "eslint .",
"start": "react-native start --config ./metro.config.js",
"test": "jest",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"test:e2e:ios": "maestro test ./e2e/ios-flow.yaml",
"test:e2e:android": "maestro test ./e2e/android-flow.yaml",
"test:e2e": "yarn test:e2e:ios && yarn test:e2e:android"
},
"dependencies": {
"react": "18.3.1",
Expand All @@ -25,6 +28,10 @@
"@react-native/babel-preset": "0.76.7",
"@react-native/metro-config": "0.76.7",
"@react-native/typescript-config": "0.76.7",
"@rnef/cli": "^0.4.1",
"@rnef/platform-android": "^0.4.1",
"@rnef/platform-ios": "^0.4.1",
"@rnef/plugin-metro": "^0.4.1",
"@types/react": "~18.3.12",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
Expand All @@ -34,4 +41,4 @@
"engines": {
"node": ">=18"
}
}
}
12 changes: 12 additions & 0 deletions examples/bare-example/rnef.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { platformAndroid } from '@rnef/platform-android';
import { platformIOS } from '@rnef/platform-ios';
import { pluginMetro } from '@rnef/plugin-metro';

export default {
bundler: pluginMetro(),
platforms: {
ios: platformIOS(),
android: platformAndroid(),
},
remoteCacheProvider: 'github-actions',
};
1 change: 1 addition & 0 deletions examples/expo-example/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.17.0
2 changes: 1 addition & 1 deletion examples/expo-example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BUTTON_RIPPLE_COLOR = '#8232ffba';

export default function App() {
function launchNotice() {
ReactNativeLegal.launchLicenseListScreen('OSS Notice');
ReactNativeLegal.launchLicenseListScreen('Licences');
}

return (
Expand Down
13 changes: 11 additions & 2 deletions examples/expo-example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.reactnativelegal.expoexample"
"bundleIdentifier": "com.reactnativelegal.expoexample",
"infoPlist": {
"ITSAppUsesNonExemptEncryption": false
}
},
"android": {
"adaptiveIcon": {
Expand All @@ -42,6 +45,12 @@
}
],
"react-native-legal"
]
],
"extra": {
"eas": {
"projectId": "58a16ff5-f983-4966-9d2f-9ba2b653b081"
}
},
"owner": "piotrski"
}
}
Loading
Loading