obsidian-testing-framework/packages/test-project/e2e/example.spec.ts

22 lines
770 B
TypeScript
Raw Normal View History

2024-10-22 15:32:25 -04:00
import { expect } from '@playwright/test';
import {test} from "obsidian-testing-library"
2024-10-24 15:07:00 -04:00
import {TFile} from "obsidian";
import {assertLineEquals, doWithApp, readFile} from "obsidian-testing-library/utils";
2024-10-22 15:32:25 -04:00
test('something', async ({ page }) => {
console.log(page.url());
expect(/obsidian\.md/i.test(page.url())).toBeTruthy()
});
test("idk", async({page}) => {
2024-10-24 15:07:00 -04:00
let what = await doWithApp<TFile | null>(page, async (app) => {
return app.metadataCache.getFirstLinkpathDest("Welcome", "/");
2024-10-22 15:32:25 -04:00
});
2024-10-24 15:07:00 -04:00
// console.log("WHAT", what)
// console.log(what?.vault)
expect(what?.basename).toEqual("Welcome")
})
test("file line", async({page}) => {
console.log(await readFile(page, "Welcome.md"))
await assertLineEquals(page, "Welcome.md", 0, "This is your new *vault*.");
2024-10-22 15:32:25 -04:00
})