Test updates

This commit is contained in:
Elio Struyf
2022-06-30 17:39:10 +02:00
parent 00273a8c86
commit c04dd79778
4 changed files with 31 additions and 23 deletions
-14
View File
@@ -29,20 +29,6 @@
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
]
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "npm: test-compile"
}
]
}
+28 -7
View File
@@ -1,4 +1,4 @@
import { By, VSBrowser, EditorView, WebView, Workbench, Notification } from "vscode-extension-tester";
import { By, VSBrowser, EditorView, WebView, Workbench, Notification, StatusBar, NotificationType } from "vscode-extension-tester";
import { expect } from "chai";
import { sleep } from "./utils";
import { join } from "path";
@@ -12,7 +12,7 @@ describe("Initialization testing", function() {
let workbench: Workbench;
let view: WebView;
this.beforeAll(async function() {
before(async function() {
await VSBrowser.instance.openResources(join(__dirname, '../sample'));
await sleep(3000);
workbench = new Workbench();
@@ -42,18 +42,39 @@ describe("Initialization testing", function() {
await sleep(1000);
await VSBrowser.instance.driver.wait(() => {
return notificationExists(workbench, 'Front Matter:');
}, 2000) as Notification;
const notifications = await workbench.getNotifications();
let notification!: Notification;
for (const not of notifications) {
const message = await not.getMessage();
if (message.includes('Front Matter:')) {
notification = not;
}
console.log(not);
// const message = await not.get;
// console.log(message);
// if (message.includes('Front Matter:')) {
// notification = not;
// }
}
expect(await notification.getMessage()).has.string(`Project initialized successfully.`);
});
it("3. Check if project file is created", async function() {});
});
});
async function notificationExists(workbench: Workbench, text: string): Promise<Notification | undefined> {
const notifications = await (await (new StatusBar()).openNotificationsCenter()).getNotifications(NotificationType.Info);
console.log(`Notifications:`, notifications.length);
for (const notification of notifications) {
const message = await notification.getMessage();
console.log(message)
if (message.indexOf(text) >= 0) {
return notification;
}
}
}
+1 -1
View File
@@ -4,7 +4,7 @@ import { ExTester, ReleaseQuality } from "vscode-extension-tester";
async function main(): Promise<void> {
const vsCodeVersion: semver.SemVer = new semver.SemVer(`1.65.0`);
const vsCodeVersion: semver.SemVer = new semver.SemVer(`1.66.0`);
const version = vsCodeVersion.version;
const storageFolder = path.join(__dirname, "..", "storage");
+2 -1
View File
@@ -1927,7 +1927,8 @@
"test-compile": "tsc -p ./",
"clean": "rimraf dist",
"start:site": "cd ./docs && npm run dev",
"test": "tsc -p tsconfig.e2e.json && node ./e2e/out/runTests.js"
"clean:test": "rm ./e2e/sample/frontmatter.json || exit 0 && rm -rf ./e2e/sample/.frontmatter || exit 0",
"test": "tsc -p tsconfig.e2e.json && npm run clean:test && node ./e2e/out/runTests.js"
},
"devDependencies": {
"@actions/core": "^1.8.2",