using System.IO; using System.Text.Json; using AxCopilot.Services.Agent; using FluentAssertions; using Xunit; namespace AxCopilot.Tests.Services; public class HtmlSkillPrintFrameTests { [Fact] public async Task ExecuteAsync_WithPrintHeaderAndFooter_ShouldRenderPrintFrame() { var workDir = Path.Combine(Path.GetTempPath(), "ax-html-printframe-" + Guid.NewGuid().ToString("N")); Directory.CreateDirectory(workDir); try { var tool = new HtmlSkill(); var context = new AgentContext { WorkFolder = workDir, Permission = "Auto", OperationMode = "external", }; var args = JsonDocument.Parse( """ { "path": "board-report.html", "title": "Board Report", "print": true, "print_header": "Board Review", "print_footer": "Confidential", "body": "

Executive Summary

Summary text with enough detail to qualify as a printable executive report.

Recommendation

Approve phase 1.

Appendix

Evidence notes.

" } """).RootElement; var result = await tool.ExecuteAsync(args, context, CancellationToken.None); result.Success.Should().BeTrue(); result.Output.Should().Contain("Quality score"); var html = File.ReadAllText(Path.Combine(workDir, "board-report.html")); html.Should().Contain("print-header"); html.Should().Contain("print-footer"); html.Should().Contain("Board Review"); html.Should().Contain("Confidential"); } finally { try { if (Directory.Exists(workDir)) Directory.Delete(workDir, true); } catch { } } } }