|
@@ -55,6 +55,45 @@ describe('Application life cycle test', function () {
|
|
done();
|
|
done();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ function waitForUrl(url, done) {
|
|
|
|
+ browser.wait(function () {
|
|
|
|
+ return browser.getCurrentUrl().then(function (currentUrl) {
|
|
|
|
+ return currentUrl === url;
|
|
|
|
+ });
|
|
|
|
+ }, TIMEOUT).then(function () { done(); });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function setAvatar(done) {
|
|
|
|
+ browser.get('https://' + app.fqdn + '/user/settings/avatar');
|
|
|
|
+
|
|
|
|
+ browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png')).then(function () {
|
|
|
|
+ browser.findElement(by.xpath('//button[contains(text(), "Update Avatar Setting")]')).click();
|
|
|
|
+
|
|
|
|
+ browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"updated successfully")]')), TIMEOUT).then(function () { done(); });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function checkAvatar(done) {
|
|
|
|
+ superagent.get('https://' + app.fqdn + '/avatars/1').end(function (error, result) {
|
|
|
|
+ expect(error).to.be(null);
|
|
|
|
+ expect(result.statusCode).to.be(200);
|
|
|
|
+ done();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function editFile(done) {
|
|
|
|
+ browser.get('https://' + app.fqdn + '/' + username + '/' + reponame + '/_edit/master/newfile');
|
|
|
|
+
|
|
|
|
+ var cm = browser.findElement(by.xpath('//div[contains(@class,"CodeMirror")]'));
|
|
|
|
+ var text = 'yo';
|
|
|
|
+ browser.executeScript('arguments[0].CodeMirror.setValue("' + text + '");', cm).then(function () {
|
|
|
|
+ browser.findElement(by.xpath('//input[@name="commit_summary"]')).sendKeys('Dummy edit');
|
|
|
|
+ browser.findElement(by.xpath('//button[contains(text(), "Commit Changes")]')).click();
|
|
|
|
+
|
|
|
|
+ waitForUrl('https://' + app.fqdn + '/' + username + '/' + reponame + '/src/master/newfile', done);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
xit('build app', function () {
|
|
xit('build app', function () {
|
|
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
});
|
|
});
|
|
@@ -112,6 +151,9 @@ describe('Application life cycle test', function () {
|
|
browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); });
|
|
browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); });
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ it('can set avatar', setAvatar);
|
|
|
|
+ it('can get avatar', checkAvatar);
|
|
|
|
+
|
|
it('can add public key', function (done) {
|
|
it('can add public key', function (done) {
|
|
browser.get('https://' + app.fqdn + '/user/settings/ssh');
|
|
browser.get('https://' + app.fqdn + '/user/settings/ssh');
|
|
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
|
|
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
|
|
@@ -162,6 +204,8 @@ describe('Application life cycle test', function () {
|
|
done();
|
|
done();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ it('can edit file', editFile);
|
|
|
|
+
|
|
it('can restart app', function (done) {
|
|
it('can restart app', function (done) {
|
|
execSync('cloudron restart');
|
|
execSync('cloudron restart');
|
|
done();
|
|
done();
|
|
@@ -184,6 +228,8 @@ describe('Application life cycle test', function () {
|
|
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ it('can get avatar', checkAvatar);
|
|
|
|
+
|
|
it('can clone the url', function (done) {
|
|
it('can clone the url', function (done) {
|
|
var env = Object.create(process.env);
|
|
var env = Object.create(process.env);
|
|
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
|
|
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
|
|
@@ -209,6 +255,8 @@ describe('Application life cycle test', function () {
|
|
browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); });
|
|
browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); });
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ it('can get avatar', checkAvatar);
|
|
|
|
+
|
|
it('displays correct clone url', function (done) {
|
|
it('displays correct clone url', function (done) {
|
|
browser.get('https://' + app.fqdn + '/' + username + '/' + reponame);
|
|
browser.get('https://' + app.fqdn + '/' + username + '/' + reponame);
|
|
browser.findElement(by.id('repo-clone-ssh')).click();
|
|
browser.findElement(by.id('repo-clone-ssh')).click();
|