Travis CI - android build failed. No connected devices error - java

Trying to get started with Travis CI for my Android projects but Travis still failing while build my android project.
Reason:
:app:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Link to travis:
https://travis-ci.org/hypeapps/Episodie/builds/158706530
.travis.yml:
language: android
jdk:
- oraclejdk8
before_install:
- chmod +x gradlew
env:
global:
- ANDROID_API_LEVEL=24
- EMULATOR_API_LEVEL=21
- ANDROID_BUILD_TOOLS_VERSION=24.0.1
- ANDROID_ABI=google_apis/armeabi-v7a
- ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)
android:
components:
- tools
- tools
- platform-tools
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- android-$ANDROID_API_LEVEL
- android-$EMULATOR_API_LEVEL
- extra
- add-on
- extra-google-m2repository
- extra-android-m2repository
# Google Play Services
- extra-google-google_play_services
# Support library
- extra-android-support
- addon-google_apis-google-$ANDROID_API_LEVEL
- addon-google_apis-google-$EMULATOR_API_LEVEL
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
- sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_script:
- echo no | android create avd --force -n test -t "Google Inc.:Google APIs:"$EMULATOR_API_LEVEL --abi $ANDROID_ABI
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
Link to gradle file:
build.gradle
Github project:
GitHub

The solution is:
add line on top:
sudo: false
Create Emulator Management: Create, Start and Wait
before_script:
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
Now Travis CI works.

Related

Execution failed for task ':app:connectedDebugAndroidTest'. Gitlab CI

i am using gitlab ci to test my apk and to do that i needed a virtual device so i can test my instrumented test to take screenshots with fastlane commande but when i try to run ./gradlew connectedAndroidTest in gitlab using this pipeline
image: mingc/android-build-box:latest
stages:
- ui-test
- build
- test
variables:
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
before_script:
- chmod +x ./gradlew
- gem install fastlane
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
build:
stage: build
script:
- fastlane build
artifacts:
paths:
- "app/build/outputs/"
tags:
- docker
ui-test:
stage: ui-test
script:
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
# Add missing folder to the PATH, to use sdkmanager
- export ADB_INSTALL_TIMEOUT=30
- export USE_SDK_WRAPPER=True
# Insall and run emulator
- sdkmanager "platform-tools" "platforms;android-27" "emulator"
- sdkmanager "system-images;android-27;google_apis;arm64-v8a"
- adb devices
# Create an ARM-based emulator AVD with 250 MB SD car
- echo "no" | avdmanager create avd -n Android_7.0_API_24 -k "system-images;android-27;google_apis;arm64-v8a" -c 250M --force
# Check the image is properly created and available to run
- emulator -list-avds
- emulator -avd Android_7.0_API_24 -no-audio -no-window -gpu off &
- adb wait-for-device devices
- echo "Emulator is ready"
- adb devices
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
- ./gradlew connectedAndroidTest
- fastlane screenshots
tags:
- docker
test:
stage: test
script:
- fastlane test
tags:
- docker
I got this error even if this test got no error while i run it in android studio
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device emulator-5554
java.lang.Throwable: ShellCommandUnresponsiveException getting properties for device emulator-5554
at com.android.ddmlib.PropertyFetcher.handleException(PropertyFetcher.java:248)
at com.android.ddmlib.PropertyFetcher.access$500(PropertyFetcher.java:30)
at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:211)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:689)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:468)
at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:705)
at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:207)
[PropertyFetcher]: ShellCommandUnresponsiveException getting properties for device emulator-5554
java.lang.Throwable: ShellCommandUnresponsiveException getting properties for device emulator-5554
at com.android.ddmlib.PropertyFetcher.handleException(PropertyFetcher.java:248)
at com.android.ddmlib.PropertyFetcher.access$500(PropertyFetcher.java:30)
at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:211)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:689)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:468)
at com.android.ddmlib.internal.DeviceImpl.executeShellCommand(DeviceImpl.java:705)
at com.android.ddmlib.PropertyFetcher$1.run(PropertyFetcher.java:207)
> Task :app:connectedDebugAndroidTest
Skipping device 'Android_7.0_API_24(AVD)' for 'app:': Unknown API Level
> : No compatible devices connected.[TestRunner] FAILED
Found 1 connected device(s), 0 of which were compatible.
> Task :app:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
61 actionable tasks: 61 executed
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///builds/chaimae.bousaid/myapplication/app/build/reports/androidTests/connected/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6m 24s
Cleaning up project directory and file based variables
00:32
ERROR: Job failed: exit code 1
does any one have any idea to solve it i have been solving this error for a mounth

