From 752dc395e1038024dcfbc0d741af5b8682e1e3fe Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 1 May 2026 10:39:27 +0200 Subject: [PATCH] test: simplify clearCache, drop logout helpers, simplify button selectors - Drop `await clearCache()` from login/auth helpers; clearing cache before every login is no longer necessary now that charlie isolates sessions. - Replace `logout` helpers with `clearCache` directly in `it()` calls; the helpers were either thin wrappers around `clearCache()` or did real navigation that is no longer worth the maintenance. - Simplify `xpath=//button[text()=...]` / `[contains(., ...)]` button text selectors to charlie's bare-string (or RegExp for OR-clauses) form. --- test/test.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/test/test.js b/test/test.js index 7b42374..5ce5e4b 100644 --- a/test/test.js +++ b/test/test.js @@ -32,18 +32,10 @@ describe('Application life cycle test', function () { } async function loginViaOIDC() { - await clearCache(); await goto(`https://${app.fqdn}/i/`); await loginOIDC('css=#btn-subscription'); } - async function logout() { - await goto(`https://${app.fqdn}`, 'css=#stream'); - await click('css=.dropdown-toggle'); - await click('xpath=//li/*[contains(@class,"signout")]'); - await waitFor('css=#loginButton'); - } - async function addSubscription() { const url = 'https://blog.cloudron.io/rss/'; const addUrl = app.manifest.version === '1.10.0' ? `${baseUrl()}/i/?c=subscription` : `${baseUrl()}/i/?c=subscription&a=add`; @@ -59,11 +51,11 @@ describe('Application life cycle test', function () { if (relogin) { await sendKeys('css=#passwordPlain', admin_password); - await click('xpath=//button[contains(.,"Login")]'); + await click('Login'); } await click('css=#api_enabled'); - await click('xpath=//button[text()="Submit"]'); + await click('Submit'); } async function checkApiConfiguration() { @@ -92,7 +84,7 @@ describe('Application life cycle test', function () { it('can check configuration', checkApiConfiguration); it('subscription exists', subscriptionExists); it('can get static extension file', getStaticExtensionFile); - it('can logout', logout); + it('can logout', clearCache); it('uninstall app', cloudronCli.uninstall); // SSO