Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8708: Updated doc section in ibexa/behat repository #122

Merged
merged 5 commits into from
Sep 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions doc/running_tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,40 @@

## Configuration

In order to use BehatBundle you need to use `behat` Symfony environment (which is defined in eZ Platform by default). It is also recommended to run in enabled debug mode, which gives you more detailed browser screenshots in case of failure.
In order to use BehatBundle you need to use `behat` Symfony environment (which is defined in Ibexa by default). It is also recommended to run in enabled debug mode, which gives you more detailed browser screenshots in case of failure.

The standard behat configuration file is [behat.yml.dist](https://github.com/ezsystems/ezplatform/blob/2.5/behat.yml.dist), located in eZ Platform's main directory. There you can:
The standard behat configuration file is [behat_ibexa_oss.yaml](https://github.com/ibexa/behat/blob/4.6/behat_ibexa_oss.yaml), located in ibexa/behat directory. There you can:
- in the `Behat\MinkExtension` section:
- set the URL of your website for browser testing (`base_url` parameter)
- set driver configuration (for example `wd_host` for Selenium Server)
- see [MinkExtension documentation](https://github.com/Behat/MinkExtension/blob/master/doc/index.rst) for more information
- in the `Bex\Behat\ScreenshotExtension` section:
- set your Cloudinary account details (`cloud_name` and `preset` parameter) to specify where the screenshots are uploaded
- see [Cloudinary screenshot driver doc](https://github.com/ezsystems/behat-screenshot-image-driver-cloudinary/blob/master/README.md) for more details about the Cloudinary integration and [elvetemedve/behat-screenshot](https://github.com/elvetemedve/behat-screenshot) for other screenshots configuration options
- in the `Behat\Symfony2Extension` section:
- set Symfony environment (`env` parameter)
- enable Symfony debug (`debug` parameter)
- See [Symfony2Extension documentation](https://github.com/Behat/Symfony2Extension/blob/master/doc/index.rst) for more information

Behat profiles and suites are not defined in this file, but imported from files specified at the bottom.
Behat profiles and suites are not defined in this file, but imported from files specified at the top.

### Running browser tests

If you want to run browser tests you need to have Selenium Server runnning. One way of doing this is running our Docker stack, which has built-in support for it: see [eZ Platform Docker blueprints](https://github.com/ezsystems/ezplatform/blob/master/doc/docker/README.md#behat-and-selenium-use) documentation for more information.
If you want to run browser tests you need to have Selenium Server runnning. One way of doing this is running our Docker stack, which has built-in support for it: see [Ibexa Docker blueprints](https://github.com/ibexa/docker/blob/4.6/README.md#behat-and-selenium-use) documentation for more information.

Another way is to use the Selenium Server Docker container and setting it up manually. Look at [ezplatform's .env file](https://github.com/ezsystems/ezplatform/blob/master/.env#L17) for the currently used version.
Another way is to use the Selenium Server Docker container and setting it up manually. Look at [manifest.json file](https://github.com/ibexa/recipes-dev/blob/master/ibexa/docker/4.6/manifest.json#L23) for the currently used version.

It can be set up using:
`docker run -p 4444:4444 -p 5900:5900 --shm-size=1gb -d --name=containerName selenium/standalone-chrome-debug:3.141.59`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selenium image is 4 years old, maybe lets add here link for https://github.com/SeleniumHQ/docker-selenium 🤔


Where:
- 4444 is the port where Selenium Server will be accessible
- 5900 is the port where the VNC client is accessible (to preview running tests)
- shm-size is related to Chrome containers requiring more memory (see [Selenium container configuration](https://github.com/ezsystems/ezplatform/blob/master/doc/docker/selenium.yml#L16))
- shm-size is related to Chrome containers requiring more memory (see [Selenium container configuration](https://github.com/ibexa/docker/blob/4.6/docker/selenium.yml#L19))

After the container is set up correctly you need to adjust the configuration of `selenium2` driver in `behat.yml.dist` file
After the container is set up correctly you need to adjust the configuration of `selenium2` driver in `behat_ibexa_oss.yaml` file

## Running tests

### Running standard Behat tests

BehatBundle comes with a wrapper for the standard Behat runner: [ibexabehat](../bin/ibexabehat.sh) to make running tests in parallel easier.
BehatBundle comes with a wrapper for the standard Behat runner: [ibexabehat](https://github.com/ibexa/behat/blob/4.6/bin/ibexabehat) to make running tests in parallel easier.

Use:
```
Expand All @@ -57,7 +53,7 @@ Running Behat feature files in parallel (on the available number of CPUs) is the

## Existing test profiles and suites

By convention profiles and suites are defined in the `behat_suites.yml` file in each bundle, if they exist. See [BehatBundle suites](../behat_suites.yml) and [AdminUI suites](https://github.com/ezsystems/ezplatform-admin-ui/blob/master/behat_suites.yml) for examples.
By convention profiles and suites are defined in the `behat_suites.yml` file in each bundle, if they exist. See [BehatBundle suites](../behat_suites.yml) and [AdminUI suites](https://github.com/ibexa/admin-ui/blob/4.6/behat_suites.yml) for examples.

In order to run them, execute:
- `bin/ibexabehat --profile=behat --suite=examples` (BehatBundle usage examples)
Expand Down
Loading