Fix test
This commit is contained in:
parent
4372579bff
commit
33135d2354
12
test/test.js
12
test/test.js
|
@ -29,7 +29,6 @@ describe('Application life cycle test', function () {
|
||||||
const SSH_PORT = 29420;
|
const SSH_PORT = 29420;
|
||||||
|
|
||||||
let app, browser;
|
let app, browser;
|
||||||
let athenticated_by_oidc = false;
|
|
||||||
|
|
||||||
const repodir = '/tmp/testrepo';
|
const repodir = '/tmp/testrepo';
|
||||||
const reponame = 'testrepo';
|
const reponame = 'testrepo';
|
||||||
|
@ -108,24 +107,21 @@ describe('Application life cycle test', function () {
|
||||||
await login('root', 'changeme');
|
await login('root', 'changeme');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginOIDC(username, password) {
|
async function loginOIDC(username, password, alreadyAuthenticated = true) {
|
||||||
browser.manage().deleteAllCookies();
|
browser.manage().deleteAllCookies();
|
||||||
await browser.get(`https://${app.fqdn}/user/login`);
|
await browser.get(`https://${app.fqdn}/user/login`);
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
|
|
||||||
|
await browser.findElement(By.xpath('//a[contains(@href, "/user/oauth2/Cloudron")]')).click();
|
||||||
await browser.findElement(By.xpath('//a[contains(@class, "openidConnect") and contains(., "Sign in with cloudron")]')).click();
|
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
|
|
||||||
if (!athenticated_by_oidc) {
|
if (!alreadyAuthenticated) {
|
||||||
await waitForElement(By.xpath('//input[@name="username"]'));
|
await waitForElement(By.xpath('//input[@name="username"]'));
|
||||||
await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(username);
|
await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(username);
|
||||||
await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password);
|
await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password);
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
await browser.findElement(By.id('loginSubmitButton')).click();
|
await browser.findElement(By.id('loginSubmitButton')).click();
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
|
|
||||||
athenticated_by_oidc = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await waitForElement(By.xpath('//img[contains(@class, "avatar")]'));
|
await waitForElement(By.xpath('//img[contains(@class, "avatar")]'));
|
||||||
|
@ -219,7 +215,7 @@ describe('Application life cycle test', function () {
|
||||||
it('can send mail', sendMail);
|
it('can send mail', sendMail);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can login', loginOIDC.bind(null, username, password));
|
it('can login', loginOIDC.bind(null, username, password, false));
|
||||||
it('can set avatar', setAvatar);
|
it('can set avatar', setAvatar);
|
||||||
it('can get avatar', checkAvatar);
|
it('can get avatar', checkAvatar);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue