Search RU
Tasks / Playwright / Kanban drag and drop
Statement medium

Kanban drag and drop

A kanban board with two columns, `todo` and `done`; `todo` holds the cards
`task-1` and `task-2`. Counters show the number of cards in each column.

Rules:

- a card can be dragged into either column;
- after a move the card is in exactly one column, and the counters match the
column contents;
- the column under the pointer gets the `drop-target` class;
- releasing the card removes the highlight;
- a drop outside the columns cancels the move: the card stays where it was;
- `Escape` during a drag cancels the move;
- dropping into an empty column works.

Write Playwright tests:

- the initial counters and card positions;
- a move into the empty `done`;
- moving both cards and bringing one back into the empty `todo`;
- cancelling a drop outside the columns (for example, on the `board-title`
heading);
- cancelling with `Escape`;
- moving a card back and forth.

Cards: `card-task-1`, `card-task-2`. Columns: `column-todo`, `column-done`.
Counters: `count-todo`, `count-done`. Heading: `board-title`. Use
`drag_to(...)` for a normal move and `mouse` + `keyboard` for cancellation; no
`sleep` is needed.

Playwright
playwrightuidrag-and-dropstate
test_ui.py Python 3.14
AI mentor

The AI mentor is available after you log in: it sees your attempt history and does not spend resources on anonymous requests.

Log in and ask
Hints 1 of 3 unlocked · attempts: 0
Hint 1

What should change after a move besides the card position? Counters and the
highlight are observable state just like the card itself.

Hint 2 — unlocks after 1 attempt
Hint 3 — unlocks after 3 attempts