1
0
mirror of https://git.cloudron.io/cloudron/gitea-app synced 2026-05-01 15:02:35 +00:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Girish Ramakrishnan f0e98b3ea0 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.
2026-05-01 10:39:30 +02:00
Girish Ramakrishnan 335940ab4a test file cleanups 2026-04-30 10:22:27 +02:00
Girish Ramakrishnan 7c3fa660e0 test: pass full Mocha test to takeScreenshot for unique screenshot names 2026-04-29 17:09:57 +02:00
+6 -26
View File
@@ -4,22 +4,7 @@ import assert from 'node:assert/strict';
import { execSync } from 'node:child_process'; import { execSync } from 'node:child_process';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { import { app, clearCache, click, cloudronCli, goto, loginOIDC, sendKeys, setupBrowser, takeScreenshot, teardownBrowser, username, waitFor, waitForUrl, press } from '@cloudron/charlie';
app,
clearCache,
click,
cloudronCli,
goto,
loginOIDC,
sendKeys,
setupBrowser,
takeScreenshot,
teardownBrowser,
username,
waitFor,
waitForUrl,
press
} from '@cloudron/charlie';
/* global it, describe, before, after, afterEach */ /* global it, describe, before, after, afterEach */
@@ -36,7 +21,7 @@ describe('Application life cycle test', function () {
}); });
afterEach(async function () { afterEach(async function () {
await takeScreenshot(this.currentTest.title); await takeScreenshot(this.currentTest);
}); });
async function login(user, passwd) { async function login(user, passwd) {
@@ -52,16 +37,11 @@ describe('Application life cycle test', function () {
} }
async function loginGiteaOIDC() { async function loginGiteaOIDC() {
await clearCache();
await goto(`https://${app.fqdn}/user/login`, /Sign in with/); await goto(`https://${app.fqdn}/user/login`, /Sign in with/);
await click(/Sign in with/); await click(/Sign in with/);
await loginOIDC('Milestones'); await loginOIDC('Milestones');
} }
async function logout() {
await clearCache();
}
async function addPublicKey() { async function addPublicKey() {
const keyPath = path.join(import.meta.dirname, 'id_ed25519'); const keyPath = path.join(import.meta.dirname, 'id_ed25519');
fs.chmodSync(keyPath, 0o600); fs.chmodSync(keyPath, 0o600);
@@ -108,7 +88,7 @@ describe('Application life cycle test', function () {
}); });
it('can admin login', adminLogin); it('can admin login', adminLogin);
it('can logout', logout); it('can logout', clearCache);
it('can login', loginGiteaOIDC); it('can login', loginGiteaOIDC);
@@ -149,11 +129,11 @@ describe('Application life cycle test', function () {
}); });
it('can admin login (no sso)', adminLogin); it('can admin login (no sso)', adminLogin);
it('can logout', logout); it('can logout', clearCache);
it('uninstall app (no sso)', cloudronCli.uninstall); it('uninstall app (no sso)', cloudronCli.uninstall);
it('can install app from appstore', async function () { it('can install app for update', async function () {
await cloudronCli.appstoreInstall({ tcpPortFlags: INSTALL_TCP_FLAGS }); await cloudronCli.appstoreInstall({ tcpPortFlags: INSTALL_TCP_FLAGS });
}); });
@@ -166,7 +146,7 @@ describe('Application life cycle test', function () {
it('can update', cloudronCli.update); it('can update', cloudronCli.update);
it('can admin login', adminLogin); it('can admin login', adminLogin);
it('can logout', logout); it('can logout', clearCache);
it('can login', loginGiteaOIDC); it('can login', loginGiteaOIDC);
it('can clone the url', cloneRepo); it('can clone the url', cloneRepo);