-
Notifications
You must be signed in to change notification settings - Fork 18
fix(E2E): wait for notification/sidebar in Flink artifact setup #3375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Dave Shoup (shouples)
wants to merge
4
commits into
main
Choose a base branch
from
djs/post-reload-workbench-readiness
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
This file contains hidden or 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,82 @@ | ||
| import type { Page } from "@playwright/test"; | ||
| import { expect } from "@playwright/test"; | ||
| import { Notification } from "../objects/notifications/Notification"; | ||
| import { NotificationArea } from "../objects/notifications/NotificationArea"; | ||
| import { ViewContainer } from "../objects/ViewContainer"; | ||
| import { ResourcesView } from "../objects/views/ResourcesView"; | ||
| import { executeVSCodeCommand } from "./commands"; | ||
|
|
||
| /** | ||
| * Prepare a freshly-loaded VS Code workspace/window before any test interactions. | ||
| * | ||
| * NOTE: This should be safe to call at fixture startup (before any test has touched the window) and | ||
| * after any workspace/window reload. | ||
| */ | ||
| export async function prepareTestWorkspace(page: Page): Promise<void> { | ||
| // wait for the (new) VS Code window DOM + workbench shell to be ready; same waits the | ||
| // electronApp fixture uses at initial launch | ||
| await page.waitForLoadState("domcontentloaded"); | ||
| await page.locator(".monaco-workbench").waitFor({ timeout: 30000 }); | ||
| // any locator-based interactions below this point will naturally wait for the Electron DOM to be | ||
| // ready/visible/etc, so we don't need additional waits for that here | ||
|
|
||
| // dismiss the "All installed extensions are temporarily disabled" toast that always appears | ||
| // under --disable-extensions; tolerate it being absent on subsequent reloads | ||
| try { | ||
| const notificationArea = new NotificationArea(page); | ||
| const infoNotifications = notificationArea.infoNotifications.filter({ | ||
| hasText: "All installed extensions are temporarily disabled", | ||
| }); | ||
| await expect(infoNotifications).not.toHaveCount(0, { timeout: 2000 }); | ||
| await new Notification(page, infoNotifications.first()).dismiss(); | ||
| } catch { | ||
| // toast wasn't present or couldn't be dismissed | ||
| } | ||
|
|
||
| // collapse the secondary sidebar if it's expanded since it isn't used for anything | ||
| try { | ||
| await expect(page.locator(`[id="workbench.parts.auxiliarybar"]`)).toBeVisible({ | ||
| timeout: 1000, | ||
| }); | ||
| // use the default VS Code keybinding instead of the command palette: `Ctrl+Shift+P` can be | ||
| // swallowed by a focused Chat webview on workspace reload, but `Ctrl+Alt+B` is a global | ||
| // workbench keybinding that routes regardless of webview focus | ||
| await page.keyboard.press("ControlOrMeta+Alt+B"); | ||
| } catch { | ||
| console.warn("Error locating/toggling secondary sidebar"); | ||
|
shouples marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Opens the primary sidebar with the main Confluent | ||
| * {@link https://code.visualstudio.com/api/ux-guidelines/views#view-containers view container}, | ||
| * which activates the extension if it isn't already activated. | ||
| * | ||
| * For most tests, this should be done first unless another explicit extension activation event is | ||
| * performed. | ||
| */ | ||
| export async function openConfluentSidebar(page: Page): Promise<void> { | ||
| await page.waitForLoadState("domcontentloaded"); | ||
|
|
||
| // check if the view container is already visible in the primary sidebar first | ||
| // and if not, use the VS Code focus command to show it | ||
| const viewContainer = new ViewContainer(page, "confluent"); | ||
| try { | ||
| await expect(viewContainer.locator).toBeVisible({ timeout: 2000 }); | ||
| } catch { | ||
| // use the VS Code command rather than clicking the activity bar tab directly, | ||
| // because the tab click toggles the sidebar: if the Confluent tab is already | ||
| // active (but hasn't rendered yet), clicking it closes the sidebar instead of opening it | ||
| await executeVSCodeCommand(page, "confluent-resources.focus"); | ||
| await expect(viewContainer.locator).toBeVisible(); | ||
| } | ||
|
|
||
| const resourcesView = new ResourcesView(page); | ||
| // the Resources should be visible and expanded by default | ||
| await expect(resourcesView.header).toHaveAttribute("aria-expanded", "true"); | ||
| // and should show the "Confluent Cloud" placeholder item (not "No resources found") | ||
| await expect(resourcesView.confluentCloudItem).toBeVisible(); | ||
| // we don't check for the "Local" item here in the event the Confluent Cloud item has children | ||
| // and is expanded, because it may push the Local item out of view and adding logic in here to | ||
| // scroll to it would be more complex than necessary for this utility function | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.