DB connection during integration tests works on local, but not working on Google Cloud Build

I'm deploying Java 11 REST API to GKE using GitHub, Gradle, and Docker.
The following errors are only happened on Google Cloud Build, not on the local environment. According to the error, it seems the app can't find the DB server(Google Cloud SQL) from Google Cloud Build. I tried both public and private IP, but the results were the same:
...
Step #0 - "Build": 2021-03-11 04:12:04.644 INFO 115 --- [ Test worker] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
Step #0 - "Build": 2021-03-11 04:12:35.855 ERROR 115 --- [ Test worker] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
Step #0 - "Build":
Step #0 - "Build": com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
Step #0 - "Build":
Step #0 - "Build": The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
...
Step #0 - "Build": Caused by: java.net.SocketTimeoutException: connect timed out
...
This happened after I added integration tests. The app deployed successfully after I removed the tests. So, I can remove the integration tests to avoid this issue. The thing is, I want to keep the tests if possible because there are things that we can't test with unit tests.
This is the Dockerfile I'm using for deployments to GKE. RUN gradle build --no-daemon -i --stacktrace is where the error occurs during the test task:
ARG APP_NAME=test-api
ARG GRADLE_USER_HOME_PATH=/home/gradle/cache_home/
#cache dependencies to reduce downloads
FROM gradle:6.8-jdk11 AS cache
ARG APP_NAME
ARG GRADLE_USER_HOME_PATH
WORKDIR /${APP_NAME}/
RUN mkdir -p ${GRADLE_USER_HOME_PATH}
ENV GRADLE_USER_HOME ${GRADLE_USER_HOME_PATH}
COPY --chown=gradle:gradle build.gradle /${APP_NAME}/
RUN gradle clean build --no-daemon -i --stacktrace -x bootJar
#build
FROM gradle:6.8-jdk11 AS build
ARG APP_NAME
ARG GRADLE_USER_HOME_PATH
WORKDIR /${APP_NAME}/
#Copies cached dependencies
COPY --from=cache ${GRADLE_USER_HOME_PATH} /home/gradle/.gradle/
#Copies the Java source code inside the container
COPY --chown=gradle:gradle . /${APP_NAME}/
#Compiles the code and runs unit tests (with Gradle build)
RUN gradle build --no-daemon -i --stacktrace
#Discards the Gradle image with all the compiled classes/unit test results etc.
#Starts again from the JRE image and copies only the JAR file created before
FROM openjdk:11-jre-slim
ARG APP_NAME
COPY --from=build /${APP_NAME}/build/libs/${APP_NAME}.jar /${APP_NAME}/${APP_NAME}.jar
ENTRYPOINT ["java","-jar","/test-api/test-api.jar"]
How to implement integration tests that using DB to GKE? Or maybe I need to change my approach?
I managed to solve the problem referencing this Q&A: Run node.js database migrations on Google Cloud SQL during Google Cloud Build
I had to add 2 steps(Cloud SQL Proxy and Test) on cloudbuild.yaml to use Cloud SQL Proxy. The other steps were auto-generated by GKE:
steps:
- name: gradle:6.8.3-jdk11
entrypoint: sh
args:
- '-c'
- |-
apt-get update && apt-get install -y wget \
&& wget "https://storage.googleapis.com/cloudsql-proxy/v1.21.0/cloud_sql_proxy.linux.amd64" -O cloud_sql_proxy \
&& chmod +x cloud_sql_proxy \
|| exit 1
id: Cloud SQL Proxy
- name: gradle:6.8.3-jdk11
entrypoint: sh
args:
- '-c'
- |-
(./cloud_sql_proxy -instances=<CONNECTION_NAME>=tcp:<PORT> & sleep 2) \
&& gradle test --no-daemon -i --stacktrace \
|| exit 1
id: Test
- name: gcr.io/cloud-builders/docker
args:
- build
- '-t'
- '$_IMAGE_NAME:$COMMIT_SHA'
- .
- '-f'
- $_DOCKERFILE_NAME
dir: $_DOCKERFILE_DIR
id: Build
- name: gcr.io/cloud-builders/docker
args:
- push
- '$_IMAGE_NAME:$COMMIT_SHA'
id: Push
- name: gcr.io/cloud-builders/gke-deploy
args:
- prepare
- '--filename=$_K8S_YAML_PATH'
- '--image=$_IMAGE_NAME:$COMMIT_SHA'
- '--app=$_K8S_APP_NAME'
- '--version=$COMMIT_SHA'
- '--namespace=$_K8S_NAMESPACE'
- '--label=$_K8S_LABELS'
- '--annotation=$_K8S_ANNOTATIONS,gcb-build-id=$BUILD_ID'
- '--create-application-cr'
- >-
--links="Build
details=https://console.cloud.google.com/cloud-build/builds/$BUILD_ID?project=$PROJECT_ID"
- '--output=output'
id: Prepare deploy
- name: gcr.io/cloud-builders/gsutil
args:
- '-c'
- |-
if [ "$_OUTPUT_BUCKET_PATH" != "" ]
then
gsutil cp -r output/suggested gs://$_OUTPUT_BUCKET_PATH/config/$_K8S_APP_NAME/$BUILD_ID/suggested
gsutil cp -r output/expanded gs://$_OUTPUT_BUCKET_PATH/config/$_K8S_APP_NAME/$BUILD_ID/expanded
fi
id: Save configs
entrypoint: sh
- name: gcr.io/cloud-builders/gke-deploy
args:
- apply
- '--filename=output/expanded'
- '--cluster=$_GKE_CLUSTER'
- '--location=$_GKE_LOCATION'
- '--namespace=$_K8S_NAMESPACE'
id: Apply deploy
...
And Dockerfile:
ARG APP_NAME=test-api
ARG APP_HOME=/test-api
FROM openjdk:11-jdk-slim AS build
USER root
ARG APP_HOME
WORKDIR ${APP_HOME}/
COPY . .
# test is performed from Test step from cloudbuild.yaml
RUN ./gradlew build --no-daemon -i --stacktrace -x test
FROM openjdk:11-jdk-slim
ARG APP_NAME
ARG APP_HOME
WORKDIR ${APP_HOME}/
COPY --from=build ${APP_HOME}/build/libs/${APP_NAME}.jar ./${APP_NAME}.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/test-api/test-api.jar"]
While I solved the questioned problem, this script has a little problem: there will be 2 separate Gradle dependencies downloads(Test and Build). I couldn't manage to use Cloud SQL Proxy on gcr.io/cloud-builders/docker, so I workaround by using the Test step instead of the Build step. Maybe this can be solved using either docker run --network="host" or host.docker.internal, but I didn't try.

