mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-27 15:02:59 +00:00
Keep startup scan on a configured Vault
This commit is contained in:
@@ -151,7 +151,7 @@ LIVESYNC_CLI_COMMAND="docker run --rm --network host --user $(id -u):$(id -g) --
|
|||||||
|
|
||||||
`test:e2e:obsidian:p2p-setup-uri-workflow` runs two concurrent isolated real Obsidian sessions against the local Compose Nostr relay fixture. The first device imports a generated initial Setup URI and completes its signalling test with zero peers, creates a Setup URI for the second device through the registered command, and remains online while the second device imports it. The second device must select the expected online source before Fetch can rebuild its local database. The workflow accepts each connection request visibly on the receiving device, verifies the initial A-to-B fetch, checks that the menu for the three persistent per-peer actions remains within the viewport, reconnects both P2P sessions in join order, and verifies the B-to-A return journey. Every started session remains tracked until teardown completes.
|
`test:e2e:obsidian:p2p-setup-uri-workflow` runs two concurrent isolated real Obsidian sessions against the local Compose Nostr relay fixture. The first device imports a generated initial Setup URI and completes its signalling test with zero peers, creates a Setup URI for the second device through the registered command, and remains online while the second device imports it. The second device must select the expected online source before Fetch can rebuild its local database. The workflow accepts each connection request visibly on the receiving device, verifies the initial A-to-B fetch, checks that the menu for the three persistent per-peer actions remains within the viewport, reconnects both P2P sessions in join order, and verifies the B-to-A return journey. Every started session remains tracked until teardown completes.
|
||||||
|
|
||||||
`test:e2e:obsidian:startup-scan` configures a temporary CouchDB database, stops Obsidian, writes a note directly into the vault, restarts Obsidian, and verifies from CouchDB that the boot-time scan picked up the offline file.
|
`test:e2e:obsidian:startup-scan` starts from a CouchDB fixture using current settings with its device-local compatibility marker already acknowledged, stops Obsidian, writes a note directly into the Vault, restarts the same isolated Vault and profile without rewriting its plug-in data, and verifies from CouchDB that the start-up scan picked up the offline file. Onboarding remains covered by `onboarding-invitation`; this scenario owns the ordinary configured restart and start-up scan.
|
||||||
|
|
||||||
`test:e2e:obsidian:setup-uri-workflow` runs the repository's public Commonlib-backed CouchDB provisioning and Setup URI tools against the local CouchDB fixture. It configures a new, empty Vault in the first real Obsidian session through the visible onboarding wizard and uses Rebuild. After that device is working, it generates a new Setup URI through the registered command; the second real Obsidian Vault uses that URI for Fetch instead of reusing the initial Setup URI produced by the provisioning tool. The workflow verifies ordinary notes from the first device to the second and back again, independently enables Hidden File Sync on each device, and verifies a snippet. The retained Setup URI screenshots show only encrypted URIs and visually masked Setup URI passphrases; plaintext credentials are not captured. Files prefixed with `guide-` capture the relevant dialogue, settings panel, or workspace leaf without transient Notices. Public documentation copies selected images only after visual inspection; the E2E run does not overwrite repository documentation assets.
|
`test:e2e:obsidian:setup-uri-workflow` runs the repository's public Commonlib-backed CouchDB provisioning and Setup URI tools against the local CouchDB fixture. It configures a new, empty Vault in the first real Obsidian session through the visible onboarding wizard and uses Rebuild. After that device is working, it generates a new Setup URI through the registered command; the second real Obsidian Vault uses that URI for Fetch instead of reusing the initial Setup URI produced by the provisioning tool. The workflow verifies ordinary notes from the first device to the second and back again, independently enables Hidden File Sync on each device, and verifies a snippet. The retained Setup URI screenshots show only encrypted URIs and visually masked Setup URI passphrases; plaintext credentials are not captured. Files prefixed with `guide-` capture the relevant dialogue, settings panel, or workspace leaf without transient Notices. Public documentation copies selected images only after visual inspection; the E2E run does not overwrite repository documentation assets.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Proves that a configured LiveSync Vault scans files created while Obsidian
|
||||||
|
* was stopped. The first launch receives a CouchDB profile using current
|
||||||
|
* settings and its acknowledged device-local compatibility marker before the
|
||||||
|
* plug-in loads.
|
||||||
|
*
|
||||||
|
* The second launch reuses the same Vault, profile, local database, and
|
||||||
|
* settings without rewriting plug-in data, so the assertion covers an
|
||||||
|
* ordinary configured restart rather than the separate onboarding flow.
|
||||||
|
*/
|
||||||
import { mkdir, writeFile } from "node:fs/promises";
|
import { mkdir, writeFile } from "node:fs/promises";
|
||||||
import { dirname, join } from "node:path";
|
import { dirname, join } from "node:path";
|
||||||
import {
|
import {
|
||||||
@@ -11,7 +21,8 @@ import {
|
|||||||
import { discoverObsidianCli, requireObsidianBinary } from "../runner/environment.ts";
|
import { discoverObsidianCli, requireObsidianBinary } from "../runner/environment.ts";
|
||||||
import {
|
import {
|
||||||
assertEqual,
|
assertEqual,
|
||||||
configureCouchDb,
|
createE2eCouchDbPluginData,
|
||||||
|
createE2eObsidianDeviceLocalState,
|
||||||
prepareRemote,
|
prepareRemote,
|
||||||
pushLocalChanges,
|
pushLocalChanges,
|
||||||
waitForLiveSyncCoreReady,
|
waitForLiveSyncCoreReady,
|
||||||
@@ -47,6 +58,12 @@ async function main(): Promise<void> {
|
|||||||
|
|
||||||
const couchDb = await loadCouchDbConfig();
|
const couchDb = await loadCouchDbConfig();
|
||||||
const dbName = makeUniqueDatabaseName(couchDb.dbPrefix, "startup-scan");
|
const dbName = makeUniqueDatabaseName(couchDb.dbPrefix, "startup-scan");
|
||||||
|
const couchDbSettings = {
|
||||||
|
uri: couchDb.uri,
|
||||||
|
username: couchDb.username,
|
||||||
|
password: couchDb.password,
|
||||||
|
dbName,
|
||||||
|
};
|
||||||
const vault = await createTemporaryVault();
|
const vault = await createTemporaryVault();
|
||||||
let session: ObsidianLiveSyncSession | undefined;
|
let session: ObsidianLiveSyncSession | undefined;
|
||||||
|
|
||||||
@@ -63,15 +80,11 @@ async function main(): Promise<void> {
|
|||||||
cliBinary: cli.binary,
|
cliBinary: cli.binary,
|
||||||
vault,
|
vault,
|
||||||
startupGraceMs: Number(process.env.E2E_OBSIDIAN_STARTUP_GRACE_MS ?? 1000),
|
startupGraceMs: Number(process.env.E2E_OBSIDIAN_STARTUP_GRACE_MS ?? 1000),
|
||||||
|
pluginData: createE2eCouchDbPluginData(couchDbSettings),
|
||||||
|
localStorageEntries: createE2eObsidianDeviceLocalState(vault.name),
|
||||||
});
|
});
|
||||||
await waitForLiveSyncCoreReady(cli.binary, session.cliEnv);
|
const initialReadiness = await waitForLiveSyncCoreReady(cli.binary, session.cliEnv);
|
||||||
const configured = await configureCouchDb(cli.binary, session.cliEnv, {
|
assertEqual(initialReadiness.configured, true, "Self-hosted LiveSync did not start configured.");
|
||||||
uri: couchDb.uri,
|
|
||||||
username: couchDb.username,
|
|
||||||
password: couchDb.password,
|
|
||||||
dbName,
|
|
||||||
});
|
|
||||||
assertEqual(configured.isConfigured, true, "Self-hosted LiveSync was not configured.");
|
|
||||||
await prepareRemote(cli.binary, session.cliEnv);
|
await prepareRemote(cli.binary, session.cliEnv);
|
||||||
await session.app.stop();
|
await session.app.stop();
|
||||||
session = undefined;
|
session = undefined;
|
||||||
@@ -84,7 +97,8 @@ async function main(): Promise<void> {
|
|||||||
vault,
|
vault,
|
||||||
startupGraceMs: Number(process.env.E2E_OBSIDIAN_STARTUP_GRACE_MS ?? 1000),
|
startupGraceMs: Number(process.env.E2E_OBSIDIAN_STARTUP_GRACE_MS ?? 1000),
|
||||||
});
|
});
|
||||||
await waitForLiveSyncCoreReady(cli.binary, session.cliEnv);
|
const restartedReadiness = await waitForLiveSyncCoreReady(cli.binary, session.cliEnv);
|
||||||
|
assertEqual(restartedReadiness.configured, true, "Self-hosted LiveSync lost its configuration on restart.");
|
||||||
|
|
||||||
const localEntry = await waitForLocalDatabaseEntry(cli.binary, session.cliEnv, notePath);
|
const localEntry = await waitForLocalDatabaseEntry(cli.binary, session.cliEnv, notePath);
|
||||||
await pushLocalChanges(cli.binary, session.cliEnv);
|
await pushLocalChanges(cli.binary, session.cliEnv);
|
||||||
|
|||||||
Reference in New Issue
Block a user