-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E test: extensions POM for playwright; enable shiny tests for web (#…
…5844) Migrated the functions we are using from MS POM to a playwright only positron version. Enabled the shiny tests for web. Fixed some missing awaits on screenshot calls. ### QA Notes All tests should pass.
- Loading branch information
1 parent
f4fbb2b
commit 6edeff5
Showing
8 changed files
with
73 additions
and
10 deletions.
There are no files selected for viewing
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 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 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,54 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (C) 2024 Posit Software, PBC. All rights reserved. | ||
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { expect } from '@playwright/test'; | ||
import { Code } from '../code'; | ||
import { PositronQuickAccess } from './positronQuickaccess'; | ||
|
||
export class PositronExtensions { | ||
|
||
constructor(private code: Code, private quickaccess: PositronQuickAccess) { } | ||
|
||
async searchForExtension(id: string): Promise<void> { | ||
await this.quickaccess.runCommand('Extensions: Focus on Extensions View', { exactLabelMatch: true }); | ||
await this.code.driver.page.locator('div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea').fill(`@id:${id}`); | ||
await expect(this.code.driver.page.locator(`div.part.sidebar div.composite.title h2`)).toHaveText('Extensions: Marketplace'); | ||
|
||
let retrials = 1; | ||
while (retrials++ < 10) { | ||
try { | ||
const locator = this.code.driver.page.locator(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"]`); | ||
await expect(locator).toBeVisible(); | ||
return; | ||
} catch (error) { | ||
this.code.logger.log(`Extension '${id}' is not found. Retrying count: ${retrials}`); | ||
await this.quickaccess.runCommand('workbench.extensions.action.refreshExtension'); | ||
} | ||
} | ||
throw new Error(`Extension ${id} is not found`); | ||
} | ||
|
||
async closeExtension(title: string): Promise<any> { | ||
try { | ||
await this.code.driver.page.locator(`.tabs-container div.tab[aria-label="Extension: ${title}, preview"] div.tab-actions a.action-label.codicon.codicon-close`).click(); | ||
} catch (e) { | ||
this.code.logger.log(`Extension '${title}' not opened as preview. Trying without 'preview'.`); | ||
await this.code.driver.page.locator(`.tabs-container div.tab[aria-label="Extension: ${title}"] div.tab-actions a.action-label.codicon.codicon-close`).click(); | ||
} | ||
} | ||
|
||
async installExtension(id: string, waitUntilEnabled: boolean): Promise<void> { | ||
await this.searchForExtension(id); | ||
const locator = this.code.driver.page.locator(`div.extensions-viewlet[id="workbench.view.extensions"] .monaco-list-row[data-extension-id="${id}"] .extension-list-item .monaco-action-bar .action-item:not(.disabled) .extension-action.install`).first(); | ||
await expect(locator).toBeVisible(); | ||
await locator.click(); | ||
await expect(this.code.driver.page.locator(`.extension-editor .monaco-action-bar .action-item:not(.disabled) .extension-action.uninstall`).first()).toBeVisible(); | ||
if (waitUntilEnabled) { | ||
await expect(this.code.driver.page.locator(`.extension-editor .monaco-action-bar .action-item:not(.disabled) a[aria-label="Disable this extension"]`)).toBeVisible(); | ||
} | ||
} | ||
|
||
|
||
} |
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 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 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 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 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