Google Cloud Debugger can't find Spring Boot web app deployed as Cloud Run service

I followed the guide (https://cloud.google.com/debugger/docs/setup/java#cloud-run) to setup the cloud debugger for my cloud run services. Everything looks like it should work. However the debugger UI tells me it can not find any application.
However I did everything that was suugested in the documentation
Source code is in Source Repositories
Cloud Build triggers on master push
I download the cdbg-java-agent.so
I run the java application with the -agentpath option
Cloud Run service is being deployed via cloudbuild.yaml
Cloud Run service starts healthy and works
However as you can see in the screenshot my application can not be found after successful deployment.
Here are some details of my configuration:
Spring Boot v2.4.2
Kotlin 1.4.21
This is my Dockerfile
FROM gradle:6.7.0-jdk14 as build
USER root
WORKDIR /dist
ADD . /dist
RUN gradle assemble
FROM alpine as agent
USER root
WORKDIR /agent
RUN wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | tar xvz
FROM openjdk:14-slim
WORKDIR /app
COPY --from=agent /agent/cdbg_java_agent.so agent.so
COPY --from=build /dist/build/libs/user-service.jar app.jar
EXPOSE 8080
CMD ["java", "-agentpath:/app/agent.so", "-Dcom.google.cdbg.breakpoints.enable_canary=false", "-jar", "app.jar"]
Here is the docker build output
Deploying '<unknown> Dockerfile: Dockerfile'...
Building image...
Preparing build context archive...
[==================================================>]1855/1855 files
Done
Sending build context to Docker daemon...
[==================================================>] 76.19MB
Done
Step 1/15 : FROM gradle:6.7.0-jdk14 as build
---> 5af4d25725b2
Step 2/15 : USER root
---> Using cache
---> c97e9145e3e1
Step 3/15 : WORKDIR /dist
---> Using cache
---> 468fff36a2e7
Step 4/15 : ADD . /dist
---> c435bd2ffde9
Step 5/15 : RUN gradle assemble
---> Running in 70f5c69b7dde
Welcome to Gradle 6.7!
Here are the highlights of this release:
- File system watching is ready for production use
- Declare the version of Java your build requires
- Java 15 support
For more details see https://docs.gradle.org/6.7/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileKotlin
> Task :compileJava NO-SOURCE
> Task :processResources
> Task :classes
> Task :bootJarMainClassName
> Task :bootJar
> Task :inspectClassesForKotlinIC
> Task :jar SKIPPED
> Task :assemble
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1m 48s
5 actionable tasks: 5 executed
Removing intermediate container 70f5c69b7dde
---> 5bbd9485f873
Step 6/15 : FROM alpine as agent
---> 28f6e2705743
Step 7/15 : USER root
---> Using cache
---> 4a0572e8ff4a
Step 8/15 : WORKDIR /agent
---> Using cache
---> 0374735af05d
Step 9/15 : RUN wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | tar xvz
---> Using cache
---> ef141a7d5acc
Step 10/15 : FROM openjdk:14-slim
---> 38fca30874ab
Step 11/15 : WORKDIR /app
---> Using cache
---> 4dd576d38d65
Step 12/15 : COPY --from=agent /agent/cdbg_java_agent.so agent.so
---> Using cache
---> ff5fc93d2d5e
Step 13/15 : COPY --from=build /dist/build/libs/user-service.jar app.jar
---> 4b009124345f
Step 14/15 : EXPOSE 8080
---> Running in 99f71fb86534
Removing intermediate container 99f71fb86534
---> 38fcd9d00999
Step 15/15 : CMD ["java", "-agentpath:/app/agent.so", "-Dcom.google.cdbg.breakpoints.enable_canary=false", "-jar", "app.jar"]
---> Running in 309f35aed48f
Removing intermediate container 309f35aed48f
---> 43757d33b2ee
Successfully built 43757d33b2ee
Existing container found: 94d3fab4505461e8e694b61909ba1f7d827d8f7078b4dd8d1d36d4c4e0a0ac08, removing...
Creating container...
Container Id: b99675b5f6c00a0e5bec76999db04abf92eab29d257ee887bcea123a02789850
Container name: '/quirky_stonebraker'
Attaching to container '/quirky_stonebraker'...
Starting container '/quirky_stonebraker'
'<unknown> Dockerfile: Dockerfile' has been deployed successfully.
The container runs fine as already stated with the mentioned deployed cloud run service.
So I am out of ideas on what to do to make this work. I hope anybody can help me out here
I also add my cloudbuild.yaml in case that is relevant
steps:
- name: 'gradle:6.8.3-jdk11'
entrypoint: 'gradle'
args: [ 'check', '-x', 'test']
- name: 'gradle:6.8.3-jdk11'
entrypoint: 'gradle'
args: [ 'test']
- name: 'gradle:6.8.3-jdk11'
entrypoint: 'gradle'
args: [ 'integration-test']
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'eu.gcr.io/$PROJECT_ID/user-service:$BUILD_ID', '.' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', 'eu.gcr.io/$PROJECT_ID/user-service:$BUILD_ID' ]
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'alpha'
- 'run'
- 'deploy'
- 'user-service'
- '--image=eu.gcr.io/$PROJECT_ID/user-service:$BUILD_ID'
- '--concurrency=10'
- '--cpu=1'
- '--memory=512Mi'
- '--region=europe-west3'
- '--max-instances=2'
- '--platform=managed'
- '--port=8080'
- '--timeout=3000'
- '--set-env-vars=SQL_CONNECTION=10.28.96.3, SQL_USER=test, SQL_PASSWORD=test'
- '--set-env-vars=AUTH0_DOMAIN=prototype.eu.auth0.com, AUTH0_CLIENT_ID=123, AUTH0_CLIENT_SECRET=123'
- '--set-env-vars=^#^SPRING_PROFILES_ACTIVE=prod'
- '--allow-unauthenticated'
- '--ingress=internal'
- '--vpc-connector=cloud-run'
- '--vpc-egress=private-ranges-only'
- '--set-cloudsql-instances=$PROJECT_ID:europe-west1:prototype'
images:
- 'eu.gcr.io/$PROJECT_ID/user-service:$BUILD_ID'
timeout: 3000s
If you look what's inside the zipped agent file, you'll notice that there's a few files in it called:
cdbg_java_agent.so
cdbg_java_agent_internals.jar
version.txt
You're getting this problem because you missed to copy the internals.jar file to /app dir. The shared object file has a dependency and that can explain why users are instructed to create a separate directory for the Debugger.
To fix it on this case, add the missing file on to your Dockerfile like this:
COPY --from=agent /agent/cdbg_java_agent.so agent.so
COPY --from=agent /agent/cdbg_java_agent_internals.jar cdbg_java_agent_internals.jar
COPY --from=build /dist/build/libs/user-service.jar app.jar
Then wait for approx. ~5 minutes until your service appears on the Debugger. Note that the source code will not appear automatically unless it's located on a Git repo. For that you have to select the source code manually.

CircleCI + Gradle + Heroku deployment

I'm trying to provide a continuous deployment with Gradle and Heroku but for some reason, the deployment step is not running.
CircleCI Pipeline result
I've already updated the circle ci with the Heroku key.
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
- v1-dependencies-
- run: gradle dependencies
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "build.gradle" }}
# run tests!
- run: gradle test
deployment:
staging:
branch: master
heroku:
appname: my-heroku-app
Could you guys help me, please? Is the deployment step in the right place?
You are using deployment configuration for CircleCI 1.0 but you are using CircleCI 2.0.
From the documentation for CircleCI 2.0:
The built-in Heroku integration through the CircleCI UI is not
implemented for CircleCI 2.0. However, it is possible to deploy to
Heroku manually.
To deploy on heroku with CircleCI 2.0, you need :
add environment variables HEROKU_LOGIN, HEROKU_API_KEY, HEROKU_APP_NAME to your CircleCI project settings https://circleci.com/gh/<account>/<project>/edit#env-vars
create a private ssh key without passphrase and add it to your CircleCI project settings https://circleci.com/gh/https://circleci.com/gh/<account>/<project>/edit#ssh for hostname git.heroku.com
add steps in the .circleci/config.yml file with the fingerprint of your ssh key
- run:
name: Setup Heroku
command: |
ssh-keyscan -H heroku.com >> ~/.ssh/known_hosts
cat > ~/.netrc << EOF
machine api.heroku.com
login $HEROKU_LOGIN
password $HEROKU_API_KEY
EOF
cat >> ~/.ssh/config << EOF
VerifyHostKeyDNS yes
StrictHostKeyChecking no
EOF
- add_ssh_keys:
fingerprints:
- "<SSH KEY fingerprint>"
- deploy:
name: "Deploy to Heroku"
command: git push --force git#heroku.com:$HEROKU_APP_NAME.git HEAD:refs/heads/master

