Skip to content

Commit cad4c42

Browse files
committed
Updated new example app for e2e tests
Update e2e-ios.yml
1 parent 2e0196e commit cad4c42

File tree

8 files changed

+413
-26
lines changed

8 files changed

+413
-26
lines changed

.github/workflows/e2e-ios.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: e2e-ios
22

33
on:
4-
push:
4+
pull_request:
55
branches:
6-
- 'e2e-tests'
6+
- 'master'
77

88
jobs:
99
e2e-test:
10-
name: Run e2e iOS test
10+
name: E2E iOS test
1111
runs-on: macOS-latest
1212
timeout-minutes: 30
1313

example/App.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const App = (): ReactElement => {
5656
<ScrollView
5757
contentInsetAdjustmentBehavior="automatic"
5858
style={styles.scrollView}>
59+
<Text style={styles.text}>react-native-ldk</Text>
5960
<View style={styles.messageContainer}>
6061
<Text style={styles.text}>{message}</Text>
6162
</View>
@@ -268,7 +269,18 @@ const App = (): ReactElement => {
268269
<Button
269270
title={'E2E test'}
270271
onPress={async (): Promise<void> => {
271-
setMessage('SUCCESS');
272+
//TODO add more functionality to test
273+
const ldkVersion = await ldk.version();
274+
if (ldkVersion.isErr()) {
275+
return setMessage(ldkVersion.error.message);
276+
}
277+
278+
const nodeIdRes = await ldk.nodeId();
279+
if (nodeIdRes.isErr()) {
280+
return setMessage(nodeIdRes.error.message);
281+
}
282+
283+
return setMessage('e2e success');
272284
}}
273285
/>
274286
</View>

example/e2e/ldk.e2e.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/*eslint-disable no-undef*/
2-
31
// https://wix.github.io/Detox/docs/introduction/writing-first-test
42
describe('LDK integration test', () => {
53
beforeAll(async () => {
@@ -11,12 +9,21 @@ describe('LDK integration test', () => {
119
});
1210

1311
it('should have heading', async () => {
14-
await expect(element(by.text('react-native-ldk'))).toBeVisible();
12+
await waitFor(element(by.text('react-native-ldk')))
13+
.toBeVisible()
14+
.withTimeout(2000);
1515
});
1616

17-
it('should show "Node running" after tapping start', async () => {
17+
it('should show "Running LDK" after starting up', async () => {
1818
// await element(by.id('start')).tap();
19+
await waitFor(element(by.text('Running LDK')))
20+
.toBeVisible()
21+
.withTimeout(2000);
22+
1923
await element(by.text('E2E test')).tap();
20-
await expect(element(by.text('SUCCESS'))).toBeVisible();
24+
25+
await waitFor(element(by.text('e2e success')))
26+
.toBeVisible()
27+
.withTimeout(2000);
2128
});
2229
});

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ PODS:
282282
- React-jsinspector (0.68.2)
283283
- React-logger (0.68.2):
284284
- glog
285-
- react-native-ldk (0.0.41):
285+
- react-native-ldk (0.0.43):
286286
- React
287287
- react-native-randombytes (3.6.1):
288288
- React-Core
@@ -554,7 +554,7 @@ SPEC CHECKSUMS:
554554
React-jsiexecutor: b7b553412f2ec768fe6c8f27cd6bafdb9d8719e6
555555
React-jsinspector: c5989c77cb89ae6a69561095a61cce56a44ae8e8
556556
React-logger: a0833912d93b36b791b7a521672d8ee89107aff1
557-
react-native-ldk: 099c3739af20b40dd93c9009d368e588e42df5a5
557+
react-native-ldk: dc6e4c247ca9b65b6cba3cd1476834f9c73495cb
558558
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
559559
react-native-tcp-socket: c1b7297619616b4c9caae6889bcb0aba78086989
560560
React-perflogger: a18b4f0bd933b8b24ecf9f3c54f9bf65180f3fe6

example/ldk/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export const setupLdk = async (): Promise<Result<string>> => {
142142
await lm.syncLdk();
143143

144144
console.log(`Node ID: ${nodeIdRes.value}`);
145-
return ok(`Node ID: ${nodeIdRes.value}`);
145+
return ok('Running LDK'); //e2e test needs to see this string
146146
} catch (e) {
147147
return err(e.toString());
148148
}

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"detox": "^19.7.1",
4747
"eslint": "^8.17.0",
4848
"jest": "^26.6.3",
49-
"jest-circus": "28.1.1",
49+
"jest-circus": "^26.6.3",
5050
"metro-react-native-babel-preset": "^0.67.0",
5151
"react-test-renderer": "17.0.2",
5252
"rn-nodeify": "^10.3.0",

0 commit comments

Comments
 (0)