Skip to content

Commit

Permalink
Modernize our one E2E test (#858)
Browse files Browse the repository at this point in the history
The test should still do the same thing as before.
No change tested code intended.

This also gets rid of the barely used and outdated E2E helpers
  • Loading branch information
raphinesse authored Oct 30, 2019
1 parent 5dfa995 commit fcaab36
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 170 deletions.
150 changes: 0 additions & 150 deletions spec/e2e/helpers/projectActions.js

This file was deleted.

49 changes: 29 additions & 20 deletions spec/e2e/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,37 @@
under the License.
*/

var path = require('path');
var actions = require('./helpers/projectActions.js');
const os = require('os');
const fs = require('fs');
const path = require('path');
const shell = require('shelljs');
const { PluginInfoProvider, superspawn } = require('cordova-common');

var PLUGIN_ADD_TIMEOUT = 90000;
const createBin = path.join(__dirname, '../../bin/create');
const fakePluginPath = path.join(__dirname, 'fixtures/cordova-plugin-fake');

describe('plugin add', function () {

it('Test#001 : create project and add a plugin with framework', function (done) {
var projectname = 'testpluginframework';
var projectid = 'com.test.plugin.framework';
var fakePluginPath = path.join(__dirname, 'fixtures/cordova-plugin-fake');

actions.createProject(projectname, projectid, function () {
actions.addPlugin(projectid, fakePluginPath, function (error) {
actions.removeProject(projectid);
if (error) {
console.error(error.stack);
}
expect(error).toBe(null);
done();
let tmpDir;
beforeEach(() => {
const tmpDirTemplate = path.join(os.tmpdir(), `cordova-android-test-`);
tmpDir = fs.realpathSync(fs.mkdtempSync(tmpDirTemplate));
});
afterEach(() => {
shell.rm('-rf', tmpDir);
});

it('Test#001 : create project and add a plugin with framework', function () {
const projectname = 'testpluginframework';
const projectid = 'com.test.plugin.framework';

const projectPath = path.join(tmpDir, projectname);
const pluginInfo = new PluginInfoProvider().get(fakePluginPath);

return Promise.resolve()
.then(() => superspawn.spawn(createBin, [projectPath, projectid, projectname]))
.then(() => {
const Api = require(path.join(projectPath, 'cordova/Api.js'));
return new Api('android', projectPath).addPlugin(pluginInfo);
});
});
}, PLUGIN_ADD_TIMEOUT);

}, 90000);
});

0 comments on commit fcaab36

Please sign in to comment.