Browse Source

Resolve merge conflicts for sytest branch

merge-requests/130/head
Jonas Zohren 5 years ago
parent
commit
aedd3c75f8
  1. 11
      .github/ISSUE_TEMPLATE/Issue.md
  2. 28
      .gitlab-ci.yml
  3. 19
      .gitlab/issue_templates/Bug Report.md
  4. 17
      .gitlab/issue_templates/Feature Request.md
  5. 15
      .gitlab/issue_templates/Issue Template.md
  6. 8
      .gitlab/merge_request_templates/MR.md
  7. 101
      tests/client-element-web/test-element-web-registration.js
  8. 15
      tests/test-config.toml

11
.github/ISSUE_TEMPLATE/Issue.md

@ -0,0 +1,11 @@
---
name: "Issue with / Feature Request for Conduit"
about: "Please file issues on GitLab: https://gitlab.com/famedly/conduit/-/issues/new"
title: "CLOSE ME"
---
**⚠ Conduit development does not happen on GitHub. Issues opened here will not be addressed**
Please open issues on GitLab: https://gitlab.com/famedly/conduit/-/issues/new

28
.gitlab-ci.yml

@ -8,8 +8,6 @@ variables:
FF_USE_FASTZIP: 1 FF_USE_FASTZIP: 1
CACHE_COMPRESSION_LEVEL: fastest CACHE_COMPRESSION_LEVEL: fastest
test:cargo: test:cargo:
stage: "test" stage: "test"
needs: [] needs: []
@ -34,7 +32,6 @@ test:cargo:
- cargo test --workspace --verbose --locked - cargo test --workspace --verbose --locked
- cargo clippy - cargo clippy
test:sytest: test:sytest:
stage: "test" stage: "test"
allow_failure: true allow_failure: true
@ -67,6 +64,29 @@ test:sytest:
junit: "$CI_PROJECT_DIR/sytest.xml" junit: "$CI_PROJECT_DIR/sytest.xml"
test:register:element-web-stable:
stage: "test"
needs:
- "build:cargo:x86_64-unknown-linux-gnu"
image: "buildkite/puppeteer:latest"
tags: ["docker"]
interruptible: true
script:
- "CONDUIT_CONFIG=tests/test-config.toml ./conduit-x86_64-unknown-linux-gnu > conduit.log &"
- "cd tests/client-element-web/"
- "npm install puppeteer"
- "node test-element-web-registration.js \"https://app.element.io/\" \"http://localhost:6167\""
- "killall --regexp \"conduit\""
- "cd ../.."
- "cat conduit.log"
artifacts:
paths:
- "tests/client-element-web/*.png"
- "*.log"
expire_in: 1 week
when: always
retry: 1
# --------------------------------------------------------------------- # # --------------------------------------------------------------------- #
# Cargo: Compiling for different architectures # # Cargo: Compiling for different architectures #
@ -110,6 +130,8 @@ build:cargo:x86_64-unknown-linux-gnu:
extends: .build-cargo-shared-settings extends: .build-cargo-shared-settings
variables: variables:
TARGET: "x86_64-unknown-linux-gnu" TARGET: "x86_64-unknown-linux-gnu"
rules:
- if: "$CI_COMMIT_BRANCH"
build:cargo:armv7-unknown-linux-gnueabihf: build:cargo:armv7-unknown-linux-gnueabihf:
extends: .build-cargo-shared-settings extends: .build-cargo-shared-settings

19
.gitlab/issue_templates/Bug Report.md

@ -0,0 +1,19 @@
<!--
If you're requesting a new feature, that isn't part of this project yet,
then please consider filling out a "Feature Request" instead!
If you need a hand setting up your conduit server, feel free to ask for help in the
Conduit Matrix Chat: https://matrix.to/#/#conduit:fachschaften.org.
-->
### Description
<!-- What did you do and what happened? Why is that bad? -->
### System Configuration
<!-- Other data that might help us debug this issue, like os, conduit version, database backend -->
Conduit Version:
Database backend (default is sqlite): sqlite
/label ~conduit

17
.gitlab/issue_templates/Feature Request.md

@ -0,0 +1,17 @@
<!--
If you want to report a bug or an error,
then please consider filling out a "Bug Report" instead!
-->
### Is your feature request related to a problem? Please describe.
<!-- Eg. I'm always frustrated when [...] -->
### Describe the solution you'd like
/label ~conduit

15
.gitlab/issue_templates/Issue Template.md

