Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, macos-latest]
node-version: [14.x]
node-version: [16.x]
vscode-version: [stable, insiders]

env:
Expand Down Expand Up @@ -60,10 +60,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js 14.x
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: ${{ matrix.node-version }}
cache: "yarn"

- run: yarn install --immutable
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"yarn": ">=3.2.0"
},
"scripts": {
"test": "yarn workspaces foreach run test --if-present",
"test:integ": "yarn workspaces foreach run test:integ --if-present",
"test": "yarn workspaces foreach run test",
"test:integ": "yarn workspaces foreach run test:integ",
"build": "yarn workspaces foreach run build",
"clean": "yarn workspaces foreach run clean"
},
Expand Down
12 changes: 11 additions & 1 deletion packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,13 @@
}
]
},
"vsce": {
"dependencies": false,
"useYarn": false
},
"scripts": {
"vscode:prepublish": "yarn run package",
"vscode:package": "vsce package --yarn",
"vscode:package": "vsce package",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
Expand All @@ -190,6 +194,9 @@
"test:compile": "tsc -p . --outDir out",
"test:watch": "tsc -p . -w --outDir out",
"test:unit": "node ./out/test/runTest.js",
"test:integ:prepare": "yarn run vscode:package && extest get-vscode --type ${VSCODE_TEST_VERSION:-stable} --storage /tmp/vscode-test-databricks && extest get-chromedriver --storage /tmp/vscode-test-databricks && extest install-vsix -f databricks-0.0.1.vsix --storage /tmp/vscode-test-databricks",
"test:integ:run": "yarn run test:compile && extest run-tests --storage /tmp/vscode-test-databricks --code_settings src/test/e2e/settings.json out/test/e2e/*.e2e.js",
"test:integ": "yarn run test:integ:prepare && yarn run test:integ:run",
"test": "yarn run test:compile && yarn run compile && yarn run test:lint && yarn run test:unit",
"build": "yarn run vscode:prepublish",
"clean": "rm -rf node_modules out dist .vscode-test"
Expand All @@ -198,6 +205,7 @@
"@databricks/databricks-sdk": "*"
},
"devDependencies": {
"@nut-tree/nut-js": "^2.1.1",
"@types/glob": "^7.2.0",
"@types/mocha": "^9.1.1",
"@types/node": "16.x",
Expand All @@ -210,10 +218,12 @@
"glob": "^8.0.3",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"tmp-promise": "^3.0.3",
"ts-loader": "^9.3.0",
"ts-mockito": "^2.6.1",
"typescript": "^4.7.4",
"vsce": "^2.9.1",
"vscode-extension-tester": "^4.3.0",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2"
}
Expand Down
72 changes: 72 additions & 0 deletions packages/databricks-vscode/src/test/e2e/happy_path.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// import the webdriver and the high level browser wrapper
import assert = require("node:assert");
import path = require("node:path");
import * as fs from "fs/promises";
import * as tmp from "tmp-promise";
import {
VSBrowser,
WebDriver,
ActivityBar,
InputBox,
Workbench,
} from "vscode-extension-tester";
import {openCommandPrompt} from "./utils";

// Create a Mocha suite
describe("My Test Suite", function () {
let browser: VSBrowser;
let driver: WebDriver;

let projectDir: string;
let cleanup: () => void;

this.timeout(20_000);

before(async () => {
browser = VSBrowser.instance;
driver = browser.driver;

({path: projectDir, cleanup} = await tmp.dir());
});

after(() => {
cleanup();
});

it("should open VSCode", async () => {
const title = await driver.getTitle();
assert(title.indexOf("Get Started") >= 0);
});

it("should dismiss notifications", async () => {
await new Promise((resolve) => setTimeout(resolve, 6000));
const notifications = await new Workbench().getNotifications();
for (const n of notifications) {
await n.dismiss();
}
});

it("should open project folder", async () => {
await fs.writeFile(path.join(projectDir, "test.txt"), "test");
(await new ActivityBar().getViewControl("Explorer"))?.openView();

const workbench = new Workbench();
const prompt = await openCommandPrompt(workbench);
await prompt.setText(">File: Open Folder");
await prompt.confirm();

const input = await InputBox.create();
await input.setText(projectDir);
await input.confirm();

// wait for reload to complete
await new Promise((resolve) => setTimeout(resolve, 3000));
});

it("should open databricks panel", async () => {
const control = await new ActivityBar().getViewControl("Databricks");
assert(control);
const view = await control.openView();
assert(view);
});
});
7 changes: 7 additions & 0 deletions packages/databricks-vscode/src/test/e2e/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"typescript.updateImportsOnFileMove.enabled": "always",
"files.simpleDialog.enable": true,
"workbench.editor.enablePreview": true,
"workbench.colorTheme": "Default Light+",
"window.newWindowDimensions": "default"
}
31 changes: 31 additions & 0 deletions packages/databricks-vscode/src/test/e2e/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {Key} from "selenium-webdriver";
import {InputBox, EditorView, Workbench} from "vscode-extension-tester";

// work around for https://github.com/redhat-developer/vscode-extension-tester/issues/470
export async function openCommandPrompt(
workbench: Workbench
): Promise<InputBox> {
const webview = await new EditorView().findElements(
(EditorView as any).locators.EditorView.webView
);
if (webview.length > 0) {
const tab = await new EditorView().getActiveTab();
if (tab) {
await tab.sendKeys(Key.F1);
return InputBox.create();
}
}
if (process.platform === "darwin") {
await workbench.getDriver().actions().sendKeys(Key.F1).perform();
} else {
await workbench
.getDriver()
.actions()
.keyDown(Key.CONTROL)
.keyDown(Key.SHIFT)
.sendKeys("p")
.perform();
}

return InputBox.create();
}
3 changes: 2 additions & 1 deletion packages/databricks-vscode/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"sourceMap": true,
"rootDir": "src",
"strict": true /* enable all strict type-checking options */
}
},
"include": ["src"]
}
Loading