Basic Cypress Framework Example
Below is a basic workflow for executing a Cypress project which is available
on GitHub. You can paste this directly into the YAML of an existing or new test, just make
sure to update the name
and namespace
for your environment if needed.
- The
spec.content
property defines the location of the GitHub project. - The
spec.steps
property defines a single step that runs the test and uploads the created reports.
Basic Cypress Workflow
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: cypress-sample
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/cypress/executor-tests/cypress-13
container:
workingDir: /data/repo/test/cypress/executor-tests/cypress-13
steps:
- name: Run tests
run:
image: cypress/included:13.6.4
args:
- --env
- NON_CYPRESS_ENV=NON_CYPRESS_ENV_value
env:
- name: CYPRESS_CUSTOM_ENV
value: CYPRESS_CUSTOM_ENV_value
artifacts:
paths:
- 'cypress/videos/**/*'
- 'cypress/screenshots/**/*'
After execution, you can see the output from the test executions under the executions panel tabs:
- Log Output
- Artifacts
The log output from the Cypress Framework execution:
The uploaded report is available in the Artifacts tab:
Basic Cypress from Template
Below is an example workflow for executing the Cypress project using an official Testkube Template.
Basic Cypress Workflow from Template
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: cypress-sample-from-template
namespace: testkube
labels:
docs: example
spec:
container:
workingDir: /data/repo/test/cypress/executor-tests/cypress-13
env:
- name: CYPRESS_CUSTOM_ENV
value: "CYPRESS_CUSTOM_ENV_value"
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- test/cypress/executor-tests/cypress-13
steps:
- name: Run from template
workingDir: /data/repo/test/cypress/executor-tests/cypress-13
template:
name: official/cypress/v1
config:
version: 13.6.4
run: "npx cypress run --env NON_CYPRESS_ENV=NON_CYPRESS_ENV_value"
artifacts:
paths:
- 'cypress/videos/**/*'
- 'cypress/screenshots/**/*'