From f486be9780dd15c4a65f4a0a8651262fe6281f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Thu, 24 Oct 2024 15:04:58 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20update=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d25e172..1182737 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,32 @@ +# the Obsidian Testing Framework -# Typescript module +## what is this? + +this is a library that (finally!) lets you end-to-end test your obsidian plugins. +it uses [playwright](https://playwright.dev/docs/intro) to interact with obsidian, +which is an Electron app under the hood. + +## great! how do i use it? + +### basic usage +```ts +import {test} from "obsidian-testing-framework"; +test('obsidian app url', async ({ page }) => { + console.log(page.url()); + expect(/obsidian\.md/i.test(page.url())).toBeTruthy() +}); +``` +### usage with the `app` instance +```ts +test("idk", async({page}) => { + console.log("idk") + let tfile = await doWithApp(page,async (app) => { + return app.metadataCache.getFirstLinkpathDest("Welcome", "/"); + }); + expect(what.basename).toEqual("Welcome") +}) +``` + +### other utilities + +see `src/util.ts` for the currently included utilities and their documentation.