mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-19 17:01:12 +00:00
[v12.0/forgejo] fix: allow for tracked time to be removed again (#8576)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8575 - `getElementById` requires a id to be passed and not a query selector, change it to `querySelector`. - Regression of forgejo/forgejo#7408 - Resolves forgejo/forgejo#8571 - Add E2E tests for adding manual tracked time and removing it. Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8576 Reviewed-by: Beowulf <beowulf@beocode.eu> Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
5095cafe49
commit
816a63ef28
2 changed files with 49 additions and 1 deletions
48
tests/e2e/issue-timetracking.test.e2e.ts
Normal file
48
tests/e2e/issue-timetracking.test.e2e.ts
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// @watch start
|
||||||
|
// web_src/js/features/comp/**
|
||||||
|
// web_src/js/features/repo-**
|
||||||
|
// templates/repo/issue/view_content/*
|
||||||
|
// @watch end
|
||||||
|
|
||||||
|
import {expect} from '@playwright/test';
|
||||||
|
import {test, save_visual} from './utils_e2e.ts';
|
||||||
|
|
||||||
|
test.use({user: 'user2'});
|
||||||
|
|
||||||
|
test('Issue timetracking', async ({page}) => {
|
||||||
|
await page.goto('/user2/repo1/issues/new');
|
||||||
|
|
||||||
|
// Create temporary issue.
|
||||||
|
await page.getByPlaceholder('Title').fill('Just a title');
|
||||||
|
await page.getByPlaceholder('Leave a comment').fill('Hi, have you considered using a rotating fish as logo?');
|
||||||
|
await page.getByRole('button', {name: 'Create issue'}).click();
|
||||||
|
await expect(page).toHaveURL(/\/user2\/repo1\/issues\/\d+$/);
|
||||||
|
|
||||||
|
// Manually add time to the time tracker.
|
||||||
|
await page.getByRole('button', {name: 'Add time'}).click();
|
||||||
|
await page.getByPlaceholder('Hours').fill('5');
|
||||||
|
await page.getByPlaceholder('Minutes').fill('32');
|
||||||
|
await page.getByRole('button', {name: 'Add time', exact: true}).click();
|
||||||
|
|
||||||
|
// Verify this was added in the timeline.
|
||||||
|
await expect(page.locator('.ui.timeline')).toContainText('added spent time');
|
||||||
|
await expect(page.locator('.ui.timeline')).toContainText('5 hours 32 minutes');
|
||||||
|
|
||||||
|
// Verify it is shown in the issue sidebar
|
||||||
|
await expect(page.locator('.issue-content-right .comments')).toContainText('Total time spent: 5 hours 32 minutes');
|
||||||
|
|
||||||
|
await save_visual(page);
|
||||||
|
|
||||||
|
// Delete the added time.
|
||||||
|
await page.getByRole('button', {name: 'Delete this time log'}).click();
|
||||||
|
await page.getByRole('button', {name: 'Yes'}).click();
|
||||||
|
|
||||||
|
// Verify this was removed in the timeline.
|
||||||
|
await expect(page.locator('.ui.timeline')).toContainText('deleted spent time');
|
||||||
|
await expect(page.locator('.ui.timeline')).toContainText('- 5 hours 32 minutes');
|
||||||
|
|
||||||
|
// Delete the issue.
|
||||||
|
await page.getByRole('button', {name: 'Delete'}).click();
|
||||||
|
await page.getByRole('button', {name: 'Yes'}).click();
|
||||||
|
await expect(page).toHaveURL('/user2/repo1/issues');
|
||||||
|
});
|
|
@ -57,7 +57,7 @@ export function initRepoIssueTimeTracking() {
|
||||||
$(sel).modal({
|
$(sel).modal({
|
||||||
duration: 200,
|
duration: 200,
|
||||||
onApprove() {
|
onApprove() {
|
||||||
document.getElementById(`${sel} form`).requestSubmit();
|
document.querySelector(`${sel} form`).requestSubmit();
|
||||||
},
|
},
|
||||||
}).modal('show');
|
}).modal('show');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue