From 7414b0b296a8ca245da1c5552a76a54688f49c53 Mon Sep 17 00:00:00 2001 From: Olaf Lessenich Date: Fri, 17 Nov 2023 16:25:53 +0100 Subject: [PATCH] fix: re-enable all playwright tests in the test suite Contributed on behalf of STMicroelectronics Signed-off-by: Olaf Lessenich --- .../src/tests/theia-output-view.test.ts | 120 +++++++++--------- .../src/tests/theia-quick-command.test.ts | 97 +++++++------- 2 files changed, 103 insertions(+), 114 deletions(-) diff --git a/examples/playwright/src/tests/theia-output-view.test.ts b/examples/playwright/src/tests/theia-output-view.test.ts index 8231666eb31a0..ff741224124e4 100644 --- a/examples/playwright/src/tests/theia-output-view.test.ts +++ b/examples/playwright/src/tests/theia-output-view.test.ts @@ -20,72 +20,66 @@ import { TheiaApp } from '../theia-app'; import { TheiaAppLoader } from '../theia-app-loader'; import { TheiaOutputView } from '../theia-output-view'; -if (process.env.USE_ELECTRON === 'true') { - // TODO: remove this once the test is stable enough with electron - test.describe.skip('Theia Output View', () => { }); -} else { - let app: TheiaApp; let outputView: TheiaOutputView; let testChannel: TheiaOutputViewChannel; - test.describe('Theia Output View', () => { +let app: TheiaApp; let outputView: TheiaOutputView; let testChannel: TheiaOutputViewChannel; +test.describe('Theia Output View', () => { - test.beforeAll(async ({ playwright, browser }) => { - app = await TheiaAppLoader.load({ playwright, browser }); - }); - - test.afterAll(async () => { - await app.page.close(); - }); + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + }); - test('should open the output view and check if is visible and active', async () => { - outputView = await app.openView(TheiaOutputView); - expect(await outputView.isTabVisible()).toBe(true); - expect(await outputView.isDisplayed()).toBe(true); - expect(await outputView.isActive()).toBe(true); - }); - test('should be opened at the bottom and have the title "Output"', async () => { - expect(await outputView.isInSidePanel()).toBe(false); - expect(await outputView.side()).toBe('bottom'); - expect(await outputView.title()).toBe('Output'); - }); - test('should be closable', async () => { - expect(await outputView.isClosable()).toBe(true); - await outputView.close(); - expect(await outputView.isTabVisible()).toBe(false); - expect(await outputView.isDisplayed()).toBe(false); - expect(await outputView.isActive()).toBe(false); - }); - test('should select a test output channel', async () => { - outputView = await app.openView(TheiaOutputView); - expect(await outputView.isTabVisible()).toBe(true); - expect(await outputView.isDisplayed()).toBe(true); - expect(await outputView.isActive()).toBe(true); + test.afterAll(async () => { + await app.page.close(); + }); - const testChannelName = 'API Sample: my test channel'; - expect(await outputView.selectOutputChannel(testChannelName)).toBe(true); - }); - test('should check if the output view of the test output channel', async () => { - const testChannelName = 'API Sample: my test channel'; - expect(await outputView.isOutputChannelSelected(testChannelName)); - const channel = await outputView.getOutputChannel(testChannelName); - expect(channel).toBeDefined; - testChannel = channel!; - expect(await testChannel!.isDisplayed()).toBe(true); - }); - test('should check if the output view test channel shows the test output', async () => { - expect(await testChannel.numberOfLines()).toBe(5); - expect(await testChannel.textContentOfLineByLineNumber(1)).toMatch('hello info1'); - expect(await testChannel.maxSeverityOfLineByLineNumber(1)).toMatch('info'); - expect(await testChannel.textContentOfLineByLineNumber(2)).toMatch('hello info2'); - expect(await testChannel.maxSeverityOfLineByLineNumber(2)).toMatch('info'); - expect(await testChannel.textContentOfLineByLineNumber(3)).toMatch('hello error'); - expect(await testChannel.maxSeverityOfLineByLineNumber(3)).toMatch('error'); - expect(await testChannel.textContentOfLineByLineNumber(4)).toMatch('hello warning'); - expect(await testChannel.maxSeverityOfLineByLineNumber(4)).toMatch('warning'); - expect(await testChannel.textContentOfLineByLineNumber(5)).toMatch( - 'inlineInfo1 inlineWarning inlineError inlineInfo2' - ); - expect(await testChannel.maxSeverityOfLineByLineNumber(5)).toMatch('error'); - }); + test('should open the output view and check if is visible and active', async () => { + outputView = await app.openView(TheiaOutputView); + expect(await outputView.isTabVisible()).toBe(true); + expect(await outputView.isDisplayed()).toBe(true); + expect(await outputView.isActive()).toBe(true); + }); + test('should be opened at the bottom and have the title "Output"', async () => { + expect(await outputView.isInSidePanel()).toBe(false); + expect(await outputView.side()).toBe('bottom'); + expect(await outputView.title()).toBe('Output'); + }); + test('should be closable', async () => { + expect(await outputView.isClosable()).toBe(true); + await outputView.close(); + expect(await outputView.isTabVisible()).toBe(false); + expect(await outputView.isDisplayed()).toBe(false); + expect(await outputView.isActive()).toBe(false); + }); + test('should select a test output channel', async () => { + outputView = await app.openView(TheiaOutputView); + expect(await outputView.isTabVisible()).toBe(true); + expect(await outputView.isDisplayed()).toBe(true); + expect(await outputView.isActive()).toBe(true); + const testChannelName = 'API Sample: my test channel'; + expect(await outputView.selectOutputChannel(testChannelName)).toBe(true); + }); + test('should check if the output view of the test output channel', async () => { + const testChannelName = 'API Sample: my test channel'; + expect(await outputView.isOutputChannelSelected(testChannelName)); + const channel = await outputView.getOutputChannel(testChannelName); + expect(channel).toBeDefined; + testChannel = channel!; + expect(await testChannel!.isDisplayed()).toBe(true); + }); + test('should check if the output view test channel shows the test output', async () => { + expect(await testChannel.numberOfLines()).toBe(5); + expect(await testChannel.textContentOfLineByLineNumber(1)).toMatch('hello info1'); + expect(await testChannel.maxSeverityOfLineByLineNumber(1)).toMatch('info'); + expect(await testChannel.textContentOfLineByLineNumber(2)).toMatch('hello info2'); + expect(await testChannel.maxSeverityOfLineByLineNumber(2)).toMatch('info'); + expect(await testChannel.textContentOfLineByLineNumber(3)).toMatch('hello error'); + expect(await testChannel.maxSeverityOfLineByLineNumber(3)).toMatch('error'); + expect(await testChannel.textContentOfLineByLineNumber(4)).toMatch('hello warning'); + expect(await testChannel.maxSeverityOfLineByLineNumber(4)).toMatch('warning'); + expect(await testChannel.textContentOfLineByLineNumber(5)).toMatch( + 'inlineInfo1 inlineWarning inlineError inlineInfo2' + ); + expect(await testChannel.maxSeverityOfLineByLineNumber(5)).toMatch('error'); }); -} +}); diff --git a/examples/playwright/src/tests/theia-quick-command.test.ts b/examples/playwright/src/tests/theia-quick-command.test.ts index d55dc9d73b601..4f9b8352cc4b6 100644 --- a/examples/playwright/src/tests/theia-quick-command.test.ts +++ b/examples/playwright/src/tests/theia-quick-command.test.ts @@ -23,63 +23,58 @@ import { TheiaNotificationIndicator } from '../theia-notification-indicator'; import { TheiaNotificationOverlay } from '../theia-notification-overlay'; import { TheiaQuickCommandPalette } from '../theia-quick-command-palette'; -if (process.env.USE_ELECTRON === 'true') { - // TODO: remove this once the test is stable enough with electron - test.describe.skip('Theia Quick Command', () => { }); -} else { - test.describe('Theia Quick Command', () => { +test.describe('Theia Quick Command', () => { - let app: TheiaApp; - let quickCommand: TheiaQuickCommandPalette; + let app: TheiaApp; + let quickCommand: TheiaQuickCommandPalette; - test.beforeAll(async ({ playwright, browser }) => { - app = await TheiaAppLoader.load({ playwright, browser }); - quickCommand = app.quickCommandPalette; - }); - - test.afterAll(async () => { - await app.page.close(); - }); + test.beforeAll(async ({ playwright, browser }) => { + app = await TheiaAppLoader.load({ playwright, browser }); + quickCommand = app.quickCommandPalette; + }); - test('should show quick command palette', async () => { - await quickCommand.open(); - expect(await quickCommand.isOpen()).toBe(true); - await quickCommand.hide(); - expect(await quickCommand.isOpen()).toBe(false); - await quickCommand.open(); - expect(await quickCommand.isOpen()).toBe(true); - }); + test.afterAll(async () => { + await app.page.close(); + }); - test('should trigger \'About\' command after typing', async () => { - await quickCommand.type('About'); - await quickCommand.trigger('About'); - expect(await quickCommand.isOpen()).toBe(false); - const aboutDialog = new TheiaAboutDialog(app); - expect(await aboutDialog.isVisible()).toBe(true); - await aboutDialog.close(); - expect(await aboutDialog.isVisible()).toBe(false); + test('should show quick command palette', async () => { + await quickCommand.open(); + expect(await quickCommand.isOpen()).toBe(true); + await quickCommand.hide(); + expect(await quickCommand.isOpen()).toBe(false); + await quickCommand.open(); + expect(await quickCommand.isOpen()).toBe(true); + }); - await quickCommand.type('Select All'); - await quickCommand.trigger('Select All'); - expect(await quickCommand.isOpen()).toBe(false); - }); + test('should trigger \'About\' command after typing', async () => { + await quickCommand.type('About'); + await quickCommand.trigger('About'); + expect(await quickCommand.isOpen()).toBe(false); + const aboutDialog = new TheiaAboutDialog(app); + expect(await aboutDialog.isVisible()).toBe(true); + await aboutDialog.close(); + expect(await aboutDialog.isVisible()).toBe(false); - test('should trigger \'Toggle Explorer View\' command after typing', async () => { - 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); - }); + await quickCommand.type('Select All'); + await quickCommand.trigger('Select All'); + expect(await quickCommand.isOpen()).toBe(false); + }); - test('should trigger \'Quick Input: Test Positive Integer\' command by confirming via Enter', async () => { - await quickCommand.type('Test Positive', true); - expect(await quickCommand.isOpen()).toBe(true); - await quickCommand.type('6', true); - const notificationIndicator = new TheiaNotificationIndicator(app); - const notification = new TheiaNotificationOverlay(app, notificationIndicator); - expect(await notification.isEntryVisible('Positive Integer: 6')).toBe(true); - }); + test('should trigger \'Toggle Explorer View\' command after typing', async () => { + 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); + }); + test('should trigger \'Quick Input: Test Positive Integer\' command by confirming via Enter', async () => { + await quickCommand.type('Test Positive', true); + expect(await quickCommand.isOpen()).toBe(true); + await quickCommand.type('6', true); + const notificationIndicator = new TheiaNotificationIndicator(app); + const notification = new TheiaNotificationOverlay(app, notificationIndicator); + expect(await notification.isEntryVisible('Positive Integer: 6')).toBe(true); }); -} + +});