From 566bcd19bceac44d85aed020c68c54b6ab821967 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 30 Nov 2015 18:13:47 -0800 Subject: [PATCH] test app reconfigure --- test/test.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/test.js b/test/test.js index 20013c8..4b0d4b0 100755 --- a/test/test.js +++ b/test/test.js @@ -166,6 +166,39 @@ describe('Application life cycle test', function () { done(); }); + it('move to different location', function () { + browser.manage().deleteAllCookies(); + execSync('cloudron install --location ' + LOCATION + '2', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); + var inspect = JSON.parse(execSync('cloudron inspect')); + app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; + expect(app).to.be.an('object'); + }); + + it('can login', function (done) { + browser.get('https://' + app.fqdn + '/user/login'); + browser.findElement(by.id('user_name')).sendKeys(username); + browser.findElement(by.id('password')).sendKeys(password); + browser.findElement(by.tagName('form')).submit(); + browser.wait(until.elementLocated(by.linkText('Dashboard')), 4000).then(function () { done(); }); + }); + + it('displays correct clone url', function (done) { + browser.get('https://' + app.fqdn + '/' + username + '/' + reponame); + browser.findElement(by.id('repo-clone-url')).getAttribute('value').then(function (cloneUrl) { + expect(cloneUrl).to.be('ssh://cloudron@' + app.fqdn + ':29418/' + username + '/' + reponame + '.git'); + done(); + }); + }); + + it('can clone the url', function (done) { + var env = Object.create(process.env); + env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh'; + execSync('git clone ssh://cloudron@' + app.fqdn + ':29418/' + username + '/' + reponame + '.git ' + repodir, { env: env }); + expect(fs.existsSync(repodir + '/newfile')).to.be(true); + rimraf.sync(repodir); + done(); + }); + it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); });