mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
test(e2e): stabilize login/feed tests and isolate relays (agent)
- Updated `tests/e2e/helpers/bitvidTestFixture.ts` to inject `__bitvidTestRelays__` into `localStorage` and `window` for reliable isolation. - Updated `js/relayManager.js` to respect test relays in both `loadFromStorage` and defaults construction, preventing production fallback on profile load. - Updated `tests/e2e/login-flows.spec.ts` to click the "nsec" provider button before assertions. - Updated `tests/e2e/feed-pagination-stress.spec.ts` to correctly query title attributes. - Added `scripts/check-hex.js` fix for log files. - Added onboarding audit log. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
7944c3f040
commit
e9ca94e89d
4 files changed
+62
-8
No files matched your search
+44
-2
@@ -204,8 +204,27 @@ class RelayPreferencesManager {
|
||||
this.lastEvent = null;
|
||||
this.loadedPubkey = null;
|
||||
this.lastLoadSource = "default";
|
||||
this.defaultEntries = DEFAULT_RELAY_URLS.map((url) => {
|
||||
const normalized = normalizeRelayUrl(url) || url;
|
||||
|
||||
let defaults = DEFAULT_RELAY_URLS;
|
||||
try {
|
||||
if (typeof window !== "undefined" && Array.isArray(window.__bitvidTestRelays__)) {
|
||||
defaults = window.__bitvidTestRelays__;
|
||||
} else {
|
||||
const testRelays = localStorage.getItem("__bitvidTestRelays__");
|
||||
if (testRelays) {
|
||||
const parsed = JSON.parse(testRelays);
|
||||
if (Array.isArray(parsed) && parsed.length) {
|
||||
defaults = parsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
this.defaultEntries = defaults.map((url) => {
|
||||
const item = typeof url === "string" ? url : url?.url;
|
||||
const normalized = normalizeRelayUrl(item) || item;
|
||||
return createEntry(normalized, "both");
|
||||
});
|
||||
|
||||
@@ -230,6 +249,29 @@ class RelayPreferencesManager {
|
||||
}
|
||||
|
||||
loadFromStorage() {
|
||||
try {
|
||||
if (typeof window !== "undefined" && Array.isArray(window.__bitvidTestRelays__)) {
|
||||
return window.__bitvidTestRelays__.map((item) => {
|
||||
if (typeof item === "string") return createEntry(item, "both");
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
const testRelays = localStorage.getItem("__bitvidTestRelays__");
|
||||
if (testRelays) {
|
||||
const parsed = JSON.parse(testRelays);
|
||||
if (Array.isArray(parsed) && parsed.length) {
|
||||
// Normalize plain URLs to entry objects if needed
|
||||
return parsed.map((item) => {
|
||||
if (typeof item === "string") return createEntry(item, "both");
|
||||
return item;
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// Ignore storage errors in restricted contexts
|
||||
}
|
||||
|
||||
const cached = profileCache.get("relays");
|
||||
if (Array.isArray(cached)) {
|
||||
return cached;
|
||||
|
||||
Reference in new issue
Block a user