Skip to content

Commit

Permalink
chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptobench committed Oct 5, 2023
1 parent 856fa5a commit 5acd5a2
Showing 1 changed file with 59 additions and 17 deletions.
76 changes: 59 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
- [Testing](#testing)
- [Running unit tests](#running-unit-tests)
- [Running E2E tests](#running-e2e-tests)
- [NodeJS](#nodejs)
- [Cypress](#cypress)
- [NodeJS](#execute-the-e2e-tests)
- [Cypress](#execute-the-cypress-tests)
- [Contributing](#contributing)
- [Controlling interactions and costs](#controlling-interactions-and-costs)
- [See also](#see-also)
Expand Down Expand Up @@ -114,27 +114,69 @@ yarn test:unit
### Running E2E tests

Both test cases for the NodeJS environment and the browser (cypress) require preparation of a test environment of the
Golem Network with Providers and all the necessary infrastructure. [Goth](https://github.com/golemfactory/goth)
framework is used for this purpose.
Golem Network with Providers and all the necessary infrastructure.

To enable E2E testing, you need to ensure that `python -m goth` is executable. Therefore, you must first
install [Goth](https://github.com/golemfactory/goth) according to the instructions described in the readme of the
project.
#### Prerequisites

#### NodeJS
1. Ensure you have `docker` and `docker-compose` installed in your system.
2. Your Linux environment should have nested virtualization enabled.

```bash
npm run test:e2e
# or
yarn test:e2e
#### Test Environment Preparation

Follow these steps to prepare your test environment:

##### Build Docker Containers

First, build the Docker containers using the `docker-compose.yml` file located under `tests/e2e`.

Execute this command to build the Docker containers:

docker compose -f tests/e2e/docker-compose.yml build

##### Start Docker Containers

Then, launch the Docker containers you've just built using the same `docker-compose.yml` file.

Execute this command to start the Docker containers:

docker compose -f tests/e2e/docker-compose.yml down && docker compose -f tests/e2e/docker-compose.yml up -d

##### Fund the Requestor

The next step is to fund the requestor.

docker exec -t e2e-requestor-1 /bin/sh -c "/golem-js/tests/e2e/fund-requestor.sh"

##### Install and Build the SDK

Finally, install and build the golem-js SDK in the Docker container

Run this chain of commands to install and build the SDK and prepare cypress.

```docker
docker exec -t e2e-requestor-1 /bin/sh -c "cd /golem-js && npm i && npm run build && ./node_modules/.bin/cypress install"
```

#### Cypress
#### Execute the E2E Tests

```bash
npm run test:cypress
# or
yarn test:cypress
With your test environment set up, you can now initiate the E2E tests. Run the following command to start:

```docker
docker exec -t e2e-requestor-1 /bin/sh -c "cd /golem-js && npm run test:e2e"
```

#### Execute the cypress Tests

First make sure that the webserver that's used for testing is running, by running the command

```docker
docker exec -t -d e2e-requestor-1 /bin/sh -c "cd /golem-js/examples/web && node app.mjs"
```

Now you're ready to start the cypress tests by running the command

```docker
docker exec -t e2e-requestor-1 /bin/sh -c "cd /golem-js && npm run test:cypress -- --browser chromium"
```

### Contributing
Expand Down

0 comments on commit 5acd5a2

Please sign in to comment.