1
0
mirror of https://git.cloudron.io/cloudron/gitea-app synced 2025-09-01 23:35:06 +00:00

setup appdata directory

fixes #3 and #4
This commit is contained in:
Girish Ramakrishnan
2017-04-04 21:42:26 -07:00
parent 072a8ea354
commit 35738a5579
4 changed files with 74 additions and 7 deletions

View File

@@ -55,6 +55,45 @@ describe('Application life cycle test', function () {
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 () {
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(); });
});
it('can set avatar', setAvatar);
it('can get avatar', checkAvatar);
it('can add public key', function (done) {
browser.get('https://' + app.fqdn + '/user/settings/ssh');
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
@@ -162,6 +204,8 @@ describe('Application life cycle test', function () {
done();
});
it('can edit file', editFile);
it('can restart app', function (done) {
execSync('cloudron restart');
done();
@@ -184,6 +228,8 @@ describe('Application life cycle test', function () {
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can get avatar', checkAvatar);
it('can clone the url', function (done) {
var env = Object.create(process.env);
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(); });
});
it('can get avatar', checkAvatar);
it('displays correct clone url', function (done) {
browser.get('https://' + app.fqdn + '/' + username + '/' + reponame);
browser.findElement(by.id('repo-clone-ssh')).click();