Commit df79658e authored by Yogev Ben David's avatar Yogev Ben David Committed by GitHub

Merge pull request #351 from wix/ciUnitTests

Migration to circleCI
parents 1c76cc72 a6fa3809
version: 2
jobs:
build:
macos:
xcode: "10.2.1"
steps:
- checkout
- run:
name: Install Dependencies
command: scripts/install.ios.sh
- run:
name: Install Android
command: scripts/install.android.sh
- run:
name: npm install
command: npm install
- run:
name: iOS unit tests
command: 'npm run test-unit-ios'
- run:
name: Android unit tests
command: 'npm run test-unit-android'
- run:
name: Detox iOS e2e tests
command: 'npm run test-e2e-ios-release'
\ No newline at end of file
language: node_js
osx_image: xcode10.1
node_js:
- "10"
# React Native Notifications [![Build Status](https://travis-ci.org/wix/react-native-notifications.svg)](https://travis-ci.org/wix/react-native-notifications)
# React Native Notifications [![CircleCI](https://circleci.com/gh/wix/react-native-notifications/tree/master.svg?style=svg)](https://circleci.com/gh/wix/react-native-notifications/tree/master)
Handle all the aspects of push notifications for your app, including remote and local notifications, interactive notifications, silent notifications, and more.
......
const Utils = require('./Utils');
const { elementByLabel } = Utils;
const {elementByLabel} = Utils;
describe('Notifications', () => {
describe('Foreground', () => {
beforeEach(async () => {
await device.relaunchApp({permissions: {notifications: 'YES'}});
await device.relaunchApp({delete: true, permissions: {notifications: 'YES'}});
});
it('Receive notification', async () => {
describe('Foreground', () => {
it('Should receive notification', async () => {
await device.sendUserNotification(createNotification({link: 'foreground/notification'}));
await expect(elementByLabel('foreground/notification')).toBeVisible();
});
it('Click notification', async () => {
it('Should open notification', async () => {
await device.sendUserNotification(createNotification({link: 'foreground/notification/click', showAlert: true}));
await expect(elementByLabel('Notification Clicked: foreground/notification/click')).toBeVisible();
});
});
describe('Background', () => {
beforeEach(async () => {
await device.launchApp({newInstance: true, permissions: {notifications: 'YES'}});
});
it('Receive notification', async () => {
device.sendToHome();
await expect(elementByLabel('background/notification')).toBeNotVisible();
device.launchApp({newInstance: false, userNotification: createNotification({link: 'background/notification'})});
await expect(elementByLabel('background/notification')).toBeVisible();
it('Should open notification', async () => {
await device.sendToHome();
await expect(elementByLabel('Notification Clicked: background/notification')).toBeNotVisible();
await device.launchApp({newInstance: false, userNotification: createNotification({link: 'background/notification'})});
await expect(elementByLabel('Notification Clicked: background/notification')).toBeVisible();
});
});
describe('Dead state', () => {
it('Receive notification', async () => {
it('Should receive notification', async () => {
await device.launchApp({newInstance: true, userNotification: createNotification({link: 'deadState/notification'})});
await expect(elementByLabel('deadState/notification')).toBeVisible();
});
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3D3C04B91DE3340900C268FA"
BuildableName = "libyoga.a"
BlueprintName = "yoga"
ReferencedContainer = "container:../../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../../node_modules/react-native/React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "NotificationsExampleApp.app"
BlueprintName = "NotificationsExampleApp"
ReferencedContainer = "container:NotificationsExampleApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "NotificationsExampleApp.app"
BlueprintName = "NotificationsExampleApp"
ReferencedContainer = "container:NotificationsExampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "NotificationsExampleApp.app"
BlueprintName = "NotificationsExampleApp"
ReferencedContainer = "container:NotificationsExampleApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "NotificationsExampleApp.app"
BlueprintName = "NotificationsExampleApp"
ReferencedContainer = "container:NotificationsExampleApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
......@@ -22,9 +22,10 @@
"main": "lib/src/index",
"scripts": {
"pretest": "./node_modules/.bin/eslint *.js test",
"test": "jest",
"test": "node scripts/test",
"start": "node ./scripts/start",
"test-e2e-ios": "node ./scripts/test-e2e --ios",
"test-e2e-ios-release": "node ./scripts/test-e2e --ios --release",
"test-unit-ios": "node ./scripts/test-unit --ios",
"test-unit-android": "node ./scripts/test-unit --android",
"test-js": "node ./scripts/test-js"
......@@ -92,8 +93,8 @@
"name": "iPhone X"
},
"ios.sim.release": {
"binaryPath": "playground/ios/DerivedData/playground/Build/Products/Release-iphonesimulator/playground.app",
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground_release -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Release -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO",
"binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Release-iphonesimulator/NotificationsExampleApp.app",
"build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp_release -project example/ios/NotificationsExampleApp.xcodeproj -sdk iphonesimulator -configuration Release -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO",
"type": "ios.simulator",
"name": "iPhone X"
}
......
#!/bin/bash -e
echo node -v $(node -v)
$(dirname "$0")/install.sh
if [ -z "$ZZ_BITRISE" ]; then
ANDROID_API=28
ANDROID_HOME="/usr/local/share/android-sdk"
echo "export ANDROID_API=${ANDROID_API}" >> $BASH_ENV
echo "export ANDROID_HOME=${ANDROID_HOME}" >> $BASH_ENV
cat $BASH_ENV
# jdk
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew untap adoptopenjdk/openjdk
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew cask install adoptopenjdk8
export PATH="$PATH:$ANDROID_HOME/tools/bin"
# set variables
ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip"
TMP_DIR=$(mktemp -d)
# download and install sdk
cd "$TMP_DIR"
curl "$ANDROID_SDK_URL" > "sdk.zip"
unzip "sdk.zip" -d "$ANDROID_HOME"
# install what you need
yes | sdkmanager --licenses || :
echo y | sdkmanager "platforms;android-${ANDROID_API}"
echo y | sdkmanager "platform-tools"
echo y | sdkmanager "build-tools;28.0.3"
echo y | sdkmanager "extras;android;m2repository"
echo y | sdkmanager "extras;google;m2repository"
echo y | sdkmanager "system-images;android-${ANDROID_API};google_apis;x86_64"
echo y | sdkmanager "extras;intel;Hardware_Accelerated_Execution_Manager"
echo y | sdkmanager "extras;google;google_play_services"
echo no | avdmanager create avd --force --name Nexus_5X_API_${ANDROID_API} --abi x86_64 --device "Nexus 5X" -k "system-images;android-${ANDROID_API};google_apis;x86_64"
fi
\ No newline at end of file
#!/bin/bash -e
$(dirname "$0")/install.sh
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install ruby
export PATH="/usr/local/opt/ruby/bin:$PATH"
gem install xcpretty
export CODE_SIGNING_REQUIRED=NO
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew
HOMEBREW_NO_INSTALL_CLEANUP=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils
echo 'export PATH=$PATH' >> $BASH_ENV
\ No newline at end of file
#!/bin/bash -e
npm install -g react-native-cli
npm install -g detox-cli
git submodule update --init --recursive
const exec = require('shell-utils').exec;
run();
function run() {
exec.execSync(`jest`);
exec.execSync(`npm run test-unit-ios`);
exec.execSync(`npm run test-unit-android`);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment