080-webapps-media.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. WebApp wave 3: media / creative apps.
  3. Smoke coverage for the media and creative WebApps served by the real
  4. ArozOS server with an authenticated session:
  5. Musicify, Movie, Manga, Paint, Pixel Studio, Audio Studio,
  6. Camera, Recorder, FFmpeg Factory
  7. (Cine Studio has its own deep static suite under specs/, so it is not
  8. repeated here.) Each app must load its entry page and render its key
  9. UI element. Camera/Recorder request getUserMedia, which is denied in
  10. headless Chromium - the assertion targets the shell, not the stream.
  11. */
  12. "use strict";
  13. const h = require("../lib/system-harness");
  14. const APPS = [
  15. { name: "Musicify", path: "/Musicify/index.html", selector: "#musicPlayer" },
  16. { name: "Movie", path: "/Movie/index.html", selector: "#mode-tabs" },
  17. { name: "Manga", path: "/Manga/index.html", selector: "#appHeader" },
  18. { name: "Paint", path: "/Paint/index.html", selector: ".ptro-bar" },
  19. { name: "Pixel Studio", path: "/Pixel%20Studio/index.html", selector: "#toolbar-buttons" },
  20. { name: "Audio Studio", path: "/Audio%20Studio/index.html", selector: "#toolbar" },
  21. { name: "Camera", path: "/Camera/index.html", selector: "#viewfinder" },
  22. { name: "Recorder", path: "/Recorder/index.html", selector: "#record" },
  23. { name: "FFmpeg Factory", path: "/FFmpeg%20Factory/index.html", selector: "#leftPanel" }
  24. ];
  25. h.run("WEBAPPS-MEDIA", async function (env) {
  26. const base = env.baseURL;
  27. const page = await h.newPage(env.browser);
  28. await h.loginViaAPI(page, base, env.admin.username, env.admin.password);
  29. page.on("dialog", function (d) { d.dismiss().catch(function () {}); });
  30. // ── 1. Every media app boots and renders its main UI ──
  31. for (const app of APPS) {
  32. await page.goto(base + app.path, { waitUntil: "domcontentloaded" });
  33. try {
  34. await page.waitForSelector(app.selector, { state: "attached", timeout: 20000 });
  35. } catch (e) {
  36. h.fail(app.name + " did not render " + app.selector + " at " + app.path);
  37. }
  38. h.ok(app.name + " boots and renders its main UI");
  39. }
  40. // ── 2. Media browsers can reach the user's storage to build libraries ──
  41. // Musicify / Movie / Manga all populate their library from listRoots +
  42. // listDir; a probe under this session guards the data path they use.
  43. const roots = await h.getJSON(page, base + "/system/file_system/listRoots");
  44. if (JSON.stringify(roots).indexOf("user") === -1) {
  45. h.fail("media library apps have no user root to browse");
  46. }
  47. h.ok("media library apps have the user storage root available");
  48. await page.close();
  49. });