Skip to content

Commit

Permalink
Merge pull request appium#2670 from sebv/master
Browse files Browse the repository at this point in the history
CI: build id + expected fails + grouped selendroid and gappium
  • Loading branch information
sebv committed May 26, 2014
2 parents 1e9b7b0 + 4e8ac4b commit ca8f7c9
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 90 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ env:
- LAUNCH_TIMEOUT='{"global":90000,"afterSimLaunch":30000}'
matrix:
- CI_CONFIG=unit
- CI_CONFIG=build_ios
- CI_CONFIG=build_android
- CI_CONFIG=build_selendroid
- CI_CONFIG=build_gappium
- CI_CONFIG=others
- CI_CONFIG=android
- CI_CONFIG=ios
before_script:
- gem install --no-rdoc --no-ri appium_doc_lint
- "./ci/installers/install-node.sh"
Expand Down
16 changes: 8 additions & 8 deletions ci/before_script_extra.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/bash
set -e
if [[ $CI_CONFIG == 'build_ios' ]]; then

if [[ $CI_CONFIG == 'ios' ]]; then
./ci/installers/install-ant.sh
./ci/installers/install-maven.sh
sudo grunt authorize
elif [[ $CI_CONFIG == 'build_android' ]]; then
elif [[ $CI_CONFIG == 'android' ]]; then
./ci/installers/install-ant.sh
./ci/installers/install-maven.sh
./ci/installers/install-android.sh
sudo grunt authorize
elif [[ $CI_CONFIG == 'build_selendroid' ]]; then
./ci/installers/install-ant.sh
./ci/installers/install-maven.sh
./ci/installers/install-android.sh
sudo grunt authorize
elif [[ $CI_CONFIG == 'build_gappium' ]]; then
elif [[ $CI_CONFIG == 'others' ]]; then
if [[ $TRAVIS_PULL_REQUEST != false ]]; then
# Skipping this config for pull requests, it takes too long.
exit 0
fi
./ci/installers/install-ant.sh
./ci/installers/install-maven.sh
./ci/installers/install-android.sh
Expand Down
43 changes: 20 additions & 23 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
set -e

BZ2_FILE=appium-ci-${TRAVIS_BRANCH}-${TRAVIS_JOB_NUMBER}-${TRAVIS_COMMIT:0:10}.tar.bz2
RUN_SAUCE=false
if [[ $TRAVIS_SECURE_ENV_VARS == true ]] && [[ $TRAVIS_PULL_REQUEST == false ]]; then
RUN_SAUCE=true
fi

