We have our pipelines to run our webdriverio tests in a docker container. It works when run serially but after configuring our tests in general through the wdio conf to run tests single or multi-threaded, multi-threaded runs only works when running the tests without docker, locally only. Bitbucket pipeline runs look like threads get created but then hang until finally exiting on failure. What do I need to add/modify/remove in the pipeline yaml to run successfully? If there's anything else needed, let me know and thanks for any help and consideration!
Command structure:
STAGE=stg SOURCE_TEST_DIR=$SOURCE_TEST_DIR THREADED=true npm run tests:e2e:docker:ci
envConfig.ts:
export const Threads = process.env.THREADED === "true" ? 5 : 1; // if THREADED, run 5 threads, else default 1.
wdio docker conf:
import {Threads} from "./envConfig";
buildConfig.hostname = 'chromedriver'
buildConfig.port = 4444
// this is not really headless, but required to pass a check on login.
// it would seem that mfa-detect-browser-capabilities detects the hardware requirements
// for multifactor authentication. in docker environment the test runs in a non-headless chrome
// but behaves differently due to biometrics capability on docker container vs your own macbook
buildConfig.headless = true
buildConfig.capabilities = [{
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
// grid with only 5 firefox instances available you can make sure that not more than
// 5 instances get started at a time.
maxInstances: Threads,
... bitbucket-pipelines.yml:
image: tendocicd/pipeline_builder:latest
definitions:
scripts:
- script: &RepoPrivateKey
git config --global url."git@bitbucket.org:tendosystems".insteadOf "https://bitbucket.org/tendosystems" &&
echo "export GOPRIVATE=bitbucket.org/tendosystems/*" >> ~/.bashrc
steps:
- step: &testEndToEndInStg
artifacts:
- node_modules/**
- reports/**
name: End To End Tests in Docker Container - ChromeDriver
services:
- docker
script:
- echo ${AWS_DEFAULT_REGION}
- source docker-setup.sh
- echo SOURCE_TEST_DIR $SOURCE_TEST_DIR
- npm install
- npm run build
- mkdir reports;chmod -R 777 reports
- STAGE=stg SOURCE_TEST_DIR=$SOURCE_TEST_DIR THREADED=true npm run tests:e2e:docker:ci -- --cucumberOpts.tagExpression="@bats and not @skip"
- npm run report:generate
pipelines:
pull-requests:
'**':
- step: *testEndToEndInStg
custom:
e2e-stg:
- step: *testEndToEndInStg