76 lines
3.1 KiB
TypeScript
76 lines
3.1 KiB
TypeScript
import {expect, test} from "@playwright/test";
|
|
|
|
import {attendreEtat, fermerNotifications, ligneFilm, login} from "./helpers";
|
|
|
|
test("conversion complète: détection → validation → traité", async ({page}) => {
|
|
await login(page);
|
|
await page.getByRole("button", {name: "Traitements"}).click();
|
|
|
|
// Lancement depuis la fiche.
|
|
await ligneFilm(page, "Pacific Rim").click();
|
|
await page.getByRole("button", {name: "Convertir en MKV"}).click();
|
|
await expect(
|
|
page.locator(".notification", {hasText: /mise en file d'attente/}),
|
|
).toBeVisible();
|
|
|
|
// Le statut passe par les états actifs puis "À valider", sans recharger.
|
|
await attendreEtat(page, "Pacific Rim", "À valider");
|
|
|
|
// Fiche: les deux chemins et le bouton de validation.
|
|
await ligneFilm(page, "Pacific Rim").click();
|
|
await expect(page.getByText("MKV lié (dossier du film)")).toBeVisible();
|
|
await expect(page.getByText("MKV brut (dossier de travail)")).toBeVisible();
|
|
|
|
// Validation: Radarr est absent dans l'environnement de test, la
|
|
// validation réussit avec un avertissement.
|
|
await fermerNotifications(page);
|
|
await page.getByRole("button", {name: "Valider la conversion"}).click();
|
|
await expect(page.locator(".notification.warning").last()).toContainText(
|
|
/mise à jour Radarr impossible/,
|
|
);
|
|
|
|
// La ligne a changé de catégorie toute seule: elle est dans "Traités".
|
|
await page.getByRole("button", {name: "Traités"}).click();
|
|
await expect(ligneFilm(page, "Pacific Rim")).toBeVisible();
|
|
await expect(
|
|
ligneFilm(page, "Pacific Rim").locator(".status", {hasText: "Terminé"}),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("annulation d'une conversion à valider: retour à détecté", async ({page}) => {
|
|
await login(page);
|
|
await page.getByRole("button", {name: "Traitements"}).click();
|
|
|
|
await ligneFilm(page, "Autre Film").click();
|
|
await page.getByRole("button", {name: "Convertir en MKV"}).click();
|
|
await attendreEtat(page, "Autre Film", "À valider");
|
|
|
|
await ligneFilm(page, "Autre Film").click();
|
|
await fermerNotifications(page);
|
|
await page.getByRole("button", {name: "Annuler"}).click();
|
|
await expect(
|
|
page.locator(".notification", {hasText: /annulée/}),
|
|
).toBeVisible();
|
|
|
|
// Retour dans "À traiter" avec l'état détecté, MKV et lien supprimés.
|
|
await attendreEtat(page, "Autre Film", "Détecté");
|
|
await page.getByRole("button", {name: "À traiter"}).click();
|
|
await expect(ligneFilm(page, "Autre Film")).toBeVisible();
|
|
});
|
|
|
|
test("reprise d'une conversion après échec", async ({page}) => {
|
|
await login(page);
|
|
await page.getByRole("button", {name: "Traitements"}).click();
|
|
await page.getByRole("button", {name: "Erreurs"}).click();
|
|
await ligneFilm(page, "Film Erreur Bis").click();
|
|
await page.getByRole("button", {name: "Reprendre la conversion en MKV"}).click();
|
|
await expect(
|
|
page.locator(".notification", {hasText: /mise en file d'attente/}),
|
|
).toBeVisible();
|
|
|
|
// Pendant la conversion la ligne quitte "Erreurs": on la suit dans
|
|
// l'onglet "En cours" jusqu'a "À valider".
|
|
await page.getByRole("button", {name: "En cours"}).click();
|
|
await attendreEtat(page, "Film Erreur Bis", "À valider");
|
|
});
|