Skip to content

Commit 921d652

Browse files
Add e2e folder with initial configurations
1 parent eb8bf58 commit 921d652

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

InstabugSample/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class App extends Component<{}> {
4040

4141
render() {
4242
return (
43-
<View style={styles.container}>
43+
<View testID='welcome' style={styles.container}>
4444
<ScrollView contentContainerStyle={styles.contentContainer} >
4545
<Text style={styles.details}>
4646
Hello {"Instabug's"} awesome user! The purpose of this application is to show you the different

InstabugSample/e2e/config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"setupFilesAfterEnv": ["./init.js"],
3+
"testEnvironment": "node",
4+
"reporters": ["detox/runners/jest/streamlineReporter"],
5+
"verbose": true
6+
}

InstabugSample/e2e/firstTest.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('Example', () => {
2+
beforeEach(async () => {
3+
await device.reloadReactNative();
4+
});
5+
6+
it('should have welcome screen', async () => {
7+
await expect(element(by.id('welcome'))).toBeVisible();
8+
});
9+
});

InstabugSample/e2e/init.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const detox = require('detox');
2+
const config = require('../package.json').detox;
3+
const adapter = require('detox/runners/jest/adapter');
4+
const specReporter = require('detox/runners/jest/specReporter');
5+
6+
// Set the default timeout
7+
jest.setTimeout(120000);
8+
jasmine.getEnv().addReporter(adapter);
9+
10+
// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
11+
// This is strictly optional.
12+
jasmine.getEnv().addReporter(specReporter);
13+
14+
beforeAll(async () => {
15+
await detox.init(config);
16+
});
17+
18+
beforeEach(async () => {
19+
await adapter.beforeEach();
20+
});
21+
22+
afterAll(async () => {
23+
await adapter.afterAll();
24+
await detox.cleanup();
25+
});

0 commit comments

Comments
 (0)