generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): basic e2e config for wdio
- Loading branch information
1 parent
e5b071a
commit 0e01939
Showing
7 changed files
with
167 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,69 @@ | ||
{ | ||
"name": "obsidian-apple-books-highlights-plugin", | ||
"version": "1.3.0", | ||
"description": "Import highlights and notes from your Apple Books to Obsidian", | ||
"main": "main.js", | ||
"scripts": { | ||
"dev": "node esbuild.config.mjs", | ||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", | ||
"lint": "eslint . --ext .ts", | ||
"version": "node version-bump.mjs", | ||
"test": "vitest", | ||
"coverage": "vitest run --coverage", | ||
"db:generate": "drizzle-kit generate:sqlite", | ||
"db:migrate": "npx tsx src/db/migrate.ts", | ||
"db:seed": "npx tsx src/db/seed.ts", | ||
"prepare": "husky" | ||
}, | ||
"keywords": [ | ||
"obsidian", | ||
"plugin", | ||
"apple", | ||
"books", | ||
"applebooks", | ||
"iBooks", | ||
"highlights", | ||
"notes", | ||
"importer" | ||
], | ||
"author": "bandantonio", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bandantonio/obsidian-apple-books-highlights-plugin.git" | ||
}, | ||
"engines": { | ||
"node": ">=20.8.0", | ||
"npm": ">=10.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/better-sqlite3": "^7.6.10", | ||
"@types/node": "^18.4.1", | ||
"@typescript-eslint/eslint-plugin": "5.29.0", | ||
"@typescript-eslint/parser": "5.29.0", | ||
"@vitest/coverage-istanbul": "^1.5.1", | ||
"better-sqlite3": "^9.5.0", | ||
"builtin-modules": "3.3.0", | ||
"drizzle-kit": "^0.20.17", | ||
"drizzle-orm": "^0.30.9", | ||
"esbuild": "0.17.3", | ||
"eslint": "^8.57.0", | ||
"husky": "^9.0.11", | ||
"obsidian": "latest", | ||
"tslib": "2.4.0", | ||
"typescript": "4.7.4", | ||
"vitest": "^1.5.1" | ||
}, | ||
"dependencies": { | ||
"dayjs": "^1.11.10", | ||
"handlebars": "^4.7.8" | ||
} | ||
} | ||
"name": "obsidian-apple-books-highlights-plugin", | ||
"version": "1.3.0", | ||
"description": "Import highlights and notes from your Apple Books to Obsidian", | ||
"main": "main.js", | ||
"scripts": { | ||
"dev": "node esbuild.config.mjs", | ||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", | ||
"lint": "eslint . --ext .ts", | ||
"version": "node version-bump.mjs", | ||
"test": "vitest", | ||
"test:e2e": "wdio run ./wdio.conf.js", | ||
"coverage": "vitest run --coverage", | ||
"db:generate": "drizzle-kit generate:sqlite", | ||
"db:migrate": "npx tsx src/db/migrate.ts", | ||
"db:seed": "npx tsx src/db/seed.ts", | ||
"prepare": "husky" | ||
}, | ||
"keywords": [ | ||
"obsidian", | ||
"plugin", | ||
"apple", | ||
"books", | ||
"applebooks", | ||
"iBooks", | ||
"highlights", | ||
"notes", | ||
"importer" | ||
], | ||
"author": "bandantonio", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bandantonio/obsidian-apple-books-highlights-plugin.git" | ||
}, | ||
"engines": { | ||
"node": ">=20.8.0", | ||
"npm": ">=10.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/better-sqlite3": "^7.6.10", | ||
"@types/node": "^18.4.1", | ||
"@typescript-eslint/eslint-plugin": "5.29.0", | ||
"@typescript-eslint/parser": "5.29.0", | ||
"@vitest/coverage-istanbul": "^1.5.1", | ||
"@wdio/cli": "^8.36.1", | ||
"@wdio/local-runner": "^8.36.1", | ||
"@wdio/mocha-framework": "^8.36.1", | ||
"@wdio/spec-reporter": "^8.36.1", | ||
"better-sqlite3": "^11.1.1", | ||
"builtin-modules": "3.3.0", | ||
"drizzle-kit": "^0.20.17", | ||
"drizzle-orm": "^0.30.9", | ||
"electron": "^30.0.3", | ||
"esbuild": "0.17.3", | ||
"eslint": "^8.57.0", | ||
"husky": "^9.0.11", | ||
"obsidian": "latest", | ||
"tslib": "2.4.0", | ||
"typescript": "4.7.4", | ||
"vitest": "^1.5.1", | ||
"wdio-electron-service": "^6.5.0", | ||
"webdriverio": "^8.36.1" | ||
}, | ||
"dependencies": { | ||
"dayjs": "^1.11.10", | ||
"handlebars": "^4.7.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const helpers = require('./helpers'); | ||
|
||
beforeEach(async () => { | ||
await helpers.initializeTestVault(); | ||
}); | ||
|
||
afterEach(() => { | ||
helpers.cleanupTestVault(); | ||
}); | ||
|
||
describe('Test plugin within Obsidian instance', () => { | ||
it('Ensure plugin is enabled', async () => { | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const fs = require("fs"); | ||
const { Key } = require('webdriverio'); | ||
|
||
module.exports = { | ||
sleep: async (seconds) => { | ||
return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); | ||
}, | ||
|
||
initializeTestVault: async () => { | ||
await browser; | ||
|
||
await browser.execute( | ||
"require('electron').ipcRenderer.sendSync('vault-open', 'test/e2e/test_e2e_vault', true)" | ||
); | ||
|
||
const pluginsDirectory = "test/e2e/test_e2e_vault/.obsidian/plugins/apple-books-import-highlights"; | ||
|
||
fs.mkdirSync(pluginsDirectory, { recursive: true }); | ||
fs.copyFileSync("manifest.json", `${pluginsDirectory}/manifest.json`); | ||
fs.copyFileSync("main.js", `${pluginsDirectory}/main.js`); | ||
fs.copyFileSync("styles.css", `${pluginsDirectory}/styles.css`); | ||
|
||
await module.exports.sleep(3); | ||
|
||
// Select the element: <button>Trust author and enable plugins</button>; | ||
await browser.$("div.modal.mod-trust-folder > div.modal-button-container > button:nth-child(1)").click(); | ||
|
||
|
||
|
||
// await browser.execute( | ||
// "app.plugins.setEnable(true);app.plugins.enablePlugin('oapple-books-import-highlights')" | ||
// ); | ||
}, | ||
|
||
cleanupTestVault: () => { | ||
fs.rmSync("test/e2e/test_e2e_vault", { recursive: true, force: true }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,9 @@ | |
] | ||
}, | ||
"include": [ | ||
"**/*.ts" | ||
"**/*.ts" | ||
], | ||
"exclude": [ | ||
"test/e2e/**" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
exports.config = { | ||
specs: ["./test/e2e/*.spec.js"], | ||
exclude: [], | ||
services: ["electron"], | ||
capabilities: [ | ||
// { | ||
// maxInstances: 1, | ||
// browserName: "chrome", | ||
// "goog:chromeOptions": { | ||
// binary: "/Applications/Obsidian.app/Contents/MacOS/Obsidian", | ||
// args: process.env.CI ? ["headless"] : [], | ||
// }, | ||
// acceptInsecureCerts: true, | ||
// }, | ||
{ | ||
browserName: "electron", | ||
browserVersion: "28.2.3", | ||
"wdio:electronServiceOptions": { | ||
// custom application args | ||
appBinaryPath: | ||
"/Applications/Obsidian.app/Contents/MacOS/Obsidian", | ||
appArgs: [], | ||
}, | ||
}, | ||
], | ||
logLevel: "info", | ||
bail: 0, | ||
baseUrl: "http://localhost", | ||
waitforTimeout: 10000, | ||
connectionRetryTimeout: 120000, | ||
connectionRetryCount: 0, | ||
framework: "mocha", | ||
reporters: ["spec"], | ||
mochaOpts: { | ||
ui: "bdd", | ||
timeout: 60000, | ||
}, | ||
}; |