From 08a792a074a23bafa9ce2248b1a6e40cbd446136 Mon Sep 17 00:00:00 2001 From: Jonathan Ruddell Date: Thu, 22 Oct 2020 16:10:56 -0400 Subject: [PATCH] fix integration tests, android build, and upgrade detox --- boilerplate/app/shared/components/search-bar/search-bar.js | 1 + boilerplate/package.json | 2 +- .../spec/shared/components/search-bar/search-bar.spec.js | 4 ++-- src/lib/react-native-navigation.js | 2 +- test/auth-tests/common-methods.js | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/boilerplate/app/shared/components/search-bar/search-bar.js b/boilerplate/app/shared/components/search-bar/search-bar.js index dec5ed246..5167bb476 100644 --- a/boilerplate/app/shared/components/search-bar/search-bar.js +++ b/boilerplate/app/shared/components/search-bar/search-bar.js @@ -30,6 +30,7 @@ export default class SearchBar extends React.Component { returnKeyType={'search'} autoCorrect={false} selectionColor={Colors.snow} + testID='searchTextInput' /> Cancel diff --git a/boilerplate/package.json b/boilerplate/package.json index 27aab1c88..c5a08e0ed 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -36,7 +36,7 @@ "eslint-plugin-prettier": "3.1.4", "lint-staged": "10.4.2", "react-native-app-auth": "6.0.0", - "detox": "17.10.2", + "detox": "17.10.3", "mocha": "8.2.0", "mockery": "2.1.0", "react-dom": "16.13.1", diff --git a/boilerplate/test/spec/shared/components/search-bar/search-bar.spec.js b/boilerplate/test/spec/shared/components/search-bar/search-bar.spec.js index fea70e410..b30dbc818 100644 --- a/boilerplate/test/spec/shared/components/search-bar/search-bar.spec.js +++ b/boilerplate/test/spec/shared/components/search-bar/search-bar.spec.js @@ -18,6 +18,6 @@ test('onSearch', () => { const wrapperPress = shallow() // checks that the methods use the right handlers - expect(wrapperPress.find('TextInput').prop('onChangeText')).toBe(onSearch) // uses the right handler - expect(JSON.stringify(wrapperPress.find('TextInput').prop('onSubmitEditing'))).toEqual(JSON.stringify(onSubmitEditing)) + expect(wrapperPress.findWhere((node) => node.prop('testID') === 'searchTextInput').prop('onChangeText')).toBe(onSearch) // uses the right handler + expect(JSON.stringify(wrapperPress.findWhere((node) => node.prop('testID') === 'searchTextInput').prop('onSubmitEditing'))).toEqual(JSON.stringify(onSubmitEditing)) }) diff --git a/src/lib/react-native-navigation.js b/src/lib/react-native-navigation.js index 92476efdd..86cd0336e 100644 --- a/src/lib/react-native-navigation.js +++ b/src/lib/react-native-navigation.js @@ -100,7 +100,7 @@ const updateAndroidFiles = async (context) => { // settings.gradle await patchInFile(context, `${process.cwd()}/android/build.gradle`, { after: `dependencies {`, - insert: ` classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$RNNKotlinVersion")"`, + insert: ` classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$RNNKotlinVersion")`, }) await patchInFile(context, `${process.cwd()}/android/build.gradle`, { diff --git a/test/auth-tests/common-methods.js b/test/auth-tests/common-methods.js index 871892eec..2b758998c 100644 --- a/test/auth-tests/common-methods.js +++ b/test/auth-tests/common-methods.js @@ -10,8 +10,8 @@ const copyFilesAndGenerateApp = async (authType, useDto) => { console.log('Generating App...') // create a dummy jhipster backend - await execa('mkdir', ['backend']) - await execa('mkdir', ['backend/.jhipster']) + await execa('mkdir', ['-p', 'backend']) + await execa('mkdir', ['-p', 'backend/.jhipster']) await execa('cp', [`${testFolder}/.jhipster/${authType}-yo-rc.json`, 'backend/.yo-rc.json']) await execa('cp', [`${testFolder}/jdl/entities${useDto ? '-dto' : ''}.jdl`, 'backend/backend.jdl']) await execa('cp', [`${testFolder}/.jhipster/FieldTestEntity.json`, 'backend/.jhipster/FieldTestEntity.json']) @@ -57,7 +57,7 @@ const runTests = async () => { const tests = await execa('npm', ['-s', 'run', 'test', '--', '-u']) console.log('Tests Complete') console.log(tests.stdout) - expect(tests.stderr).not.toMatch(/failed/) + expect(tests.stderr).not.toMatch(/failed,/) } module.exports = {