Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions packages/databricks-vscode/src/test/e2e/bundle_variables.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,24 @@ describe("Bundle Variables", async function () {
"databricks.bundle.variable.openFile"
);
});
const editor = (await workbench
.getEditorView()
.openEditor("vscode.bundlevars.json")) as TextEditor;
let editor: TextEditor | undefined;
await browser.waitUntil(
async () => {
try {
editor = (await workbench
.getEditorView()
.openEditor("vscode.bundlevars.json")) as TextEditor;
return editor !== undefined;
} catch (e) {
return false;
}
},
{
timeout: 10_000,
interval: 500,
timeoutMsg: "Editor 'vscode.bundlevars.json' did not open",
}
);
assert(editor);

await editor.clearText();
Expand Down
32 changes: 21 additions & 11 deletions packages/databricks-vscode/src/test/e2e/utils/commonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,24 +313,34 @@ export async function executeCommandWhenAvailable(command: string) {
export async function waitForNotification(message: string, action?: string) {
await browser.waitUntil(
async () => {
const workbench = await browser.getWorkbench();
for (const notification of await workbench.getNotifications()) {
const label = await notification.getMessage();
console.log("Checking notification message:", label);
if (label.includes(message)) {
console.log(`Notification with "${message}" found.`);
if (action) {
console.log(`Taking action: ${action}`);
await notification.takeAction(action);
try {
const workbench = await browser.getWorkbench();
for (const notification of await workbench.getNotifications()) {
try {
const label = await notification.getMessage();
console.log("Checking notification message:", label);
if (label.includes(message)) {
console.log(`Notification with "${message}" found.`);
if (action) {
console.log(`Taking action: ${action}`);
await notification.takeAction(action);
}
return true;
}
} catch (e) {
// Notification may have been dismissed between collecting
// elements and reading its message — skip it and continue
console.log("Skipping stale notification element:", e);
}
return true;
}
} catch (e) {
console.log("Error fetching notifications, will retry:", e);
}
return false;
},
{
timeout: 60_000,
interval: 2000,
interval: 500,
timeoutMsg: `Notification with message "${message}" not found`,
}
);
Expand Down
Loading