if [[ $CI_CONFIG == 'unit' ]]; then
cd docs
appium_doc_lint || exit 1
cd -
npm test
elif [[ $CI_CONFIG == 'build_ios' ]]; then
elif [[ $CI_CONFIG == 'ios' ]]; then
unset SUDO_UID
echo OS X version: `sw_vers -productVersion`
echo Xcode version: `xcodebuild build -version`
echo Xcode path: `xcode-select --print-path`
./reset.sh --hardcore --no-npmlink --dev --ios
if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then
if [[ $RUN_SAUCE == true ]]; then
./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$BZ2_FILE \
node ./ci/tools/parallel-mocha.js \
-p 30 \
-c ios
fi
elif [[ $CI_CONFIG == 'build_android' ]]; then
elif [[ $CI_CONFIG == 'android' ]]; then
source ./ci/android_env
echo JAVA_HOME: $JAVA_HOME
./reset.sh --hardcore --no-npmlink --dev --android
if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then
if [[ $RUN_SAUCE == true ]]; then
rm sample-code/apps/ApiDemos
mv submodules/ApiDemos sample-code/apps/
./ci/upload_build_to_sauce.sh
Expand All @@ -34,37 +38,30 @@ elif [[ $CI_CONFIG == 'build_android' ]]; then
-p 30 \
-c android
fi
elif [[ $CI_CONFIG == 'build_selendroid' ]]; then
elif [[ $CI_CONFIG == 'others' ]]; then
if [[ $TRAVIS_PULL_REQUEST != false ]]; then
echo "Skipping this config for pull requests, it takes too long."
exit 0
fi
source ./ci/android_env
echo OS X version: `sw_vers -productVersion`
echo Xcode version: `xcodebuild build -version`
echo Xcode path: `xcode-select --print-path`
echo JAVA_HOME: $JAVA_HOME
./reset.sh --hardcore --no-npmlink --dev --selendroid
if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then
./reset.sh --hardcore --ios --android --no-npmlink
./reset.sh --dev --gappium --selendroid --no-npmlink
if [[ $RUN_SAUCE == true ]]; then
rm sample-code/apps/ApiDemos
mv submodules/ApiDemos sample-code/apps/
rm sample-code/apps/selendroid-test-app.apk
mv submodules/selendroid/selendroid-test-app/target/selendroid-test-app-0.10.0.apk \
sample-code/apps/selendroid-test-app.apk
./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$BZ2_FILE \
node ./ci/tools/parallel-mocha.js \
-p 30 \
-c selendroid
fi
elif [[ $CI_CONFIG == 'build_gappium' ]]; then
source ./ci/android_env
echo OS X version: `sw_vers -productVersion`
echo Xcode version: `xcodebuild build -version`
echo Xcode path: `xcode-select --print-path`
echo JAVA_HOME: $JAVA_HOME
./reset.sh --hardcore --ios --android --selendroid --no-npmlink
./reset.sh --gappium --dev --no-npmlink
if [[ $TRAVIS_SECURE_ENV_VARS == true ]]; then
rm sample-code/apps/io.appium.gappium.sampleapp
mv submodules/io.appium.gappium.sampleapp sample-code/apps/
./ci/upload_build_to_sauce.sh
TARBALL=sauce-storage:$BZ2_FILE \
node ./ci/tools/parallel-mocha.js \
-p 30 \
-c gappium
-c others
fi
fi
16 changes: 9 additions & 7 deletions ci/test-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ module.exports = {
'test/functional/android/**/*-specs.js'
]
},
'selendroid':{
'mocha-bin': 'ci/mochas/selendroid-mocha',
'glob-patterns': [
'test/functional/selendroid/**/*-specs.js'
]
},
'gappium':[
'others':[
// selendroid
{
'mocha-bin': 'ci/mochas/selendroid-mocha',
'glob-patterns': [
'test/functional/selendroid/**/*-specs.js'
]
},
//gappium
{
'mocha-bin': 'ci/mochas/ios71-mocha',
'glob-patterns': [
Expand Down
6 changes: 4 additions & 2 deletions ci/tools/parallel-mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ function fillQueue(fileInfo) {
return deferred.promise;
}

queue.pause();
Q.all(_(fileInfos).map(function (fileInfo) {
return fillQueue(fileInfo);
})).done();
return fillQueue(fileInfo);
})).then(function () { queue.resume(); })
.done();
4 changes: 4 additions & 0 deletions ci/upload_build_to_sauce.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh
set -e

echo "Starting to compress and upload appium."

BZ2_FILE=appium-ci-${TRAVIS_BRANCH}-${TRAVIS_JOB_NUMBER}-${TRAVIS_COMMIT:0:10}.tar.bz2
UPLOAD_INFO_FILE=/tmp/build-upload-info.json

Expand All @@ -20,3 +22,5 @@ curl \

# checking/printing result file
node ci/tools/build-upload-tool.js $UPLOAD_INFO_FILE

echo "Finished to compress and upload appium."
2 changes: 1 addition & 1 deletion test/functional/selendroid/api-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var setup = require("../common/setup-base"),
desired = require('./desired');

describe('selendroid - api', function () {
describe('api', function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });
Expand Down
27 changes: 27 additions & 0 deletions test/functional/selendroid/app-act-fully-qualified-specs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"use strict";

require('../../helpers/setup-chai');

var env = require('../../helpers/env')
, initSession = require('../../helpers/session').initSession
, _ = require('underscore')
, desired = require('./desired');

describe('app activities - fully qualified', function () {
this.timeout(env.MOCHA_INIT_TIMEOUT);
var session;
var name = this.parent.title + " " + this.title;

afterEach(function (done) {
session
.tearDown(this.currentTest.state === 'passed')
.nodeify(done);
});

it('should still launch app', function (done) {
var newDesired = _.defaults({'appActivity': 'com.example.android.apis.ApiDemos'}, desired);
session = initSession(newDesired);
session.setUp(name)
.nodeify(done);
});
});
36 changes: 36 additions & 0 deletions test/functional/selendroid/app-act-no-dot-specs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict";

require('../../helpers/setup-chai');

var env = require('../../helpers/env')
, initSession = require('../../helpers/session').initSession
, _ = require('underscore')
, desired = require('./desired')
, attachToSession = require('../../helpers/session').attachToSession;

describe('app activities - with no dot', function () {
this.timeout(env.MOCHA_INIT_TIMEOUT);
var session;
var name = this.parent.title + " " + this.title;
it('should not launch app', function (done) {
var newDesired = _.defaults({'appActivity': 'ApiDemos'}, desired);
session = initSession(newDesired, {'no-retry': true, 'expect-error': true});
session
.setUp(name)
.catch(function (err) {
err.should.exist;
if (env.SAUCE) {
// getting session id from error and greening job
var sessionId = null;
try {
var errorData = JSON.parse(err.data);
sessionId = errorData.sessionId;
} catch (ign) {}
sessionId.should.exist;
var driver = attachToSession(sessionId);
return driver.sauceJobStatus(true);
}
})
.nodeify(done);
});
});
42 changes: 0 additions & 42 deletions test/functional/selendroid/app-activities-specs.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/functional/selendroid/background-app-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var setup = require("../common/setup-base")
, desired = require('./desired');


describe('selendroid - background app', function () {
describe('background app', function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });

Expand Down
2 changes: 1 addition & 1 deletion test/functional/selendroid/uninstall-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var setup = require("../common/setup-base")
, desired = require('./desired');

// TODO: not working on sauce, investigate
describe('selendroid - uninstall app @skip-ci', function () {
describe('uninstall app @skip-ci', function () {

var driver;
setup(this, desired).then(function (d) { driver = d; });
Expand Down
2 changes: 1 addition & 1 deletion test/functional/selendroid/webview-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
var androidWebviewTests = require('../common/android-webview-base');
// if it doesn't work run: adb uninstall io.selendroid.testapp

describe('selendroid - webview', androidWebviewTests);
describe('webview', androidWebviewTests);
1 change: 1 addition & 0 deletions test/helpers/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env.VERSION = process.env.VERSION;

// travis
env.TRAVIS_JOB_NUMBER = process.env.TRAVIS_JOB_NUMBER;
env.TRAVIS_BUILD_NUMBER = process.env.TRAVIS_BUILD_NUMBER;
env.TRAVIS_BUILD_DIR = process.env.TRAVIS_BUILD_DIR;

// http
Expand Down
10 changes: 10 additions & 0 deletions test/helpers/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ module.exports.initSession = function (desired, opts) {
if (env.SAUCE) {
if (env.TRAVIS_JOB_NUMBER) name = '[' + env.TRAVIS_JOB_NUMBER + '] ' + name;
if (name) desired.name = name.replace(/@[^\s]*/,'');
if (env.TRAVIS_BUILD_NUMBER) desired.build = env.TRAVIS_BUILD_NUMBER;
if (caps['appium-version']){
// locking cap list
caps['appium-version']['filter-caps'] = _(caps).keys();
}
if (opts['expect-error']){
caps.tags.push('expect-error');
}
}

if (env.VERBOSE) console.log("caps -->", caps);
Expand Down Expand Up @@ -148,3 +152,9 @@ module.exports.initSession = function (desired, opts) {
promisedBrowser: deferred.promise
};
};

module.exports.attachToSession = function (sessionId) {
var browser = wd.promiseChainRemote(env.APPIUM_HOST, env.APPIUM_PORT, env.APPIUM_USERNAME, env.APPIUM_PASSWORD);
browser.attach(sessionId);
return browser;
};

0 comments on commit ca8f7c9

Please sign in to comment.