Disable encryption for e2e tests (#1024)
<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Disable Electron safeStorage encryption in test builds so e2e runs are consistent and don’t require the OS keychain. Added an IS_TEST_BUILD guard in encrypt() to force the unencrypted fallback during tests. <!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -6,6 +6,7 @@ import { safeStorage } from "electron";
|
|||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import log from "electron-log";
|
import log from "electron-log";
|
||||||
import { DEFAULT_TEMPLATE_ID } from "@/shared/templates";
|
import { DEFAULT_TEMPLATE_ID } from "@/shared/templates";
|
||||||
|
import { IS_TEST_BUILD } from "@/ipc/utils/test_utils";
|
||||||
|
|
||||||
const logger = log.scope("settings");
|
const logger = log.scope("settings");
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ export function writeSettings(settings: Partial<UserSettings>): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function encrypt(data: string): Secret {
|
export function encrypt(data: string): Secret {
|
||||||
if (safeStorage.isEncryptionAvailable()) {
|
if (safeStorage.isEncryptionAvailable() && !IS_TEST_BUILD) {
|
||||||
return {
|
return {
|
||||||
value: safeStorage.encryptString(data).toString("base64"),
|
value: safeStorage.encryptString(data).toString("base64"),
|
||||||
encryptionType: "electron-safe-storage",
|
encryptionType: "electron-safe-storage",
|
||||||
|
|||||||
Reference in New Issue
Block a user