fix: fs e2e tests

This commit is contained in:
Tienson Qin
2023-11-06 21:51:22 +08:00
parent 196d056f99
commit 9efcaf41c1
3 changed files with 29 additions and 30 deletions

View File

@@ -37,7 +37,7 @@ test('create file on disk then delete', async ({ page, block, graphDir }) => {
const results = await searchPage(page, pageTitle);
const firstResultRow = await results[0].innerText()
expect(firstResultRow).toContain(pageTitle);
expect(firstResultRow).not.toContain("New");
expect(firstResultRow).not.toContain("Create");
await closeSearchBox(page);
}
@@ -51,7 +51,7 @@ test('create file on disk then delete', async ({ page, block, graphDir }) => {
// Test that the page is deleted
const results = await searchPage(page, pageTitle);
const firstResultRow = await results[0].innerText()
expect(firstResultRow).toContain("New");
expect(firstResultRow).toContain("Create");
await closeSearchBox(page);
}
});
@@ -62,7 +62,7 @@ test("Rename file on disk", async ({ page, block, graphDir }) => {
const testCases = [
// Normal -> NameSpace
{pageTitle: "User:John", fileName: "User%3AJohn",
{pageTitle: "User:John", fileName: "User%3AJohn",
newPageTitle: "User/John", newFileName: "User___John"},
// NameSpace -> Normal
{pageTitle: "#/%23", fileName: "#___%2523",
@@ -87,7 +87,7 @@ test("Rename file on disk", async ({ page, block, graphDir }) => {
const results = await searchPage(page, pageTitle);
const firstResultRow = await results[0].innerText()
expect(firstResultRow).toContain(pageTitle);
expect(firstResultRow).not.toContain("New");
expect(firstResultRow).not.toContain("Create");
await closeSearchBox(page);
}
@@ -104,7 +104,7 @@ test("Rename file on disk", async ({ page, block, graphDir }) => {
const firstResultRow = await results[0].innerText()
expect(firstResultRow).toContain(newPageTitle);
expect(firstResultRow).not.toContain(pageTitle);
expect(firstResultRow).not.toContain("New");
expect(firstResultRow).not.toContain("Create");
await closeSearchBox(page);
}
})
@@ -112,7 +112,6 @@ test("Rename file on disk", async ({ page, block, graphDir }) => {
test('special page names', async ({ page, block, graphDir }) => {
const testCases = [
{pageTitle: "User:John", fileName: "User%3AJohn"},
// FIXME: Logseq can't creat page starting with "#" in search panel
{pageTitle: "_#%ff", fileName: "_%23%25ff"},
{pageTitle: "_#%23", fileName: "_%23%2523"},
{pageTitle: "@!#%", fileName: "@!%23%"},
@@ -127,7 +126,7 @@ test('special page names', async ({ page, block, graphDir }) => {
const text = `content for ${pageTitle}`
await block.mustFill(text)
await page.keyboard.press("Enter")
// Wait for the file to be created on disk
await page.waitForTimeout(2000);
// Validate that the file is created on disk with the content

View File

@@ -60,5 +60,5 @@ export async function searchPage(page: Page, query: string): Promise<ElementHand
await page.fill('[placeholder="What are you looking for?"]', query)
await page.waitForTimeout(2000) // wait longer for search contents to render
return page.$$('#ui__ac-inner>div');
return page.$$('.search-results>div');
}