mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Cleanup
This commit is contained in:
@@ -1,78 +0,0 @@
|
|||||||
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";
|
|
||||||
|
|
||||||
// https://github.com/microsoft/vscode-java-dependency/blob/4256fa6adcaff5ec24dbdbb8d9a516fad21431c5/test/ui/index.ts
|
|
||||||
// https://github.com/microsoft/vscode-java-dependency/blob/4256fa6adcaff5ec24dbdbb8d9a516fad21431c5/test/ui/command.test.ts
|
|
||||||
|
|
||||||
describe("Initialization testing", function() {
|
|
||||||
this.timeout(2 * 60 * 1000 /*ms*/);
|
|
||||||
|
|
||||||
let workbench: Workbench;
|
|
||||||
let view: WebView;
|
|
||||||
|
|
||||||
before(async function() {
|
|
||||||
await VSBrowser.instance.openResources(join(__dirname, '../sample'));
|
|
||||||
await sleep(3000);
|
|
||||||
workbench = new Workbench();
|
|
||||||
|
|
||||||
await workbench.executeCommand("frontMatter.dashboard");
|
|
||||||
await sleep(3000);
|
|
||||||
|
|
||||||
await new EditorView().openEditor(`FrontMatter Dashboard`);
|
|
||||||
|
|
||||||
view = new WebView();
|
|
||||||
await view.switchToFrame();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("1. Open welcome dashboard", async function() {
|
|
||||||
const element = await view.findWebElement(By.css('h1'));
|
|
||||||
|
|
||||||
const title = await element.getText();
|
|
||||||
|
|
||||||
expect(title).has.string(`Front Matter`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("2. Initialize project", async function() {
|
|
||||||
const btn = await view.findWebElement(By.css('[data-test="welcome-init"] button'));
|
|
||||||
expect(btn).to.exist;
|
|
||||||
|
|
||||||
await btn.click();
|
|
||||||
|
|
||||||
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) {
|
|
||||||
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);
|
|
||||||
|
|
||||||
for (const notification of notifications) {
|
|
||||||
const message = await notification.getMessage();
|
|
||||||
if (message.indexOf(text) >= 0) {
|
|
||||||
return notification;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import * as path from 'path'
|
|
||||||
import * as semver from 'semver'
|
|
||||||
import { ExTester, ReleaseQuality } from 'vscode-extension-tester'
|
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
|
||||||
const vsCodeVersion: semver.SemVer = new semver.SemVer(`1.66.0`)
|
|
||||||
const version = vsCodeVersion.version
|
|
||||||
|
|
||||||
const storageFolder = path.join(__dirname, '..', 'storage')
|
|
||||||
const extFolder = path.join(__dirname, '..', 'extensions')
|
|
||||||
|
|
||||||
try {
|
|
||||||
const testPath = path.join(__dirname, 'command.test.js')
|
|
||||||
|
|
||||||
const exTester = new ExTester(storageFolder, ReleaseQuality.Stable, extFolder)
|
|
||||||
await exTester.downloadCode(version)
|
|
||||||
await exTester.installVsix({ useYarn: false })
|
|
||||||
// await exTester.installFromMarketplace("eliostruyf.vscode-front-matter");
|
|
||||||
await exTester.downloadChromeDriver(version)
|
|
||||||
// await exTester.setupRequirements({vscodeVersion: version});
|
|
||||||
const result = await exTester.runTests(testPath, {
|
|
||||||
vscodeVersion: version,
|
|
||||||
resources: [storageFolder],
|
|
||||||
})
|
|
||||||
|
|
||||||
process.exit(result)
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from './sleep';
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export async function sleep(time: number) {
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, time));
|
|
||||||
}
|
|
||||||
@@ -2564,9 +2564,6 @@
|
|||||||
"prod:panel": "webpack --mode production --config ./webpack/panel.config.js",
|
"prod:panel": "webpack --mode production --config ./webpack/panel.config.js",
|
||||||
"test-compile": "tsc -p ./",
|
"test-compile": "tsc -p ./",
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"start:site": "cd ./docs && npm run dev",
|
|
||||||
"clean:test": "rm ./e2e/sample/frontmatter.json || exit 0 && rm -rf ./e2e/sample/.frontmatter || exit 0",
|
|
||||||
"test": "npm run lint; tsc -p tsconfig.e2e.json && npm run clean:test && npm run i -g @vscode/vsce && node ./e2e/out/runTests.js",
|
|
||||||
"lint": "eslint --max-warnings=0 ./src/{commands,components}",
|
"lint": "eslint --max-warnings=0 ./src/{commands,components}",
|
||||||
"prettier": "prettier --write ./src",
|
"prettier": "prettier --write ./src",
|
||||||
"localization:watch": "node ./scripts/watch-localization.js",
|
"localization:watch": "node ./scripts/watch-localization.js",
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ export class Article {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let position = editor.selection.active;
|
const position = editor.selection.active;
|
||||||
const selectionText = editor.document.getText(editor.selection);
|
const selectionText = editor.document.getText(editor.selection);
|
||||||
|
|
||||||
// Check for snippet wrapper
|
// Check for snippet wrapper
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class Cache {
|
|||||||
await Extension.getInstance().setState(key, data, type);
|
await Extension.getInstance().setState(key, data, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async clear(showNotification: boolean = true) {
|
public static async clear(showNotification = true) {
|
||||||
const ext = Extension.getInstance();
|
const ext = Extension.getInstance();
|
||||||
|
|
||||||
await ext.setState(ExtensionState.Dashboard.Pages.Cache, undefined, 'workspace', true);
|
await ext.setState(ExtensionState.Dashboard.Pages.Cache, undefined, 'workspace', true);
|
||||||
|
|||||||
@@ -283,7 +283,6 @@ export class Folders {
|
|||||||
public static async getInfo(limit?: number): Promise<FolderInfo[] | null> {
|
public static async getInfo(limit?: number): Promise<FolderInfo[] | null> {
|
||||||
const supportedFiles = Settings.get<string[]>(SETTING_CONTENT_SUPPORTED_FILETYPES);
|
const supportedFiles = Settings.get<string[]>(SETTING_CONTENT_SUPPORTED_FILETYPES);
|
||||||
const folders = Folders.get();
|
const folders = Folders.get();
|
||||||
const wsFolder = parseWinPath(Folders.getWorkspaceFolder()?.fsPath || '');
|
|
||||||
|
|
||||||
if (folders && folders.length > 0) {
|
if (folders && folders.length > 0) {
|
||||||
const folderInfo: FolderInfo[] = [];
|
const folderInfo: FolderInfo[] = [];
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ export class Preview {
|
|||||||
* @param filePath
|
* @param filePath
|
||||||
* @param slug
|
* @param slug
|
||||||
*/
|
*/
|
||||||
public static async updatePageUrl(filePath: string, slug?: string) {
|
public static async updatePageUrl(filePath: string, _: string) {
|
||||||
const webView = this.webviews[filePath];
|
const webView = this.webviews[filePath];
|
||||||
if (webView) {
|
if (webView) {
|
||||||
const localhost = await this.getLocalServerUrl();
|
const localhost = await this.getLocalServerUrl();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class Settings {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (newOption) {
|
if (newOption) {
|
||||||
let options = (await TaxonomyHelper.get(type)) || [];
|
const options = (await TaxonomyHelper.get(type)) || [];
|
||||||
|
|
||||||
if (options.find((o) => o === newOption)) {
|
if (options.find((o) => o === newOption)) {
|
||||||
Notifications.warning(l10n.t(LocalizationKey.commandsSettingsCreateWarning, taxonomy));
|
Notifications.warning(l10n.t(LocalizationKey.commandsSettingsCreateWarning, taxonomy));
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export class Template {
|
|||||||
await copyFileAsync(template.fsPath, newFilePath);
|
await copyFileAsync(template.fsPath, newFilePath);
|
||||||
|
|
||||||
// Update the properties inside the template
|
// Update the properties inside the template
|
||||||
let frontMatter = await ArticleHelper.getFrontMatterByPath(newFilePath);
|
const frontMatter = await ArticleHelper.getFrontMatterByPath(newFilePath);
|
||||||
if (!frontMatter) {
|
if (!frontMatter) {
|
||||||
Notifications.warning(l10n.t(LocalizationKey.commonError));
|
Notifications.warning(l10n.t(LocalizationKey.commonError));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es6",
|
|
||||||
"outDir": "e2e/out",
|
|
||||||
"lib": [
|
|
||||||
"es6",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
"sourceMap": true,
|
|
||||||
"strict": false,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"skipLibCheck": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"e2e/src/**/*"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"src"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
".vscode-test",
|
".vscode-test",
|
||||||
"docs",
|
"docs"
|
||||||
"e2e"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user