From 72637de9a982b811e73f6d7fd6d95e31e97406ce Mon Sep 17 00:00:00 2001 From: Jonas Zohren Date: Fri, 16 Jul 2021 22:18:54 +0200 Subject: [PATCH] Cleanup for MR --- .gitlab-ci.yml | 10 ++++++---- .../test-element-web-registration.js} | 15 +++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) rename tests/{puppeteer/test-element-web.js => client-element-web/test-element-web-registration.js} (85%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a2b6aa..cb7385a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,23 +32,25 @@ test:cargo: - cargo test --workspace --verbose --locked - cargo clippy -test:register:element-release: + +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/puppeteer/" + - "cd tests/client-element-web/" - "npm install puppeteer" - - "node test-element-web.js" + - "node test-element-web-registration.js \"https://app.element.io/\" \"http://localhost:6167\"" - "killall --regexp \"conduit\"" - "cd ../.." - "cat conduit.log" artifacts: paths: - - "tests/puppeteer/*.png" + - "tests/client-element-web/*.png" - "*.log" expire_in: 1 week when: always diff --git a/tests/puppeteer/test-element-web.js b/tests/client-element-web/test-element-web-registration.js similarity index 85% rename from tests/puppeteer/test-element-web.js rename to tests/client-element-web/test-element-web-registration.js index a3c3dae..8f2e7f0 100644 --- a/tests/puppeteer/test-element-web.js +++ b/tests/client-element-web/test-element-web-registration.js @@ -1,13 +1,20 @@ const puppeteer = require('puppeteer'); run().then(() => console.log('Done')).catch(error => { - console.error("Registration test failed"); + 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); @@ -19,9 +26,9 @@ async function run() { }); const page = await browser.newPage(); - await page.goto('https://app.element.io/'); + await page.goto(elementUrl); - await page.screenshot({ path: '01-element-web-started.png' }); + await page.screenshot({ path: '01-element-web-opened.png' }); console.debug("Click [Create Account] button"); await page.waitForSelector('a.mx_ButtonCreateAccount'); @@ -42,7 +49,7 @@ async function run() { await page.waitForSelector('input#mx_homeserverInput'); await page.click('input#mx_homeserverInput'); await page.click('input#mx_homeserverInput'); - await page.keyboard.type('http://localhost:6167'); + await page.keyboard.type(homeserverUrl); await page.screenshot({ path: '04-typed-in-homeserver.png' });