Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WDIO Buildkite Pipeline Steps - STUI to Webdriver SG Blog
# Our main deployment pipeline will trigger selected WebdriverIO tests to run on this pipeline
# OR we can also use these pipeline steps to run with certain environment variable configurations if
# we wanted to run these steps in a scheduled test pipeline
steps:
- label: ":docker: Build UITests Docker Image"
command:
# Build the Docker image with the frontend application/test code
- docker-compose -f docker-compose.uitests.yml build uitests
# We need to tag latest and a unique version tag using the Buildkite build ID on the container
# to pull it down in another step and each step can possibly run on a different node
- docker tag <private_docker_registry>/uitests$${PIPELINE_SUFFIX}:$${VERSION} <private_docker_registry>/uitests$${PIPELINE_SUFFIX}:latest
# Push images to private registry with Buildkite versioning and latest tags
- docker push <private_docker_registry>/uitests$${PIPELINE_SUFFIX}:$${VERSION}
- docker push <private_docker_registry>/uitests$${PIPELIEN_SUFFIX}:latest
env:
# Adds unique version tag so we can reference the tagged Docker image in future steps
# BUILDKITE_BUILD_ID env variable is already set for us
VERSION: "$BUILDKITE_BUILD_ID"
# This appends the pipeline suffix like _name to the Docker image name
# This is set in the Buildkite pipeline settings through the UI
# or through exported environment variables when triggered from another pipeline
PIPELINE_SUFFIX: "$UITESTPIPELINE"
- wait
- label: ":selenium: :chromium: Run Webdriver tests against Chrome"
command:
# Pull the specific Buildkite version of the image in case multiple jobs are run at the same time and latest is overwritten or this step
# is run on a different node
- docker pull <private_docker_registry>/uitests$${PIPELINE_SUFFIX}:$${VERSION}
# Start up Chrome and run Webdriver tests; the exit code from Webdriver tests will be outputted for success or failure build
- docker-compose -f docker-compose.uitests.yml up -d
- docker-compose -f docker-compose.uitests.yml exec uitests /bin/bash -c "npm run uitest:cicd:$$UITESTENV -- --suite $$UITESTSUITE"
# Buildkite allows us to access the error screenshots from Webdriver tests in the Docker container as artifacts
artifact_paths:
- errorShots/*
- reports/**/*
env:
# UITESTSUITE and UITESTENV are set through either the Buildkite settings or from a triggered pipeline's env
VERSION: "$BUILDKITE_BUILD_ID"
PIPELINE_SUFFIX: "$UITESTPIPELINE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.