Skip to content

Commit

Permalink
test: update README with guidance to install simulator and clean work…
Browse files Browse the repository at this point in the history
…space
  • Loading branch information
AllanZhengYP committed Aug 5, 2020
1 parent 3608c49 commit 49be401
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
44 changes: 43 additions & 1 deletion tests/react-native/End2End/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@
## Prerequisite

- See [Detox requirement](https://github.com/wix/Detox#environment)
- Launch Xcode.app, if it asks you to install the update or extra components, please follow the instructions to install
- Launch XCode.app, if it asks you to install the update or extra components, please follow the instructions to install
them.
- Confirm iPhone X simulator is installed locally, by running:
```console
applesimutils --list | grep "name" | grep iPhone
```
If `applesimutils` command is not found, you can install it [following the guidance](https://github.com/wix/AppleSimulatorUtils#installing).
If iPhone X simulator is not available in the runtime, you can install it following the next step.
- Launch XCode.app, click `Open another project`, choose the directory `tests/react-native/End2End/ios`. Open XCode ->
Open Developer Tool -> simulator. In the simulator.app, open Hardware -> Device -> Manage Devices... -> Simulators ->
click "+" at the button of left side bar. In the pop-up, "Device Type" drop-down, choose "iPhone X", click "Create".
Make sure iPhone X is available in the last step.

## Steps to Setup

Expand All @@ -31,3 +41,35 @@
- make sure you have configured the SDK with the the credentials from the testing account that contains
`SdkReleaseV3IntegTestResourcesStack`
- `node launch-app.js --local-publish`

## Steps to Re-run the Tests

If the scripts above fail and you need to re-run the test script, you need to make sure the workspace is cleaned and
ready to run the test script again. Follow the steps bellow to clean the workspace.

1. Kill the local NPM registry process. You can get the process PID by running:

```console
lsof -i -P -n | grep "TCP 127.0.0.1:4873"
```

The number after `node` is the PID.

Kill the process by running:

```console
kill -9 [PID]
```

1. Reset the temporary changes to the workspace in git from project root:

```console
git reset --hard clients/*/package.json packages/*/package.json protocol_tests/*/package.json
```

1. Follow the `Launch the ReactNative test:` step of [Steps to Setup](#steps-to-setup). If you don't plan to install
the packages to `End2End` test APP again, you can omit the `--local-publish` option the test script:

```console
node launch-app.js
```
2 changes: 1 addition & 1 deletion tests/react-native/End2End/launch-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const run = async () => {
await new Promise((resolve) => {
setTimeout(resolve, 5000);
});
await spawnPromise("yarn", ["--registry", "http://localhost:4873"], { cwd: __dirname });
await spawnPromise("yarn", ["--no-lockfile", "--registry", "http://localhost:4873"], { cwd: __dirname });
const integTestResourcesEnv = await getIntegTestResources();
const envFile = Object.entries(integTestResourcesEnv)
.map(([name, key]) => `${name}=${key}`)
Expand Down

0 comments on commit 49be401

Please sign in to comment.