-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
detox.test.ts
58 lines (50 loc) · 1.81 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
46
47
48
49
50
51
52
53
54
55
56
57
58
import {
checkFilesExist,
isOSX,
newProject,
runCLI,
runCLIAsync,
uniq,
getSelectedPackageManager,
killPorts,
} from '@nrwl/e2e/utils';
describe('Detox', () => {
beforeEach(() => newProject());
it('should create files and run lint command', async () => {
// currently react native does not support pnpm: https://github.com/pnpm/pnpm/issues/3321
if (getSelectedPackageManager() === 'pnpm') return;
const appName = uniq('myapp');
runCLI(
`generate @nrwl/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint`
);
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 build and test ios', async () => {
const appName = uniq('myapp');
runCLI(
`generate @nrwl/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint`
);
expect(runCLI(`build-ios ${appName}-e2e`)).toContain(
'Running target "build-ios" succeeded'
);
expect(runCLI(`build-ios ${appName}-e2e --pod`)).toContain(
'Running target "build-ios" succeeded'
);
expect(
runCLI(
`test-ios ${appName}-e2e --prod --debugSynchronization=true --loglevel=trace`
)
).toContain('Running target "test-ios" succeeded');
await killPorts(8081); // kill the port for the serve command
}, 1000000);
}
});
});