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.
This commit is contained in:
+3
-9
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { app, click, cloudronCli, goto, loginOIDC, sendKeys, setupBrowser, takeScreenshot, teardownBrowser, waitFor } from '@cloudron/charlie';
|
||||
import { app, clearCache, click, cloudronCli, goto, loginOIDC, sendKeys, setupBrowser, takeScreenshot, teardownBrowser, waitFor } from '@cloudron/charlie';
|
||||
|
||||
/* global it, describe, before, after, afterEach */
|
||||
|
||||
@@ -32,12 +32,6 @@ describe('Application life cycle test', function () {
|
||||
await loginOIDC('xpath=//span[contains(., "Bookmarks")] | //strong[text()="Successfully authenticated from Cloudron account."]');
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
await goto(`https://${app.fqdn}/settings/preferences/appearance`, 'css=#logout');
|
||||
await click('css=#logout');
|
||||
await waitFor('css=#user_email');
|
||||
}
|
||||
|
||||
async function checkTimeline() {
|
||||
await goto(`https://${app.fqdn}/home`, 'Your home timeline is empty');
|
||||
}
|
||||
@@ -70,7 +64,7 @@ describe('Application life cycle test', function () {
|
||||
it('registration is disabled', checkRegistrationClosed);
|
||||
it('can OIDC login', loginOidc);
|
||||
it('can see timeline', checkTimeline);
|
||||
it('can logout', logout);
|
||||
it('can logout', clearCache);
|
||||
|
||||
it('backup app', cloudronCli.createBackup);
|
||||
it('restore app', cloudronCli.restoreFromLatestBackup);
|
||||
@@ -91,7 +85,7 @@ describe('Application life cycle test', function () {
|
||||
// test update
|
||||
it('can install app for update', cloudronCli.appstoreInstall);
|
||||
it('can OIDC login', loginOidc);
|
||||
it('can logout', logout);
|
||||
it('can logout', clearCache);
|
||||
|
||||
it('can update', cloudronCli.update);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user