forgejo/tests/e2e/repo-commitgraph.test.e2e.ts
Otto Richter f87b76160e e2e: Selective screenshots (#9499)
* Add some test that only snapshot relevant content
* Allow adding marging around the element in case the environment is relevant (e.g. the location of an element relative to the parent, but excluding the environment of the parent)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9499
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Otto Richter <git@otto.splvs.net>
Co-committed-by: Otto Richter <git@otto.splvs.net>
2025-10-03 13:45:08 +02:00

50 lines
1.8 KiB
TypeScript

// @watch start
// templates/repo/graph.tmpl
// web_src/css/features/gitgraph.css
// web_src/js/features/repo-graph.js
// @watch end
import {expect} from '@playwright/test';
import {test} from './utils_e2e.ts';
import {screenshot} from './shared/screenshots.ts';
test('Commit graph overflow', async ({page}) => {
const response = await page.goto('/user2/repo1/graph');
expect(response?.status()).toBe(200);
await page.click('#flow-select-refs-dropdown');
const input = page.locator('#flow-select-refs-dropdown');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await input.press('Enter');
await expect(page.locator('#flow-select-refs-dropdown')).toBeInViewport({ratio: 1});
await expect(page.getByRole('button', {name: 'Mono'})).toBeInViewport({ratio: 1});
await expect(page.getByRole('button', {name: 'Color'})).toBeInViewport({ratio: 1});
await expect(page.locator('.selection.search.dropdown')).toBeInViewport({ratio: 1});
await screenshot(page);
});
test('Switch branch', async ({page}) => {
const response = await page.goto('/user2/repo1/graph');
expect(response?.status()).toBe(200);
await page.click('#flow-select-refs-dropdown');
const input = page.locator('#flow-select-refs-dropdown');
await input.pressSequentially('develop', {delay: 50});
await input.press('Enter');
await page.waitForLoadState();
await expect(page.locator('#loading-indicator')).toBeHidden();
await expect(page.locator('#rel-container')).toBeVisible();
await expect(page.locator('#rev-container')).toBeVisible();
await screenshot(page);
});