@ -1,15 +0,0 @@
# Headline
### Description
/label ~conduit

8
.gitlab/merge_request_templates/MR.md

@ -0,0 +1,8 @@
<!-- Please describe your changes here -->
-----------------------------------------------------------------------------
- [ ] I ran `cargo fmt` and `cargo test`
- [ ] I agree to release my code and all other changes of this MR under the Apache-2.0 license

101
tests/client-element-web/test-element-web-registration.js

@ -0,0 +1,101 @@
const puppeteer = require('puppeteer');
run().then(() => console.log('Done')).catch(error => {
console.error("Registration test failed.");
console.error("There might be a screenshot of the failure in the artifacts.\n");
console.error(error);
process.exit(111);
});
async function run() {
const elementUrl = process.argv[process.argv.length - 2];
console.debug("Testing registration with ElementWeb hosted at "+ elementUrl);
const homeserverUrl = process.argv[process.argv.length - 1];
console.debug("Homeserver url: "+ homeserverUrl);
const username = "testuser" + String(Math.floor(Math.random() * 100000));
const password = "testpassword" + String(Math.floor(Math.random() * 100000));
console.debug("Testuser for this run:\n User: " + username + "\n Password: " + password);
const browser = await puppeteer.launch({
headless: true, args: [
"--no-sandbox"
]
});
const page = await browser.newPage();
await page.goto(elementUrl);
await page.screenshot({ path: '01-element-web-opened.png' });
console.debug("Click [Create Account] button");
await page.waitForSelector('a.mx_ButtonCreateAccount');
await page.click('a.mx_ButtonCreateAccount');
await page.screenshot({ path: '02-clicked-create-account-button.png' });
// The webapp should have loaded right now, if anything takes more than 5 seconds, something probably broke
page.setDefaultTimeout(5000);
console.debug("Click [Edit] to switch homeserver");
await page.waitForSelector('div.mx_ServerPicker_change');
await page.click('div.mx_ServerPicker_change');
await page.screenshot({ path: '03-clicked-edit-homeserver-button.png' });
console.debug("Type in local homeserver url");
await page.waitForSelector('input#mx_homeserverInput');
await page.click('input#mx_homeserverInput');
await page.click('input#mx_homeserverInput');
await page.keyboard.type(homeserverUrl);
await page.screenshot({ path: '04-typed-in-homeserver.png' });
console.debug("[Continue] with changed homeserver");
await page.waitForSelector("div.mx_ServerPickerDialog_continue");
await page.click('div.mx_ServerPickerDialog_continue');
await page.screenshot({ path: '05-back-to-enter-user-credentials.png' });
console.debug("Type in username");
await page.waitForSelector("input#mx_RegistrationForm_username");
await page.click('input#mx_RegistrationForm_username');
await page.keyboard.type(username);
await page.screenshot({ path: '06-typed-in-username.png' });
console.debug("Type in password");
await page.waitForSelector("input#mx_RegistrationForm_password");
await page.click('input#mx_RegistrationForm_password');
await page.keyboard.type(password);
await page.screenshot({ path: '07-typed-in-password-once.png' });
console.debug("Type in password again");
await page.waitForSelector("input#mx_RegistrationForm_passwordConfirm");
await page.click('input#mx_RegistrationForm_passwordConfirm');
await page.keyboard.type(password);
await page.screenshot({ path: '08-typed-in-password-twice.png' });
console.debug("Click on [Register] to finish the account creation");
await page.waitForSelector("input.mx_Login_submit");
await page.click('input.mx_Login_submit');
await page.screenshot({ path: '09-clicked-on-register-button.png' });
// Waiting for the app to login can take some time, so be patient.
page.setDefaultTimeout(10000);
console.debug("Wait for chat window to show up");
await page.waitForSelector("div.mx_HomePage_default_buttons");
console.debug("Apparently the registration worked.");
await page.screenshot({ path: '10-logged-in-homescreen.png' });
// Close the browser and exit the script
await browser.close();
}

15
tests/test-config.toml

@ -0,0 +1,15 @@
[global]
# Server runs in same container as tests do, so localhost is fine
server_name = "localhost"
# With a bit of luck /tmp is a RAM disk, so that the file system does not become the bottleneck while testing
database_path = "/tmp"
# All the other settings are left at their defaults:
port = 6167
max_request_size = 20_000_000
allow_registration = true
trusted_servers = ["matrix.org"]
address = "127.0.0.1"
proxy = "none"
Loading…
Cancel
Save