Skip to content

Commit

Permalink
Merge branch 'develop' into ts-yarn-scripts
Browse files Browse the repository at this point in the history
* develop:
  Dutch translation (#590)
  FR locale update (#591)
  Fix incorrect intersect function import (#575)
  Add e2e test + screenshots for iPhone SE (#586)
  Translate platform (iOS, Android) strings (#578)
  Improve Google Location Data import experience (#410)
  Fix intersect to handle multiple authorities (#529)
  update italian localization (#576)
  [iOS] End to end tests w/ Detox (#567)
  Add a debug mode for intersections (#437)
  Romanian Translation (#545)
  Making COVID-19 consistent on all screens (#565)
  Update iOS splash text to "Safe Paths" (#562)
  Update android splash text to "Safe Paths" (#560)
  • Loading branch information
tstirrat committed Apr 20, 2020
2 parents 3d53852 + 41b6c65 commit 20a135d
Show file tree
Hide file tree
Showing 95 changed files with 3,344 additions and 653 deletions.
68 changes: 68 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:jest/recommended',
],
parser: 'babel-eslint',
plugins: ['react', 'react-native', 'detox'],
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
modules: true,
},
},
env: {
commonjs: true,
es6: true,
'react-native/react-native': true,
'detox/detox': true,
node: true,
jest: true,
'jest/globals': true,
mocha: true,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// 0 is for off, 1 is for warning, 2 is for error
'eol-last': 2, // Require file to end with single newline
'no-constant-condition': 2, // Disallow use of constant expressions in conditions
'no-dupe-keys': 2, // Disallow Duplicate Keys
'no-empty': 2, // Disallow Empty Block Statements
'no-extra-boolean-cast': 2, // Disallow Extra Boolean Casts
'no-prototype-builtins': 2, // Disallow use of Object.prototypes builtins directly
'no-undef': 2, // Disallow Undeclared Variables
'no-underscore-dangle': 2, // Disallow dangling underscores in identifiers
'no-unreachable': 2, // Disallow unreachable code after return, throw, continue, and break statements
'no-unused-vars': 2, // Disallow Unused Variables
'no-useless-escape': 2, // Disallow unnecessary escape usage
'no-console': 0, // disallow the use of console
'no-var': 2, // require let or const instead of var
strict: [2, 'global'], // require or disallow strict mode directives
'react-native/no-color-literals': 1, // Detect StyleSheet rules and inline styles containing color literals instead of variables
'react-native/no-inline-styles': 0, // For keeping styles away from the logic, we can switch it to 1 in future
'react-native/no-raw-text': 1, // This is to make sure everything is translated in the app
'react-native/no-unused-styles': 1, // Detect StyleSheet rules which are not used in your React components
'react/jsx-boolean-value': 2, // Enforce boolean attributes notation in JSX (fixable)
'react/jsx-key': 2, // Report missing key props in iterators/collection literals
'react/jsx-no-duplicate-props': 2, // Enforce no duplicate props
'react/jsx-no-undef': 2, // Disallow undeclared variables in JSX
'react/jsx-sort-props': 0, // Enforce props alphabetical sorting (fixable)
'react/jsx-wrap-multilines': 2, // Prevent missing parentheses around multilines JSX (fixable)
'react/no-deprecated': 1, // Prevent usage of deprecated methods
'react/no-did-mount-set-state': 1, // Prevent usage of setState in componentDidMount
'react/no-did-update-set-state': 1, // Prevent usage of setState in componentDidUpdate
'react/no-multi-comp': 0, // Prevent multiple component definition per file
'react/no-string-refs': 1, // Prevent string definitions for references and prevent referencing this.refs
'react/prop-types': 0, // Prevent missing props validation in a React component definition
'react/react-in-jsx-scope': 2, // Prevent missing React when using JSX
'react/self-closing-comp': 2, // Prevent extra closing tags for components without children
},
};
65 changes: 0 additions & 65 deletions .eslintrc.json

This file was deleted.

152 changes: 152 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,155 @@ jobs:
- run: yarn test
env:
CI: true

e2e-ios-build:
runs-on: macOS-latest
# while this job doesn't depend on the previous job explicitly
# this will force them not to run in parallel. If they're run in parallel,
# the node_modules caches will conflict
needs: unit-test
timeout-minutes: 15
env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app
steps:
- uses: actions/checkout@master
- name: Cache node_modules/
uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{ runner.OS }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-cache-
- name: Rebuild detox
if: steps.cache.outputs.cache-hit == 'true'
run: yarn detox-setup

- name: Install Node Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- name: Cache ruby gems
uses: actions/cache@v1
with:
path: ios/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems (including Cocoapods)
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
working-directory: ./ios

- name: Cache CocoaPods
uses: actions/cache@v1
with:
path: ios/Pods
key: ${{ runner.OS }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.OS }}-pods-
- run: pod install --repo-update
working-directory: ./ios

- run: yarn build:e2e:ios

- uses: actions/upload-artifact@v1
with:
name: e2e-ios-bin
path: ios/build/Build/Products/Release-iphonesimulator/COVIDSafePaths.app

e2e-iphone11:
runs-on: macOS-latest
needs: e2e-ios-build
timeout-minutes: 15
env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app
steps:
- uses: actions/checkout@master
- name: Cache node_modules/
uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{ runner.OS }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-cache-
- name: Rebuild detox
if: steps.cache.outputs.cache-hit == 'true'
run: yarn detox-setup

- name: Install Node Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- run: brew tap wix/brew

- run: brew install applesimutils

- uses: actions/download-artifact@master
with:
name: e2e-ios-bin
path: ios/build/Build/Products/Release-iphonesimulator/COVIDSafePaths.app

- run: yarn test:e2e:iphone11

- name: Upload Screenshots
uses: actions/upload-artifact@v1
with:
name: iPhone 11 screenshots
path: e2e/artifacts

e2e-iphone-se:
runs-on: macOS-latest
needs: e2e-ios-build
timeout-minutes: 15
env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app
steps:
- uses: actions/checkout@master
- name: Cache node_modules/
uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{ runner.OS }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-yarn-cache-
- name: Rebuild detox
if: steps.cache.outputs.cache-hit == 'true'
run: yarn detox-setup

- name: Install Node Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile

- run: brew tap wix/brew

- run: brew install applesimutils

# - run: xcrun simctl list devicetypes

# - run: xcrun simctl list runtimes

- run: xcrun simctl create "iPhone SE" com.apple.CoreSimulator.SimDeviceType.iPhone-SE com.apple.CoreSimulator.SimRuntime.iOS-13-4

- run: xcrun simctl list

- uses: actions/download-artifact@master
with:
name: e2e-ios-bin
path: ios/build/Build/Products/Release-iphonesimulator/COVIDSafePaths.app

- run: yarn test:e2e:iphone-se

- name: Upload Screenshots
uses: actions/upload-artifact@v1
with:
name: iPhone SE screenshots
path: e2e/artifacts
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ ios/Podfile.lock

# Ruby gems
ios/vendor/bundle/*

# Screenshots
e2e/artifacts/*

# VSCode
.vscode/*
5 changes: 5 additions & 0 deletions __mocks__/react-native-document-picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
pick: jest.fn(),
pickMultiple: jest.fn(),
isCancel: jest.fn(),
};
6 changes: 6 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled true

// detox e2e testing
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

versionCode 22
versionName "0.9.4"
}
Expand Down Expand Up @@ -208,6 +213,7 @@ dependencies {
} else {
implementation jscFlavor
}
androidTestImplementation('com.wix:detox:+') // detox: e2e testing
}

// Just to fix the app start crash error
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.pathcheck.covidsafepaths;

import com.wix.detox.Detox;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class DetoxTest {

@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);

@Test
public void runDetoxTests() {
Detox.runTests(mActivityRule);
}
}
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="covidsafepaths_kit_notification_channel"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="Handle all local notifications"/>
android:value="@string/notification_channel_description"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@android:color/white"/>
Expand Down
Loading

0 comments on commit 20a135d

Please sign in to comment.