Created
March 24, 2023 18:09
-
-
Save leegilmorecode/52655ccb23b66eaf6dcac762a3b2be14 to your computer and use it in GitHub Desktop.
Example running Cypress in a CDK Pipelines pipeline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// add the feature-dev stage with the relevant environment config to the pipeline | |
// this is the test stage (beta) | |
const featureDevStage: PipelineStage = new PipelineStage( | |
this, | |
'FeatureDev', | |
{ | |
...environments.featureDev, | |
} | |
); | |
pipeline.addStage(featureDevStage, { | |
post: [ | |
new pipelines.ShellStep('HealthCheck', { | |
envFromCfnOutputs: { | |
HEALTH_CHECK_ENDPOINT: featureDevStage.healthCheckUrl, | |
}, | |
commands: ['curl -Ssf $HEALTH_CHECK_ENDPOINT'], | |
}), | |
new pipelines.ShellStep('IntegrationTests', { | |
envFromCfnOutputs: { | |
API_ENDPOINT: featureDevStage.apiEndpointUrl, | |
}, | |
// we run the postman basic api integration tests | |
commands: [ | |
'npm install -g newman', | |
'newman run ./tests/integration/integration-collection.json --env-var api-url=$API_ENDPOINT', | |
], | |
}), | |
new pipelines.ShellStep('AcceptanceTests', { | |
envFromCfnOutputs: { | |
ROUTE53_CLIENT_URL: featureDevStage.route53ClientUrl, | |
}, | |
// we run the cypress acceptance tests against beta (feature dev) | |
commands: [ | |
'apt-get update', | |
'apt-get install -y xvfb libatk-bridge2.0-0 libgbm-dev libgtk-3-0 libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2', | |
'cd ./client/', | |
'npm ci', | |
'npx cypress verify', | |
'CYPRESS_BASE_URL=https://$ROUTE53_CLIENT_URL/ npx cypress run', | |
], | |
}), | |
], | |
}); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment