diff --git a/packages/app-desktop/integration-tests/settings.spec.ts b/packages/app-desktop/integration-tests/settings.spec.ts index 44f2415d0..c5974f888 100644 --- a/packages/app-desktop/integration-tests/settings.spec.ts +++ b/packages/app-desktop/integration-tests/settings.spec.ts @@ -51,8 +51,10 @@ test.describe('settings', () => { await expect(mainScreen.dialog).toBeVisible(); }); - test('should be possible to navigate settings screen tabs with the arrow keys', async ({ electronApp, mainWindow }) => { + test('should be possible to navigate settings screen tabs with the arrow keys', async ({ electronApp, mainWindow, startupPluginsLoaded }) => { const mainScreen = new MainScreen(mainWindow); + await startupPluginsLoaded; + await mainScreen.waitFor(); await mainScreen.openSettings(electronApp); diff --git a/packages/app-desktop/integration-tests/util/test.ts b/packages/app-desktop/integration-tests/util/test.ts index 93729bed5..c40e5cdac 100644 --- a/packages/app-desktop/integration-tests/util/test.ts +++ b/packages/app-desktop/integration-tests/util/test.ts @@ -31,6 +31,14 @@ const getAndResizeMainWindow = async (electronApp: ElectronApplication) => { return mainWindow; }; +const waitForStartupPlugins = async (electronApp: ElectronApplication) => { + return electronApp.evaluate(({ ipcMain }) => { + return new Promise(resolve => { + ipcMain.once('startup-plugins-loaded', () => resolve()); + }); + }); +}; + const testDir = dirname(__dirname); export const test = base.extend({ @@ -75,10 +83,12 @@ export const test = base.extend({ pluginPaths.map(path => resolve(testDir, path)).join(','), ], }); + const mainWindowPromise = getAndResizeMainWindow(electronApp); + await waitForStartupPlugins(electronApp); return { app: electronApp, - mainWindow: await getAndResizeMainWindow(electronApp), + mainWindow: await mainWindowPromise, }; }); @@ -89,13 +99,7 @@ export const test = base.extend({ }, startupPluginsLoaded: async ({ electronApp }, use) => { - const startupPluginsLoadedPromise = electronApp.evaluate(({ ipcMain }) => { - return new Promise(resolve => { - ipcMain.once('startup-plugins-loaded', () => resolve()); - }); - }); - - await use(startupPluginsLoadedPromise); + await use(waitForStartupPlugins(electronApp)); }, mainWindow: async ({ electronApp }, use) => {