From 82a4ec9cbde1a42d7c41f537a024cb3b8d45eb87 Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Sat, 17 Jul 2021 12:00:38 +0200 Subject: [PATCH 1/6] Add more detailed issue templates Shamelessly stolen from https://github.com/HedgeDoc/client Originally written by https://github.com/ErikMichelson and https://github.com/DerMolly --- .gitlab/issue_templates/Bug Report.md | 48 ++++++++++++++++++++++ .gitlab/issue_templates/Feature Request.md | 28 +++++++++++++ .gitlab/issue_templates/Issue Template.md | 15 ------- 3 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 .gitlab/issue_templates/Bug Report.md create mode 100644 .gitlab/issue_templates/Feature Request.md delete mode 100644 .gitlab/issue_templates/Issue Template.md diff --git a/.gitlab/issue_templates/Bug Report.md b/.gitlab/issue_templates/Bug Report.md new file mode 100644 index 0000000..3fdc303 --- /dev/null +++ b/.gitlab/issue_templates/Bug Report.md @@ -0,0 +1,48 @@ + + +### Description + + + + +### To Reproduce + + + + +### Expected behavior + + + + +### Error/Log + +```log +Copy and paste the error log from Conduit here. +``` + + +### Your Setup (please complete the following information): + +- Conduit version [e.g. Git commit at download time] +- OS: [e.g. Raspbian , Ubuntu 20.04, ...] +- RAM available to Conduit: [e.g. 1 GB] +- Cores available to Conduit: [e.g. 1 Core] + + +### Additional context + + + + +/label ~conduit diff --git a/.gitlab/issue_templates/Feature Request.md b/.gitlab/issue_templates/Feature Request.md new file mode 100644 index 0000000..4100eb6 --- /dev/null +++ b/.gitlab/issue_templates/Feature Request.md @@ -0,0 +1,28 @@ + + + +### Is your feature request related to a problem? Please describe. + + + + +### Describe the solution you'd like + + + + +### Describe alternatives you've considered + + + + +### Additional context + + + + + +/label ~conduit diff --git a/.gitlab/issue_templates/Issue Template.md b/.gitlab/issue_templates/Issue Template.md deleted file mode 100644 index e1a0667..0000000 --- a/.gitlab/issue_templates/Issue Template.md +++ /dev/null @@ -1,15 +0,0 @@ -# Headline - -### Description - - - - - - - - - - - -/label ~conduit From 7054f74783effdb96733c38b65e2f4f315ec2fd6 Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Sat, 17 Jul 2021 12:09:50 +0200 Subject: [PATCH 2/6] Add issue template for GitHub which redirects to Gitlab --- .github/ISSUE_TEMPLATE/Issue.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/Issue.md diff --git a/.github/ISSUE_TEMPLATE/Issue.md b/.github/ISSUE_TEMPLATE/Issue.md new file mode 100644 index 0000000..9022062 --- /dev/null +++ b/.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 \ No newline at end of file From 5d8ad4fd72bf9a5a06c14b1624432ce52b59cbe6 Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Sat, 17 Jul 2021 12:22:11 +0200 Subject: [PATCH 3/6] Add some more details to the MR template --- .gitlab/merge_request_templates/MR.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .gitlab/merge_request_templates/MR.md diff --git a/.gitlab/merge_request_templates/MR.md b/.gitlab/merge_request_templates/MR.md new file mode 100644 index 0000000..cf3c09e --- /dev/null +++ b/.gitlab/merge_request_templates/MR.md @@ -0,0 +1,8 @@ + + + +----------------------------------------------------------------------------- + +- [ ] I ran `cargo fmt --all`, `cargo test --workspace` and `cargo clippy` +- [ ] I agree to release my code and all other changes of this MR under the Apache-2.0 license + From 092221ca3f9c10eb66672b61bbadc15e8bfea7ab Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Sun, 18 Jul 2021 20:30:57 +0000 Subject: [PATCH 4/6] Reduce amount of text in Bug Report template --- .gitlab/issue_templates/Bug Report.md | 41 ++++----------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/.gitlab/issue_templates/Bug Report.md b/.gitlab/issue_templates/Bug Report.md index 3fdc303..3e66d43 100644 --- a/.gitlab/issue_templates/Bug Report.md +++ b/.gitlab/issue_templates/Bug Report.md @@ -2,47 +2,18 @@ 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 just have trouble setting up a conduit server or other questions, feel free to ask for help in the +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 + - +### System Configuration + - -### To Reproduce - - - - -### Expected behavior - - - - -### Error/Log - -```log -Copy and paste the error log from Conduit here. -``` - - -### Your Setup (please complete the following information): - -- Conduit version [e.g. Git commit at download time] -- OS: [e.g. Raspbian , Ubuntu 20.04, ...] -- RAM available to Conduit: [e.g. 1 GB] -- Cores available to Conduit: [e.g. 1 Core] - - -### Additional context - - +Conduit Version: +Database backend (default is sqlite): sqlite /label ~conduit From cdd01262d23e92b445cbb757005278358a6097d8 Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Sun, 18 Jul 2021 20:43:21 +0000 Subject: [PATCH 5/6] Shorten more templates --- .github/ISSUE_TEMPLATE/Issue.md | 2 +- .gitlab/issue_templates/Feature Request.md | 13 +------------ .gitlab/merge_request_templates/MR.md | 4 ++-- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Issue.md b/.github/ISSUE_TEMPLATE/Issue.md index 9022062..7889665 100644 --- a/.github/ISSUE_TEMPLATE/Issue.md +++ b/.github/ISSUE_TEMPLATE/Issue.md @@ -8,4 +8,4 @@ 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 \ No newline at end of file +Please open issues on GitLab: https://gitlab.com/famedly/conduit/-/issues/new diff --git a/.gitlab/issue_templates/Feature Request.md b/.gitlab/issue_templates/Feature Request.md index 4100eb6..3f636e7 100644 --- a/.gitlab/issue_templates/Feature Request.md +++ b/.gitlab/issue_templates/Feature Request.md @@ -6,22 +6,11 @@ then please consider filling out a "Bug Report" instead! ### Is your feature request related to a problem? Please describe. - + ### Describe the solution you'd like - - - -### Describe alternatives you've considered - - - - -### Additional context - - diff --git a/.gitlab/merge_request_templates/MR.md b/.gitlab/merge_request_templates/MR.md index cf3c09e..c592a3b 100644 --- a/.gitlab/merge_request_templates/MR.md +++ b/.gitlab/merge_request_templates/MR.md @@ -1,8 +1,8 @@ - + ----------------------------------------------------------------------------- -- [ ] I ran `cargo fmt --all`, `cargo test --workspace` and `cargo clippy` +- [ ] 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 From 2babff1e418d9c82d187f7c016d7e33ef00a3d2a Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Mon, 19 Jul 2021 08:23:04 +0000 Subject: [PATCH 6/6] CI: Test registration with element web --- .gitlab-ci.yml | 31 +++++- .../test-element-web-registration.js | 101 ++++++++++++++++++ tests/test-config.toml | 15 +++ 3 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 tests/client-element-web/test-element-web-registration.js create mode 100644 tests/test-config.toml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92da543..cb7385a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ stages: - - test - build + - test - upload artifacts variables: @@ -8,8 +8,6 @@ variables: FF_USE_FASTZIP: 1 CACHE_COMPRESSION_LEVEL: fastest - - test:cargo: stage: "test" needs: [] @@ -34,6 +32,31 @@ test:cargo: - cargo test --workspace --verbose --locked - cargo clippy + +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 # # --------------------------------------------------------------------- # @@ -76,6 +99,8 @@ build:cargo:x86_64-unknown-linux-gnu: extends: .build-cargo-shared-settings variables: TARGET: "x86_64-unknown-linux-gnu" + rules: + - if: "$CI_COMMIT_BRANCH" build:cargo:armv7-unknown-linux-gnueabihf: extends: .build-cargo-shared-settings diff --git a/tests/client-element-web/test-element-web-registration.js b/tests/client-element-web/test-element-web-registration.js new file mode 100644 index 0000000..8f2e7f0 --- /dev/null +++ b/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(); +} \ No newline at end of file diff --git a/tests/test-config.toml b/tests/test-config.toml new file mode 100644 index 0000000..c466687 --- /dev/null +++ b/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" \ No newline at end of file