-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
detox.test.ts
45 lines (39 loc) · 1.24 KB
/
detox.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import {
checkFilesExist,
isOSX,
newProject,
runCLI,
runCLIAsync,
uniq,
killPorts,
} from '@nrwl/e2e/utils';
describe('Detox', () => {
const appName = uniq('myapp');
beforeAll(() => {
newProject();
runCLI(
`generate @nrwl/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint`
);
});
it('should create files and run lint command', async () => {
checkFilesExist(`apps/${appName}-e2e/.detoxrc.json`);
checkFilesExist(`apps/${appName}-e2e/tsconfig.json`);
checkFilesExist(`apps/${appName}-e2e/tsconfig.e2e.json`);
checkFilesExist(`apps/${appName}-e2e/test-setup.ts`);
checkFilesExist(`apps/${appName}-e2e/src/app.spec.ts`);
const lintResults = await runCLIAsync(`lint ${appName}-e2e`);
expect(lintResults.combinedOutput).toContain('All files pass linting');
});
describe('React Native Detox MACOS-Tests', () => {
if (isOSX()) {
it('should test ios MACOS-Tests', async () => {
expect(
runCLI(
`test-ios ${appName}-e2e --prod --debugSynchronization=true --loglevel=trace`
)
).toContain('Successfully ran target test-ios');
await killPorts(8081); // kill the port for the serve command
}, 3000000);
}
});
});