Skip to content

feat: Detox simulator test runner #590

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

Merged
merged 34 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
20031a9
Added detox tests for ios.
Chriztiaan May 7, 2025
a0ba3b0
Merge branch 'main' into op-sqlite-tests
Chriztiaan May 7, 2025
9047ac1
Fixing Android test suite. Prepping for Github workflow.
Chriztiaan May 7, 2025
021746b
Testing Android emulator.
Chriztiaan May 8, 2025
decad66
Fixing detox setup.
Chriztiaan May 8, 2025
25354f5
typo
Chriztiaan May 8, 2025
5a1a8fd
Added tests pnpm android working directory
Chriztiaan May 8, 2025
01c0967
Specifying avd name to workflow avd name.
Chriztiaan May 8, 2025
41705fe
Slightly more lenient test timeout.
Chriztiaan May 12, 2025
063a59f
Cleanup readme, removed prettier config. Applying prettier formatting…
Chriztiaan May 12, 2025
ae54fd4
Updated readme.
Chriztiaan May 12, 2025
0377d5f
Merged simulator/emulator tests into single workflow file.
Chriztiaan May 12, 2025
ceae348
Rejecting pending read/write operations when the database is closed f…
Chriztiaan May 12, 2025
fb97273
Merge branch 'main' into op-sqlite-tests
Chriztiaan May 12, 2025
d58eecf
Fixed typo in workflow.
Chriztiaan May 12, 2025
fd87b12
Typos.
Chriztiaan May 12, 2025
979d0a4
Added comlink to include list to stabilize web tests.
Chriztiaan May 12, 2025
a56e8c0
Revert lock file.
Chriztiaan May 12, 2025
e86c48d
Fewer executions in writeLock test.
Chriztiaan May 12, 2025
e70b962
Caching derived data for iOS build.
Chriztiaan May 15, 2025
a3ea29b
Make closing OPSQlite adapter async
stevensJourney May 19, 2025
b98a193
Add `await` to close test. Test CI command optimisation.
stevensJourney May 19, 2025
1924c86
Switching to new gradle action. Added changeset for close change.
Chriztiaan May 19, 2025
b7f80f5
Merge branch 'op-sqlite-tests' of github.com:powersync-ja/powersync-j…
Chriztiaan May 19, 2025
6e70eb7
Merge branch 'main' into op-sqlite-tests
Chriztiaan May 19, 2025
a028764
Referring to runner tool's Derived data location.
Chriztiaan May 22, 2025
50ba5e9
Different DerivedData location.
Chriztiaan May 22, 2025
4ca417c
Merge branch 'main' into op-sqlite-tests
Chriztiaan May 26, 2025
b79b970
Only running sim/emu tests if there are changes made to common or pow…
Chriztiaan May 26, 2025
5fecdd3
Added `await db.init()` call.
Chriztiaan May 26, 2025
2852194
Trying to cache derived data for iOS again.
Chriztiaan May 27, 2025
35ec382
Merge branch 'main' into op-sqlite-tests
Chriztiaan May 28, 2025
be0069d
Longer waiting indicator timeout for tests to finish.
Chriztiaan May 28, 2025
c38064c
Merge branch 'op-sqlite-tests' of github.com:powersync-ja/powersync-j…
Chriztiaan May 28, 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
72 changes: 72 additions & 0 deletions .github/workflows/test-simulators.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Ensures certain packages work on simulators
name: Test Simulators

on:
push:

jobs:
test:
name: Test Simulators
runs-on: macOS-15

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: CocoaPods Cache
uses: actions/cache@v3
id: cocoapods-cache
with:
path: |
tools/powersynctests/ios/Pods/*
key: ${{ runner.os }}-${{ hashFiles('tools/powersynctests/ios/Podfile.lock') }}

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build:packages

- name: Install Detox dependencies
run: |
brew tap wix/brew
brew install applesimutils
npm install -g detox-cli
detox clean-framework-cache && detox build-framework-cache

- name: Install CocoaPods dependencies
working-directory: tools/powersynctests/ios
run: pod install

- name: iOS Simulator Build
working-directory: ./tools/powersynctests
run: pnpx detox build --configuration ios.sim.release

- name: iOS Simulator Test
working-directory: ./tools/powersynctests
run: pnpx detox test --configuration ios.sim.release --cleanup
3,269 changes: 2,541 additions & 728 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tools/powersynctests/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
87 changes: 87 additions & 0 deletions tools/powersynctests/.detoxrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/** @type {Detox.DetoxConfig} */
module.exports = {
testRunner: {
args: {
$0: 'jest',
config: 'e2e/jest.config.js',
},
jest: {
setupTimeout: 120000,
},
},
apps: {
'ios.debug': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Debug-iphonesimulator/powersynctests.app',
build:
'xcodebuild -workspace ios/powersynctests.xcworkspace -scheme powersynctests -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
},
'ios.release': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/powersynctests.app',
build:
'xcodebuild -workspace ios/powersynctests.xcworkspace -scheme powersynctests -configuration Release -sdk iphonesimulator -derivedDataPath ios/build',
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
build:
'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
reversePorts: [8081],
},
'android.release': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
build:
'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release',
},
},
devices: {
simulator: {
type: 'ios.simulator',
device: {
type: 'iPhone 16',
},
},
attached: {
type: 'android.attached',
device: {
adbName: '.*',
},
},
emulator: {
type: 'android.emulator',
device: {
avdName: 'Pixel_3a_API_30_x86',
},
},
},
configurations: {
'ios.sim.debug': {
device: 'simulator',
app: 'ios.debug',
},
'ios.sim.release': {
device: 'simulator',
app: 'ios.release',
},
'android.att.debug': {
device: 'attached',
app: 'android.debug',
},
'android.att.release': {
device: 'attached',
app: 'android.release',
},
'android.emu.debug': {
device: 'emulator',
app: 'android.debug',
},
'android.emu.release': {
device: 'emulator',
app: 'android.release',
},
},
};
4 changes: 4 additions & 0 deletions tools/powersynctests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};
75 changes: 75 additions & 0 deletions tools/powersynctests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
**/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore
.kotlin/

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
**/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
7 changes: 7 additions & 0 deletions tools/powersynctests/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions tools/powersynctests/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 10 additions & 0 deletions tools/powersynctests/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'
109 changes: 109 additions & 0 deletions tools/powersynctests/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.7.10)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.3.3)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.17.1)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.9.0)
mutex_m
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.7.6)
minitest (5.25.4)
molinillo (0.8.0)
mutex_m (0.3.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.4.1)
ruby-macho (2.5.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.25.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (>= 3.3.6, < 4.0)
zeitwerk (2.6.18)

PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
concurrent-ruby (< 1.3.4)
xcodeproj (< 1.26.0)

RUBY VERSION
ruby 2.6.10p210

BUNDLED WITH
1.17.2
Loading