have separate app objects

This commit is contained in:
Girish Ramakrishnan
2024-10-15 17:11:36 +02:00
parent 57a7c5a874
commit 0796c63cfc

View File

@@ -32,7 +32,7 @@ describe('Application life cycle test', function () {
const ROOM_NAME = 'Test room ' + ROOM_ID;
const MSG_TEXT = 'Test message ';
let browser, app;
let browser, app, elementApp;
before(function () {
const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 });
@@ -81,8 +81,8 @@ describe('Application life cycle test', function () {
function getElementAppInfo() {
const inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location.indexOf(ELEMENT_LOCATION) === 0; })[0];
expect(app).to.be.an('object');
elementApp = inspect.apps.filter(function (a) { return a.location.indexOf(ELEMENT_LOCATION) === 0; })[0];
expect(elementApp).to.be.an('object');
}
function getMessage() {
@@ -103,7 +103,7 @@ describe('Application life cycle test', function () {
}
async function registerUser() {
await browser.get(`https://${app.fqdn}/#/register`);
await browser.get(`https://${elementApp.fqdn}/#/register`);
await waitForElement(By.xpath('//input[@label="Username"]'));
await browser.findElement(By.xpath('//input[@label="Username"]')).sendKeys(USERNAME);
await browser.sleep(2000);
@@ -122,7 +122,7 @@ describe('Application life cycle test', function () {
async function loginOIDC(username, password, hasSession) {
browser.manage().deleteAllCookies();
await browser.get(`https://${app.fqdn}/#/login`);
await browser.get(`https://${elementApp.fqdn}/#/login`);
await browser.sleep(6000);
await waitForElement(By.xpath('//div[@role="button" and contains(., "Continue with Cloudron")]'));
@@ -168,7 +168,7 @@ describe('Application life cycle test', function () {
}
async function login() {
await browser.get('https://' + app.fqdn + '/#/login');
await browser.get(`https://${elementApp.fqdn}/#/login`);
await browser.wait(until.elementLocated(By.xpath('//input[@value="Sign in"]')), TEST_TIMEOUT);
await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(USERNAME);
await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(PASSWORD);
@@ -189,7 +189,7 @@ describe('Application life cycle test', function () {
}
async function logout() {
await browser.get('https://' + app.fqdn + '/#/home');
await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.sleep(5000);
await waitForElement(By.xpath('//div[@role="button" and @aria-label="User menu"]'));
@@ -208,12 +208,12 @@ describe('Application life cycle test', function () {
}
async function isLoggedIn() {
await browser.get('https://' + app.fqdn + '/#/home');
await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.wait(until.elementLocated(By.xpath('//span[text()="Rooms"]')), TEST_TIMEOUT);
}
async function createRoom() {
await browser.get('https://' + app.fqdn + '/#/home');
await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.sleep(4000);
await waitForElement(By.xpath('//div[@role="button" and @aria-label="Add room"]'));
await browser.findElement(By.xpath('//div[@role="button" and @aria-label="Add room"]')).click();
@@ -233,7 +233,7 @@ describe('Application life cycle test', function () {
}
async function checkRoom() {
await browser.get('https://' + app.fqdn + '/#/home');
await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.sleep(4000);
await waitForElement(By.xpath('//div[@role="treeitem" and @aria-label="' + ROOM_NAME + '"]'));
await browser.findElement(By.xpath('//div[@role="treeitem" and @aria-label="' + ROOM_NAME + '"]')).click();
@@ -282,9 +282,9 @@ describe('Application life cycle test', function () {
it('can get app info', getAppInfo);
it('can install element-web app (sso)', function () { execSync('cloudron install --appstore-id im.riot.cloudronapp --location ' + ELEMENT_LOCATION, EXEC_ARGS); });
it('can get Element app info', getElementAppInfo);
it('update element-app config', updateSynapseConfig);
it('can get Element app info', getElementAppInfo);
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD, false));
it('create room', createRoom);
it('can send message', sendMessage);
@@ -294,7 +294,6 @@ describe('Application life cycle test', function () {
it('backup app', function () { execSync(`cloudron backup create --app ${app.id}`, EXEC_ARGS); });
it('can get Element app info', getElementAppInfo);
it('is logged in', isLoggedIn);
it('check room', checkRoom);
@@ -310,7 +309,6 @@ describe('Application life cycle test', function () {
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
});
it('can get Element app info', getElementAppInfo);
it('is logged in', isLoggedIn);
it('check room', checkRoom);
it('can send message', sendMessage);
@@ -341,13 +339,13 @@ describe('Application life cycle test', function () {
// test update
it('clear cache', clearCache);
it('can install app for update', function () { execSync('cloudron install --appstore-id org.matrix.synapse --location ' + LOCATION, EXEC_ARGS); });
it('can install element-web app (update)', function () { execSync('cloudron install --appstore-id im.riot.cloudronapp --location ' + ELEMENT_LOCATION, EXEC_ARGS); });
it('can get app info', getAppInfo);
it('update element-app config', updateSynapseConfig);
it('can install element-web app (update)', function () { execSync('cloudron install --appstore-id im.riot.cloudronapp --location ' + ELEMENT_LOCATION, EXEC_ARGS); });
it('can get Element app info', getElementAppInfo);
it('update element-app config', updateSynapseConfig);
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD, false));
it('is logged in', isLoggedIn);
it('create room', createRoom);