mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-04 00:02:03 +08:00
CB-13006: removed create and update end-to-end tests, and instead added more unit test coverage. tweaked code coverage invocation so that we get coverage details on the create.js module. slight changes to the create.js module so that it is slightly easier to test.
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var actions = require('./helpers/projectActions.js');
|
||||
|
||||
var CREATE_TIMEOUT = 180000;
|
||||
|
||||
function createAndBuild (projectname, projectid, done) {
|
||||
actions.createProject(projectname, projectid, function (error) {
|
||||
expect(error).toBe(null);
|
||||
actions.buildProject(projectid, function (error) {
|
||||
expect(error).toBe(null);
|
||||
actions.removeProject(projectid);
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('create', function () {
|
||||
|
||||
it('Test#001 : create project with ascii name, no spaces', function (done) {
|
||||
var projectname = 'testcreate';
|
||||
var projectid = 'com.test.create.app1';
|
||||
|
||||
createAndBuild(projectname, projectid, done);
|
||||
}, CREATE_TIMEOUT);
|
||||
|
||||
it('Test#002 : create project with ascii name, and spaces', function (done) {
|
||||
var projectname = 'test create';
|
||||
var projectid = 'com.test.create.app2';
|
||||
|
||||
createAndBuild(projectname, projectid, done);
|
||||
}, CREATE_TIMEOUT);
|
||||
|
||||
it('Test#003 : create project with unicode name, no spaces', function (done) {
|
||||
var projectname = '応応応応用用用用';
|
||||
var projectid = 'com.test.create.app3';
|
||||
|
||||
createAndBuild(projectname, projectid, done);
|
||||
}, CREATE_TIMEOUT);
|
||||
|
||||
it('Test#004 : create project with unicode name, and spaces', function (done) {
|
||||
var projectname = '応応応応 用用用用';
|
||||
var projectid = 'com.test.create.app4';
|
||||
|
||||
createAndBuild(projectname, projectid, done);
|
||||
}, CREATE_TIMEOUT);
|
||||
|
||||
it('Test#005 : create project with ascii+unicode name, no spaces', function (done) {
|
||||
var projectname = '応応応応hello用用用用';
|
||||
var projectid = 'com.test.create.app5';
|
||||
|
||||
createAndBuild(projectname, projectid, done);
|
||||
}, CREATE_TIMEOUT);
|
||||
|
||||
it('Test#006 : create project with ascii+unicode name, and spaces', function (done) {
|
||||
var projectname = '応応応応 hello 用用用用';
|
||||
var projectid = 'com.test.create.app6';
|
||||
|
||||
createAndBuild(projectname, projectid, done);
|
||||
}, CREATE_TIMEOUT);
|
||||
|
||||
});
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
var actions = require('./helpers/projectActions.js');
|
||||
var shell = require('shelljs');
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
var platformOld = { version: '4.0.0', path: 'cordova-android-old' };
|
||||
var platformEdge = { version: getCurrentVersion(), path: '.' };
|
||||
|
||||
var DOWNLOAD_TIMEOUT = 2 * 60 * 1000;
|
||||
var UPDATE_TIMEOUT = 90 * 1000;
|
||||
var PLATFORM_GIT_URL = 'https://github.com/apache/cordova-android';
|
||||
|
||||
function getCurrentVersion () {
|
||||
return fs.readFileSync('VERSION').toString().trim();
|
||||
}
|
||||
|
||||
function testUpdate (projectname, projectid, createfrom, updatefrom, doBuild, done) {
|
||||
actions.createProject(projectname, projectid, createfrom.path, function (error) {
|
||||
expect(error).toBe(null);
|
||||
actions.updateProject(projectid, updatefrom.path, function (error) {
|
||||
expect(error).toBe(null);
|
||||
actions.getPlatformVersion(projectid, function (v) {
|
||||
expect(v).toEqual(updatefrom.version);
|
||||
if (doBuild) {
|
||||
actions.buildProject(projectid, function (error) {
|
||||
expect(error).toBe(null);
|
||||
actions.removeProject(projectid);
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
actions.removeProject(projectid);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('preparing fixtures', function () {
|
||||
|
||||
it('Test#001 : cloning old platform', function (done) {
|
||||
var command = util.format('git clone %s --depth=1 --branch %s %s',
|
||||
PLATFORM_GIT_URL, platformOld.version, platformOld.path);
|
||||
shell.rm('-rf', platformOld.path);
|
||||
shell.exec(command, { silent: true }, function (err) {
|
||||
expect(err).toBe(0);
|
||||
done();
|
||||
});
|
||||
}, DOWNLOAD_TIMEOUT);
|
||||
|
||||
});
|
||||
|
||||
describe('update', function () {
|
||||
|
||||
it('Test#002 : should update major version and build the project', function (done) {
|
||||
var projectname = 'testupdate';
|
||||
var projectid = 'com.test.update.app1';
|
||||
|
||||
testUpdate(projectname, projectid, platformOld, platformEdge, true, done);
|
||||
|
||||
}, UPDATE_TIMEOUT);
|
||||
|
||||
});
|
||||
|
||||
describe('cleanup', function () {
|
||||
|
||||
it('Test#004 : remove cloned old platform', function () {
|
||||
shell.rm('-rf', platformOld.path);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user