We have a workflow where initially we build the website, then we start the next jobs on the workflow to run the browser testing. Here is the figure:
We configured the website to be accessible to a specific URL, we ran the wget command to check if its running, and it returns success.
However, when running the wget command on the browser testing job, it fails because the URL is not valid. We need to connect the browser testing job to the build job.
Can you figure out how to connect the testing job to the website on the build job?
Snippet of the config.yml
version: 2.1
references:
working_directory: &working_directory "/home/docker_image/application/public_html"
container_config: &container_config
docker:
- image: cloudwaysdocker/docker_debian:php74_mariadb103
working_directory: *working_directory
dependencies:
cache_directories:
- ~/.composer/cache
- /home/docker_image/application/public_html/
jobs:
build:
<<: *container_config
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "our finger print"
- run:
name: "Add .htaccess"
command: some command
- run:
name: "Install Composer packages"
command: /usr/local/bin/composer install -n -o
- run:
name: "Import database"
environment:
DB environment
command: |
import command
- run:
name: 'Append etc/hosts'
command: echo "127.0.0.1 dev.pomcollegeconsulting.com" | tee --append /etc/hosts
- run:
name: 'Check if dev site is running'
command: wget http://dev.pomcollegeconsulting.com
# Save workspace for subsequent jobs (i.e. test)
- persist_to_workspace:
root: .
paths:
- .
test_automation:
workin g_directory: ~/automation
parameters:
env:
description: Define the TestNG xml file to test, either the STAGING(-DsuiteFile=Tests-STAGING.xml) or PROD(-DsuiteFile=Tests-PROD.xml)
type: string
default: -DsuiteFile=Tests-STAGING.xml
docker:
- image: circleci/openjdk:16-jdk-buster-browsers
steps:
- run:
name: Download Selenium
command: curl -O http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
- run:
name: Start Selenium Server
command: java -jar selenium-server-standalone-3.141.59.jar
background: true
- run:
name: 'Check if dev site is running'
command: wget http://dev.pomcollegeconsulting.com
- run:
name: Clone and run the automation repository
command: |
git clone "test repo"
cd test repo name
git fetch origin
mvn clean install << parameters.env >>
- store_test_results:
path: test repo/target/surefire-reports
- store_artifacts:
path: test repo/target/surefire-reports
workflows:
version: 2.1
test:
jobs:
- build
- test_automation:
name: DEV Chrome
env: -DsuiteFile=Tests-DEV-Chrome.xml
requires:
- build
- test_automation:
name: DEV Firefox
env: -DsuiteFile=Tests-DEV-Firefox.xml
requires:
- build