diff --git a/examples/playwright/src/tests/theia-electron-app.test.ts b/examples/playwright/src/tests/theia-electron-app.test.ts index afbdbeb36c2bb..3f25c78573934 100644 --- a/examples/playwright/src/tests/theia-electron-app.test.ts +++ b/examples/playwright/src/tests/theia-electron-app.test.ts @@ -19,38 +19,72 @@ import { TheiaExplorerView } from '../theia-explorer-view'; import { TheiaAboutDialog } from '../theia-about-dialog'; import { ElectronLaunchOptions, TheiaElectronAppLoader } from '../theia-app-loader'; import { TheiaWorkspace } from '../theia-workspace'; +import { TheiaApp } from '../theia-app'; test.describe('Theia Electron Application', () => { + let ws: TheiaWorkspace; + let app: TheiaApp; + + test.beforeAll(async () => { + ws = new TheiaWorkspace(['src/tests/resources/sample-files1']); + app = await TheiaElectronAppLoader.load(new ElectronLaunchOptions('../electron', '../../plugins'), ws); + }); + test('should load and show main content panel', async () => { - const ws = new TheiaWorkspace(['src/tests/resources/sample-files1']); - const app = await TheiaElectronAppLoader.load(new ElectronLaunchOptions('../electron', '../../plugins'), ws); expect(await app.isMainContentPanelVisible()).toBe(true); + }); - const quickCommand = app.quickCommandPalette; + test('open about dialog using menu', async () => { + // open about dialog using menu + await (await app.menuBar.openMenu('Help')).clickMenuItem('About'); + const aboutDialog = new TheiaAboutDialog(app); + expect(await aboutDialog.isVisible()).toBe(true); + await aboutDialog.close(); + expect(await aboutDialog.isVisible()).toBe(false); + }); + test('toggle explorer view using menu', async () => { + await (await app.menuBar.openMenu('View')).clickMenuItem('Explorer'); + const explorerView = new TheiaExplorerView(app); + expect(await explorerView.isDisplayed()).toBe(true); + await (await app.menuBar.openMenu('View')).clickMenuItem('Explorer'); + expect(await explorerView.isDisplayed()).toBe(false); + }); + + test('open quick command palette', async () => { + const quickCommand = app.quickCommandPalette; + expect(await quickCommand.isOpen()).toBe(false); await quickCommand.open(); expect(await quickCommand.isOpen()).toBe(true); + }); + test('open about dialog using command', async () => { + const quickCommand = app.quickCommandPalette; await quickCommand.open(); await quickCommand.type('About'); await quickCommand.trigger('About'); - expect(await quickCommand.isOpen()).toBe(false); const aboutDialog = new TheiaAboutDialog(app); + expect(await quickCommand.isOpen()).toBe(false); expect(await aboutDialog.isVisible()).toBe(true); await aboutDialog.close(); - expect(await aboutDialog.isVisible()).toBe(false); + }); + test('select all using command', async () => { + const quickCommand = app.quickCommandPalette; await quickCommand.type('Select All'); await quickCommand.trigger('Select All'); expect(await quickCommand.isOpen()).toBe(false); + }); + test('toggle explorer view using command', async () => { + const quickCommand = app.quickCommandPalette; + const explorerView = new TheiaExplorerView(app); await quickCommand.open(); await quickCommand.type('Toggle Explorer'); await quickCommand.trigger('Toggle Explorer View'); expect(await quickCommand.isOpen()).toBe(false); - const explorerView = new TheiaExplorerView(app); expect(await explorerView.isDisplayed()).toBe(true); }); - }); +