Compare commits

...

22 Commits

Author SHA1 Message Date
Girish Ramakrishnan
940ca3c5bc Version 1.98.0 2024-10-15 18:43:36 +02:00
Renovate Bot
337178cbe3 chore(deps): update dependency element-hq/synapse to v1.117.0 2024-10-15 16:21:57 +00:00
Girish Ramakrishnan
417ccb1b90 update tests 2024-10-15 18:21:42 +02:00
Girish Ramakrishnan
bd139e7e51 uninstall element 2024-10-15 18:00:47 +02:00
Girish Ramakrishnan
1fd50ed537 proceed with reset here 2024-10-15 17:33:46 +02:00
Girish Ramakrishnan
fbcbe82562 unsure when reset comes in 2024-10-15 17:20:17 +02:00
Girish Ramakrishnan
0796c63cfc have separate app objects 2024-10-15 17:11:36 +02:00
Girish Ramakrishnan
57a7c5a874 removed login by mistake 2024-10-15 17:00:04 +02:00
Girish Ramakrishnan
564422747a more test fixing 2024-10-15 16:56:23 +02:00
Girish Ramakrishnan
540e8b955a uninstall any previous element 2024-10-15 16:35:05 +02:00
Girish Ramakrishnan
d80249d454 Fix test 2024-10-15 16:31:20 +02:00
Renovate Bot
144d1169ec chore(deps): add renovate.json 2024-10-15 14:14:56 +00:00
Girish Ramakrishnan
f5ebcedfa3 Update renovate for s3 2024-10-15 14:13:43 +00:00
Girish Ramakrishnan
647e78afd2 Add renovate 2024-10-15 14:11:31 +00:00
Girish Ramakrishnan
b255387cde add files for ci 2024-10-15 16:09:15 +02:00
Johannes Zellner
7976cc122d Bump version 2024-10-02 17:46:05 +02:00
Johannes Zellner
a2709eebdb Update test deps 2024-10-02 17:14:42 +02:00
Johannes Zellner
3018681164 Update to 1.116.0 2024-10-02 17:14:29 +02:00
Girish Ramakrishnan
800e8f667e add element to tag list 2024-09-23 10:06:46 +02:00
Johannes Zellner
1363bab648 Bump version 2024-09-18 12:44:07 +02:00
Johannes Zellner
6099885ae5 Update test deps 2024-09-18 11:56:09 +02:00
Johannes Zellner
638ba056a0 Update to 1.115.0 2024-09-18 11:56:02 +02:00
8 changed files with 125 additions and 89 deletions

5
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,5 @@
include:
- project: devops/pipeline-components
ref: main
file: cloudron-app.gitlab-ci.yml

View File

