Fix tests
This commit is contained in:
parent
bf67824fa6
commit
2329c01ba5
50
test/test.js
50
test/test.js
|
@ -77,7 +77,13 @@ describe('Application life cycle test', function () {
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.findElement(by.xpath('//button[contains(text(), "Update Avatar Setting")]')).click();
|
return browser.findElement(by.xpath('//button[contains(text(), "Update Avatar Setting")]')).click();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"updated successfully")]')), TIMEOUT).then(function () { done(); });
|
if (app.manifest.version === '1.0.3') {
|
||||||
|
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"updated successfully")]')), TIMEOUT);
|
||||||
|
} else {
|
||||||
|
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"Your avatar setting has been updated.")]')), TIMEOUT);
|
||||||
|
}
|
||||||
|
}).then(function () {
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,28 +126,52 @@ describe('Application life cycle test', function () {
|
||||||
function addPublicKey(done) {
|
function addPublicKey(done) {
|
||||||
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
|
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
|
||||||
|
|
||||||
browser.get('https://' + app.fqdn + '/user/settings/ssh').then(function () {
|
var sshPage;
|
||||||
|
if (app.manifest.version === '1.0.3') {
|
||||||
|
sshPage = 'https://' + app.fqdn + '/user/settings/ssh';
|
||||||
|
} else {
|
||||||
|
sshPage = 'https://' + app.fqdn + '/user/settings/keys';
|
||||||
|
}
|
||||||
|
|
||||||
|
browser.get(sshPage).then(function () {
|
||||||
return browser.findElement(by.xpath('//div[text()="Add Key"]')).click();
|
return browser.findElement(by.xpath('//div[text()="Add Key"]')).click();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.findElement(by.id('ssh-key-title')).sendKeys('testkey');
|
return browser.findElement(by.id('ssh-key-title')).sendKeys('testkey');
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.findElement(by.id('ssh-key-content')).sendKeys(publicKey.trim()); // #3480
|
return browser.findElement(by.id('ssh-key-content')).sendKeys(publicKey.trim()); // #3480
|
||||||
|
}).then(function () {
|
||||||
|
var button = browser.findElement(by.xpath('//button[contains(text(), "Add Key")]'));
|
||||||
|
return browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.findElement(by.xpath('//button[contains(text(), "Add Key")]')).click();
|
return browser.findElement(by.xpath('//button[contains(text(), "Add Key")]')).click();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(), "added successfully!")]')), TIMEOUT);
|
if (app.manifest.version === '1.0.3') {
|
||||||
|
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(), "added successfully!")]')), TIMEOUT);
|
||||||
|
} else {
|
||||||
|
return browser.wait(until.elementLocated(by.xpath('//p[contains(text(), "has been added.")]')), TIMEOUT);
|
||||||
|
}
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRepo(done) {
|
function createRepo(done) {
|
||||||
browser.get('https://' + app.fqdn).then(function () {
|
var getRepoPage;
|
||||||
return browser.findElement(by.linkText('New Repository')).click();
|
if (app.manifest.version === '1.0.3') {
|
||||||
}).then(function () {
|
getRepoPage = browser.get('https://' + app.fqdn).then(function () {
|
||||||
return browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "New Repository")]')), TIMEOUT);
|
return browser.findElement(by.linkText('New Repository')).click();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
return browser.wait(until.elementLocated(by.xpath('//*[contains(text(), "New Repository")]')), TIMEOUT);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
getRepoPage = browser.get('https://' + app.fqdn + '/repo/create');
|
||||||
|
}
|
||||||
|
|
||||||
|
getRepoPage.then(function () {
|
||||||
return browser.findElement(by.id('repo_name')).sendKeys(reponame);
|
return browser.findElement(by.id('repo_name')).sendKeys(reponame);
|
||||||
|
}).then(function () {
|
||||||
|
var button = browser.findElement(by.xpath('//button[contains(text(), "Create Repository")]'));
|
||||||
|
return browser.executeScript('arguments[0].scrollIntoView(true)', button);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.findElement(by.id('auto-init')).click();
|
return browser.findElement(by.id('auto-init')).click();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
@ -250,7 +280,8 @@ describe('Application life cycle test', function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can clone the url', checkCloneUrl);
|
it('can login', login);
|
||||||
|
it('displays correct clone url', checkCloneUrl);
|
||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('file exists in repo', fileExists);
|
it('file exists in repo', fileExists);
|
||||||
|
|
||||||
|
@ -262,6 +293,7 @@ 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 login', login);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
it('can clone the url', cloneRepo);
|
it('can clone the url', cloneRepo);
|
||||||
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
|
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
|
||||||
|
|
Loading…
Reference in New Issue