-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI tests] [playwright] Start customizing suite for trace viewer, add…
… a few testcases Create a "trace viewer app" from the generic @theia/playwright "theiaApp" and add a "trace explorer view". Enhance test suite with some related test cases. Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
- Loading branch information
1 parent
8e7c420
commit b2e731b
Showing
9 changed files
with
1,098 additions
and
703 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
playwright-tests/tests/page-objects/theia-trace-viewer-app.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2022 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
// The following covers enhancements made after initially copying the file | ||
// from the "theia-playwright-template": | ||
|
||
/******************************************************************************** | ||
* Copyright (C) 2024 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
********************************************************************************/ | ||
|
||
import { TheiaApp, TheiaWorkspace } from '@theia/playwright'; | ||
import { TraceExplorerView } from './trace-explorer-view'; | ||
import { Page } from '@playwright/test'; | ||
|
||
export class TraceViewerApp extends TheiaApp { | ||
traceExplorerView: TraceExplorerView; | ||
|
||
public constructor( | ||
public page: Page, | ||
public workspace: TheiaWorkspace, | ||
public isElectron: boolean, | ||
) { | ||
super(page, workspace,isElectron); | ||
this.traceExplorerView = this.createTraceExplorer(); | ||
} | ||
|
||
getTraceExplorer(): TraceExplorerView { | ||
return this.traceExplorerView; | ||
} | ||
|
||
protected createTraceExplorer(): TraceExplorerView { | ||
return new TraceExplorerView(this); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
playwright-tests/tests/page-objects/trace-explorer-view.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2024 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
********************************************************************************/ | ||
|
||
import { TheiaView } from '@theia/playwright'; | ||
import { TraceViewerApp } from './theia-trace-viewer-app'; | ||
|
||
/** | ||
* Represents the Trace Explorer view. This view is by default part of the left panel, | ||
* and is toggled by clicking on the "Trace Viewer" tab entry | ||
*/ | ||
export class TraceExplorerView extends TheiaView { | ||
constructor(public app: TraceViewerApp) { | ||
super( | ||
{ | ||
tabSelector: '#shell-tab-trace-explorer', | ||
viewSelector: '#trace-explorer', | ||
viewName: 'Trace Viewer' | ||
}, | ||
app | ||
); | ||
} | ||
|
||
async isTraceServerStarted(): Promise<boolean> { | ||
const serverStatusElement = await this.page.waitForSelector('#server-status-id'); | ||
const statusColor = await serverStatusElement.getAttribute('style'); | ||
return statusColor?.includes('green')? true : false; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2022 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
// The following covers enhancements made after initially copying the file | ||
// from the "theia-playwright-template": | ||
|
||
/******************************************************************************** | ||
* Copyright (C) 2024 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
********************************************************************************/ | ||
|
||
import { expect, test } from '@playwright/test'; | ||
import { TraceViewerApp } from './page-objects/theia-trace-viewer-app'; | ||
import { TheiaAppLoader } from '@theia/playwright'; | ||
import { TraceExplorerView } from './page-objects/trace-explorer-view'; | ||
|
||
let app: TraceViewerApp; | ||
let traceExplorer: TraceExplorerView; | ||
|
||
test.beforeAll(async ({ playwright, browser }) => { | ||
app = await TheiaAppLoader.load<TraceViewerApp>( | ||
{ playwright, browser }, | ||
undefined, | ||
TraceViewerApp | ||
); | ||
traceExplorer = app.getTraceExplorer(); | ||
}); | ||
|
||
test.describe('My Trace viewer application', () => { | ||
test('should show main content panel', async () => { | ||
expect(await app.isMainContentPanelVisible()).toBe(true); | ||
}); | ||
}); | ||
|
||
test.describe('My Trace Explorer View', () => { | ||
test('Is initially not visible', async () => { | ||
expect(await traceExplorer.isDisplayed()).toBe(false); | ||
}); | ||
test('Once tab activated, becomes visible', async () => { | ||
expect(await traceExplorer.isDisplayed()).toBe(false); | ||
await traceExplorer.activate(); | ||
expect(await traceExplorer.isDisplayed()).toBe(true); | ||
}); | ||
test('Is closable', async () => { | ||
await traceExplorer.isClosable(); | ||
expect(await traceExplorer.isDisplayed()).toBe(true); | ||
}); | ||
test('Once closed, is not visible any more', async () => { | ||
expect(await traceExplorer.isDisplayed()).toBe(true); | ||
await traceExplorer.close(); | ||
expect(await traceExplorer.isDisplayed()).toBe(false); | ||
}); | ||
test('From closed, can be re-opened using the command palette', async () => { | ||
expect(await traceExplorer.isDisplayed()).toBe(false); | ||
await traceExplorer.open(); | ||
expect(await traceExplorer.isDisplayed()).toBe(true); | ||
}); | ||
test('Trace Server status is shown as not started (red)', async () => { | ||
await traceExplorer.activate(); | ||
expect(await traceExplorer.isTraceServerStarted()).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters