Skip to content

Commit

Permalink
Merge pull request #190 from Agoric/rs-update-doc-for-running-tests-l…
Browse files Browse the repository at this point in the history
…ocally

docs: update README for running e2e tests locally
  • Loading branch information
rabi-siddique committed Aug 28, 2024
2 parents 4ab9ece + ff43325 commit 08faa89
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
56 changes: 51 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,67 @@ There are two ways to run the tests:

## On Local Machine

To run tests on your local machine, first you need to start the frontend server:
### 1. Start the development server

```
To run tests on your local machine, first you need to start the development server:

```bash
yarn build && yarn preview
```

Then you need to run the tests using
### 2. Ensure Keys are in Local Keyring

You need to ensure that the key `user1` is present in your local keyring. To find the mnemonic for this key, open the file `test/e2e/test.utils.js`. In this file, you will find an object named `mnemonics`, which contains the mnemonics for different keys, including `user1` and `user2`.

If you are going to run tests with `CYPRESS_AGORIC_NET=local`, use the mnemonic for `user1`. Otherwise, use the mnemonic for `user2`.

Regardless of which mnemonic you choose, make sure to name the key `user1` when adding it with the `agd` command.

**Note:** The test case for adding keys using `agd` from the CLI might fail. This is expected behavior and is fine when testing on your local machine.

### 3. Adjust agops Path in Code

These tests use the `agops` command for placing bids. Ensure that `agops` is properly configured on your computer.

To adjust the file path for `agops` in code to match your local machine’s directory structure. Open the file located at `test/e2e/support.js` in your code editor. Go to `line number 10` and locate the path configuration for `agops`. Modify this path to match the actual location of agops on your computer.

### 4. Running the a3p chain(optional)

If you plan to run tests with `CYPRESS_AGORIC_NET=local`, you must start the `a3p` chain beforehand. To do this, use the following command:

```bash
docker run -d -p 26657:26657 -p 1317:1317 -p 9090:9090 ghcr.io/agoric/agoric-3-proposals:latest
```

Alternatively, you can create an `a3p` chain from a specific branch in your `agoric-sdk` repository. To do this, navigate to the `a3p-integration` directory in your `agoric-sdk` repository. Install all necessary dependencies and build the project with:

```bash
yarn && yarn build
```

Once the build is complete, locate the Docker image you just created by running:

```bash
docker images
```

Find the hash of your new image and start the container using the hash:

```bash
docker run -p 26657:26657 -p 1317:1317 -p 9090:9090 {hash}
```

### 5. Run the tests

Next, run the tests using the following command:

```bash
CYPRESS_AGORIC_NET=<network> yarn test:e2e
```

where `network` can be: `emerynet` or `devnet`
where `network` can be: `local`,`emerynet`,`devnet`, `xnet` or `ollinet`.

Note: the tests use chrome browser by default so they require it to be installed
**Note:** The tests use chrome browser by default so they require it to be installed.

## On Github

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const config = {
COMMAND_TIMEOUT: 2 * 60 * 1000,
},
testnet: {
userKeyName: 'user2',
userKeyName: 'user1',
userWalletAddress: accountAddresses.user2,
userWalletMnemonic: mnemonics.user2,
COMMAND_TIMEOUT: 2 * 60 * 1000,
Expand Down

0 comments on commit 08faa89

Please sign in to comment.