jasmine_node failed while running mean-seed

Having trouble running a project generated by yeoman generator called mean-seed. I've been tinkering with it for a few days now and tried a couple things. Where I am having trouble is running the "jasmine_node" task:
Running "jasmine_node" task
>> Error: Unable to access jarfile node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar
Warning: Done, with errors. Use --force to continue.
Aborted due to warnings.
So I first tried identifying missing npm packages to install
744 npm install && bower update && bower install
755 npm install protractor
760 npm install npm install selenium-standalone
761 npm install -g protractor
765 npm install protractor-tester
767 npm install protractor-selenium-server-vagrant
768 npm install selenium-standalone#2.39.0-2.8.0-2
none of these actually created the file selenium-server-standalone-2.39.0.jar in the node_modules directory. I ran a find to check, however several other jars were install.
$ find . -name "*.jar" -print
./node_modules/grunt-jasmine-node-coverage-validation/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/jline.jar
./node_modules/grunt-jasmine-node-coverage-validation/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/js.jar
./node_modules/selenium-standalone/.selenium/2.39.0/server.jar
I found the selenium server download so I tried downloading and copying it over to the referenced directory which I had to create
https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar
I run grunt again. It goes through tasks then runs the jasmine_node task
Running "jasmine_node" task
TEST configFile: /Users/jgs/Projects/mean/app/test/../configs/config.test.json
configFile: ./app/configs/config.test.json
info - socket.io started
waiting for server to be running..
[success] connected to db at localhost:27017/test_temp
>> Feb 01, 2014 3:03:54 PM org.openqa.grid.selenium.GridLauncher main
>> INFO: Launching a standalone server
>> Setting system property webdriver.chrome.driver to node_modules/protractor/selenium/chromedriver
------------------
[ERROR]
Run `node run.js config=test`
Server not connected. Ensure you have a node server running with the `config=test` command line option so this server connects to the TEST database - the same one used here for the tests. Do NOT connect to the live database for doing tests!
------------------
[success] connected to db at localhost:27017/test_temp
all tests - 2526 ms
should test everything - 2525 ms
Failures:
1) all tests should test everything
Message:
Expected 'ERROR - check the logs above to fix the problem then try again' to be false.
Stacktrace:
Error: Expected 'ERROR - check the logs above to fix the problem then try again' to be false.
at /Users/jgs/Projects/mean/app/test/all.spec.js:6:2935
at _rejected (/Users/jgs/Projects/mean/node_modules/q/q.js:808:24)
at /Users/jgs/Projects/mean/node_modules/q/q.js:834:30
at Promise.when (/Users/jgs/Projects/mean/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/jgs/Projects/mean/node_modules/q/q.js:752:41)
at /Users/jgs/Projects/mean/node_modules/q/q.js:574:44
at flush (/Users/jgs/Projects/mean/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Finished in 2.53 seconds
1 test, 1 assertion, 1 failure, 0 skipped
Warning: Task "jasmine_node" failed. Use --force to continue.
Aborted due to warnings.
$
Any idea why jasmine task is still failing?
Run ./node_modules/protractor/bin/webdriver-manager update, see here for more info:
https://github.com/jackrabbitsgroup/generator-mean-seed/issues/5
I hadn't yet updated the documentation everywhere yet for the Protractor upgrade, sorry about that!
Here is my solution.
First you need to download both the selenium-server-standalone
https://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.39.0.jar
and the chromedriver
http://chromedriver.storage.googleapis.com/index.html
copy them to
node_modules/protractor/selenium/
you will want another terminal tab or window to start the node server by runing
node run.js
then you can run the default grunt task
grunt
You will then see the output of the selenium tests in the console and chrome should open and perform the tests automatically.

Categories