github-issue-tower-defence-management 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/bin/adapter/entry-points/console/ui-dist/assets/{index-DKxao68k.js → index-CfqusL5j.js} +8 -8
- package/bin/adapter/entry-points/console/ui-dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/console/ui/e2e/consoleScenario.spec.ts +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentComposer.stories.tsx +8 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentComposer.test.tsx +81 -2
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentComposer.tsx +12 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.tsx +0 -5
- package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +5 -0
- package/src/adapter/entry-points/console/ui-dist/assets/{index-DKxao68k.js → index-CfqusL5j.js} +8 -8
- package/src/adapter/entry-points/console/ui-dist/index.html +1 -1
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOkAndAwaitingWorkspaceActions.stories.tsx +0 -25
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOkAndAwaitingWorkspaceActions.test.tsx +0 -62
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOkAndAwaitingWorkspaceActions.tsx +0 -33
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>TDPM Console</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CfqusL5j.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-DshIymWu.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
|
@@ -608,6 +608,40 @@ test('posts a comment and moves the item to Awaiting Workspace when the Comment
|
|
|
608
608
|
});
|
|
609
609
|
});
|
|
610
610
|
|
|
611
|
+
test('posts an ok comment and moves the item to Awaiting Workspace when the ok & Awaiting Workspace button is clicked', async ({
|
|
612
|
+
page,
|
|
613
|
+
}) => {
|
|
614
|
+
await page.goto(harness.appRootUrl);
|
|
615
|
+
|
|
616
|
+
await itemRowByText(
|
|
617
|
+
page,
|
|
618
|
+
'Resolve the shared GitHub token rate-limit exhaustion blocker',
|
|
619
|
+
).click();
|
|
620
|
+
|
|
621
|
+
await expect(page.locator('.console-composer-input')).toBeInViewport();
|
|
622
|
+
|
|
623
|
+
await page
|
|
624
|
+
.getByRole('button', { name: 'ok & Awaiting Workspace', exact: true })
|
|
625
|
+
.click();
|
|
626
|
+
|
|
627
|
+
await expect
|
|
628
|
+
.poll(
|
|
629
|
+
() =>
|
|
630
|
+
harness.commentCalls.some(
|
|
631
|
+
(c) =>
|
|
632
|
+
c.url ===
|
|
633
|
+
'https://github.com/HiromiShikata/npm-cli-github-issue-tower-defence-management/issues/720' &&
|
|
634
|
+
c.body === 'ok',
|
|
635
|
+
),
|
|
636
|
+
{ timeout: 10000 },
|
|
637
|
+
)
|
|
638
|
+
.toBe(true);
|
|
639
|
+
|
|
640
|
+
await expect(tabByLabel(page, 'Workflow Blocker')).toHaveCount(0, {
|
|
641
|
+
timeout: 8000,
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
|
|
611
645
|
test('project switcher appears at the left end of the tab bar and opens a dropdown on click', async ({
|
|
612
646
|
page,
|
|
613
647
|
}) => {
|
|
@@ -58,3 +58,11 @@ export const ComposerWithMoveToAwaitingWorkspace: Story = {
|
|
|
58
58
|
onSubmitAndMoveToAwaitingWorkspace: acceptComment,
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
export const ComposerWithAllActionButtons: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
initiallyOpen: true,
|
|
65
|
+
onOkAndAwaitingWorkspace: () => {},
|
|
66
|
+
onSubmitAndMoveToAwaitingWorkspace: acceptComment,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
1
|
+
import { act, fireEvent, render, waitFor } from '@testing-library/react';
|
|
2
2
|
import type { ConsoleComment } from '../../logic/types';
|
|
3
3
|
import {
|
|
4
4
|
appendAttachmentMarkdown,
|
|
@@ -329,14 +329,93 @@ describe('ConsoleCommentComposer', () => {
|
|
|
329
329
|
});
|
|
330
330
|
});
|
|
331
331
|
|
|
332
|
-
it('renders only the Comment button when onSubmitAndMoveToAwaitingWorkspace is
|
|
332
|
+
it('renders only the Comment button when neither onOkAndAwaitingWorkspace nor onSubmitAndMoveToAwaitingWorkspace is provided', () => {
|
|
333
333
|
const { queryByText, getByText } = render(
|
|
334
334
|
<ConsoleCommentComposer initiallyOpen onSubmit={stubSubmit} />,
|
|
335
335
|
);
|
|
336
336
|
expect(getByText('Comment')).toBeInTheDocument();
|
|
337
|
+
expect(queryByText('ok & Awaiting Workspace')).toBeNull();
|
|
337
338
|
expect(queryByText('Comment & Awaiting Workspace')).toBeNull();
|
|
338
339
|
});
|
|
339
340
|
|
|
341
|
+
it('renders ok & Awaiting Workspace between Comment and Comment & Awaiting Workspace when both callbacks are provided', () => {
|
|
342
|
+
const { getAllByRole } = render(
|
|
343
|
+
<ConsoleCommentComposer
|
|
344
|
+
initiallyOpen
|
|
345
|
+
onSubmit={stubSubmit}
|
|
346
|
+
onOkAndAwaitingWorkspace={() => {}}
|
|
347
|
+
onSubmitAndMoveToAwaitingWorkspace={stubSubmit}
|
|
348
|
+
/>,
|
|
349
|
+
);
|
|
350
|
+
const buttons = getAllByRole('button').filter((b) =>
|
|
351
|
+
[
|
|
352
|
+
'Comment',
|
|
353
|
+
'ok & Awaiting Workspace',
|
|
354
|
+
'Comment & Awaiting Workspace',
|
|
355
|
+
].includes(b.textContent ?? ''),
|
|
356
|
+
);
|
|
357
|
+
expect(buttons.map((b) => b.textContent)).toEqual([
|
|
358
|
+
'Comment',
|
|
359
|
+
'ok & Awaiting Workspace',
|
|
360
|
+
'Comment & Awaiting Workspace',
|
|
361
|
+
]);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('calls onOkAndAwaitingWorkspace when the ok & Awaiting Workspace button is clicked', () => {
|
|
365
|
+
const onOkAndAwaitingWorkspace = jest.fn();
|
|
366
|
+
const { getByText } = render(
|
|
367
|
+
<ConsoleCommentComposer
|
|
368
|
+
initiallyOpen
|
|
369
|
+
onSubmit={stubSubmit}
|
|
370
|
+
onOkAndAwaitingWorkspace={onOkAndAwaitingWorkspace}
|
|
371
|
+
/>,
|
|
372
|
+
);
|
|
373
|
+
fireEvent.click(getByText('ok & Awaiting Workspace'));
|
|
374
|
+
expect(onOkAndAwaitingWorkspace).toHaveBeenCalledTimes(1);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it('disables the ok & Awaiting Workspace button while a comment is being posted', async () => {
|
|
378
|
+
let resolvePost!: () => void;
|
|
379
|
+
const slowSubmit = async (_body: string): Promise<ConsoleComment> =>
|
|
380
|
+
new Promise((resolve) => {
|
|
381
|
+
resolvePost = () =>
|
|
382
|
+
resolve({
|
|
383
|
+
author: 'HiromiShikata',
|
|
384
|
+
body: _body,
|
|
385
|
+
createdAt: '2026-06-19T11:58:00.000Z',
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
const { getByPlaceholderText, getByText } = render(
|
|
389
|
+
<ConsoleCommentComposer
|
|
390
|
+
initiallyOpen
|
|
391
|
+
onSubmit={slowSubmit}
|
|
392
|
+
onOkAndAwaitingWorkspace={() => {}}
|
|
393
|
+
onSubmitAndMoveToAwaitingWorkspace={stubSubmit}
|
|
394
|
+
/>,
|
|
395
|
+
);
|
|
396
|
+
fireEvent.change(getByPlaceholderText('Leave a comment…'), {
|
|
397
|
+
target: { value: 'in-flight comment' },
|
|
398
|
+
});
|
|
399
|
+
fireEvent.click(getByText('Comment'));
|
|
400
|
+
await waitFor(() => {
|
|
401
|
+
expect(getByText('ok & Awaiting Workspace')).toBeDisabled();
|
|
402
|
+
});
|
|
403
|
+
await act(async () => {
|
|
404
|
+
resolvePost();
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it('does not render ok & Awaiting Workspace when onOkAndAwaitingWorkspace is not provided', () => {
|
|
409
|
+
const { queryByText } = render(
|
|
410
|
+
<ConsoleCommentComposer
|
|
411
|
+
initiallyOpen
|
|
412
|
+
onSubmit={stubSubmit}
|
|
413
|
+
onSubmitAndMoveToAwaitingWorkspace={stubSubmit}
|
|
414
|
+
/>,
|
|
415
|
+
);
|
|
416
|
+
expect(queryByText('ok & Awaiting Workspace')).toBeNull();
|
|
417
|
+
});
|
|
418
|
+
|
|
340
419
|
it('renders both Comment and Comment & Awaiting Workspace buttons when onSubmitAndMoveToAwaitingWorkspace is provided', () => {
|
|
341
420
|
const { getByText } = render(
|
|
342
421
|
<ConsoleCommentComposer
|
|
@@ -9,6 +9,7 @@ export type ConsoleCommentComposerProps = {
|
|
|
9
9
|
onSubmitAndMoveToAwaitingWorkspace?: (
|
|
10
10
|
body: string,
|
|
11
11
|
) => Promise<ConsoleComment>;
|
|
12
|
+
onOkAndAwaitingWorkspace?: () => void;
|
|
12
13
|
onUploadFile?: (file: File) => Promise<string>;
|
|
13
14
|
};
|
|
14
15
|
|
|
@@ -82,6 +83,7 @@ export const ConsoleCommentComposer = ({
|
|
|
82
83
|
onSubmit,
|
|
83
84
|
onDraftChange,
|
|
84
85
|
onSubmitAndMoveToAwaitingWorkspace,
|
|
86
|
+
onOkAndAwaitingWorkspace,
|
|
85
87
|
onUploadFile,
|
|
86
88
|
}: ConsoleCommentComposerProps) => {
|
|
87
89
|
const [open, setOpen] = useState<boolean>(initiallyOpen);
|
|
@@ -244,6 +246,16 @@ export const ConsoleCommentComposer = ({
|
|
|
244
246
|
>
|
|
245
247
|
Comment
|
|
246
248
|
</button>
|
|
249
|
+
{onOkAndAwaitingWorkspace !== undefined && (
|
|
250
|
+
<button
|
|
251
|
+
type="button"
|
|
252
|
+
className="console-composer-submit"
|
|
253
|
+
disabled={status.kind === 'posting'}
|
|
254
|
+
onClick={onOkAndAwaitingWorkspace}
|
|
255
|
+
>
|
|
256
|
+
ok & Awaiting Workspace
|
|
257
|
+
</button>
|
|
258
|
+
)}
|
|
247
259
|
{onSubmitAndMoveToAwaitingWorkspace !== undefined && (
|
|
248
260
|
<button
|
|
249
261
|
type="button"
|
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
} from '../../logic/types';
|
|
10
10
|
import { ConsoleCloseActions } from './ConsoleCloseActions';
|
|
11
11
|
import { ConsoleNextActionDateActions } from './ConsoleNextActionDateActions';
|
|
12
|
-
import { ConsoleOkAndAwaitingWorkspaceActions } from './ConsoleOkAndAwaitingWorkspaceActions';
|
|
13
12
|
import { ConsolePullRequestReviewActions } from './ConsolePullRequestReviewActions';
|
|
14
13
|
import { ConsoleStatusActions } from './ConsoleStatusActions';
|
|
15
14
|
|
|
@@ -31,10 +30,6 @@ export const ConsoleOperationMenu = ({
|
|
|
31
30
|
}: ConsoleOperationBarProps) => {
|
|
32
31
|
return (
|
|
33
32
|
<div className="console-operation-bar">
|
|
34
|
-
<ConsoleOkAndAwaitingWorkspaceActions
|
|
35
|
-
statusOptions={statusOptions}
|
|
36
|
-
onOkAndAwaitingWorkspace={handlers.onOkAndAwaitingWorkspace}
|
|
37
|
-
/>
|
|
38
33
|
{hasPullRequest && (
|
|
39
34
|
<ConsolePullRequestReviewActions
|
|
40
35
|
onReview={handlers.onReview}
|
|
@@ -318,6 +318,11 @@ export const ConsoleItemDetailContainer = ({
|
|
|
318
318
|
initialDraft={initialCommentDraft}
|
|
319
319
|
onSubmit={addComment}
|
|
320
320
|
onDraftChange={onCommentDraftChange}
|
|
321
|
+
onOkAndAwaitingWorkspace={
|
|
322
|
+
awaitingWorkspaceOption !== null
|
|
323
|
+
? () => handlers.onOkAndAwaitingWorkspace(awaitingWorkspaceOption)
|
|
324
|
+
: undefined
|
|
325
|
+
}
|
|
321
326
|
onSubmitAndMoveToAwaitingWorkspace={
|
|
322
327
|
addCommentAndMoveToAwaitingWorkspace
|
|
323
328
|
}
|