Show page titles in wiki search results (#6048)

Replace wiki page filenames with page titles in the search results,
fixing the problem with them showing unreadable URI-encoded names.
This commit is contained in:
Oto Šťáva 2024-11-23 14:37:16 +01:00
parent 19bde653c1
commit fc31fa0eeb
No known key found for this signature in database
GPG key ID: 32B22D20C9B4E680
4 changed files with 41 additions and 6 deletions

View file

@ -17,3 +17,14 @@ test(`Search for long titles and test for no overflow`, async ({page}, workerInf
// timeout is necessary because HTMX search could be slow
await expect(page.locator('#wiki-search a[href]')).toBeInViewport({ratio: 1});
});
test(`Search results show titles (and not file names)`, async ({page}, workerInfo) => {
test.skip(workerInfo.project.name === 'Mobile Safari', 'Fails as always, see https://codeberg.org/forgejo/forgejo/pulls/5326#issuecomment-2313275');
await page.goto('/user2/repo1/wiki');
await page.getByPlaceholder('Search wiki').fill('spaces');
await page.getByPlaceholder('Search wiki').click();
// workaround: HTMX listens on keyup events, playwright's fill only triggers the input event
// so we manually "type" the last letter
await page.getByPlaceholder('Search wiki').dispatchEvent('keyup');
await expect(page.locator('#wiki-search a[href] b')).toHaveText('Page With Spaced Name');
});