mirror of
https://github.com/appium/appium.git
synced 2026-02-09 11:18:51 -06:00
Merge pull request #2534 from sebv/ci-first-sauce-tests
First ci tests on sauce
This commit is contained in:
37
.travis.yml
37
.travis.yml
@@ -3,20 +3,39 @@ osx_image: mavericks
|
||||
notifications:
|
||||
email: false
|
||||
rvm:
|
||||
- 2.1.1
|
||||
- 2.1.1
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
git:
|
||||
submodules: false
|
||||
env:
|
||||
global:
|
||||
- secure: KNDEn/ryhd0yRGzpJSfHRKBzBIC73RKaHWFDkqD4E+iUXepwBfF2bBfningf8f++9qLNscumYZOHjQ0PWf/YALQCr5B2vHsGN+eHWc331d8f5sU/b6oyCAxsayI32lr/mNVCuHd44+ManMcKUH6831Q1qwa15o5w4dDPtJKuv6Y=
|
||||
- secure: gZ9B0mE58AYdjVxvj5z27c+0pNJqrRzJiXdSe8T0UswR3gFxhOYoW1ikFTcij1NcQhdzDwGIDDJl30D6Z69Y73W3wagowkELasPeNcKobWqerof5lG8A6Qud90jXedABdXw9FEGnY47mG3/ZWwyx1KyOVkIlxoabkCqUwd7xaio=
|
||||
- SAUCE_REST_ROOT=https://saucelabs.com/rest/v1
|
||||
- APPIUM_HOST='ondemand.saucelabs.com'
|
||||
- APPIUM_PORT=80
|
||||
- SAUCE_USERNAME=appium
|
||||
- secure: GXGFbQptLEsKlaWnpOL2EB9hqQ4XBT6tqg7REt5j1h1jYBsfHQHSgSLt1jpzOF5kooXVbw2K7IrZyNVBXEUHR00Hp6O72FBOd+SSj8uPCJBLjAOaJWs0ZtujqGHwHpe6gadFfn0L7q0ffoV5OJVeNHHcuw4f9BaA78fTFNfm1jE=
|
||||
- secure: WLRP9RJIHWPer189swCqMCnexS8XpVQ8FRMSXNxLXp5fUaERVzU7/ncGFeqcM8GWGIU12PP8TJUaMRa58vTGgApW6POMdAPiauepfzoru+n/S4Xrw64hmd4oK0GEZI3wgnkPofUn6TzQeXRmVG496PNzbV8KfqF4mTAesZOLSFA=
|
||||
matrix:
|
||||
- CI_CONFIG=unit
|
||||
- CI_CONFIG=build
|
||||
- CI_CONFIG=build_ios
|
||||
- CI_CONFIG=build_android
|
||||
- CI_CONFIG=build_selendroid
|
||||
- CI_CONFIG=build_gappium
|
||||
before_script:
|
||||
- gem install --no-rdoc --no-ri appium_doc_lint
|
||||
- ./ci/install-node.sh
|
||||
- ./ci/show-env.sh
|
||||
- npm install -g jshint grunt-cli
|
||||
- "./ci/git-config.sh"
|
||||
- "./ci/installers/install-node.sh"
|
||||
- "echo Node.js version: `node -v`"
|
||||
- npm install -g jshint grunt-cli mocha
|
||||
- npm install
|
||||
- ./ci/before_script_extra.sh
|
||||
- "./ci/before_script_extra.sh"
|
||||
script:
|
||||
- ./ci/script.sh
|
||||
- "./ci/script.sh"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
if [[ $CI_CONFIG == 'build' ]]; then
|
||||
./ci/install-ant.sh
|
||||
./ci/install-maven.sh
|
||||
./ci/install-android.sh
|
||||
set -e
|
||||
if [[ $CI_CONFIG == 'build_ios' ]]; then
|
||||
./ci/installers/install-ant.sh
|
||||
./ci/installers/install-maven.sh
|
||||
sudo grunt authorize
|
||||
elif [[ $CI_CONFIG == 'build_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
|
||||
./ci/installers/install-ant.sh
|
||||
./ci/installers/install-maven.sh
|
||||
./ci/installers/install-android.sh
|
||||
npm install -g cordova
|
||||
sudo grunt authorize
|
||||
fi
|
||||
|
||||
9
ci/git-config.sh
Executable file
9
ci/git-config.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
git config --global user.email "appium-ci@appium.io"
|
||||
git config --global user.name "appium-ci"
|
||||
PUSH_URL=$(git config --get remote.origin.url | sed s/git:/https:/)
|
||||
echo "https://${GH_TOKEN}:@github.com" > ${HOME}/.git-credentials
|
||||
git config credential.helper "store --file=${HOME}/.git-credentials"
|
||||
git remote set-url --push origin ${PUSH_URL}
|
||||
git config --global push.default simple
|
||||
17
ci/git-push.sh
Executable file
17
ci/git-push.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CI_BRANCH=ci-${BRANCH_CAT}-${TRAVIS_BRANCH}
|
||||
UPLOAD_INFO_FILE=ci/build-upload-info.json
|
||||
|
||||
|
||||
# preparing test branch
|
||||
git branch -f ${CI_BRANCH}
|
||||
git checkout ${CI_BRANCH}
|
||||
cp .travis.yml .travis.yml.master
|
||||
node ci/tools/travis-yml-tool.js .travis.yml.master ci/travis-functional.yml > .travis.yml
|
||||
git add ${UPLOAD_INFO_FILE}
|
||||
git commit -a -m "ci ${BRANCH_CAT} branch for build #${TRAVIS_JOB_NUMBER}"
|
||||
|
||||
# pushing
|
||||
git push -f origin ${CI_BRANCH}:${CI_BRANCH}
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
|
||||
mkdir -p $HOME/tools/ant
|
||||
cd $HOME/tools/ant
|
||||
wget -P /tmp http://ftp.tc.edu.tw/pub/Apache/ant/binaries/apache-ant-1.9.3-bin.tar.gz
|
||||
tar xzf /tmp/apache-ant-1.9.3-bin.tar.gz
|
||||
echo 'export PATH=$HOME/tools/ant/apache-ant-1.9.3/bin:$PATH' > $HOME/tools/ant/env
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
set -e
|
||||
|
||||
COMPONENTS=build-tools-19.0.3,android-19,android-18,android-16,extra-android-support
|
||||
|
||||
8
ci/installers/install-ant.sh
Executable file
8
ci/installers/install-ant.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
mkdir -p $HOME/tools/ant
|
||||
cd $HOME/tools/ant
|
||||
wget -P /tmp http://www.us.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.gz
|
||||
tar xzf /tmp/apache-ant-1.9.4-bin.tar.gz
|
||||
echo 'export PATH=$HOME/tools/ant/apache-ant-1.9.4/bin:$PATH' > $HOME/tools/ant/env
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
set -e
|
||||
|
||||
mkdir -p $HOME/tools/maven
|
||||
cd $HOME/tools/maven
|
||||
wget -P /tmp http://apache.cdpa.nsysu.edu.tw/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
|
||||
wget -P /tmp http://www.us.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz
|
||||
tar xzf /tmp/apache-maven-3.1.1-bin.tar.gz
|
||||
echo 'export PATH=$HOME/tools/maven/apache-maven-3.1.1/bin:$PATH' > $HOME/tools/maven/env
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
set -e
|
||||
git clone https://github.com/visionmedia/n.git /tmp/n
|
||||
cd /tmp/n
|
||||
make install
|
||||
53
ci/script.sh
53
ci/script.sh
@@ -1,17 +1,50 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
|
||||
unset SUDO_UID
|
||||
|
||||
source ./ci/env
|
||||
./ci/show-env.sh
|
||||
set -e
|
||||
|
||||
if [[ $CI_CONFIG == 'unit' ]]; then
|
||||
cd docs
|
||||
appium_doc_lint || exit 1
|
||||
cd -
|
||||
npm test
|
||||
elif [[ $CI_CONFIG == 'build' ]]; then
|
||||
./reset.sh --hardcore --dev --ios --android --selendroid --gappium --verbose
|
||||
./ci/upload_build_to_sauce.sh
|
||||
fi
|
||||
elif [[ $CI_CONFIG == 'build_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 --verbose
|
||||
./ci/upload_build_to_sauce.sh
|
||||
BRANCH_CAT=ios ./ci/git-push.sh
|
||||
elif [[ $CI_CONFIG == 'build_android' ]]; then
|
||||
source ./ci/android_env
|
||||
echo JAVA_HOME: $JAVA_HOME
|
||||
./reset.sh --hardcore --no-npmlink --dev --android --verbose
|
||||
#./ci/upload_build_to_sauce.sh
|
||||
#BRANCH_CAT=android ./ci/git-push.sh
|
||||
elif [[ $CI_CONFIG == 'build_selendroid' ]]; then
|
||||
source ./ci/android_env
|
||||
echo JAVA_HOME: $JAVA_HOME
|
||||
./reset.sh --hardcore --no-npmlink --dev --selendroid
|
||||
#./ci/upload_build_to_sauce.sh
|
||||
#BRANCH_CAT=selendroid ./ci/git-push.sh
|
||||
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 --no-npmlink --dev --gappium
|
||||
#./ci/upload_build_to_sauce.sh
|
||||
#BRANCH_CAT=gappium ./ci/git-push.sh
|
||||
elif [[ $CI_CONFIG == 'functional' ]]; then
|
||||
TARBALL=sauce-storage:$(node ./ci/tools/build-upload-tool.js \
|
||||
./ci/build-upload-info.json filename)
|
||||
SAUCE=1 \
|
||||
VERBOSE=1 \
|
||||
TARBALL="${TARBALL}" \
|
||||
DEVICE="ios71" \
|
||||
VERSION="7.1" \
|
||||
./node_modules/.bin/mocha \
|
||||
--recursive \
|
||||
-g "@skip-ios71|@skip-ios7|@skip-ios-all" -i \
|
||||
$MOCHA_FILES
|
||||
fi
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
set +e
|
||||
echo OS X version: `sw_vers -productVersion`
|
||||
echo Xcode version: `xcodebuild build -version`
|
||||
echo Xcode path: `xcode-select --print-path`
|
||||
echo Node.js version: `node -v`
|
||||
echo JAVA_HOME: $JAVA_HOME
|
||||
|
||||
16
ci/tools/build-upload-tool.js
Normal file
16
ci/tools/build-upload-tool.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
var args = process.argv.slice(2),
|
||||
assert = require('assert');
|
||||
|
||||
var fs = require("fs");
|
||||
var data = JSON.parse(fs.readFileSync(args[0]));
|
||||
assert(data.filename);
|
||||
|
||||
switch (args[1]) {
|
||||
case 'filename':
|
||||
console.log(data.filename);
|
||||
break;
|
||||
default:
|
||||
console.log(data);
|
||||
}
|
||||
30
ci/tools/travis-yml-tool.js
Normal file
30
ci/tools/travis-yml-tool.js
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var args = process.argv.slice(2),
|
||||
assert = require('assert'),
|
||||
_ = require('underscore');
|
||||
|
||||
var fs = require("fs");
|
||||
var source = fs.readFileSync(args[0], 'UTF8');
|
||||
var target = fs.readFileSync(args[1], 'UTF8');
|
||||
|
||||
// replace secure lines
|
||||
var secureLines = source.match(/^\s*- secure.*/gm).join('\n');
|
||||
secureLines = secureLines.replace(/^\s*-/mg, ' -');
|
||||
assert(secureLines);
|
||||
target = target.replace(/(^\s*- secure.*\r?\n)+/m, ' # <SECURE>\n');
|
||||
target = target.replace(/^ # <SECURE>.*$/m, secureLines);
|
||||
|
||||
_([
|
||||
'SAUCE_REST_ROOT', 'APPIUM_HOST',
|
||||
'APPIUM_PORT', 'SAUCE_USERNAME',
|
||||
]).each(function(varName) {
|
||||
var regex = new RegExp('- ' + varName + '=.*');
|
||||
var line = source.match(regex)[0];
|
||||
regex = new RegExp('- ' + varName + '=.*','g');
|
||||
target = target.replace(regex, line);
|
||||
});
|
||||
console.log(target);
|
||||
|
||||
|
||||
|
||||
23
ci/travis-functional.yml
Normal file
23
ci/travis-functional.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
notifications:
|
||||
email: false
|
||||
git:
|
||||
submodules: false
|
||||
branches:
|
||||
only:
|
||||
- /^ci-.*$/
|
||||
env:
|
||||
global:
|
||||
- CI_CONFIG=functional
|
||||
- SAUCE_REST_ROOT=auto
|
||||
- APPIUM_HOST=auto
|
||||
- APPIUM_PORT=auto
|
||||
- SAUCE_USERNAME=auto
|
||||
# <SECURE>
|
||||
matrix:
|
||||
- MOCHA_FILES=test/functional/ios/testapp/find-element-specs.js
|
||||
- MOCHA_FILES=test/functional/ios/testapp/get-attribute-specs.js
|
||||
script:
|
||||
- "./ci/script.sh"
|
||||
@@ -1,11 +1,22 @@
|
||||
#!/bin/sh
|
||||
GIT_COMMIT=git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/"
|
||||
tar cfj - --exclude=node_modules --exclude=submodules . | \
|
||||
set -e
|
||||
|
||||
BZ2_FILE=appium-ci-${TRAVIS_BRANCH}-${TRAVIS_JOB_NUMBER}-${TRAVIS_COMMIT:0:10}.tar.bz2
|
||||
UPLOAD_INFO_FILE=ci/build-upload-info.json
|
||||
|
||||
# zipping/uploading
|
||||
tar \
|
||||
cfj - \
|
||||
--exclude=.git \
|
||||
--exclude=submodules . | \
|
||||
curl \
|
||||
--verbose \
|
||||
-k \
|
||||
--progress-bar \
|
||||
-u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY \
|
||||
-X POST "https://saucelabs.com/rest/v1/storage/${SAUCE_USERNAME}/appium-dev-${GIT_COMMIT}.bjz?overwrite=true" \
|
||||
-X POST "${SAUCE_REST_ROOT}/storage/${SAUCE_USERNAME}/${BZ2_FILE}?overwrite=true" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @- > /tmp/curl.out
|
||||
cat /tmp/curl.out
|
||||
--data-binary @- \
|
||||
-o $UPLOAD_INFO_FILE
|
||||
|
||||
# checking/printing result file
|
||||
node ci/tools/build-upload-tool.js $UPLOAD_INFO_FILE
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
"devDependencies": {
|
||||
"mocha": "~1.18.2",
|
||||
"underscore-cli": "~0.2.17",
|
||||
"wd": "~0.2.18",
|
||||
"wd": "0.2.21",
|
||||
"yiewd": "~0.4.4",
|
||||
"monocle-js": "~0.6.1",
|
||||
"assert": "~1.1.1",
|
||||
|
||||
16
reset.sh
16
reset.sh
@@ -25,6 +25,7 @@ grunt="$(npm bin)/grunt" # might not have grunt-cli installed with -g
|
||||
verbose=false
|
||||
chromedriver_version=false
|
||||
chromedriver_install_all=false
|
||||
npmlink=true
|
||||
if test -d .git ; then
|
||||
is_git_checkout=true
|
||||
else
|
||||
@@ -50,6 +51,7 @@ do
|
||||
"--chromedriver-version") chromedriver_version=$2;;
|
||||
"--chromedriver-install-all") chromedriver_install_all=true;;
|
||||
"--udid") udid=$2;;
|
||||
"--no-npmlink") npmlink=false;;
|
||||
esac
|
||||
|
||||
if [[ -n "$2" ]] && [[ "$2" != --* ]]; then
|
||||
@@ -178,12 +180,14 @@ reset_ios() {
|
||||
build/WebViewApp/
|
||||
fi
|
||||
if $include_dev ; then
|
||||
echo "* Cloning/npm linking appium-atoms"
|
||||
run_cmd ./bin/npmlink.sh -l appium-atoms
|
||||
echo "* Cloning/npm linking appium-instruments"
|
||||
run_cmd ./bin/npmlink.sh -l appium-instruments
|
||||
echo "* Cloning/npm linking appium-uiauto"
|
||||
run_cmd ./bin/npmlink.sh -l appium-uiauto
|
||||
if $npmlink ; then
|
||||
echo "* Cloning/npm linking appium-atoms"
|
||||
run_cmd ./bin/npmlink.sh -l appium-atoms
|
||||
echo "* Cloning/npm linking appium-instruments"
|
||||
run_cmd ./bin/npmlink.sh -l appium-instruments
|
||||
echo "* Cloning/npm linking appium-uiauto"
|
||||
run_cmd ./bin/npmlink.sh -l appium-uiauto
|
||||
fi
|
||||
if $ios7_active ; then
|
||||
if $hardcore ; then
|
||||
echo "* Clearing out old UICatalog download"
|
||||
|
||||
@@ -128,19 +128,19 @@ describe("apidemo - basic -", function () {
|
||||
|
||||
describe('activity style: no period', function () {
|
||||
var session;
|
||||
after(function () { session.tearDown(); });
|
||||
after(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
it('should still find activity', function (done) {
|
||||
session = initSession(_.defaults({appActivity: 'ApiDemos'}, desired));
|
||||
session.setUp().nodeify(done);
|
||||
session.setUp(this.parent.title + " " + this.title).nodeify(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('activity style: fully qualified', function () {
|
||||
var session;
|
||||
after(function () { session.tearDown(); });
|
||||
after(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
it('should still find activity', function (done) {
|
||||
session = initSession(_.defaults({appActivity: 'com.example.android.apis.ApiDemos'}, desired));
|
||||
session.setUp().nodeify(done);
|
||||
session.setUp(this.parent.title + " " + this.title).nodeify(done);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -149,11 +149,11 @@ describe("apidemo - basic -", function () {
|
||||
|
||||
describe('activity style: non-existent', function () {
|
||||
var session;
|
||||
after(function () { session.tearDown(); });
|
||||
after(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
it('should throw an error', function (done) {
|
||||
session = initSession(_.defaults({appActivity: '.Blargimarg'}, desired), opts);
|
||||
try3Times(function () {
|
||||
return session.setUp()
|
||||
return session.setUp(this.parent.title + " " + this.title)
|
||||
.catch(function (err) { throw err.data; })
|
||||
.should.be.rejectedWith(/Activity used to start app doesn't exist/);
|
||||
}).nodeify(done);
|
||||
@@ -162,12 +162,12 @@ describe("apidemo - basic -", function () {
|
||||
|
||||
describe('bad app path', function () {
|
||||
var session;
|
||||
after(function () { session.tearDown(); });
|
||||
after(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
it('should throw an error', function (done) {
|
||||
var badAppPath = path.resolve(__dirname, "../../../sample-code/apps/ApiDemos/bin/ApiDemos-debugz.apk");
|
||||
session = initSession(_.defaults({'app': badAppPath}, desired), opts);
|
||||
try3Times(function () {
|
||||
return session.setUp()
|
||||
return session.setUp(this.parent.title + " " + this.title)
|
||||
.catch(function (err) { throw err.data; })
|
||||
.should.be.rejectedWith(/Error locating the app/);
|
||||
}).nodeify(done);
|
||||
@@ -217,24 +217,24 @@ describe("apidemo - basic -", function () {
|
||||
});
|
||||
}
|
||||
|
||||
afterEach(function () { session.tearDown(); });
|
||||
afterEach(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
|
||||
it('should load an app with using absolute path', function (done) {
|
||||
var appPath = path.resolve(desired.app);
|
||||
session = initSession(_.defaults({'app': appPath}, desired));
|
||||
session.setUp().nodeify(done);
|
||||
session.setUp(this.parent.title + " " + this.title).nodeify(done);
|
||||
});
|
||||
|
||||
it('should load an app with using relative path', function (done) {
|
||||
var appPath = path.relative(process.cwd(), desired.app);
|
||||
session = initSession(_.defaults({'app': appPath}, desired));
|
||||
session.setUp().nodeify(done);
|
||||
session.setUp(this.parent.title + " " + this.title).nodeify(done);
|
||||
});
|
||||
|
||||
it('should load a zipped app via url', function (done) {
|
||||
var appUrl = 'http://appium.s3.amazonaws.com/ApiDemos-debug.apk';
|
||||
session = initSession(_.defaults({'app': appUrl}, desired));
|
||||
session.setUp().nodeify(done);
|
||||
session.setUp(this.parent.title + " " + this.title).nodeify(done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -16,11 +16,25 @@ module.exports = function (context, desired, opts) {
|
||||
var session = initSession(desired, opts);
|
||||
|
||||
if (env.FAST_TESTS) {
|
||||
before(function (done) { session.setUp().nodeify(done); });
|
||||
after(function (done) { session.tearDown().nodeify(done); });
|
||||
var allPassed = true;
|
||||
before(function (done) {
|
||||
session
|
||||
.setUp(context.title)
|
||||
.nodeify(done);
|
||||
});
|
||||
after(function (done) { session.tearDown(allPassed).nodeify(done); });
|
||||
afterEach(function () {
|
||||
allPassed = allPassed && this.currentTest.state === 'passed';
|
||||
});
|
||||
} else {
|
||||
beforeEach(function (done) { session.setUp().nodeify(done); });
|
||||
afterEach(function (done) { session.tearDown().nodeify(done); });
|
||||
beforeEach(function (done) {
|
||||
session
|
||||
.setUp(this.currentTest.parent.title + " " + this.currentTest.title)
|
||||
.nodeify(done);
|
||||
});
|
||||
afterEach(function (done) {
|
||||
session.tearDown(this.currentTest.state === 'passed').nodeify(done);
|
||||
});
|
||||
}
|
||||
|
||||
return session.promisedBrowser;
|
||||
|
||||
@@ -59,7 +59,8 @@ describe('testapp - location services -', function () {
|
||||
locationServicesAuthorized: true
|
||||
});
|
||||
it('should not work without bundleId', function (done) {
|
||||
initSession(newDesired, {'no-retry': true, 'no-reset': true}).setUp()
|
||||
initSession(newDesired, {'no-retry': true, 'no-reset': true})
|
||||
.setUp(this.parent.title + " " + this.title)
|
||||
.then(function (err) {
|
||||
err.cause.value.message.should.contain("bundleId");
|
||||
throw err;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
process.env.DEVICE = process.env.DEVICE || "selendroid";
|
||||
var setup = require("../common/setup-base")
|
||||
, env = require('../../../helpers/env')
|
||||
, initSession = require('../../helpers/session').initSession
|
||||
, path = require('path')
|
||||
, Q = require("q")
|
||||
@@ -131,11 +132,15 @@ describe('selendroid - basic -', function () {
|
||||
|
||||
describe('app activities with no dot', function () {
|
||||
var session;
|
||||
after(function () { session.tearDown(); });
|
||||
after(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
|
||||
it('should not launch app', function (done) {
|
||||
session = initSession(_.defaults({appActivity: 'ApiDemos'}, desired), {'no-retry': true});
|
||||
session.setUp()
|
||||
var newDesired = _.defaults({'app-activity': 'ApiDemos'}, desired);
|
||||
if (env.SAUCE) {
|
||||
newDesired.name = this.currentTest.parent.title + " " + this.currentTest.title;
|
||||
}
|
||||
session = initSession(newDesired, {'no-retry': true});
|
||||
session.setUp(this.parent.title + " " + this.title)
|
||||
.should.be.rejected
|
||||
.nodeify(done);
|
||||
});
|
||||
@@ -144,11 +149,15 @@ describe('selendroid - basic -', function () {
|
||||
|
||||
describe('fully qualified app activities', function () {
|
||||
var session;
|
||||
after(function () { session.tearDown(); });
|
||||
after(function () { session.tearDown(this.currentTest.state === 'passed'); });
|
||||
|
||||
it('should still launch app', function (done) {
|
||||
session = initSession(_.defaults({appActivity: 'com.example.android.apis.ApiDemos'}, desired));
|
||||
session.setUp()
|
||||
var newDesired = _.defaults({'app-activity': 'com.example.android.apis.ApiDemos'}, desired);
|
||||
if (env.SAUCE) {
|
||||
newDesired.name = this.currentTest.parent.title + " " + this.currentTest.title;
|
||||
}
|
||||
session = initSession(newDesired);
|
||||
session.setUp(this.parent.title + " " + this.title)
|
||||
.nodeify(done);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ if (env.SAUCE) {
|
||||
}
|
||||
env.APPIUM_USERNAME = process.env.SAUCE_USERNAME;
|
||||
env.APPIUM_PASSWORD = process.env.SAUCE_ACCESS_KEY;
|
||||
env.SAUCE_REST_ROOT = process.env.SAUCE_REST_ROOT;
|
||||
}
|
||||
|
||||
env.LAUNCH_TIMEOUT = JSON.parse(process.env.LAUNCH_TIMEOUT || 60000);
|
||||
@@ -40,9 +41,10 @@ function iphoneOrIpadSimulator(device, version) {
|
||||
switch (version) {
|
||||
case '6.1':
|
||||
case '7.0':
|
||||
return isIpad ? 'iPad Simulator' : 'iPhone Simulator';
|
||||
case '7.1':
|
||||
return isIpad ? 'iPad Retina' : 'iPhone Retina 4-inch';
|
||||
return isIpad ? 'iPad Simulator' : 'iPhone Simulator';
|
||||
// case '7.1':
|
||||
// return isIpad ? 'iPad Retina' : 'iPhone Retina 4-inch';
|
||||
default:
|
||||
throw new Error("invalid version");
|
||||
}
|
||||
@@ -141,7 +143,22 @@ if (env.VERSION) {
|
||||
env.CAPS.platformVersion = "7.0";
|
||||
}
|
||||
|
||||
// app path root
|
||||
// max retry
|
||||
if (process.env.MAX_RETRY) env.MAX_RETRY = parseInt(process.env.MAX_RETRY, 10);
|
||||
|
||||
//dev tarball
|
||||
env.TARBALL = process.env.TARBALL;
|
||||
|
||||
// add the tarball to caps
|
||||
if (env.SAUCE && env.TARBALL) {
|
||||
env.CAPS['appium-version'] = {
|
||||
'appium-url': env.TARBALL,
|
||||
//'npm-install': true,
|
||||
'download-app': false,
|
||||
'appium-startup-args': 'minimal'
|
||||
//'appium-startup-args': '-m'
|
||||
};
|
||||
}
|
||||
|
||||
// rest enf points
|
||||
env.TEST_END_POINT = 'http://localhost:' + env.APPIUM_PORT + '/test/';
|
||||
|
||||
@@ -38,8 +38,13 @@ module.exports.initSession = function (desired, opts) {
|
||||
});
|
||||
|
||||
return {
|
||||
setUp: function () {
|
||||
setUp: function (name) {
|
||||
if (env.VERBOSE) {
|
||||
console.log("env.APPIUM_HOST -->", env.APPIUM_HOST);
|
||||
console.log("env.APPIUM_PORT -->", env.APPIUM_PORT);
|
||||
}
|
||||
browser = wd.promiseChainRemote(env.APPIUM_HOST, env.APPIUM_PORT, env.APPIUM_USERNAME, env.APPIUM_PASSWORD);
|
||||
if(env.SAUCE_REST_ROOT) browser.sauceRestRoot = env.SAUCE_REST_ROOT;
|
||||
if (env.VERBOSE) {
|
||||
var MAX_DATA_LENGTH = 500;
|
||||
browser.on('status', function (info) {
|
||||
@@ -54,13 +59,14 @@ module.exports.initSession = function (desired, opts) {
|
||||
}
|
||||
deferred.resolve(browser);
|
||||
var caps = _.defaults(desired, env.CAPS);
|
||||
if (env.SAUCE) {
|
||||
caps.name = this.currentTest.parent.title + " " + this.currentTest.title;
|
||||
}
|
||||
|
||||
if (env.VERBOSE) console.log("caps -->", caps);
|
||||
if (env.VERBOSE) console.log("opts -->", opts);
|
||||
|
||||
|
||||
if (env.SAUCE) {
|
||||
desired.name = name;
|
||||
}
|
||||
|
||||
function init(remainingAttempts) {
|
||||
if (env.VERBOSE) console.log("remainingAttempts -->", remainingAttempts);
|
||||
return browser
|
||||
@@ -77,6 +83,7 @@ module.exports.initSession = function (desired, opts) {
|
||||
});
|
||||
}
|
||||
var attempts = opts['no-retry'] ? 1 : 3;
|
||||
if (env.MAX_RETRY) attempts = Math.min(env.MAX_RETRY, attempts);
|
||||
return browser.chain()
|
||||
.then(function () {
|
||||
if (env.IOS && env.RESET_IOS && !opts['no-reset']) {
|
||||
@@ -91,11 +98,7 @@ module.exports.initSession = function (desired, opts) {
|
||||
.then(function () { initialized = true; })
|
||||
.setImplicitWaitTimeout(5000);
|
||||
},
|
||||
tearDown: function () {
|
||||
var passed = false;
|
||||
if (this.currentTest) {
|
||||
passed = this.currentTest.state = 'passed';
|
||||
}
|
||||
tearDown: function (passed) {
|
||||
return browser.chain()
|
||||
.then(function () {
|
||||
if (initialized && !opts['no-quit']) {
|
||||
@@ -108,7 +111,7 @@ module.exports.initSession = function (desired, opts) {
|
||||
}).then(function () {
|
||||
if (env.SAUCE) return browser.sauceJobStatus(passed);
|
||||
})
|
||||
.catch(function () { console.warn("didn't manange to set sauce status."); })
|
||||
.catch(function (err) { console.warn("didn't manange to set sauce status. error:", err); })
|
||||
.sleep(2000);
|
||||
},
|
||||
promisedBrowser: deferred.promise
|
||||
|
||||
Reference in New Issue
Block a user