2019-10-25 14:58:59 +02:00
metadata :
name : karmaExecuteTests
description : Executes the Karma test runner
longDescription : |
In this step the ([Karma test runner](http://karma-runner.github.io)) is executed.
The step is using the `seleniumExecuteTest` step to spin up two containers in a Docker network :
* a Selenium/Chrome container (`selenium/standalone-chrome`)
2022-09-26 14:40:55 +02:00
* a NodeJS container (`node:lts-buster`)
2019-10-25 14:58:59 +02:00
In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the `hostname` properties of the test configuration ([Karma](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver](https://github.com/karma-runner/karma-webdriver-launcher#usage)).
!!! note
In a Kubernetes environment, the containers both need to be referenced with `localhost`.
spec :
inputs :
2021-04-15 13:58:23 +02:00
secrets :
- name : seleniumHubCredentialsId
type : jenkins
description : "Defines the id of the user/password credentials to be used to connect to a Selenium Hub. The credentials are provided in the environment variables `PIPER_SELENIUM_HUB_USER` and `PIPER_SELENIUM_HUB_PASSWORD`."
2019-10-25 14:58:59 +02:00
resources :
- name : buildDescriptor
type : stash
- name : tests
type : stash
params :
- name : installCommand
type : string
description : The command that is executed to install the test tool.
default : npm install --quiet
scope :
2020-08-31 16:10:28 +02:00
- GENERAL
- PARAMETERS
- STAGES
- STEPS
2019-10-25 14:58:59 +02:00
mandatory : true
2021-04-15 13:58:23 +02:00
- name : modules
type : "[]string"
description : Define the paths of the modules to execute tests on.
default : [ "." ]
2019-10-25 14:58:59 +02:00
scope :
2020-08-31 16:10:28 +02:00
- PARAMETERS
- STAGES
- STEPS
2019-10-25 14:58:59 +02:00
mandatory : true
- name : runCommand
type : string
description : The command that is executed to start the tests.
default : npm run karma
scope :
2020-08-31 16:10:28 +02:00
- GENERAL
- PARAMETERS
- STAGES
- STEPS
2019-10-25 14:58:59 +02:00
mandatory : true
2022-01-24 13:06:35 +02:00
outputs :
resources :
- name : reports
type : reports
params :
- filePattern : "**/TEST-*.xml"
type : karma
- filePattern : "**/cobertura-coverage.xml"
type : karma
- filePattern : "**/TEST-*.xml"
type : junit
- filePattern : "**/jacoco.xml"
type : jacoco-coverage
- filePattern : "**/cobertura-coverage.xml"
type : cobertura-coverage
- filePattern : "**/xmake_stage.json"
type : xmake
- filePattern : "**/requirement.mapping"
type : requirement-mapping
2019-10-25 14:58:59 +02:00
containers :
2019-11-08 12:28:42 +02:00
- name : karma
2022-09-26 14:40:55 +02:00
image : node:lts-buster
2019-11-08 12:28:42 +02:00
env :
2020-08-31 16:10:28 +02:00
- name : no_proxy
value : localhost,selenium,$no_proxy
- name : NO_PROXY
value : localhost,selenium,$NO_PROXY
2021-04-16 15:18:34 +02:00
- name : "PIPER_SELENIUM_HOSTNAME"
value : "karma"
- name : "PIPER_SELENIUM_WEBDRIVER_HOSTNAME"
value : "selenium"
- name : "PIPER_SELENIUM_WEBDRIVER_PORT"
value : "4444"
2019-11-08 12:28:42 +02:00
workingDir : /home/node
2019-10-25 14:58:59 +02:00
volumeMounts :
2020-08-31 16:10:28 +02:00
- mountPath : /dev/shm
name : dev-shm
2019-10-25 14:58:59 +02:00
sidecars :
2020-08-31 16:10:28 +02:00
- image : selenium/standalone-chrome
name : selenium
securityContext :
privileged : true
volumeMounts :
- mountPath : /dev/shm
name : dev-shm
env :
- name : "NO_PROXY"
value : "localhost,karma,$NO_PROXY"
- name : "no_proxy"
value : "localhost,selenium,$no_proxy"