diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-18 20:33:49 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-12-12 23:57:56 +0100 |
commit | e68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch) | |
tree | 97775d6c13b0f416af55314eb6a89ef792474615 /tests/e2e/repo-wiki.test.e2e.js | |
parent | Initial commit. (diff) | |
download | forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip |
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'tests/e2e/repo-wiki.test.e2e.js')
-rw-r--r-- | tests/e2e/repo-wiki.test.e2e.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/e2e/repo-wiki.test.e2e.js b/tests/e2e/repo-wiki.test.e2e.js new file mode 100644 index 0000000..dc8a670 --- /dev/null +++ b/tests/e2e/repo-wiki.test.e2e.js @@ -0,0 +1,36 @@ +// @ts-check +import {expect} from '@playwright/test'; +import {test} from './utils_e2e.js'; + +for (const searchTerm of ['space', 'consectetur']) { + for (const width of [null, 2560, 4000]) { + test(`Search for '${searchTerm}' and test for no overflow ${width && `on ${width}-wide viewport` || ''}`, async ({page, viewport}, workerInfo) => { + test.skip(workerInfo.project.name === 'Mobile Safari', 'Fails as always, see https://codeberg.org/forgejo/forgejo/pulls/5326#issuecomment-2313275'); + + await page.setViewportSize({ + width: width ?? viewport.width, + height: 1440, // We're testing that we fit horizontally - vertical scrolling is fine. + }); + await page.goto('/user2/repo1/wiki'); + await page.waitForLoadState('networkidle'); + await page.getByPlaceholder('Search wiki').fill(searchTerm); + 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'); + // 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'); +}); |