diff --git a/docs/composer/plugin/drupal-dev-environment/index.md b/docs/composer/plugin/drupal-dev-environment/index.md index 419e051d1fc02b1e0be950ed838ed07e97d2763c..492449782c3260b87c7dbf49702b468038aed0b3 100644 --- a/docs/composer/plugin/drupal-dev-environment/index.md +++ b/docs/composer/plugin/drupal-dev-environment/index.md @@ -34,6 +34,7 @@ This will print out a list with all available tools: - [PHP Metrics](../../../dev_tools/test.md#php-metrics) - [Stylelint](../../../dev_tools/test.md#stylelint) - [Eslint](../../../dev_tools/test.md#es-lint) +- [Cspell](../../../dev_tools/test.md#cspell) ## Working with Themes diff --git a/docs/dev_tools/test.md b/docs/dev_tools/test.md index d6bbd7c34467b3285d9029f7e758f50b562ba3c9..67b46d6657e6fd0899ee8456fc29db14f9eb4b41 100644 --- a/docs/dev_tools/test.md +++ b/docs/dev_tools/test.md @@ -13,6 +13,7 @@ code analysis to unit testing. You also have to set up your environment with the tool [l3d](../docker/l3d/index.md). The composer plugin [Drupal Development Environment](../composer/plugin/drupal-dev-environment/index.md) does all the setup for you. +This can be executed out of the box using [Ahoy](../../plugin/ahoy/index.md) by using the shortcut `a`. ## Drupal Dependency Analysis @@ -97,7 +98,14 @@ You can just execute: a test phpcs-fix <contrib_module> ``` -Now th errors are gone, which saves a lot of time and effort. +Now the errors are gone, which saves a lot of time and effort. + +#### Using PHPCS in a GitLab pipeline + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). +To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project. + +Here you find more information of using [PHPCS in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/phpcs/). ### PHPStan @@ -133,6 +141,14 @@ a test phpstan <file_ordirectory> Whether it is a directory, it runs the analysis for everything under this directory recursively. +#### Using PHPStan in a GitLab pipeline + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). +To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project. + +Here you find more information of using [PHPStan in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/phpstan/). + + ### PHP Lint You can execute [PHP Lint](https://github.com/overtrue/phplint) for a specific Drupal contrib module: @@ -227,6 +243,16 @@ If you want to analyse a custom module, just do the following: a test stylelintmodule ../custom/<custom_module> ``` +#### Using Stylelint in a GitLab pipeline + + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). +To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project. + +Here you find more information of using [Stylelint in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/stylelint/). + + + ### ES Lint This is another useful tool to test your `css` files. @@ -241,6 +267,27 @@ If you want to analyse a custom module, just do the following: a test eslintmodule ../custom/<custom_module> ``` +#### Using ES Lint in a GitLab pipeline + + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). +To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project. + +Here you find more information of using [ES Lint in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/eslint/). + + + +### CSpell + +#### Using CSpell in a GitLab pipeline + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). +To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project. + +Here you find more information of using [CSpell in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/cspell/). + + + ## Unit/Kernel/Functional Testing To execute the tests, you can use a single command: @@ -288,6 +335,16 @@ arrow: You can also use the execution with the debugger. +### Using PHPUnit in a GitLab pipeline + + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). +To take advantage of the Drupal optimized pipelines we make heavy use of the [GitLab Templates](https://www.drupal.org/project/gitlab_templates) project. + +Here you find more information of using [PHPUnit in a pipeline](https://project.pages.drupalcode.org/gitlab_templates/jobs/phpunit/). + + + ### Code Coverage First, activate the coverage option: @@ -321,3 +378,52 @@ Now you can execute every test including code coverage. To check, if it is working properly, a new view for coverage should open in your IDE, like:  + +## End-to-end testing + +Most of the time a lot Drupal modules must work together, and you want to test the entire behaviour. +Therefore, we use [Cypress](https://www.cypress.io/), which is a very powerful tool to test website functionality. + +### Cypress + +You will find the official documentation [here](https://docs.cypress.io/guides/overview/why-cypress). +We recommend using [Docker for Drupal](omposer/plugin/d4d/) to install cypress, so you will benefit form the great +and easy Drupal integration. You also get the corresponding [Ahoy](composer/plugin/ahoy/) commands out of the box. +Make sure the Docker container inside [l3D](docker/l3d/) for Drupal are running, and you can start Cypress by + +```cypress +a cypress on +``` + +The container starts, and you will see the Cypress UI in a few seconds: + + + +The tests must be located in `<drupal_root>/tests/cypress/e2e` and will be automatically loaded. + +As a useful convenience we provide a `commands.js` file, which is available all the time. You find it +[here](https://gitlab.lakedrops.com/docker/cypress/-/blob/main/commands.js?ref_type=heads), and it provides a lot of helpful +functions like: + +- login +- createAndLogin +- drush +- and many more.... + +If you use Basic Auth on your website, no problem. You can pass the following two environment variables +to the Docker container: + + - CYPRESS_basicauth_user={{ your.user }} + - CYPRESS_basicauth_pass={{ your.pass }} + +Now the `visit` and all `login` functions take care for it automatically. + +#### Using Cypress in a GitLab pipeline + +The easiest way is to use our templates for a GitLab pipeline. They can be found [here](https://gitlab.lakedrops.com/gitlab-ci-cd/drupal). + +In your `.gitlab-ci.yml` you can enable a job for cypress by setting: + +```cypress +DISABLE_CI_TEST_CYPRESSE2E: 0 +``` diff --git a/docs/docker/cypress/index.md b/docs/docker/cypress/index.md index 9f410aa3d34ab599047b696186fd65bfa17db2b8..aefb3684db9d446c2f67ef8fa2af37bf6c40228d 100644 --- a/docs/docker/cypress/index.md +++ b/docs/docker/cypress/index.md @@ -9,35 +9,6 @@ tags: --- # Cypress - This Docker project contains the testing tool [Cypress](https://cypress.io/). - You will find the official documentation [here](https://docs.cypress.io/guides/overview/why-cypress). -We recommend using [Docker for Drupal](omposer/plugin/d4d/) to install cypress, so you will benefit form the great -and easy Drupal integration. You also get the corresponding [Ahoy](composer/plugin/ahoy/) commands out of the box. -Make sure the Docker container inside [l3D](docker/l3d/) for Drupal are running, and you can start Cypress by +This Docker project contains the testing tool [Cypress](https://cypress.io/). +For more information see [here](../../dev_tools/test.md#cypress). -```cypress -a cypress on -``` - -The container starts, and you will see the Cypress UI in a few seconds: - - - -The tests must be located in `<drupal_root>/tests/cypress/e2e` and will be automatically loaded. - -As a useful convenience we provide a `commands.js` file, which is available all the time. You find it -[here](https://gitlab.lakedrops.com/docker/cypress/-/blob/main/commands.js?ref_type=heads), and it provides a lot of helpful -functions like: - -- login -- createAndLogin -- drush -- and many more.... - -If you use Basic Auth on your website, no problem. You can pass the following two environment variables -to the Docker container: - - - CYPRESS_basicauth_user={{ your.user }} - - CYPRESS_basicauth_pass={{ your.pass }} - -Now the `visit` and all `login` functions take care for it automatically.