Skip to content

Commit

Permalink
some unsucessful attempt at Detox. it doesn't start. will revisit later.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasburtey committed Oct 26, 2020
1 parent 357bc9f commit a7b360c
Show file tree
Hide file tree
Showing 9 changed files with 982 additions and 24 deletions.
22 changes: 22 additions & 0 deletions .detoxrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"configurations": {
"ios": {
"type": "ios.simulator",
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/Bitcoin Beach.app",
"build": "xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"device": {
"type": "iPhone 11"
}
},
"android": {
"type": "android.emulator",
"binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY",
"device": {
"avdName": "Pixel_2_API_29"
}
}
}
}

1 change: 1 addition & 0 deletions app/screens/get-started-screen/get-started-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const GetStartedScreen = () => {
titleStyle={styles.buttonTitle}
onPress={() => navigate("welcomeFirst")}
containerStyle={styles.buttonContainer}
testID={"getStarted"}
/>
</View>
</Screen>
Expand Down
33 changes: 33 additions & 0 deletions e2e/List.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe('PostList', () => {
beforeEach(async () => {
await device.reloadReactNative();
});

it('render a tappable list of posts', async () => {
// await expect(element(by.id('post-list'))).toBeVisible();
// await waitFor(element(by.id('post-row-0')))
// .toBeVisible()
// .withTimeout(2000);
// await element(by.id('post-row-0')).tap();
// await expect(element(by.id('post-title'))).toBeVisible();
});

it('should have get started', async () => {
expect(true).toBeTruthy()
// console.log("get started start")
// await expect(element(by.id('getStarted'))).toBeVisible();
// console.log("get start middle")
// const imagePath = await device.takeScreenshot('opened general section');

});

// it('should show hello screen after tap', async () => {
// await element(by.id('hello_button')).tap();
// await expect(element(by.text('Hello!!!'))).toBeVisible();
// });

// it('should show world screen after tap', async () => {
// await element(by.id('world_button')).tap();
// await expect(element(by.text('World!!!'))).toBeVisible();
// });
});
8 changes: 8 additions & 0 deletions e2e/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"testEnvironment": "./environment",
"testRunner": "jest-circus/runner",
"testTimeout": 120000,
"testRegex": "\\.e2e\\.js$",
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true
}
23 changes: 23 additions & 0 deletions e2e/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const {
DetoxCircusEnvironment,
SpecReporter,
WorkerAssignReporter,
} = require('detox/runners/jest-circus');

class CustomDetoxEnvironment extends DetoxCircusEnvironment {
constructor(config) {
super(config);

// Can be safely removed, if you are content with the default value (=300000ms)
this.initTimeout = 300000;

// This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
// This is strictly optional.
this.registerListeners({
SpecReporter,
WorkerAssignReporter,
});
}
}

module.exports = CustomDetoxEnvironment;
6 changes: 0 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ PODS:
- React
- react-native-safe-area-context (3.1.1):
- React
- react-native-splash-screen (3.2.0):
- React
- react-native-version-number (0.3.6):
- React
- React-RCTActionSheet (0.63.2):
Expand Down Expand Up @@ -447,7 +445,6 @@ DEPENDENCIES:
- react-native-maps (from `../node_modules/react-native-maps`)
- "react-native-qrcode-local-image (from `../node_modules/@remobile/react-native-qrcode-local-image`)"
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-splash-screen (from `../node_modules/react-native-splash-screen`)
- react-native-version-number (from `../node_modules/react-native-version-number`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
Expand Down Expand Up @@ -553,8 +550,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/@remobile/react-native-qrcode-local-image"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-splash-screen:
:path: "../node_modules/react-native-splash-screen"
react-native-version-number:
:path: "../node_modules/react-native-version-number"
React-RCTActionSheet:
Expand Down Expand Up @@ -664,7 +659,6 @@ SPEC CHECKSUMS:
react-native-maps: f4b89da81626ad7f151a8bfcb79733295d31ce5c
react-native-qrcode-local-image: a16d554baf5cf5c04da86b464d99cf658e215c52
react-native-safe-area-context: 344b969c45af3d8464d36e8dea264942992ef033
react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865
react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f
React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"react-native-safe-area-context": "^3.1.1",
"react-native-screens": "^2.4.0",
"react-native-snap-carousel": "^4.0.0-beta.5",
"react-native-splash-screen": "3.2.0",
"react-native-svg": "^12.1.0",
"react-native-swiper": "^1.6.0-rc.3",
"react-native-vector-icons": "^7.0.0",
Expand Down Expand Up @@ -124,6 +123,7 @@
"babel-jest": "^26.2.2",
"babel-loader": "^8.1.0",
"csv-parse": "^4.8.9",
"detox": "^17.10.3",
"emotion-theming": "^10.0.27",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.10.0",
Expand All @@ -136,6 +136,7 @@
"eslint-plugin-standard": "^4.0.0",
"ignite-bowser": "^5.2.1",
"jest": "^26.2.2",
"jest-circus": "^26.6.1",
"jetifier": "^1.6.6",
"metro-react-native-babel-preset": "^0.61.0",
"npm-run-all": "4.1.5",
Expand Down
2 changes: 0 additions & 2 deletions storybook/storybook.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react"
import { getStorybookUI, configure } from "@storybook/react-native"
import SplashScreen from "react-native-splash-screen"

declare var module

Expand All @@ -25,7 +24,6 @@ const Stack = createStackNavigator();
export class StorybookUIRoot extends React.Component {

componentDidMount() {
SplashScreen.hide()
if (typeof __TEST__ === "undefined" || !__TEST__) {
const Reactotron = require("../app/services/reactotron")
const reactotron = new Reactotron.Reactotron()
Expand Down
Loading

0 comments on commit a7b360c

Please sign in to comment.