mirror of
https://github.com/appium/appium.git
synced 2026-02-12 21:10:10 -06:00
don't run tests by starting server with app anymore, let's do it all from desired caps
This commit is contained in:
committed by
Sebastian Tiedtke
parent
e6cde7c0e1
commit
241f9884cc
@@ -11,9 +11,14 @@ var _ = require("underscore")
|
||||
, spawn = require('child_process').spawn;
|
||||
|
||||
module.exports.startAppium = function(appName, verbose, readyCb, doneCb) {
|
||||
var app = (fs.existsSync(appName)) ? appName:
|
||||
path.resolve(__dirname,
|
||||
"./sample-code/apps/"+appName+"/build/Release-iphonesimulator/"+appName+".app");
|
||||
var app;
|
||||
if (appName) {
|
||||
app = (fs.existsSync(appName)) ? appName:
|
||||
path.resolve(__dirname,
|
||||
"./sample-code/apps/"+appName+"/build/Release-iphonesimulator/"+appName+".app");
|
||||
} else {
|
||||
app = null;
|
||||
}
|
||||
return server.run({
|
||||
app: app
|
||||
, udid: null
|
||||
@@ -57,12 +62,16 @@ module.exports.runMochaTests = function(grunt, appName, testType, cb) {
|
||||
}
|
||||
var args = ['-t', options.timeout, '-R', options.reporter, '--colors'];
|
||||
var fileConfig = grunt.config(['mochaTestWithServer']);
|
||||
_.each(fileConfig[appName], function(testFiles, testKey) {
|
||||
if (testType == "*" || testType == testKey) {
|
||||
_.each(testFiles, function(file) {
|
||||
_.each(grunt.file.expandFiles(file), function(file) {
|
||||
args.push(file);
|
||||
});
|
||||
_.each(fileConfig, function(config, configApp) {
|
||||
if (!appName || appName === configApp) {
|
||||
_.each(config, function(testFiles, testKey) {
|
||||
if (testType == "*" || testType == testKey) {
|
||||
_.each(testFiles, function(file) {
|
||||
_.each(grunt.file.expandFiles(file), function(file) {
|
||||
args.push(file);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
10
grunt.js
10
grunt.js
@@ -35,10 +35,9 @@ module.exports = function(grunt) {
|
||||
, mochaTestWithServer: {
|
||||
TestApp: {
|
||||
functional: ['test/functional/*.js']
|
||||
, unit: ['app/test/unit/*.js']
|
||||
}
|
||||
, UICatalog: {
|
||||
uicatalog: ['test/uicatalog/*.js']
|
||||
functional: ['test/uicatalog/*.js']
|
||||
}
|
||||
}
|
||||
, mochaTestConfig: {
|
||||
@@ -51,12 +50,9 @@ module.exports = function(grunt) {
|
||||
|
||||
grunt.loadNpmTasks('grunt-mocha-test');
|
||||
grunt.registerTask('functional', "Run functional tests", function(log) {
|
||||
runTestsWithServer(grunt, 'TestApp', 'functional', log === "log", this.async());
|
||||
runTestsWithServer(grunt, null, 'functional', log === "log", this.async());
|
||||
});
|
||||
grunt.registerTask('uicatalog', "Run UICatalog tests", function(log) {
|
||||
runTestsWithServer(grunt, 'UICatalog', 'uicatalog', log === "log", this.async());
|
||||
});
|
||||
grunt.registerTask('test', 'lint buildApp:TestApp buildApp:UICatalog unit appiumutils functional uicatalog');
|
||||
grunt.registerTask('test', 'lint buildApp:TestApp buildApp:UICatalog unit appiumutils functional');
|
||||
grunt.registerTask('unit', 'mochaTest:unit');
|
||||
grunt.registerTask('appiumutils', 'mochaTest:appiumutils');
|
||||
grunt.registerTask('default', 'lint test');
|
||||
|
||||
Reference in New Issue
Block a user