Fixup tests

This commit is contained in:
Johannes Zellner 2022-01-31 14:08:14 +01:00
parent 8999bc9112
commit aa0b00cd1e

View file

@ -88,7 +88,7 @@ describe('Application life cycle test', function () {
await browser.findElement(By.id('user_name')).sendKeys(username);
await browser.findElement(By.id('password')).sendKeys(password);
await browser.findElement(By.xpath('//form[@action="/user/login"]//button')).click();
await browser.wait(until.elementLocated(By.linkText('Dashboard')), TIMEOUT);
await browser.wait(until.elementLocated(By.xpath('//img[contains(@class, "avatar")]')), TIMEOUT);
}
async function adminLogin() {
@ -111,7 +111,26 @@ describe('Application life cycle test', function () {
await browser.get(sshPage);
await browser.findElement(By.xpath('//div[text()="Add Key"]')).click();
await browser.wait(until.elementLocated(By.id('add-ssh-button')), TIMEOUT);
await browser.findElement(By.id('add-ssh-button')).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 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")]'));
@ -264,7 +283,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', addPublicKey);
it('can add public key', addPublicKeyOld);
it('can create repo', createRepo);
it('can clone the url', cloneRepo);
it('can add and push a file', pushFile);