Skip to content
Draft
2 changes: 1 addition & 1 deletion packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "LicenseRef-LICENSE",
"version": "2.10.5",
"engines": {
"vscode": "^1.101.0",
"vscode": "^1.86.0",
"node": ">=22.0"
},
"categories": [
Expand Down
7 changes: 1 addition & 6 deletions packages/databricks-vscode/src/test/e2e/auth.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import assert from "node:assert";
import {
dismissNotifications,
getActionButton,
waitForInput,
getViewSection,
waitForLogin,
Expand Down Expand Up @@ -71,12 +70,8 @@ describe("Configure Databricks Extension", async function () {
const items = await section.getVisibleItems();
for (const item of items) {
const label = await item.getLabel();
console.log(
"Looking for signin button, got item:",
await (await item.elem).getHTML()
);
if (label.toLowerCase().includes("auth type")) {
return getActionButton(item, "Sign in");
return item.getActionButton("Sign in");
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import assert from "node:assert";
import {
dismissNotifications,
getActionButton,
getUniqueResourceName,
getViewSection,
selectOutputChannel,
waitForDeployment,
waitForLogin,
waitForTreeItems,
Expand Down Expand Up @@ -67,7 +65,7 @@ describe("Deploy and run job", async function () {

it("should deploy and run the current job", async () => {
const outputView = await workbench.getBottomBar().openOutputView();
await selectOutputChannel(outputView, "Databricks Bundle Logs");
await outputView.selectChannel("Databricks Bundle Logs");
await outputView.clearText();

const jobItem = await getResourceViewItem(
Expand All @@ -77,8 +75,7 @@ describe("Deploy and run job", async function () {
);
assert(jobItem, `Job ${jobName} not found in resource explorer`);

const deployAndRunButton = await getActionButton(
jobItem,
const deployAndRunButton = await jobItem.getActionButton(
"Deploy the bundle and run the job"
);
assert(deployAndRunButton, "Deploy and run button not found");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import assert from "node:assert";
import {
dismissNotifications,
getActionButton,
getViewSection,
selectOutputChannel,
waitForDeployment,
waitForLogin,
waitForTreeItems,
Expand Down Expand Up @@ -64,7 +62,7 @@ describe("Deploy and run pipeline", async function () {

it("should deploy and run the current pipeline", async () => {
const outputView = await workbench.getBottomBar().openOutputView();
await selectOutputChannel(outputView, "Databricks Bundle Logs");
await outputView.selectChannel("Databricks Bundle Logs");
await outputView.clearText();

const pipelineItem = await getResourceViewItem(
Expand All @@ -77,14 +75,13 @@ describe("Deploy and run pipeline", async function () {
`Pipeline ${pipelineName} not found in resource explorer`
);

const deployAndRunButton = await getActionButton(
pipelineItem,
const deployAndRunButton = await pipelineItem.getActionButton(
"Deploy the bundle and run the pipeline"
);
assert(deployAndRunButton, "Deploy and run button not found");
await deployAndRunButton.elem.click();

await waitForDeployment(outputView);
await waitForDeployment();

await waitForRunStatus(
resourceExplorerView,
Expand Down Expand Up @@ -120,7 +117,7 @@ describe("Deploy and run pipeline", async function () {
"Dataset 'test_table' defined as MATERIALIZED_VIEW."
) ||
labels.includes(
"Dataset `test_table` defined as MATERIALIZED_VIEW."
"Dataset `vscode_integration_test`.`test_table` defined as MATERIALIZED_VIEW."
),
"test_table item not found"
);
Expand All @@ -146,11 +143,15 @@ describe("Deploy and run pipeline", async function () {
datasets.push({label, description, item});
}
datasets.sort((a, b) => (a.label > b.label ? 1 : -1));

assert.strictEqual(datasets.length, 2);
assert.strictEqual(datasets[0].label, "test_table");
assert.strictEqual(datasets[0].description, "materialized view");
assert.strictEqual(datasets[1].label, "test_view");
assert.strictEqual(datasets[1].description, "view");
assert.strictEqual(datasets[0].label, "test_view");
assert.strictEqual(datasets[0].description, "view");
assert.strictEqual(
datasets[1].label,
"vscode_integration_test.test_table"
);
assert.strictEqual(datasets[1].description, "");
});

it("should show expected schema definitions for a dataset", async () => {
Expand All @@ -159,7 +160,7 @@ describe("Deploy and run pipeline", async function () {
"Pipelines",
pipelineName,
"Datasets",
"test_table"
"vscode_integration_test.test_table"
);
assert.strictEqual(schemaItems.length, 1);
assert.strictEqual(await schemaItems[0].getLabel(), "1");
Expand Down
58 changes: 38 additions & 20 deletions packages/databricks-vscode/src/test/e2e/destroy.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
dismissNotifications,
getUniqueResourceName,
getViewSection,
selectOutputChannel,
waitForLogin,
waitForTreeItems,
} from "./utils/commonUtils.ts";
Expand Down Expand Up @@ -72,33 +71,42 @@ describe("Deploy and destroy", async function () {
.replaceAll(/[^a-zA-Z0-9]/g, "_")}]`;

const outputView = await workbench.getBottomBar().openOutputView();
await selectOutputChannel(outputView, "Databricks Bundle Logs");
await outputView.selectChannel("Databricks Bundle Logs");
await outputView.clearText();

await browser.executeWorkbench(async (vscode) => {
await vscode.commands.executeCommand("databricks.bundle.deploy");
});

await browser.executeWorkbench(async (vscode) => {
await vscode.commands.executeCommand(
"workbench.panel.output.focus"
);
});

await selectOutputChannel(outputView, "Databricks Bundle Logs");

console.log("Waiting for deployment to finish");
// Wait for the deployment to finish
await browser.waitUntil(
async () => {
try {
await browser.executeWorkbench(async (vscode) => {
await vscode.commands.executeCommand(
"workbench.panel.output.focus"
);
});
const outputView = await workbench
.getBottomBar()
.openOutputView();

if (
(await outputView.getCurrentChannel()) !==
"Databricks Bundle Logs"
) {
await outputView.selectChannel(
"Databricks Bundle Logs"
);
}

const logs = (await outputView.getText()).join("");
console.log(logs);
return (
logs.includes("Bundle deployed successfully") &&
logs.includes("Bundle configuration refreshed")
);
} catch (e) {
console.log("Error waiting for deployment to finish:", e);
return false;
}
},
Expand Down Expand Up @@ -127,19 +135,29 @@ describe("Deploy and destroy", async function () {
);
});

await browser.executeWorkbench(async (vscode) => {
await vscode.commands.executeCommand(
"workbench.panel.output.focus"
);
});

await selectOutputChannel(outputView, "Databricks Bundle Logs");

console.log("Waiting for bundle to destroy");
// Wait for status to reach success
await browser.waitUntil(
async () => {
try {
await browser.executeWorkbench(async (vscode) => {
await vscode.commands.executeCommand(
"workbench.panel.output.focus"
);
});
const outputView = await workbench
.getBottomBar()
.openOutputView();

if (
(await outputView.getCurrentChannel()) !==
"Databricks Bundle Logs"
) {
await outputView.selectChannel(
"Databricks Bundle Logs"
);
}

const logs = (await outputView.getText()).join("");
console.log(logs);
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {CustomTreeSection} from "wdio-vscode-service";
import {
dismissNotifications,
getViewSection,
selectOutputChannel,
waitForLogin,
} from "./utils/commonUtils.ts";
import {
Expand Down Expand Up @@ -79,8 +78,7 @@ describe("Automatically refresh resource explorer", async function () {
const outputView = await (await browser.getWorkbench())
.getBottomBar()
.openOutputView();

await selectOutputChannel(outputView, "Databricks Bundle Logs");
await outputView.selectChannel("Databricks Bundle Logs");

const jobDef = await createProjectWithJob(
projectName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function checkOutputFile(path: string, expectedContent: string) {
return fileContent.includes(expectedContent);
},
{
timeout: 60_000,
timeout: 120_000,
interval: 2000,
timeoutMsg: `Output file "${path}" did not contain "${expectedContent}"`,
}
Expand All @@ -33,7 +33,7 @@ async function checkOutputFile(path: string, expectedContent: string) {

describe("Run files on serverless compute", async function () {
let projectDir: string;
this.timeout(3 * 60 * 1000);
this.timeout(6 * 60 * 1000);

before(async () => {
assert(process.env.WORKSPACE_PATH, "WORKSPACE_PATH doesn't exist");
Expand Down Expand Up @@ -109,6 +109,7 @@ describe("Run files on serverless compute", async function () {
"# MAGIC select 1 + 1;",
"# MAGIC select 'hello run;'",
"# COMMAND ----------",
`import os`,
`df = _sqldf.toPandas()`,
`df.to_json(os.path.join(os.getcwd(), "databricks-run-notebook-output.json"))`,
].join("\n")
Expand All @@ -118,6 +119,7 @@ describe("Run files on serverless compute", async function () {
path.join(nestedDir, "databricks-notebook.py"),
[
"# Databricks notebook source",
`import os`,
`spark.sql('SELECT "hello world"').show()`,
"# COMMAND ----------",
"# DBTITLE 1,My cell title",
Expand Down Expand Up @@ -207,6 +209,7 @@ describe("Run files on serverless compute", async function () {
);
}
await dependenciesInput.confirm();

await waitForNotification("The following environment is selected");
await waitForNotification("Databricks Connect", "Install");

Expand Down
14 changes: 2 additions & 12 deletions packages/databricks-vscode/src/test/e2e/run_files.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {

describe("Run files", async function () {
let projectDir: string;
this.timeout(3 * 60 * 1000);
this.timeout(6 * 60 * 1000);

before(async () => {
assert(process.env.WORKSPACE_PATH, "WORKSPACE_PATH doesn't exist");
Expand Down Expand Up @@ -56,17 +56,7 @@ describe("Run files", async function () {
const message = await notification.getMessage();
console.log("Message:", message);
if (message.includes("Uploading bundle assets")) {
const elements = await notification.actions$.$$(
notification.locators.action
);
console.log("Elements:", elements.length);
for (const element of elements) {
const text = await element.getText();
if (text === "Cancel") {
await element.click();
break;
}
}
await notification.takeAction("Cancel");
return true;
}
}
Expand Down
Loading
Loading