mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
Chore: Desktop: Wait for plugins to load before running certain plugin-related tests (#11224)
This commit is contained in:
parent
c364fd087f
commit
08f29b7866
@ -51,8 +51,10 @@ test.describe('settings', () => {
|
|||||||
await expect(mainScreen.dialog).toBeVisible();
|
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);
|
const mainScreen = new MainScreen(mainWindow);
|
||||||
|
await startupPluginsLoaded;
|
||||||
|
|
||||||
await mainScreen.waitFor();
|
await mainScreen.waitFor();
|
||||||
await mainScreen.openSettings(electronApp);
|
await mainScreen.openSettings(electronApp);
|
||||||
|
|
||||||
|
@ -31,6 +31,14 @@ const getAndResizeMainWindow = async (electronApp: ElectronApplication) => {
|
|||||||
return mainWindow;
|
return mainWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const waitForStartupPlugins = async (electronApp: ElectronApplication) => {
|
||||||
|
return electronApp.evaluate(({ ipcMain }) => {
|
||||||
|
return new Promise<void>(resolve => {
|
||||||
|
ipcMain.once('startup-plugins-loaded', () => resolve());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const testDir = dirname(__dirname);
|
const testDir = dirname(__dirname);
|
||||||
|
|
||||||
export const test = base.extend<JoplinFixtures>({
|
export const test = base.extend<JoplinFixtures>({
|
||||||
@ -75,10 +83,12 @@ export const test = base.extend<JoplinFixtures>({
|
|||||||
pluginPaths.map(path => resolve(testDir, path)).join(','),
|
pluginPaths.map(path => resolve(testDir, path)).join(','),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
const mainWindowPromise = getAndResizeMainWindow(electronApp);
|
||||||
|
await waitForStartupPlugins(electronApp);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
app: electronApp,
|
app: electronApp,
|
||||||
mainWindow: await getAndResizeMainWindow(electronApp),
|
mainWindow: await mainWindowPromise,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -89,13 +99,7 @@ export const test = base.extend<JoplinFixtures>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
startupPluginsLoaded: async ({ electronApp }, use) => {
|
startupPluginsLoaded: async ({ electronApp }, use) => {
|
||||||
const startupPluginsLoadedPromise = electronApp.evaluate(({ ipcMain }) => {
|
await use(waitForStartupPlugins(electronApp));
|
||||||
return new Promise<void>(resolve => {
|
|
||||||
ipcMain.once('startup-plugins-loaded', () => resolve());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
await use(startupPluginsLoadedPromise);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mainWindow: async ({ electronApp }, use) => {
|
mainWindow: async ({ electronApp }, use) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user