/*
catcrafts.net
Copyright (C) 2026 Catcrafts
The source code of this website is made available for viewing purposes only.
No permission is granted to copy, modify, distribute, or create derivative works.
*/
// The bug this suite exists for: /demos/raytracer is two segments deep, and
// every asset the runtime needs was referenced RELATIVE to the document —
// src="runtime.js", fetch("files.json"), fetch("variants.json"), and the
// .wasm named by variants.json. So the browser asked for /demos/runtime.js,
// Caddy's try_files handed back index.html, and the module was blocked for
// being text/html. Four NS_ERROR_CORRUPTED_CONTENT failures and a blank demo.
//
// The server emits on any page that boots wasm, which fixes
// all of them at once. These checks pin that, and pin the precondition that
// makes it safe: nothing else on the page may use a relative URL.
//
// Skips (exit 77) when no wasm bundle sits under bin/ — build the web product
// first. CI re-runs exactly this suite after the wasm build for that reason.
import std;
import Catcrafts.E2eHarness;
using namespace Catcrafts::E2e;
int main(int argc, char** argv) {
TestServer srv(argv[1], 8213);
const std::string page = srv.Body("/demos/raytracer");
if (page.find("