I've an error on circleci that i'm not able to understand. It says that Chrome version must be between 70 and 73 when using selenium chrome webdriver.
[21:58:05] I/downloader - curl -o/home/circleci/project/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.45.zip https://chromedriver.storage.googleapis.com/2.45/chromedriver_linux64.zip
[21:58:05] I/update - chromedriver: unzipping chromedriver_2.45.zip
[21:58:05] I/update - chromedriver: setting permissions to 0755 for /home/circleci/project/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.45
[21:58:05] I/launcher - Running 1 instances of WebDriver
[21:58:05] I/direct - Using ChromeDriver directly...
[21:58:06] E/launcher - session not created: Chrome version must be between 70 and 73
(Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.4.0-141-generic x86_64)
[21:58:06] E/launcher - SessionNotCreatedError: session not created: Chrome version must be between 70 and 73
(Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.4.0-141-generic x86_64)
at Object.checkLegacyResponse (/home/circleci/project/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/home/circleci/project/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/home/circleci/project/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
at Function.createSession (/home/circleci/project/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/home/circleci/project/node_modules/selenium-webdriver/chrome.js:761:15)
at Direct.getNewDriver (/home/circleci/project/node_modules/protractor/built/driverProviders/direct.js:77:33)
at Runner.createBrowser (/home/circleci/project/node_modules/protractor/built/runner.js:195:43)
at q.then.then (/home/circleci/project/node_modules/protractor/built/runner.js:339:29)
at _fulfilled (/home/circleci/project/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/home/circleci/project/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/home/circleci/project/node_modules/q/q.js:796:13)
at /home/circleci/project/node_modules/q/q.js:556:49
at runSingle (/home/circleci/project/node_modules/q/q.js:137:13)
[21:58:06] E/launcher - Process exited with error code 199
An unexpected error occurred: undefined
my circleci config file
version: 2
jobs:
build:
docker:
- image: circleci/node:8.11-browsers
working_directory: ~/project
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm run lint
- run: npm run e2e
Any idea of what is happening ?
This isn't a problem specific to Circle CI. I was receiving it on my regular IDE setup. The issue is that your chromedriver no longer matches the browser version.
Steps to fix (I'm using Mac OSX):
- Upgrade your chrome browser to latest: currently 74
- Upgrade your chromedriver to latest: you can manually download it from their site, or if installed via brew cask just run brew cask upgrade
This worked for me. In circle.yml
- run:
name: Install Chrome
command: |
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
Other solutions like using -browsers docker images does not work now
One idea would be to download and install the latest Chrome in the .circleci/config.yml file (similar to #andriy-baran's comment). However, that might use up your build time unless there's a way to cache the Chrome engine directory together with its dependencies.
Check your Chrome version Help -> About Google Chrome.
Download the matching Chromedriver from http://chromedriver.chromium.org/downloads
Should solve the issue.
Related
I am using CircleCI with a GameCI docker image in order to build a Unity project. The build works, but I am trying to make use of the h-matsuo/github-release orb in order to create a release on GitHub for the build. I have created a new separate job for this, so I needed to share data between the jobs. I am using persist_to_workspace in order to do that, as specified in the documentation, but the solution doesn't seem to work. I get the following error:
Could not ensure that workspace directory /root/project/Zipped exists
For the workspace persist logic, I've added the following lines of code in my config.yml file:
working_directory: /root/project - Inside the executor of the main job
persist_to_workspace - As a last command inside my main job's steps
attach_workspace - As a beginning command inside my second job's steps
Here's my full config.yml file:
version: 2.1
orbs:
github-release: h-matsuo/github-release#0.1.3
executors:
unity_exec:
docker:
- image: unityci/editor:ubuntu-2019.4.19f1-windows-mono-0.9.0
environment:
BUILD_NAME: speedrun-circleci-build
working_directory: /root/project
.build: &build
executor: unity_exec
steps:
- checkout
- run: mkdir -p /root/project/Zipped
- run:
name: Git submodule recursive
command: git submodule update --init --recursive
- run:
name: Remove editor folder in shared project
command: rm -rf ./Assets/Shared/Movement/Generic/Attributes/Editor/
- run:
name: Converting Unity license
command: chmod +x ./ci/unity_license.sh && ./ci/unity_license.sh
- run:
name: Building game binaries
command: chmod +x ./ci/build.sh && ./ci/build.sh
- run:
name: Zipping build
command: apt update && apt -y install zip && zip -r "/root/project/Zipped/build.zip" ./Builds/
- store_artifacts:
path: /root/project/Zipped/build.zip
- run:
name: Show all files
command: find "$(pwd)"
- persist_to_workspace:
root: Zipped
paths:
- build.zip
jobs:
build_windows:
<<: *build
environment:
BUILD_TARGET: StandaloneWindows64
release:
description: Build project and publish a new release tagged `v1.1.1`.
executor: github-release/default
steps:
- attach_workspace:
at: /root/project/Zipped
- run:
name: Show all files
command: sudo find "/root/project"
- github-release/create:
tag: v1.1.1
title: Version v1.1.1
description: This release is version v1.1.1.
file-path: ./build.zip
workflows:
version: 2
build:
jobs:
- build_windows
- release:
requires:
- build_windows
Can somebody help me with this please?
If somebody ever encounters the same issue, try to avoid making use of the /root path. I've stored the artifacts somewhere inside /tmp/, and before storing artifacts, I've manually created the folder with chmod 777 by using mkdir with the -m flag to specify chmod permissions.
I am trying to integrate protractor e2e tests on my circleCi with the following setup:
config.yml
- run:
name: NPM test
command: |
cd frontend
npm install
apk update
apk add chromium
export CHROME_BIN=$(which chromium-browser)
npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI --code-coverage || exit 0
- run:
name: Protractor e2e tests
command: |
cd frontend
npm run e2e -- --protractor-config=./e2e/protractor-ci.conf.js
protractor config:
const config = require('./protractor.conf').config;
config.capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--no-sandbox']
}
};
exports.config = config;
Unit test run with success, although e2e tests are not running:
[10:12:58] I/file_manager - creating folder /root/project/frontend/node_modules/protractor/node_modules/webdriver-manager/selenium
[10:12:58] I/config_source - curl -o/root/project/frontend/node_modules/protractor/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/
ℹ 「wdm」: Compiled successfully.
[10:12:58] I/downloader - curl -o/root/project/frontend/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_81.0.4044.69.zip https://chromedriver.storage.googleapis.com/81.0.4044.69/chromedriver_linux64.zip
[10:12:59] I/update - chromedriver: unzipping chromedriver_81.0.4044.69.zip
[10:12:59] I/update - chromedriver: setting permissions to 0755 for /root/project/frontend/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_81.0.4044.69
[10:12:59] I/launcher - Running 1 instances of WebDriver
[10:12:59] I/direct - Using ChromeDriver directly...
[10:12:59] E/launcher - spawn /root/project/frontend/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_81.0.4044.69 ENOENT
[10:12:59] E/launcher - Error: spawn /root/project/frontend/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_81.0.4044.69 ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
at onErrorNT (internal/child_process.js:421:16)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
[10:12:59] E/launcher - Process exited with error code 199
An unexpected error occurred: undefined
Setup:
Angular CLI: 7.3.9
Node: 10.19.0
Protractor: 5.4.3
Already tried:
- Update webdriver before the tests started.
- Already check thatc hromedriver_81.0.4044.69 file is on the folder of the error
I want to cache the Android NDK in my Github Actions workflow. The reason is that I require a specific version of the NDK and CMake which aren't pre-installed on MacOS runners.
I tried to use the following workflow job to achieve this:
jobs:
build:
runs-on: macos-latest
steps:
- name: Cache NDK
id: cache-primes
uses: actions/cache#v1
with:
path: ${{ env.ANDROID_NDK_HOME }}
key: ${{ runner.os }}-ndk-${{ hashFiles(env.ANDROID_NDK_HOME) }}
- name: Install NDK
run: echo "y" | $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.0.6113669" "cmake;3.10.2.4988404"
The problem with this is that the env context doesn't contain the ANDROID_NDK_HOME variable. So this means build.steps.with.path evaluates empty.
The regular environment variable is present and prints the correct path if I debug using the following step:
jobs:
build:
steps:
- name: Debug print ANDROID_NDK_HOME
run: echo $ANDROID_NDK_HOME
But the regular environment variable can only be used in shell scripts and not in build.steps.with as far as I understand.
- name: Prepare NDK dir for caching ( workaround for https://github.com/actions/virtual-environments/issues/1337 )
run: |
sudo mkdir -p /usr/local/lib/android/sdk/ndk
sudo chmod -R 777 /usr/local/lib/android/sdk/ndk
sudo chown -R $USER:$USER /usr/local/lib/android/sdk/ndk
- name: NDK Cache
id: ndk-cache
uses: actions/cache#v2
with:
path: /usr/local/lib/android/sdk/ndk
key: ndk-cache-21.0.6113669-v2
- name: Install NDK
if: steps.ndk-cache.outputs.cache-hit != 'true'
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669"
Here is a config I use in my project.
Couple of note:
You need to create ndk directory and change permission to workaround https://github.com/actions/virtual-environments/issues/1337
Make sure
you use proper id (ndk-cache in example above) in if statement so
you can actually use cache
You can easily specify the NDK installation directory to be cached.
- name: Cache (NDK)
uses: actions/cache#v2
with:
path: ${ANDROID_HOME}/ndk/21.0.6113669
key: ndk-cache
- name: Install NDK
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install 'ndk;21.0.6113669'
As long as you're using an NDK version that is pre-installed with Github Actions runners, then you no longer need to worry about caching your NDK :)
Find the runners list here:
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software
Example runner list:
https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
For the Ubuntu 22.04 runner, it comes with three NDKs pre-installed
23.2.8568313
24.0.8215888
25.2.9519653 (default)
I have recently built a selenium test project. Now i want to host it on circle CI.
Can someone please provide me the step by step details with the configuration file.
I already have a Github and circle CI account. Im new to this integration aspect.
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk-stretch-browsers
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
- run: mkdir test-reports
- run:
name: Download Selenium
command: |
curl -O http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar
- run:
name: Start Selenium
command: |
java -jar selenium-server-standalone-3.5.3.jar -log test-reports/selenium.log
background: true
- run: mvn dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
# run tests!
- run: mvn clean integration-test
- run:
name: Save test results
command: |
mkdir -p ~/testng/results/
find . -type f -regex "./test-output/testng-results.xml" -exec cp {} ~/testng/results/ \;
when: always
- store_test_results:
path: ~/testng/results/
- store_artifacts:
path: ~/testng/results/
- store_artifacts:
path: testng/results/
After a lot of digging the internet I was finally able to create my own config file. I searched crazily but I could'nt anthying for testng. I started building from scratch. Hopefully this helps someone in the future.
I'm trying to build a pipeline for a gradle java app which is using an embedded mongo instance. I have built a container to which has java and mongo. However, I keep getting the following error for all my test that require the embedded mongo instance.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer'
defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]:
Invocation of init method failed; nested exception is java.io.IOException:
Cannot run program "/tmp/extract-f816c11c-614b-46d7-ad29-68923ca9d624extractmongod": error=2, No such file or directory
My gitlab-ci.yml looks like this:
image: java:latest
services:
- docker:dind
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
DOCKER_DRIVER: overlay
SPRING_PROFILES_ACTIVE: gitlab-ci
stages:
- build
- test
build:
stage: build
script: ./gradlew --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
test:
stage: test
image: registry.gitlab.com/path/to/explorer-ci:1.0.0
script: ./gradlew check --debug
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
The build job works fine, the test job fails. My explorer-ci container is built using the following Dockerfile
FROM openjdk:8-jdk-alpine
RUN apk update && \
apk add --no-cache \
mongodb \
bash
VOLUME /data/db
VOLUME log
RUN ["mongod", "--smallfiles", "--fork", "--logpath", "log/mongodb.log"]
I've spent a week with a bunch of different configs but can't seem to hack it. Just to note, builds/tests run fine on my local machine. Any ideas of what I'm doing wrong?
On reflection, as I am using an embedded mongo instance, I do not have a dependency on mongodb to build or test. I am now using the following gitlab-ci.yaml and it works fine.
image: openjdk:8-jdk
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
DOCKER_DRIVER: overlay
SPRING_PROFILES_ACTIVE: gitlab-ci
stages:
- build
- test
build:
stage: build
script: ./gradlew --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
test:
stage: test
script: ./gradlew check
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
The issue was on base docker image for your project runner, You need to use jdk version not alpine.
Try to change base image to this image: openjdk:8-jdk and it will work fine.
In our case the solution described at Fladoodle embedded MongoDB on the issues here helped:
https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo/issues/281
In short - we added this to our Gitlab script (or do this in container setup itself if possible) before running our tests:
apk --no-cache add ca-certificates
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-bin-2.29-r0.apk
apk add glibc-2.29-r0.apk glibc-bin-2.29-r0.apk
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-i18n-2.29-r0.apk
apk add glibc-bin-2.29-r0.apk glibc-i18n-2.29-r0.apk
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
just updating the dependency should resolve:
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>2.2.0</version>
<scope>test</scope>
</dependency>