diff --git a/.gitignore b/.gitignore index ccae77c94e..b1974f6907 100644 --- a/.gitignore +++ b/.gitignore @@ -625,6 +625,7 @@ packages/app-desktop/integration-tests/util/getMainWindow.js packages/app-desktop/integration-tests/util/ignoreFlakyReporter.js packages/app-desktop/integration-tests/util/mockClipboard.js packages/app-desktop/integration-tests/util/retryOnFailure.js +packages/app-desktop/integration-tests/util/seedProfileSettings.js packages/app-desktop/integration-tests/util/setDarkMode.js packages/app-desktop/integration-tests/util/setFilePickerResponse.js packages/app-desktop/integration-tests/util/setMessageBoxResponse.js diff --git a/.ignore.eslint b/.ignore.eslint index cf6ab96857..ad17cebdd4 100644 --- a/.ignore.eslint +++ b/.ignore.eslint @@ -650,6 +650,7 @@ packages/app-desktop/integration-tests/util/getMainWindow.js packages/app-desktop/integration-tests/util/ignoreFlakyReporter.js packages/app-desktop/integration-tests/util/mockClipboard.js packages/app-desktop/integration-tests/util/retryOnFailure.js +packages/app-desktop/integration-tests/util/seedProfileSettings.js packages/app-desktop/integration-tests/util/setDarkMode.js packages/app-desktop/integration-tests/util/setFilePickerResponse.js packages/app-desktop/integration-tests/util/setMessageBoxResponse.js diff --git a/packages/app-desktop/integration-tests/util/seedProfileSettings.ts b/packages/app-desktop/integration-tests/util/seedProfileSettings.ts new file mode 100644 index 0000000000..e496095c45 --- /dev/null +++ b/packages/app-desktop/integration-tests/util/seedProfileSettings.ts @@ -0,0 +1,12 @@ +import { join } from 'path'; +import { writeFile } from 'fs-extra'; + +// Writes the profile's settings.json before the app starts, so that these values are +// picked up during startup. Currently used to keep the editor+viewer layout that many +// integration tests rely on -- the app's default only shows the editor. +const seedProfileSettings = async (profileDirectory: string, values: Record) => { + const settingFilePath = join(profileDirectory, 'settings.json'); + await writeFile(settingFilePath, JSON.stringify(values), 'utf8'); +}; + +export default seedProfileSettings; diff --git a/packages/app-desktop/integration-tests/util/test.ts b/packages/app-desktop/integration-tests/util/test.ts index 7ad31cc0e8..e60132a5fe 100644 --- a/packages/app-desktop/integration-tests/util/test.ts +++ b/packages/app-desktop/integration-tests/util/test.ts @@ -6,6 +6,7 @@ import createStartupArgs from './createStartupArgs'; import getMainWindow from './getMainWindow'; import setDarkMode from './setDarkMode'; import evaluateWithRetry from './evaluateWithRetry'; +import seedProfileSettings from './seedProfileSettings'; type StartWithPluginsResult = { app: ElectronApplication; mainWindow: Page }; @@ -75,6 +76,10 @@ export const test = base.extend({ const profileSubdir = join(profilePath, uuid.createNano()); await mkdirp(profileSubdir); + // Many integration tests interact with the note viewer, which is hidden by the + // app's default layout (editor only). Force the editor+viewer layout for tests. + await seedProfileSettings(profileSubdir, { noteVisiblePanes: ['editor', 'viewer'] }); + await use(profileSubdir); // For debugging purposes, attach the Joplin log file to the test: diff --git a/packages/lib/models/settings/builtInMetadata.ts b/packages/lib/models/settings/builtInMetadata.ts index 4cb6fb17f0..f94e9db9ba 100644 --- a/packages/lib/models/settings/builtInMetadata.ts +++ b/packages/lib/models/settings/builtInMetadata.ts @@ -1864,7 +1864,7 @@ const builtInMetadata = (Setting: typeof SettingType) => { appTypes: [AppType.Mobile], isGlobal: true, }, - noteVisiblePanes: { value: ['editor', 'viewer'], type: SettingItemType.Array, storage: SettingStorage.File, isGlobal: true, public: false, appTypes: [AppType.Desktop] }, + noteVisiblePanes: { value: ['editor'], type: SettingItemType.Array, storage: SettingStorage.File, isGlobal: true, public: false, appTypes: [AppType.Desktop] }, tagHeaderIsExpanded: { value: true, type: SettingItemType.Bool, public: false, appTypes: [AppType.Desktop] }, folderHeaderIsExpanded: { value: true, type: SettingItemType.Bool, public: false, appTypes: [AppType.Desktop] }, syncReportIsVisible: { value: false, type: SettingItemType.Bool, public: false, appTypes: [AppType.Desktop] },