Skip to content

Commit

Permalink
Update testing.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti authored Oct 10, 2023
1 parent 1d4491d commit 732287a
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions documentation/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,40 @@ See https://gitlab.com/weitzman/drupal-test-traits for more information.

## Functional JavaScript tests

To run Functional JS tests on local environment, you must start your local environment with `testing` compose profile.
### Local environment

You can either modify your project's `.env` file and append `testing` to `COMPOSE_PROFILES` environment variable, or start the project with `COMPOSE_PROFILES=testing make up`.
Make sure your `docker-compose.yml` file contains `artemis` service and the `app` service has `SIMPLETEST_BASE_URL: "http://app:8888"` environment variable:
```yaml
services:
app:
environments:
SIMPLETEST_BASE_URL: "http://app:8888"
artemis:
container_name: "${COMPOSE_PROJECT_NAME}-artemis"
image: quay.io/artemiscloud/activemq-artemis-broker
environment:
AMQ_EXTRA_ARGS: "--nio --user admin --password admin"
depends_on:
- app
networks:
- internal
profiles:
- queue
chromium:
# @todo Update this to newer version once minkphp supports Selenium 4.
# @see https://github.com/minkphp/MinkSelenium2Driver/pull/372
image: selenium/standalone-chrome:106.0
networks:
- internal
profiles:
- testing
```

Then start your local environment with `testing` compose profile. You can either modify your project's `.env` file and append `testing` to `COMPOSE_PROFILES` environment variable, or start the project with `COMPOSE_PROFILES=testing make up`.

In order for this to work, the `chromium` container must be able to connect back to `app` container, so `$SIMPLETEST_BASE_URL` must be something that `chromium` container can connect to.

For example `SIMPLETEST_BASE_URL=http://app:8888`, then start the Drush server with `drush rs $SIMPLETEST_BASE_URL --dns`.
For example, if you use Drush runserver to run tests, you must start the the Drush server with `--dns` flag: `drush rs $SIMPLETEST_BASE_URL --dns`.

## GitHub Actions

Expand Down

0 comments on commit 732287a

Please sign in to comment.