@@ -1275,3 +1275,15 @@
* Update Synapse to 1.114.0 * Update Synapse to 1.114.0
* [Full changelog](https://github.com/element-hq/synapse/releases/tag/v1.114.0) * [Full changelog](https://github.com/element-hq/synapse/releases/tag/v1.114.0)
[1.97.5]
* Update Synapse to 1.115.0
* [Full changelog](https://github.com/element-hq/synapse/releases/tag/v1.115.0)
[1.97.6]
* Update Synapse to 1.116.0
* [Full changelog](https://github.com/element-hq/synapse/releases/tag/v1.116.0)
[1.98.0]
* Update Synapse to 1.118.0
* [Full changelog](https://github.com/element-hq/synapse/releases/tag/v1.118.0)

View File

@@ -5,24 +5,39 @@
"description": "file://DESCRIPTION.md", "description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG.md", "changelog": "file://CHANGELOG.md",
"tagline": "Secure & decentralized communication", "tagline": "Secure & decentralized communication",
"version": "1.97.4", "version": "1.98.0",
"upstreamVersion": "1.114.0", "upstreamVersion": "1.117.0",
"healthCheckPath": "/", "healthCheckPath": "/",
"httpPort": 8008, "httpPort": 8008,
"memoryLimit": 536870912, "memoryLimit": 536870912,
"addons": { "addons": {
"localstorage": {}, "localstorage": {},
"oidc": { "loginRedirectUri": "/_synapse/client/oidc/callback" }, "oidc": {
"loginRedirectUri": "/_synapse/client/oidc/callback"
},
"postgresql": {}, "postgresql": {},
"sendmail": { "supportsDisplayName": true }, "sendmail": {
"turn": { "optional": true } "supportsDisplayName": true
},
"turn": {
"optional": true
}
}, },
"manifestVersion": 2, "manifestVersion": 2,
"website": "https://matrix.org", "website": "https://matrix.org",
"contactEmail": "support@cloudron.io", "contactEmail": "support@cloudron.io",
"icon": "file://logo.png", "icon": "file://logo.png",
"tags": [ "tags": [
"im", "collaboration", "voip", "videochat", "chat", "slack", "zulip", "federated" "im",
"collaboration",
"voip",
"videochat",
"chat",
"slack",
"zulip",
"federated",
"element",
"riot"
], ],
"mediaLinks": [ "mediaLinks": [
"https://screenshots.cloudron.io/org.matrix.synapse/1.png", "https://screenshots.cloudron.io/org.matrix.synapse/1.png",

View File

@@ -9,16 +9,17 @@ RUN virtualenv -p python3 /app/code/env
ENV VIRTUAL_ENV=/app/code/env ENV VIRTUAL_ENV=/app/code/env
ENV PATH="$VIRTUAL_ENV/bin:$PATH" ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ARG VERSION=1.114.0 # renovate: datasource=github-releases depName=element-hq/synapse versioning=semver extractVersion=^v(?<version>.+)$
ARG SYNAPSE_VERSION=1.117.0
# https://github.com/matrix-org/synapse-s3-storage-provider # renovate: datasource=github-releases depName=matrix-org/synapse-s3-storage-provider versioning=semver extractVersion=^v(?<version>.+)$
ARG STORAGE_PROVIDER_VERSION=1beb6af95e1f5caedb8e6e7e1cc176cdb2106d37 ARG S3PROVIDER_VERSION=1.4.0
# Synapse (https://github.com/matrix-org/synapse/blob/master/INSTALL.md) # Synapse (https://github.com/matrix-org/synapse/blob/master/INSTALL.md)
# lxml - required for previews # lxml - required for previews
RUN pip install --upgrade pip && \ RUN pip install --upgrade pip && \
pip install --upgrade setuptools && \ pip install --upgrade setuptools && \
pip install matrix-synapse==v${VERSION} psycopg2-binary python-ldap matrix-synapse-ldap3 lxml publicsuffix2 git+https://github.com/matrix-org/synapse-s3-storage-provider.git@${STORAGE_PROVIDER_VERSION} matrix-synapse[oidc] pip install matrix-synapse==v${SYNAPSE_VERSION} psycopg2-binary python-ldap matrix-synapse-ldap3 lxml publicsuffix2 git+https://github.com/matrix-org/synapse-s3-storage-provider.git@v${S3PROVIDER_VERSION} matrix-synapse[oidc]
# Updated suffix list # Updated suffix list
RUN curl -L https://publicsuffix.org/list/public_suffix_list.dat -o /app/code/env/lib/python3.10/site-packages/publicsuffix2/public_suffix_list.dat RUN curl -L https://publicsuffix.org/list/public_suffix_list.dat -o /app/code/env/lib/python3.10/site-packages/publicsuffix2/public_suffix_list.dat

6
renovate.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>devops/renovator//config/app/default.json5"
]
}

28
test/package-lock.json generated
View File

@@ -9,10 +9,10 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^128.0.1", "chromedriver": "^129.0.2",
"expect.js": "^0.3.1", "expect.js": "^0.3.1",
"mocha": "^10.7.3", "mocha": "^10.7.3",
"selenium-webdriver": "^4.24.0" "selenium-webdriver": "^4.25.0"
} }
}, },
"node_modules/@bazel/runfiles": { "node_modules/@bazel/runfiles": {
@@ -246,9 +246,9 @@
} }
}, },
"node_modules/chromedriver": { "node_modules/chromedriver": {
"version": "128.0.1", "version": "129.0.2",
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-128.0.1.tgz", "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-129.0.2.tgz",
"integrity": "sha512-UmWqZXXAyuRa37pE+lnU46vJcCM/y0ddF015LHxycEOYfuqsK7k9ZxJuXCQNWbws9e7FAMQj/GJZT92WPgis0g==", "integrity": "sha512-rUEFCJAmAwOdFfaDFtveT97fFeA7NOxlkgyPyN+G09Ws4qGW39aLDxMQBbS9cxQQHhTihqZZobgF5CLVYXnmGA==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@testim/chrome-version": "^1.1.4", "@testim/chrome-version": "^1.1.4",
@@ -1180,9 +1180,9 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}, },
"node_modules/selenium-webdriver": { "node_modules/selenium-webdriver": {
"version": "4.24.0", "version": "4.25.0",
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.24.0.tgz", "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.25.0.tgz",
"integrity": "sha512-qrqoHhHPZuKLiz5VAQUxrn3ILs7/cYqn2/x96r35g5JjkLUjOS1lX+F+tEJKhRMlQ/MGJ+N1016JF5g2xZUFzw==", "integrity": "sha512-zl9IX93caOT8wbcCpZzAkEtYa+hNgJ4C5GUN8uhpzggqRLvsg1asfKi0p1uNZC8buYVvsBZbx8S+9MjVAjs4oA==",
"dependencies": { "dependencies": {
"@bazel/runfiles": "^5.8.1", "@bazel/runfiles": "^5.8.1",
"jszip": "^3.10.1", "jszip": "^3.10.1",
@@ -1663,9 +1663,9 @@
} }
}, },
"chromedriver": { "chromedriver": {
"version": "128.0.1", "version": "129.0.2",
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-128.0.1.tgz", "resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-129.0.2.tgz",
"integrity": "sha512-UmWqZXXAyuRa37pE+lnU46vJcCM/y0ddF015LHxycEOYfuqsK7k9ZxJuXCQNWbws9e7FAMQj/GJZT92WPgis0g==", "integrity": "sha512-rUEFCJAmAwOdFfaDFtveT97fFeA7NOxlkgyPyN+G09Ws4qGW39aLDxMQBbS9cxQQHhTihqZZobgF5CLVYXnmGA==",
"requires": { "requires": {
"@testim/chrome-version": "^1.1.4", "@testim/chrome-version": "^1.1.4",
"axios": "^1.7.4", "axios": "^1.7.4",
@@ -2338,9 +2338,9 @@
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}, },
"selenium-webdriver": { "selenium-webdriver": {
"version": "4.24.0", "version": "4.25.0",
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.24.0.tgz", "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.25.0.tgz",
"integrity": "sha512-qrqoHhHPZuKLiz5VAQUxrn3ILs7/cYqn2/x96r35g5JjkLUjOS1lX+F+tEJKhRMlQ/MGJ+N1016JF5g2xZUFzw==", "integrity": "sha512-zl9IX93caOT8wbcCpZzAkEtYa+hNgJ4C5GUN8uhpzggqRLvsg1asfKi0p1uNZC8buYVvsBZbx8S+9MjVAjs4oA==",
"requires": { "requires": {
"@bazel/runfiles": "^5.8.1", "@bazel/runfiles": "^5.8.1",
"jszip": "^3.10.1", "jszip": "^3.10.1",

View File

@@ -9,9 +9,9 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^128.0.1", "chromedriver": "^129.0.2",
"expect.js": "^0.3.1", "expect.js": "^0.3.1",
"mocha": "^10.7.3", "mocha": "^10.7.3",
"selenium-webdriver": "^4.24.0" "selenium-webdriver": "^4.25.0"
} }
} }

View File

@@ -1,11 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
/* jshint esversion: 8 */ /* jshint esversion: 8 */
/* global it:false */ /* global it, xit, describe, before, after, afterEach */
/* global xit:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict'; 'use strict';
@@ -13,11 +9,11 @@ require('chromedriver');
const execSync = require('child_process').execSync, const execSync = require('child_process').execSync,
expect = require('expect.js'), expect = require('expect.js'),
fs = require('fs'),
path = require('path'), path = require('path'),
{ Builder, By, Key, until } = require('selenium-webdriver'), { Builder, By, Key, until } = require('selenium-webdriver'),
{ Options } = require('selenium-webdriver/chrome'); { Options } = require('selenium-webdriver/chrome');
if (!process.env.USERNAME || !process.env.PASSWORD) { if (!process.env.USERNAME || !process.env.PASSWORD) {
console.log('USERNAME and PASSWORD env vars need to be set'); console.log('USERNAME and PASSWORD env vars need to be set');
process.exit(1); process.exit(1);
@@ -27,7 +23,7 @@ describe('Application life cycle test', function () {
this.timeout(0); this.timeout(0);
const ELEMENT_LOCATION = 'element-test'; const ELEMENT_LOCATION = 'element-test';
const LOCATION = 'test'; const LOCATION = process.env.LOCATION || 'test';
const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000; const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000;
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
const USERNAME = process.env.USERNAME; const USERNAME = process.env.USERNAME;
@@ -36,22 +32,40 @@ describe('Application life cycle test', function () {
const ROOM_NAME = 'Test room ' + ROOM_ID; const ROOM_NAME = 'Test room ' + ROOM_ID;
const MSG_TEXT = 'Test message '; const MSG_TEXT = 'Test message ';
let browser, app; let browser, app, elementApp;
let athenticated_by_oidc = false;
before(function () { before(function () {
const options = new Options().windowSize({ width: 1280, height: 1024 }); const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 });
if (process.env.HEADLESS) options.addArguments('headless'); if (process.env.CI) chromeOptions.addArguments('no-sandbox', 'disable-dev-shm-usage', 'headless');
browser = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build();
if (!fs.existsSync('./screenshots')) fs.mkdirSync('./screenshots');
browser = new Builder().forBrowser('chrome').setChromeOptions(options).build(); if (process.env.CI) execSync(`cloudron uninstall --app ${ELEMENT_LOCATION} || true`, EXEC_ARGS);
}); });
after(function () { after(function () {
browser.quit(); browser.quit();
}); });
function sleep(millis) { afterEach(async function () {
return new Promise(resolve => setTimeout(resolve, millis)); if (!process.env.CI || !app) return;
const currentUrl = await browser.getCurrentUrl();
if (!currentUrl.includes(app.domain)) return;
expect(this.currentTest.title).to.be.a('string');
const screenshotData = await browser.takeScreenshot();
fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64');
});
async function clearCache() {
await browser.manage().deleteAllCookies();
await browser.quit();
browser = null;
const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 });
if (process.env.CI) chromeOptions.addArguments('no-sandbox', 'disable-dev-shm-usage', 'headless');
chromeOptions.addArguments(`--user-data-dir=${await fs.promises.mkdtemp('/tmp/test-')}`); // --profile-directory=Default
browser = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build();
} }
async function waitForElement(elem) { async function waitForElement(elem) {
@@ -67,8 +81,8 @@ describe('Application life cycle test', function () {
function getElementAppInfo() { function getElementAppInfo() {
const inspect = JSON.parse(execSync('cloudron inspect')); const inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location.indexOf(ELEMENT_LOCATION) === 0; })[0]; elementApp = inspect.apps.filter(function (a) { return a.location.indexOf(ELEMENT_LOCATION) === 0; })[0];
expect(app).to.be.an('object'); expect(elementApp).to.be.an('object');
} }
function getMessage() { function getMessage() {
@@ -80,7 +94,7 @@ describe('Application life cycle test', function () {
execSync(`cloudron exec --app ${ELEMENT_LOCATION} -- bash -c "jq '.default_server_config[\\"m.homeserver\\"].base_url = \\"https://${app.fqdn}\\"' /app/data/config.json | sponge /app/data/config.json"`); execSync(`cloudron exec --app ${ELEMENT_LOCATION} -- bash -c "jq '.default_server_config[\\"m.homeserver\\"].base_url = \\"https://${app.fqdn}\\"' /app/data/config.json | sponge /app/data/config.json"`);
execSync(`cloudron restart --app ${ELEMENT_LOCATION}`); execSync(`cloudron restart --app ${ELEMENT_LOCATION}`);
// wait when all services are up and running // wait when all services are up and running
await sleep(15000); await browser.sleep(15000);
} }
async function checkLandingPage() { async function checkLandingPage() {
@@ -89,7 +103,7 @@ describe('Application life cycle test', function () {
} }
async function registerUser() { 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 waitForElement(By.xpath('//input[@label="Username"]'));
await browser.findElement(By.xpath('//input[@label="Username"]')).sendKeys(USERNAME); await browser.findElement(By.xpath('//input[@label="Username"]')).sendKeys(USERNAME);
await browser.sleep(2000); await browser.sleep(2000);
@@ -106,35 +120,29 @@ describe('Application life cycle test', function () {
await waitForElement(By.xpath(`//h1[contains(., "Welcome")]`)); await waitForElement(By.xpath(`//h1[contains(., "Welcome")]`));
} }
async function loginOIDC(username, password) { async function loginOIDC(username, password, hasSession, proceedWithReset) {
browser.manage().deleteAllCookies(); browser.manage().deleteAllCookies();
await browser.get(`https://${app.fqdn}/#/login`); await browser.get(`https://${elementApp.fqdn}/#/login`);
await browser.sleep(6000); await browser.sleep(6000);
await waitForElement(By.xpath('//div[@role="button" and contains(., "Continue with Cloudron")]')); await waitForElement(By.xpath('//div[@role="button" and contains(., "Continue with Cloudron")]'));
await browser.findElement(By.xpath('//div[@role="button" and contains(., "Continue with Cloudron")]')).click(); await browser.findElement(By.xpath('//div[@role="button" and contains(., "Continue with Cloudron")]')).click();
await browser.sleep(2000); await browser.sleep(2000);
if (!athenticated_by_oidc) { if (!hasSession) {
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('//p[@class="confirm-trust" and contains(., "Continuing will grant ")]')); await waitForElement(By.xpath('//p[@class="confirm-trust" and contains(., "Continuing will grant ")]'));
await browser.findElement(By.xpath('//a[contains(., "Continue")]')).click(); await browser.findElement(By.xpath('//a[contains(., "Continue")]')).click();
await browser.sleep(2000); await browser.sleep(2000);
//if (await browser.findElements(By.xpath('//div[@aria-label="Skip verification for now"]')).then(found => !!found.length)) { if (proceedWithReset) {
// await skipVerification();
//}
if (await browser.findElements(By.xpath('//div[text()="Proceed with reset"]')).then(found => !!found.length)) {
await browser.findElement(By.xpath('//div[text()="Proceed with reset"]')).click(); await browser.findElement(By.xpath('//div[text()="Proceed with reset"]')).click();
await waitForElement(By.xpath('//button[text()="Continue"]')); await waitForElement(By.xpath('//button[text()="Continue"]'));
@@ -160,17 +168,13 @@ describe('Application life cycle test', function () {
} }
async function login() { 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.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="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.findElement(By.xpath('//input[@value="Sign in"]')).click(); await browser.findElement(By.xpath('//input[@value="Sign in"]')).click();
await browser.sleep(5000); await browser.sleep(5000);
await skipVerification();
if (await browser.findElements(By.xpath('//div[@aria-label="Skip verification for now"]')).then(found => !!found.length)) {
await skipVerification();
}
await browser.wait(until.elementLocated(By.xpath('//span[text()="Rooms"]')), TEST_TIMEOUT); await browser.wait(until.elementLocated(By.xpath('//span[text()="Rooms"]')), TEST_TIMEOUT);
} }
@@ -185,7 +189,7 @@ describe('Application life cycle test', function () {
} }
async function logout() { async function logout() {
await browser.get('https://' + app.fqdn + '/#/home'); await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.sleep(5000); await browser.sleep(5000);
await waitForElement(By.xpath('//div[@role="button" and @aria-label="User menu"]')); await waitForElement(By.xpath('//div[@role="button" and @aria-label="User menu"]'));
@@ -195,21 +199,21 @@ describe('Application life cycle test', function () {
await browser.findElement(By.xpath('//li[@role="menuitem" and @aria-label="Sign out"]')).click(); await browser.findElement(By.xpath('//li[@role="menuitem" and @aria-label="Sign out"]')).click();
await browser.sleep(2000); await browser.sleep(2000);
// if (await browser.findElements(By.xpath('//button[contains(text(), "I don\'t want my encrypted messages")]')).then(found => !!found.length)) { if (await browser.findElements(By.xpath('//button[contains(text(), "I don\'t want my encrypted messages")]')).then(found => !!found.length)) {
await browser.findElement(By.xpath('//button[contains(text(), "I don\'t want my encrypted messages")]')).click(); await browser.findElement(By.xpath('//button[contains(text(), "I don\'t want my encrypted messages")]')).click();
await browser.sleep(3000); await browser.sleep(3000);
// } }
await waitForElement(By.xpath('//h1[text()="Sign in"]')); await waitForElement(By.xpath('//h1[text()="Sign in"]'));
} }
async function isLoggedIn() { 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); await browser.wait(until.elementLocated(By.xpath('//span[text()="Rooms"]')), TEST_TIMEOUT);
} }
async function createRoom() { async function createRoom() {
await browser.get('https://' + app.fqdn + '/#/home'); await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.sleep(4000); await browser.sleep(4000);
await waitForElement(By.xpath('//div[@role="button" and @aria-label="Add room"]')); 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(); await browser.findElement(By.xpath('//div[@role="button" and @aria-label="Add room"]')).click();
@@ -229,7 +233,7 @@ describe('Application life cycle test', function () {
} }
async function checkRoom() { async function checkRoom() {
await browser.get('https://' + app.fqdn + '/#/home'); await browser.get(`https://${elementApp.fqdn}/#/home`);
await browser.sleep(4000); await browser.sleep(4000);
await waitForElement(By.xpath('//div[@role="treeitem" and @aria-label="' + ROOM_NAME + '"]')); 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(); await browser.findElement(By.xpath('//div[@role="treeitem" and @aria-label="' + ROOM_NAME + '"]')).click();
@@ -261,15 +265,12 @@ describe('Application life cycle test', function () {
it('can register new user', registerUser); it('can register new user', registerUser);
it('create room', createRoom); it('create room', createRoom);
it('can send message', sendMessage); it('can send message', sendMessage);
it('can logout', logout); // from auto-login
it('can logout', logout);
it('can login', login); it('can login', login);
it('check room', checkRoom); it('check room', checkRoom);
it('can logout', logout); it('can logout', logout);
it('can get app info', getAppInfo);
it('uninstall element-web app', async function () { it('uninstall element-web app', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
execSync(`cloudron uninstall --app ${ELEMENT_LOCATION}`, EXEC_ARGS); execSync(`cloudron uninstall --app ${ELEMENT_LOCATION}`, EXEC_ARGS);
@@ -281,10 +282,10 @@ describe('Application life cycle test', function () {
it('can get app info', getAppInfo); 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 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('update element-app config', updateSynapseConfig);
it('can get Element app info', getElementAppInfo); it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD, false, false /* proceedWithReset */));
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD));
it('create room', createRoom); it('create room', createRoom);
it('can send message', sendMessage); it('can send message', sendMessage);
it('can get app info', getAppInfo); it('can get app info', getAppInfo);
@@ -293,10 +294,8 @@ describe('Application life cycle test', function () {
it('backup app', function () { execSync(`cloudron backup create --app ${app.id}`, EXEC_ARGS); }); 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('is logged in', isLoggedIn);
it('check room', checkRoom); it('check room', checkRoom);
it('can get app info', getAppInfo);
it('restore app', async function () { it('restore app', async function () {
const backups = JSON.parse(execSync(`cloudron backup list --raw --app ${app.id}`)); const backups = JSON.parse(execSync(`cloudron backup list --raw --app ${app.id}`));
@@ -310,7 +309,6 @@ describe('Application life cycle test', function () {
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS); 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('is logged in', isLoggedIn);
it('check room', checkRoom); it('check room', checkRoom);
it('can send message', sendMessage); it('can send message', sendMessage);
@@ -323,50 +321,49 @@ describe('Application life cycle test', function () {
execSync(`cloudron configure --location ${LOCATION}2`, EXEC_ARGS); execSync(`cloudron configure --location ${LOCATION}2`, EXEC_ARGS);
getAppInfo(); getAppInfo();
// wait when all services are up and running await browser.sleep(15000);
await sleep(15000);
}); });
it('update element-app config', updateSynapseConfig); it('update element-app config', updateSynapseConfig);
it('can get Element app info', getElementAppInfo); it('can get Element app info', getElementAppInfo);
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD)); it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD, true, true /* proceedWithReset */));
it('check room', checkRoom); it('check room', checkRoom);
it('can send message', sendMessage); it('can send message', sendMessage);
it('can logout', logout);
it('can get app info', getAppInfo);
it('uninstall app', async function () { it('uninstall app', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS); execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS);
}); });
it('uninstall element-web app', function () {
execSync(`cloudron uninstall --app ${ELEMENT_LOCATION}`, EXEC_ARGS);
});
// test update // 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 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('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('can get Element app info', getElementAppInfo);
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD)); it('update element-app config', updateSynapseConfig);
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD, false, false /* proceedWithReset */));
it('is logged in', isLoggedIn); it('is logged in', isLoggedIn);
it('create room', createRoom); it('create room', createRoom);
it('can send message', sendMessage); it('can send message', sendMessage);
it('can logout', logout); it('can logout', logout);
it('can get app info', getAppInfo);
it('can update', async function () { it('can update', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
execSync(`cloudron update --app ${app.id}`, EXEC_ARGS); execSync(`cloudron update --app ${app.id}`, EXEC_ARGS);
// wait when all services are up and running await browser.sleep(15000);
await sleep(15000);
}); });
it('can get Element app info', getElementAppInfo); it('can get Element app info', getElementAppInfo);
it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD)); it('can login via OIDC', loginOIDC.bind(null, USERNAME, PASSWORD, true, true /* proceedWithReset */));
it('is logged in', isLoggedIn); it('is logged in', isLoggedIn);
it('check room', checkRoom); it('check room', checkRoom);
it('can send message', sendMessage); it('can send message', sendMessage);