Files
ohm_streaming/templates/components/downloads_list.html
T
Kimi Agent 6521fe3416
CI / Test (Python 3.11) (push) Has been cancelled
CI / Test (Python 3.12) (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Type Check (push) Has been cancelled
CI / Summary (push) Has been cancelled
test(e2e): add download flow tests and fix status CSS classes
- Add Playwright E2E tests covering real user download journeys:
  - Search anime → choose episodes → trigger download (with toast)
  - Real file download via static fixture and verify completion in UI
  - Click new release on homepage → switch to anime search tab
  - Search for series and display mocked results
- Fix bug in downloads_list.html: CSS classes used task.status (enum)
  which rendered as 'status-DownloadStatus.COMPLETED' instead of
  'status-completed'. Use task.status.value for correct CSS class names.
- Add static test fixture (20KB fake MP4) for reliable download tests
- All 16 E2E tests passing (12 existing + 4 new)
2026-05-12 12:18:32 +00:00

67 lines
3.5 KiB
HTML

{% if tasks %}
<div class="downloads-grid">
{% for task in tasks %}
<div class="download-item status-{{ task.status.value }}">
<div class="download-info">
<span class="download-name" title="{{ task.filename }}">{{ task.filename }}</span>
<span class="badge badge-{{ task.status.value }}">{{ task.status | upper }}</span>
</div>
<div class="progress-container">
<div class="progress-bar" style="width: {{ task.progress }}%"></div>
</div>
<div class="download-meta">
<span>{{ task.progress | round(1) }}%</span>
<span>{{ task.speed or '0' }} KB/s</span>
<span>{{ task.eta or '' }}</span>
</div>
<div class="download-actions">
{% if task.status == 'downloading' or task.status == 'pending' %}
<button class="btn-icon" hx-post="/api/downloads/{{ task.id }}/pause" hx-swap="none"
hx-on::after-request="htmx.trigger('#downloads-container-inner', 'refresh')" title="Pause">
<i class="fas fa-pause"></i>
</button>
{% elif task.status == 'paused' %}
<button class="btn-icon success" hx-post="/api/downloads/{{ task.id }}/resume" hx-swap="none"
hx-on::after-request="htmx.trigger('#downloads-container-inner', 'refresh')" title="Reprendre">
<i class="fas fa-play"></i>
</button>
{% endif %}
{% if task.status == 'failed' or task.status == 'cancelled' %}
<button class="btn-icon warning" hx-post="/api/downloads/{{ task.id }}/retry" hx-swap="none"
hx-on::after-request="htmx.trigger('#downloads-container-inner', 'refresh')" title="Relancer">
<i class="fas fa-redo"></i>
</button>
{% endif %}
{% if task.status == 'completed' %}
<a href="/api/downloads/video/{{ task.id }}" class="btn-icon success" title="Streamer">
<i class="fas fa-play-circle"></i>
</a>
<a href="/downloads/{{ task.filename }}" class="btn-icon" download title="Telecharger">
<i class="fas fa-file-download"></i>
</a>
{% endif %}
<button class="btn-icon danger"
hx-delete="/api/downloads/{{ task.id }}"
hx-confirm="Supprimer ce telechargement ?"
hx-swap="none"
hx-on::after-request="htmx.trigger('#downloads-container-inner', 'refresh')"
title="Supprimer">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state" style="text-align: center; padding: 60px 20px; color: var(--text-dim);">
<i class="fas fa-cloud-download-alt" style="font-size: 3rem; margin-bottom: 20px; opacity: 0.1; display: block;"></i>
<p>Aucun telechargement en cours</p>
</div>
{% endif %}