Skip to content

Commit

Permalink
UHF-9099: Run functional js tests in separate container, removed chro…
Browse files Browse the repository at this point in the history
…mium and chromium-driver from CI/local images
  • Loading branch information
tuutti committed Oct 7, 2023
1 parent f4ebc4c commit 71643bf
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 22 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2023-10-07

Local and CI Docker images no longer ship with chromium/chromium-driver.

### Required actions

- Update `docker-compose.yml`, `phpunit.xml.dist` files from this repository.
- Start your project using `testing` Docker compose profile. See [documentation](/documentation/local.md) for more information.

## 2023-09-27

base.sh cron has been updated with a feature which prevents running cron during deployment process.
Expand Down
4 changes: 0 additions & 4 deletions README.project.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ This will log you inside the app container:
$ make shell
```

## Docker compose profiles

Modify the value of `COMPOSE_PROFILES` environment variable from `.env` file or start the project with `COMPOSE_RROFILES=your-profiles make up`.

## Documentation

See [documentatation](https://github.com/City-of-Helsinki/drupal-helfi-platform/tree/main/documentation).
12 changes: 11 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
# DOCKERHOST: host.docker.internal
# Use drush server to run functional tests, so we don't have to care about
# permission or SSL issues.
SIMPLETEST_BASE_URL: "http://127.0.0.1:8888"
SIMPLETEST_BASE_URL: "http://app:8888"
SIMPLETEST_DB: "mysql://drupal:drupal@db:3306/drupal"
BROWSERTEST_OUTPUT_BASE_URL: "https://${DRUPAL_HOSTNAME}"
DRUPAL_VARNISH_HOST: "${COMPOSE_PROJECT_NAME}-varnish"
Expand Down Expand Up @@ -122,10 +122,20 @@ services:
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
networks:
internal:
external: false
Expand Down
6 changes: 4 additions & 2 deletions documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

[Basic installation instructions (in Finnish)](/documentation/installation.md)

## Infrastructure
## Infrastructure documentation

- [Infrastructure documentation (OpenShift)](/documentation/openshift.md)
- [Using OpenShift origin client (OC)](/documentation/openshift-oc.md)
- [Syncing databases between environments](/documentation/openshift-db-sync.md)
- [Building assets](/documentation/build-assets.md)
- [Profiling code with Blackfire.io](/documentation/blackfire.md)
- [Queue](/documentation/queue.md)
- [Queue service](/documentation/queue.md)
- [Testing and CI](/documentation/testing.md)
- [Local environment](/documentation/local.md)

## Testing

Expand Down
2 changes: 1 addition & 1 deletion documentation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Ennen käyttöönottoa

Platform vaatii toimiakseen seuraavanlaisen ympäristön:

* PHP 8 ja Composer 2.x
* PHP 8.1+ ja Composer 2.x

* [Docker ja Stonehenge](https://github.com/druidfi/guidelines/blob/master/docs/local_dev_env.md)

Expand Down
8 changes: 8 additions & 0 deletions documentation/local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Local environment

## Docker compose profiles

Compose profiles are used to only run services that are actually needed. For example, there is no reason to start `elasticsearch` or `artemis` containers if your project is not using them.

Modify the value of `COMPOSE_PROFILES` environment variable from `.env` file or start the project with `COMPOSE_RROFILES=your-profiles make up`.

13 changes: 1 addition & 12 deletions documentation/queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ Apache Artemis is used to manage Drupal queues.

## Configuration

Add and expose the following environment variables:

```bash
# This should be something like 'tcp://route-to-artemis:61613'.
ARTEMIS_BROKERS
# The username of Artemis service.
ARTEMIS_LOGIN
# The password of Artemis service.
ARTEMIS_PASSCODE
```

@todo: Figure out where to find these values.
@todo: Figure out what configuration is required.

## Running queues

Expand Down
21 changes: 21 additions & 0 deletions documentation/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Testing

## Drupal tests

Tests can be run with `vendor/bin/phpunit -c /app/phpunit.xml.dist /path/to/test`.

### Functional tests

Functional tests are run using build-in Drush webserver.

The server should be started automatically on local environment, in case it's not, you can run it with something like `drush rs $SIMPLETEST_BASE_URL --dns`.

### Functional JavaScript tests

To run Functional JS tests, you must 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`.

## CI tests

@todo
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<!-- Do not limit the amount of memory tests take to run. -->
<ini name="memory_limit" value="-1"/>
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value="public/sites/simpletest"/>
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"w3c": false, "args":["--disable-gpu","--headless", "--no-sandbox"]}}, "http://127.0.0.1:4444"]' />
<env name="DTT_MINK_DRIVER_ARGS" value='["chrome", {"chromeOptions":{"w3c": false }}, "http://127.0.0.1:4444"]'/>
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"w3c": false}}, "http://chromium:4444/wd/hub"]' />
<env name="DTT_MINK_DRIVER_ARGS" value='["chrome", {"chromeOptions":{"w3c": false }}, "http://chromium:4444/wd/hub"]'/>
<env name="DTT_API_OPTIONS" value='{"socketTimeout": 360, "domWaitTimeout": 3600000}' />
<env name="DTT_API_URL" value="http://127.0.0.1:9222"/>
<env name="DTT_BASE_URL" value="http://127.0.0.1:8888"/>
Expand Down

0 comments on commit 71643bf

Please sign in to comment.