jojo/tests/e2e/repo-labels.test.e2e.ts
Gusted 1f4488215b fix: make edit label dialog work again (#9899)
- The E2E code did not actually assert that the functionality worked (`expect` was missing).
- Regression of forgejo/forgejo!9636
- Resolves forgejo/forgejo#9893

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9899
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-10-29 16:43:22 +01:00

43 lines
1.5 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.getByRole('textbox', {name: 'Label name'}).fill(labelName);
await page.getByRole('button', {name: 'Create label'}).click();
await expect(page.locator('.label-title').filter({hasText: labelName})).toBeVisible();
});
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.getByRole('textbox', {name: 'Label name'}).fill(labelName);
await page.getByRole('button', {name: 'Save'}).click();
await expect(page.locator('.label-title').filter({hasText: labelName})).toBeVisible();
});