-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,368 additions
and
210 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 |
---|---|---|
|
@@ -28,6 +28,7 @@ web/src/_e2e-test/screenshots | |
|
||
# mobile | ||
mobile/.expo | ||
mobile/artifacts | ||
|
||
# data | ||
data/nodemon.json |
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,57 @@ | ||
/** @type {Detox.DetoxConfig} */ | ||
module.exports = { | ||
logger: { | ||
level: process.env.CI ? "debug" : undefined, | ||
}, | ||
testRunner: { | ||
$0: "jest", | ||
args: { | ||
config: "src/_e2e-test/support/jest.config.js", | ||
_: ["src/_e2e-test"], | ||
}, | ||
}, | ||
artifacts: { | ||
plugins: { | ||
log: process.env.CI ? "failing" : undefined, | ||
screenshot: "failing", | ||
}, | ||
}, | ||
apps: { | ||
"ios.release": { | ||
type: "ios.app", | ||
build: | ||
"xcodebuild -workspace ios/eastestsexample.xcworkspace -scheme DzCodeio -configuration Release -sdk iphonesimulator -arch x86_64 -derivedDataPath ios/build", | ||
binaryPath: "ios/build/Build/Products/Release-iphonesimulator/DzCodeio.app", | ||
}, | ||
"android.release": { | ||
type: "android.apk", | ||
build: | ||
"cd android && ./gradlew :app:assembleRelease :app:assembleAndroidTest -DtestBuildType=release && cd ..", | ||
binaryPath: "android/app/build/outputs/apk/release/app-release.apk", | ||
}, | ||
}, | ||
devices: { | ||
simulator: { | ||
type: "ios.simulator", | ||
device: { | ||
type: "iPhone 14", | ||
}, | ||
}, | ||
emulator: { | ||
type: "android.emulator", | ||
device: { | ||
avdName: "pixel_4", | ||
}, | ||
}, | ||
}, | ||
configurations: { | ||
"ios.release": { | ||
device: "simulator", | ||
app: "ios.release", | ||
}, | ||
"android.release": { | ||
device: "emulator", | ||
app: "android.release", | ||
}, | ||
}, | ||
}; |
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,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
function cleanup() | ||
{ | ||
echo 'Cleaning up...' | ||
if [[ "$EAS_BUILD_PLATFORM" == "android" ]]; then | ||
# Kill emulator | ||
adb emu kill & | ||
fi | ||
} | ||
|
||
if [[ "$EAS_BUILD_PROFILE" != "test" ]]; then | ||
exit | ||
fi | ||
|
||
# Fail if anything errors | ||
set -eox pipefail | ||
# If this script exits, trap it first and clean up the emulator | ||
trap cleanup EXIT | ||
|
||
ANDROID_EMULATOR=pixel_4 | ||
|
||
if [[ "$EAS_BUILD_PLATFORM" == "android" ]]; then | ||
# Start emulator | ||
$ANDROID_SDK_ROOT/emulator/emulator @$ANDROID_EMULATOR -no-audio -no-boot-anim -no-window -use-system-libs 2>&1 >/dev/null & | ||
|
||
# Wait for emulator | ||
max_retry=10 | ||
counter=0 | ||
until adb shell getprop sys.boot_completed; do | ||
sleep 10 | ||
[[ counter -eq $max_retry ]] && echo "Failed to start the emulator!" && exit 1 | ||
counter=$((counter + 1)) | ||
done | ||
|
||
# Execute Android tests | ||
if [[ "$EAS_BUILD_PROFILE" == "test" ]]; then | ||
detox test --configuration android.release | ||
fi | ||
else | ||
# Execute iOS tests | ||
if [[ "$EAS_BUILD_PROFILE" == "test" ]]; then | ||
detox test --configuration ios.release | ||
fi | ||
fi |
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eox pipefail | ||
|
||
if [[ "$EAS_BUILD_RUNNER" == "eas-build" && "$EAS_BUILD_PROFILE" == "test"* ]]; then | ||
if [[ "$EAS_BUILD_PLATFORM" == "android" ]]; then | ||
sudo apt-get --quiet update --yes | ||
|
||
# Install emulator & video bridge dependencies | ||
# Source: https://github.com/react-native-community/docker-android/blob/master/Dockerfile | ||
sudo apt-get --quiet install --yes \ | ||
libc6 \ | ||
libdbus-1-3 \ | ||
libfontconfig1 \ | ||
libgcc1 \ | ||
libpulse0 \ | ||
libtinfo5 \ | ||
libx11-6 \ | ||
libxcb1 \ | ||
libxdamage1 \ | ||
libnss3 \ | ||
libxcomposite1 \ | ||
libxcursor1 \ | ||
libxi6 \ | ||
libxext6 \ | ||
libxfixes3 \ | ||
zlib1g \ | ||
libgl1 \ | ||
pulseaudio \ | ||
socat | ||
|
||
# Emulator must be API 31 -- API 32 and 33 fail due to https://github.com/wix/Detox/issues/3762 | ||
sdkmanager --install "system-images;android-31;google_apis;x86_64" | ||
avdmanager --verbose create avd --force --name "pixel_4" --device "pixel_4" --package "system-images;android-31;google_apis;x86_64" | ||
else | ||
brew tap wix/brew | ||
brew install applesimutils | ||
fi | ||
fi | ||
|
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 |
---|---|---|
|
@@ -13,27 +13,30 @@ | |
"@dzcode.io/utils": "*", | ||
"@sentry/react-native": "4.13.0", | ||
"debounce": "^1.2.1", | ||
"expo": "~48.0.9", | ||
"expo": "~48.0.10", | ||
"expo-application": "~5.1.1", | ||
"expo-constants": "~14.2.1", | ||
"expo-device": "~5.2.1", | ||
"expo-splash-screen": "~0.18.1", | ||
"expo-status-bar": "~1.4.4", | ||
"expo-updates": "~0.16.3", | ||
"react": "18.2.0", | ||
"react-native": "0.71.4", | ||
"react-native": "0.71.6", | ||
"react-redux": "^7.2.6", | ||
"redux": "^4.1.2", | ||
"redux-thunk": "^2.4.1", | ||
"sentry-expo": "~6.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.0", | ||
"@config-plugins/detox": "^5.0.1", | ||
"@dzcode.io/tooling": "*", | ||
"@expo/ngrok": "^4.1.0", | ||
"@types/debounce": "^1.2.0", | ||
"@types/react": "~18.0.14", | ||
"@types/react-test-renderer": "^18.0.0", | ||
"babel-plugin-transform-define": "^2.0.0", | ||
"detox": "^20.6.0", | ||
"eas-cli": "^3.8.1", | ||
"internal-ip": "^6.2.0", | ||
"jest-expo": "^48.0.2", | ||
|
@@ -58,6 +61,7 @@ | |
"repository": "https://github.com/dzcode-io/dzcode.io.git" | ||
}, | ||
"scripts": { | ||
"android": "expo run:android", | ||
"build": "lerna run build:alone [email protected]/mobile --include-dependencies --stream", | ||
"build:alone:watch": "tsc --watch --preserveWatchOutput", | ||
"build:android": "eas build -p android --no-wait --non-interactive", | ||
|
@@ -82,16 +86,20 @@ | |
"delete:screen": "rnhc delete -s", | ||
"deploy": "eas update --channel production --message \"update\" --non-interactive", | ||
"deploy:stg": "eas update --channel stage --message \"update\" --non-interactive", | ||
"eas-build-on-success": "./eas-hooks/eas-build-on-success.sh", | ||
"eas-build-post-install": "yarn build", | ||
"eas-build-pre-install": "./eas-hooks/eas-build-pre-install.sh", | ||
"generate:bundle-info": "ts-node ../packages/tooling/bundle-info.ts", | ||
"generate:sentry-release": "ts-node ../packages/tooling/sentry-release.ts mobile dist", | ||
"ios": "expo run:ios", | ||
"lint": "yarn build && yarn lint:alone", | ||
"lint:alone": "yarn lint:eslint . && yarn lint:prettier --check . && yarn lint:tsc", | ||
"lint:eslint": "eslint --config ../packages/tooling/.eslintrc.json --ignore-path ../packages/tooling/.eslintignore --report-unused-disable-directives", | ||
"lint:fix": "yarn build && yarn lint:fix:alone", | ||
"lint:fix:alone": "yarn lint:eslint --fix . && yarn lint:prettier --write .", | ||
"lint:prettier": "prettier --config ../packages/tooling/.prettierrc --ignore-path ../packages/tooling/.prettierignore --loglevel warn", | ||
"lint:tsc": "tsc --noEmit", | ||
"start": "expo start --dev-client", | ||
"start:dev": "echo \" \n\\033[0;32mPlease run in a separate terminal session the following command:\n \n\\033[0;32myarn --cwd=mobile start:expo\n \n \"", | ||
"start:expo": "expo start --port 1010", | ||
"test": "yarn build && yarn test:alone", | ||
|
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,12 @@ | ||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
rootDir: "../../../", | ||
testMatch: ["<rootDir>/src/_e2e-test/tests/**/*.test.ts"], | ||
testTimeout: 120000, | ||
maxWorkers: 1, | ||
globalSetup: "detox/runners/jest/globalSetup", | ||
globalTeardown: "detox/runners/jest/globalTeardown", | ||
reporters: ["detox/runners/jest/reporter"], | ||
testEnvironment: "detox/runners/jest/testEnvironment", | ||
verbose: true, | ||
}; |
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,15 @@ | ||
import { by, device, element, expect } from "detox"; | ||
|
||
describe("Contribute screen", () => { | ||
beforeAll(async () => { | ||
await device.launchApp(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await device.reloadReactNative(); | ||
}); | ||
|
||
it('"No contributions" view should be visible', async () => { | ||
await expect(element(by.id("no-contributions"))).toBeVisible(); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -27,3 +27,4 @@ nodemon.json | |
*.eslintignore | ||
*.ttf | ||
*.ts-prunerc | ||
*.sh |
Oops, something went wrong.