forgejo/tests/e2e/repo-labels.test.e2e.ts
Gusted 8eb8f49581 feat: move more modals to native dialogs (#9636)
Follow up of forgejo/forgejo#8859

Move the following modals to native dialogs:
- Admin notice.
- Edit label.
- New label.
- Update email in admin's email list.

Each has a E2E test to screenshot the modal and test functionality.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9636
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-10-13 17:48:49 +02:00

43 lines
1.4 KiB
TypeScript

// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
// @watch start
// templates/repo/issues/labels/**
// web_src/js/features/comp/LabelEdit.js
// @watch end
import {expect} from '@playwright/test';
import {test, dynamic_id} from './utils_e2e.ts';
import {screenshot} from './shared/screenshots.ts';
test.use({user: 'user2'});
test('New label', async ({page}) => {
const response = await page.goto('/user2/repo1/labels');
expect(response?.status()).toBe(200);
await page.getByRole('button', {name: 'New label'}).click();
await expect(page.locator('#new-label-modal')).toBeVisible();
await screenshot(page, page.locator('#new-label-modal'));
const labelName = dynamic_id();
await page.keyboard.type(labelName);
await page.getByRole('button', {name: 'Create label'}).click();
await page.locator('.label-title').filter({hasText: labelName}).isVisible();
});
test('Edit label', async ({page}) => {
const response = await page.goto('/user2/repo1/labels');
expect(response?.status()).toBe(200);
await page.getByText('Edit').first().click();
await expect(page.locator('#edit-label-modal')).toBeVisible();
await screenshot(page, page.locator('#edit-label-modal'));
const labelName = dynamic_id();
await page.keyboard.type(labelName);
await page.getByRole('button', {name: 'Save'}).click();
await page.locator('.label-title').filter({hasText: labelName}).isVisible();
});