mirror of
https://git.cloudron.io/cloudron/gitea-app.git
synced 2024-11-21 23:50:59 +00:00
Fixup tests
This commit is contained in:
parent
77e05f56bf
commit
e5296ab5ee
1 changed files with 5 additions and 36 deletions
41
test/test.js
41
test/test.js
|
@ -11,11 +11,10 @@
|
|||
|
||||
require('chromedriver');
|
||||
|
||||
var execSync = require('child_process').execSync,
|
||||
const execSync = require('child_process').execSync,
|
||||
expect = require('expect.js'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
rimraf = require('rimraf'),
|
||||
superagent = require('superagent'),
|
||||
{ Builder, By, until } = require('selenium-webdriver'),
|
||||
{ Options } = require('selenium-webdriver/chrome');
|
||||
|
@ -49,7 +48,7 @@ describe('Application life cycle test', function () {
|
|||
|
||||
after(function () {
|
||||
browser.quit();
|
||||
rimraf.sync(repodir);
|
||||
fs.rmSync(repodir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function getAppInfo() {
|
||||
|
@ -122,24 +121,6 @@ describe('Application life cycle test', function () {
|
|||
await browser.wait(until.elementLocated(By.xpath('//p[contains(text(), "has been added.")]')), TIMEOUT);
|
||||
}
|
||||
|
||||
async function addPublicKeyOld() {
|
||||
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
|
||||
|
||||
const sshPage = 'https://' + app.fqdn + '/user/settings/keys';
|
||||
|
||||
await browser.get(sshPage);
|
||||
|
||||
await browser.wait(until.elementLocated(By.xpath('//div[@data-panel="#add-ssh-key-panel"]')), TIMEOUT);
|
||||
await browser.findElement(By.xpath('//div[@data-panel="#add-ssh-key-panel"]')).click();
|
||||
await browser.findElement(By.id('ssh-key-title')).sendKeys('testkey');
|
||||
await browser.findElement(By.id('ssh-key-content')).sendKeys(publicKey.trim()); // #3480
|
||||
var button = browser.findElement(By.xpath('//button[contains(text(), "Add Key")]'));
|
||||
await browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
||||
await browser.findElement(By.xpath('//button[contains(text(), "Add Key")]')).click();
|
||||
|
||||
await browser.wait(until.elementLocated(By.xpath('//p[contains(text(), "has been added.")]')), TIMEOUT);
|
||||
}
|
||||
|
||||
async function createRepo() {
|
||||
var getRepoPage = await browser.get('https://' + app.fqdn + '/repo/create');
|
||||
|
||||
|
@ -165,7 +146,7 @@ describe('Application life cycle test', function () {
|
|||
}
|
||||
|
||||
function cloneRepo() {
|
||||
rimraf.sync(repodir);
|
||||
fs.rmSync(repodir, { recursive: true, force: true });
|
||||
var env = Object.create(process.env);
|
||||
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
|
||||
execSync(`git clone ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame}.git ${repodir}`, { env: env });
|
||||
|
@ -176,7 +157,7 @@ describe('Application life cycle test', function () {
|
|||
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
|
||||
execSync(`touch newfile && git add newfile && git commit -a -mx && git push ssh://git@${app.fqdn}:${SSH_PORT}/${username}/${reponame} master`,
|
||||
{ env: env, cwd: repodir });
|
||||
rimraf.sync('/tmp/testrepo');
|
||||
fs.rmSync(repodir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
function fileExists() {
|
||||
|
@ -252,18 +233,6 @@ describe('Application life cycle test', function () {
|
|||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||
});
|
||||
|
||||
// check if the _first_ login via email succeeds
|
||||
it('can login via email', async function () { execSync(`cloudron install --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, EXEC_ARGS); });
|
||||
|
||||
it('can get app information', getAppInfo);
|
||||
it('can login', login.bind(null, email, password));
|
||||
|
||||
it('uninstall app', async function () {
|
||||
// ensure we don't hit NXDOMAIN in the mean time
|
||||
await browser.get('about:blank');
|
||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||
});
|
||||
|
||||
// No SSO
|
||||
it('install app (no sso)', function () { execSync(`cloudron install --no-sso --location ${LOCATION} -p SSH_PORT=${SSH_PORT}`, EXEC_ARGS); });
|
||||
|
||||
|
@ -283,7 +252,7 @@ describe('Application life cycle test', function () {
|
|||
it('can login', login.bind(null, username, password));
|
||||
it('can set avatar', setAvatar);
|
||||
it('can get avatar', checkAvatar);
|
||||
it('can add public key', addPublicKeyOld);
|
||||
it('can add public key', addPublicKey);
|
||||
it('can create repo', createRepo);
|
||||
it('can clone the url', cloneRepo);
|
||||
it('can add and push a file', pushFile);
|
||||
|
|
Loading…
Reference in a new issue