Skip to content

Commit

Permalink
test: fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr committed Jul 11, 2024
1 parent 1d015ee commit cbb37c1
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 78 deletions.
4 changes: 2 additions & 2 deletions .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ module.exports = {
testBinaryPath: 'android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk',
binaryPath: 'android/app/build/outputs/apk/debug/app-universal-debug.apk',
build:
'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .. ',
'cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd .. ',
reversePorts,
},
'android.release': {
type: 'android.apk',
testBinaryPath: 'android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk',
binaryPath: 'android/app/build/outputs/apk/release/app-universal-release.apk',
build:
'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..',
'cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release && cd ..',
reversePorts,
},
},
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ metro.config.js
postinstall.js
__mocks__/**

src/polyfills/**
src/**/*_deprecated.tsx
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
6 changes: 3 additions & 3 deletions e2e/slashtags.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from './helpers';
import initWaitForElectrumToSync from '../__tests__/utils/wait-for-electrum';

const __DEV__ = process.env.DEV === 'true';
const d = checkComplete('slash-1') ? describe.skip : describe;

// private key: rhuoi5upr3he3d5p9ef685bnxq8adbariwphg7i8gxdnnazok87xtc3e15pkouxizbzm6m4kjaoi9bndwp88iefycf6i6qhqu1ifzfa
Expand Down Expand Up @@ -143,9 +142,10 @@ d('Profile and Contacts', () => {
await expect(element(by.text(satoshi.website))).toExist();
await element(by.id('NavigationBack')).tap();

if (!__DEV__ && device.getPlatform() === 'ios') {
if (device.getPlatform() === 'ios') {
// FIXME: this bottom sheet should not appear
await element(by.id('AddContactNote')).swipe('down');
// Tap on background to dismiss
await element(by.label('Close')).atIndex(0).tap({ x: 10, y: 10 });
}

// Hal
Expand Down
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- MMKV (1.3.3):
- MMKVCore (~> 1.3.3)
- MMKVCore (1.3.3)
- MMKV (1.3.7):
- MMKVCore (~> 1.3.7)
- MMKVCore (1.3.7)
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2024.01.01.00):
- boost
Expand Down Expand Up @@ -1780,8 +1780,8 @@ SPEC CHECKSUMS:
hermes-engine: 1f547997900dd0752dc0cc0ae6dd16173c49e09b
lottie-ios: e047b1d2e6239b787cc5e9755b988869cf190494
lottie-react-native: 4279da8b681e89c29a2adb9f99985d6cf372d49d
MMKV: f902fb6719da13c2ab0965233d8963a59416f911
MMKVCore: d26e4d3edd5cb8588c2569222cbd8be4231374e9
MMKV: 36a22a9ec84c9bb960613a089ddf6f48be9312b0
MMKVCore: 158e61c8516401a9fac730288acb29e6fc19bbf9
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 02617c592a293bd6d418e0a88ff4ee1f88329b47
RCTDeprecation: 4c7eeb42be0b2e95195563c49be08d0b839d22b4
Expand Down
102 changes: 51 additions & 51 deletions ios/bitkit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@formatjs/intl-numberformat": "8.10.1",
"@formatjs/intl-pluralrules": "5.2.12",
"@formatjs/intl-relativetimeformat": "11.2.12",
"@gorhom/bottom-sheet": "4.6.1",
"@gorhom/bottom-sheet": "4.6.3",
"@react-native-async-storage/async-storage": "1.22.3",
"@react-native-clipboard/clipboard": "1.14.1",
"@react-native-community/blur": "4.4.0",
Expand Down
18 changes: 9 additions & 9 deletions src/components/BottomSheetWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import React, {
useMemo,
} from 'react';
import { StyleSheet } from 'react-native';
import { useReducedMotion } from 'react-native-reanimated';
import BottomSheet, {
BottomSheetView,
BottomSheetBackdrop,
BottomSheetBackgroundProps,
BottomSheetBackdropProps,
useBottomSheetTimingConfigs,
} from '@gorhom/bottom-sheet';
import { useTheme } from 'styled-components/native';

Expand Down Expand Up @@ -69,6 +69,7 @@ const BottomSheetWrapper = forwardRef(
ref,
): ReactElement => {
const bottomSheetRef = useRef<BottomSheet>(null);
const reducedMotion = useReducedMotion();
const dispatch = useAppDispatch();
const data = useAppSelector((state) => viewControllerSelector(state, view));
const theme = useTheme();
Expand All @@ -77,8 +78,6 @@ const BottomSheetWrapper = forwardRef(
[theme.colors.gray2],
);

const testAnimationConfigs = useBottomSheetTimingConfigs({ duration: 1 });

// /~https://github.com/gorhom/react-native-bottom-sheet/issues/770#issuecomment-1072113936
// do not activate BottomSheet if swipe horizontally, this allows using Swiper inside of it
const activeOffsetX = useMemo(() => [-999, 999], []);
Expand Down Expand Up @@ -135,6 +134,7 @@ const BottomSheetWrapper = forwardRef(
{...props}
disappearsOnIndex={-1}
appearsOnIndex={0}
accessibilityLabel="Close"
/>
);
},
Expand All @@ -153,19 +153,19 @@ const BottomSheetWrapper = forwardRef(

return (
<BottomSheet
ref={bottomSheetRef}
backgroundComponent={backgroundComponent}
backdropComponent={renderBackdrop}
handleIndicatorStyle={handleIndicatorStyle}
handleStyle={styles.handle}
enablePanDownToClose={true}
keyboardBlurBehavior="restore"
ref={bottomSheetRef}
index={index}
onChange={handleSheetChanges}
backdropComponent={renderBackdrop}
snapPoints={snapPoints}
animateOnMount={!reducedMotion && !__E2E__}
enablePanDownToClose={true}
keyboardBlurBehavior="restore"
activeOffsetX={activeOffsetX}
activeOffsetY={activeOffsetY}
animationConfigs={__E2E__ ? testAnimationConfigs : undefined}>
onChange={handleSheetChanges}>
<BottomSheetView style={styles.container} testID={testID}>
{children}
</BottomSheetView>
Expand Down
3 changes: 2 additions & 1 deletion src/screens/Contacts/AddContact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ const AddContact = ({

const onContact = (): void => {
setUrl('');
dispatch(closeSheet('addContactModal'));
// Add delay to prevent sheet from staying open
setTimeout(() => dispatch(closeSheet('addContactModal')), 500);
};

handleSlashtagURL(contactUrl, onError, onContact);
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3033,9 +3033,9 @@ __metadata:
languageName: node
linkType: hard

"@gorhom/bottom-sheet@npm:4.6.1":
version: 4.6.1
resolution: "@gorhom/bottom-sheet@npm:4.6.1"
"@gorhom/bottom-sheet@npm:4.6.3":
version: 4.6.3
resolution: "@gorhom/bottom-sheet@npm:4.6.3"
dependencies:
"@gorhom/portal": 1.0.14
invariant: ^2.2.4
Expand All @@ -3051,7 +3051,7 @@ __metadata:
optional: true
"@types/react-native":
optional: true
checksum: fc30da15c5d7e7c7b81ad2450e6ecb3884f0e040bc1ed5f467b1f846e2598519608a21c14cd50ea8288caac3cdfd9ad2c7742c31c77dd137804f94148105f389
checksum: 718c55a89b0e18581eae6080d1d21caabf4895088e01f0dfe17b5891835a110d7aee1d0cb1b9e623efc16b598fdb28c2ec929e0ed74bfbca283306191d8a5c41
languageName: node
linkType: hard

Expand Down Expand Up @@ -6352,7 +6352,7 @@ __metadata:
"@formatjs/intl-numberformat": 8.10.1
"@formatjs/intl-pluralrules": 5.2.12
"@formatjs/intl-relativetimeformat": 11.2.12
"@gorhom/bottom-sheet": 4.6.1
"@gorhom/bottom-sheet": 4.6.3
"@ptsecurity/commitlint-config": ^2.0.0
"@radar/lnrpc": ^0.11.1-beta.1
"@react-native-async-storage/async-storage": 1.22.3
Expand Down

0 comments on commit cbb37c1

Please sign in to comment.