File upload with validation
The page imports CSV/JSON files. After a file is chosen it validates the type
and size, then shows the file name, the size, a progress bar, and a status.
Rules:
- only `.csv` and `.json` are allowed; the extension is case-insensitive;
- the size limit is 1 MB (1,048,576 bytes), inclusive;
- a valid file shows its name, a size like `2.0 KB`, a progress bar at 100,
and the status `Готово` ("Done");
- a wrong type shows `Недопустимый тип файла` ("Invalid file type"), resets the
name to `Файл не выбран` ("No file chosen"), and hides the progress;
- an oversized file shows `Файл больше 1 МБ` ("File is larger than 1 MB") and
hides the progress;
- `Отмена` ("Cancel") clears the selection: the name is `Файл не выбран`, the
progress and the status are hidden;
- after an error another file can be selected and the error disappears.
Write Playwright tests:
- a valid CSV;
- a `.txt` file;
- a file larger than 1 MB;
- exactly 1 MB (the boundary);
- cancel after a successful upload;
- re-upload after an error.
Elements: `file-input`, `file-name`, `file-size`, `progress`, `status`,
`error`, `cancel` — via `get_by_test_id`. Set files with
`set_input_files(...)`; no `sleep` is needed, `expect` waits on its own.
The message texts are the literal strings the page renders; assertions compare
them exactly.
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 askHint 1
Which parts of the page prove that a file was accepted, and which prove it was
rejected? Start with a pair of "state element → expected value" for success and
for an error.