forgejo/tests/e2e/git-notes.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

31 lines
1.2 KiB
TypeScript

// @ts-check
import {expect} from '@playwright/test';
import {test} from './utils_e2e.ts';
import {screenshot} from './shared/screenshots.ts';
test.use({user: 'user2'});
test('Change git note', async ({page}) => {
let response = await page.goto('/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d');
expect(response?.status()).toBe(200);
// An add button should not be present, because the commit already has a commit note
await expect(page.locator('#commit-notes-add-button')).toHaveCount(0);
await page.locator('#commit-notes-edit-button').click();
let textarea = page.locator('textarea[name="notes"]');
await expect(textarea).toBeVisible();
await textarea.fill('This is a new note');
await screenshot(page, page.locator('.ui.container.fluid.padded'));
await page.locator('#notes-save-button').click();
await screenshot(page, page.locator('.ui.container.fluid.padded'));
response = await page.goto('/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d');
expect(response?.status()).toBe(200);
textarea = page.locator('textarea[name="notes"]');
await expect(textarea).toHaveText('This is a new note');
await screenshot(page, page.locator('.ui.container.fluid.padded'));
});