feat(KAN-34): rework blocker and ticket history
This commit is contained in:
@@ -101,6 +101,102 @@ try {
|
||||
}
|
||||
await page.setViewportSize({ width: 390, height: 1000 });
|
||||
await visit();
|
||||
const blocker = content().locator('#ticket-blocker');
|
||||
const blockerToggle = blocker.getByRole('checkbox', {
|
||||
name: 'Mark ticket as blocked',
|
||||
exact: true,
|
||||
});
|
||||
const blockerComment = blocker.getByLabel('Blocker comment', {
|
||||
exact: true,
|
||||
});
|
||||
assert.equal(await blockerToggle.isChecked(), true);
|
||||
assert.equal(
|
||||
await blocker.getByText('Alex Morgan', { exact: true }).count(),
|
||||
0,
|
||||
);
|
||||
assert.equal(
|
||||
await content()
|
||||
.locator('#ticket-history')
|
||||
.getByText('Alex Morgan', { exact: true })
|
||||
.count(),
|
||||
1,
|
||||
);
|
||||
assert.equal(
|
||||
await content()
|
||||
.locator('#ticket-history')
|
||||
.getByText('Status changed', { exact: true })
|
||||
.count(),
|
||||
1,
|
||||
);
|
||||
await blockerComment.fill('');
|
||||
assert.equal(
|
||||
await blockerComment.evaluate(
|
||||
(element) => element.validity.valueMissing,
|
||||
),
|
||||
true,
|
||||
);
|
||||
await blockerComment.fill('Waiting for a production decision.');
|
||||
await blocker.getByRole('button', { name: 'Save blocker' }).click();
|
||||
await page.getByText('Ticket updated.', { exact: true }).waitFor();
|
||||
assert.equal(
|
||||
await blockerComment.inputValue(),
|
||||
'Waiting for a production decision.',
|
||||
);
|
||||
for (const label of ['Assignee', 'Reviewer']) {
|
||||
const field = content()
|
||||
.locator('#ticket-metadata dl > div')
|
||||
.filter({ has: page.getByText(label, { exact: true }) });
|
||||
assert.match(await field.locator('dd').innerText(), /Alex Morgan/);
|
||||
}
|
||||
await blockerToggle.uncheck();
|
||||
await blocker.getByRole('button', { name: 'Unblock ticket' }).click();
|
||||
await blocker
|
||||
.getByText('This ticket currently has no active blocker.', {
|
||||
exact: true,
|
||||
})
|
||||
.waitFor();
|
||||
assert.equal(await blocker.getByLabel('Blocker comment').count(), 0);
|
||||
await content().getByRole('button', { name: 'Change parent' }).click();
|
||||
await page.waitForFunction(
|
||||
() => document.activeElement?.id === 'parent_ticket_id',
|
||||
);
|
||||
const saveTicket = content().getByRole('button', {
|
||||
name: 'Save changes',
|
||||
exact: true,
|
||||
});
|
||||
assert.equal(
|
||||
await content()
|
||||
.getByRole('button', { name: 'Discard changes', exact: true })
|
||||
.isDisabled(),
|
||||
true,
|
||||
'Saving the blocker must also update the ticket form defaults.',
|
||||
);
|
||||
await page
|
||||
.getByLabel('Title', { exact: true })
|
||||
.fill('Updated title after unblocking');
|
||||
const ticketUpdate = page.waitForRequest(
|
||||
(request) =>
|
||||
request.method() === 'PATCH' &&
|
||||
new URL(request.url()).pathname === '/projects/7/tickets/42',
|
||||
);
|
||||
await saveTicket.click();
|
||||
const savedTicket = (await ticketUpdate).postDataJSON();
|
||||
assert.equal(savedTicket.is_blocked, false);
|
||||
assert.equal(savedTicket.blocked_comment, '');
|
||||
assert.equal(Number(savedTicket.parent_ticket_id), 40);
|
||||
assert.deepEqual(savedTicket.acceptance_criteria, [
|
||||
{ id: 10, text: 'Cache requests safely', checked: false, indent: 0 },
|
||||
{
|
||||
id: 11,
|
||||
text: 'Invalidate when records change',
|
||||
checked: false,
|
||||
indent: 1,
|
||||
},
|
||||
]);
|
||||
await page
|
||||
.getByRole('heading', { name: 'Updated title after unblocking' })
|
||||
.waitFor();
|
||||
await visit();
|
||||
await tabTo(edit());
|
||||
await page.keyboard.press('Enter');
|
||||
await page.getByLabel('Title', { exact: true }).fill('Unsaved title draft');
|
||||
|
||||
Reference in New Issue
Block a user