diff --git a/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/CardGroupNestedInExplore/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/CardGroupNestedInExplore/RendersHtml.verified.html new file mode 100644 index 0000000000..7ac0e744b3 --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/CardGroupNestedInExplore/RendersHtml.verified.html @@ -0,0 +1,47 @@ +
+

Explore the docs

+

Organized by task.

+
+
+ +
+ +

Authoring

+ +
+
+
    +
  • +

    + Syntax +

    +
  • +
+
+
+
diff --git a/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/GetStartedWithFiveStepsAfterTheBox/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/GetStartedWithFiveStepsAfterTheBox/RendersHtml.verified.html new file mode 100644 index 0000000000..7d1ba07caa --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/GetStartedWithFiveStepsAfterTheBox/RendersHtml.verified.html @@ -0,0 +1,49 @@ +
+
+

Get started

+
+
+
    +
  1. +
    + +

    One

    +
    +
  2. +
+
    +
  1. +
    + +

    Two

    +
    +
    +
    +
  2. +
  3. +
    + +

    Three

    +
    +
    +
    +
  4. +
  5. +
    + +

    Four

    +
    +
    +
    +
  6. +
  7. +
    + +

    Five

    +
    +
    +
    +
  8. +
+
+
diff --git a/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/GetStartedWithFourSteps/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/GetStartedWithFourSteps/RendersHtml.verified.html new file mode 100644 index 0000000000..85274d9694 --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/GetStartedWithFourSteps/RendersHtml.verified.html @@ -0,0 +1,58 @@ +
+
+

Get started

+
+
+
    +
  1. +
    + +

    Install

    +
    +
    +
    + Source +
    +
    +								dotnet build
    +							
    +
    +
    + +
    + Container + Get started +
    +
    +
  2. +
+
    +
  1. +
    + +

    Write

    +
    +
    +
    +
  2. +
  3. +
    + +

    Preview

    +
    +
    +
    +
  4. +
  5. +
    + +

    Validate

    +
    +
    +
    +
  6. +
+
+
diff --git a/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/OnThisPageWithAllSectionKinds/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/OnThisPageWithAllSectionKinds/RendersHtml.verified.html new file mode 100644 index 0000000000..2f8ae3ba33 --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/OnThisPageWithAllSectionKinds/RendersHtml.verified.html @@ -0,0 +1,116 @@ + +
+
+

Get started with Kibana

+
+
+
    +
  1. +
    + +

    Install

    +
    +

    Install it.

    +
  2. +
+
+
+
+
+
+

What's new

+
+
+ +
+
+

Solutions

+
+ +
+

Explore Kibana docs

+
+
+ +
+
+

Use Kibana

+
+
+
+ +

Analyze data

+ +
+
+
    +
  • +
    + Discover +
    +
  • +
+
+
+
diff --git a/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/WhatsNewWithAnInlineBody/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/WhatsNewWithAnInlineBody/RendersHtml.verified.html new file mode 100644 index 0000000000..761e2711f2 --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/Blocks/Hub/WhatsNewWithAnInlineBody/RendersHtml.verified.html @@ -0,0 +1,46 @@ +
+
+
+

What's new in docs-builder

+

Recent additions to the toolchain.

+
+
+ +
diff --git a/tests/Elastic.Authoring.Tests/.snapshots/DesignSystem/AppliesToComponent/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/DesignSystem/AppliesToComponent/RendersHtml.verified.html new file mode 100644 index 0000000000..5879760ff9 --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/DesignSystem/AppliesToComponent/RendersHtml.verified.html @@ -0,0 +1,65 @@ +
+
+ + + + + + Note + + + + + The + Elastic Stack + includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. + Availability + + + Planned + We plan to add this functionality in a future Elastic Stack update. Subject to changes. + + + Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. + This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the + release notes + for changes. + + + +
+
+

This applies to the stack.

+
+
+

Inline badge: + + + + + The + Elastic Stack + includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. + Availability + + + Planned + We plan to add this functionality in a future Elastic Stack update. Subject to changes. + + + Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. + This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the + release notes + for changes. + + + +

diff --git a/tests/Elastic.Authoring.Tests/.snapshots/DesignSystem/VectorSizingComponent/RendersHtml.verified.html b/tests/Elastic.Authoring.Tests/.snapshots/DesignSystem/VectorSizingComponent/RendersHtml.verified.html new file mode 100644 index 0000000000..896c599718 --- /dev/null +++ b/tests/Elastic.Authoring.Tests/.snapshots/DesignSystem/VectorSizingComponent/RendersHtml.verified.html @@ -0,0 +1,141 @@ + diff --git a/tests/Elastic.Authoring.Tests/Applicability/AppliesToDirective.cs b/tests/Elastic.Authoring.Tests/Applicability/AppliesToDirective.cs index 920deba723..9ac2c6d69d 100644 --- a/tests/Elastic.Authoring.Tests/Applicability/AppliesToDirective.cs +++ b/tests/Elastic.Authoring.Tests/Applicability/AppliesToDirective.cs @@ -79,11 +79,9 @@ public class WarnsOnOldSyntax : MarkdownTest ``` """; - [Test, DisplayName("has no errors")] - public async Task HasNoErrors() => await Docs.HasNoErrors(); - - [Test, DisplayName("warns on bad syntax")] - public async Task WarnsOnBadSyntax() => await Docs.HasWarning("Applies block does not use valid yaml keys: :hosted"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics("warning {repo}/docs/index.md:2 Applies block does not use valid yaml keys: :hosted"); } public class HintsOnInvalidKeys : MarkdownTest @@ -94,6 +92,9 @@ public class HintsOnInvalidKeys : MarkdownTest ``` """; - [Test, DisplayName("hints on unknown key")] - public async Task HintsOnUnknownKey() => await Docs.HasHint("Unknown key 'hosted' in applies_to."); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "hint {repo}/docs/index.md:2 Unknown key 'hosted' in applies_to. Valid keys: apm_agent_dotnet, deployment, ecctl, ece, ech, eck, elasticsearch, elasticsearch, ess, observability, product, security, …." + ); } diff --git a/tests/Elastic.Authoring.Tests/Applicability/AppliesToFrontMatter.cs b/tests/Elastic.Authoring.Tests/Applicability/AppliesToFrontMatter.cs index cf56c75527..805f9e8947 100644 --- a/tests/Elastic.Authoring.Tests/Applicability/AppliesToFrontMatter.cs +++ b/tests/Elastic.Authoring.Tests/Applicability/AppliesToFrontMatter.cs @@ -304,8 +304,11 @@ public class BothEssAndEchDefinedUsesEchValueAndWarns : AuthoringTest public async Task EchValueWins() => await Docs.AppliesTo(new ApplicableTo { Deployment = new DeploymentApplicability { Ess = Applies("beta") } }); - [Test, DisplayName("emits warning about both being defined")] - public async Task EmitsWarning() => await Docs.HasWarning("Both 'ess' and 'ech' are defined"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "warning {repo}/docs/index.md Both 'ess' and 'ech' are defined. Move 'ess' content into 'ech' to avoid information loss." + ); } public class ParsesEchAtTopLevel : AuthoringTest @@ -333,8 +336,9 @@ public class ParsesProductComingDeprecated : AuthoringTest product: coming 9.5 """); - [Test, DisplayName("should warn of deprecated lifecycle state")] - public async Task WarnOfDeprecatedLifecycle() => await Docs.HasHint("The 'coming' lifecycle is deprecated and will be removed"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics("hint {repo}/docs/index.md The 'coming' lifecycle is deprecated and will be removed in a future release."); } public class ParsesProductPlanned : AuthoringTest @@ -345,8 +349,11 @@ public class ParsesProductPlanned : AuthoringTest product: planned 9.5 """); - [Test, DisplayName("should warn of deprecated lifecycle state")] - public async Task WarnOfDeprecatedLifecycle() => await Docs.HasHint("The 'planned' lifecycle is deprecated and will be removed"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "hint {repo}/docs/index.md The 'planned' lifecycle is deprecated and will be removed in a future release." + ); } public class ParsesProductRemoved : AuthoringTest @@ -600,8 +607,11 @@ public class ServerlessStringWithVersionEmitsError : AuthoringTest serverless: ga 9.5 """); - [Test, DisplayName("emits error for versioned serverless")] - public async Task EmitsErrorForVersionedServerless() => await Docs.HasError("Can't specify a version for 'serverless'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'serverless' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } public class ServerlessProjectWithVersionEmitsError : AuthoringTest @@ -613,8 +623,11 @@ public class ServerlessProjectWithVersionEmitsError : AuthoringTest elasticsearch: ga 9.5 """); - [Test, DisplayName("emits error for versioned elasticsearch project")] - public async Task EmitsError() => await Docs.HasError("Can't specify a version for 'elasticsearch'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'elasticsearch' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } public class ServerlessVectorDatabaseWithVersionEmitsError : AuthoringTest @@ -626,8 +639,11 @@ public class ServerlessVectorDatabaseWithVersionEmitsError : AuthoringTest vectordb: ga 9.5 """); - [Test, DisplayName("emits error for versioned vector database project")] - public async Task EmitsError() => await Docs.HasError("Can't specify a version for 'vectordb'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'vectordb' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } public class DeploymentEssWithVersionEmitsError : AuthoringTest @@ -639,8 +655,11 @@ public class DeploymentEssWithVersionEmitsError : AuthoringTest ess: ga 9.5 """); - [Test, DisplayName("emits error for versioned ess")] - public async Task EmitsError() => await Docs.HasError("Can't specify a version for 'ess'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'ess' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } public class DeploymentEchWithVersionEmitsError : AuthoringTest @@ -652,8 +671,11 @@ public class DeploymentEchWithVersionEmitsError : AuthoringTest ech: preview 9.5 """); - [Test, DisplayName("emits error for versioned ech")] - public async Task EmitsError() => await Docs.HasError("Can't specify a version for 'ech'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'ech' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } public class TopLevelEchWithVersionEmitsError : AuthoringTest @@ -665,8 +687,11 @@ public class TopLevelEchWithVersionEmitsError : AuthoringTest stack: ga 9.1 """); - [Test, DisplayName("emits error for versioned top level ech")] - public async Task EmitsError() => await Docs.HasError("Can't specify a version for 'ech'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'ech' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } public class DeploymentStringShorthandWithVersionEmitsErrorForEss : AuthoringTest @@ -677,6 +702,9 @@ public class DeploymentStringShorthandWithVersionEmitsErrorForEss : AuthoringTes deployment: ga 9.0.0 """); - [Test, DisplayName("emits error because ess does not support versions")] - public async Task EmitsError() => await Docs.HasError("Can't specify a version for 'ess'"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md Can't specify a version for 'ess' because this product is not versioned. Remove the version, or use 'stack:' for version-specific requirements." + ); } diff --git a/tests/Elastic.Authoring.Tests/Blocks/AgentSkill.cs b/tests/Elastic.Authoring.Tests/Blocks/AgentSkill.cs index c14885aafc..faafd1b9f2 100644 --- a/tests/Elastic.Authoring.Tests/Blocks/AgentSkill.cs +++ b/tests/Elastic.Authoring.Tests/Blocks/AgentSkill.cs @@ -94,8 +94,9 @@ public class AgentSkillMissingUrl : MarkdownTest ::: """; - [Test, DisplayName("has error")] - public async Task HasError() => await Docs.HasError("requires a :url: property"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics("error {repo}/docs/index.md:2 agent-skill directive requires a :url: property"); } public class AgentSkillRelativeUrl : MarkdownTest @@ -106,6 +107,7 @@ public class AgentSkillRelativeUrl : MarkdownTest ::: """; - [Test, DisplayName("has error")] - public async Task HasError() => await Docs.HasError("must be an absolute URL"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics("error {repo}/docs/index.md:2 agent-skill :url: must be an absolute URL, got '/relative/path'"); } diff --git a/tests/Elastic.Authoring.Tests/Blocks/CodeBlocks/CodeBlocks.cs b/tests/Elastic.Authoring.Tests/Blocks/CodeBlocks/CodeBlocks.cs index a2eddd09c3..8be573925b 100644 --- a/tests/Elastic.Authoring.Tests/Blocks/CodeBlocks/CodeBlocks.cs +++ b/tests/Elastic.Authoring.Tests/Blocks/CodeBlocks/CodeBlocks.cs @@ -14,8 +14,9 @@ public class WarnsOnInvalidLanguage : MarkdownTest ``` """; - [Test, DisplayName("validate HTML: generates link and alt attr")] - public async Task ValidateHtml() => await Docs.HasWarning("Unknown language: not-a-valid-language"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics("warning {repo}/docs/index.md:2 Unknown language: not-a-valid-language"); [Test, DisplayName("parses to EnhancedCodeBlock")] public async Task ParsesCodeBlock() diff --git a/tests/Elastic.Authoring.Tests/Blocks/Hub/CardsAndExplore.cs b/tests/Elastic.Authoring.Tests/Blocks/Hub/CardsAndExplore.cs index 2715b077e9..cb5eed257c 100644 --- a/tests/Elastic.Authoring.Tests/Blocks/Hub/CardsAndExplore.cs +++ b/tests/Elastic.Authoring.Tests/Blocks/Hub/CardsAndExplore.cs @@ -28,21 +28,32 @@ public class CardGroupStandalone : MarkdownTest :::: """; - [Test, DisplayName("renders a heading and a grid, not an accordion")] - public async Task RendersHeadingAndGrid() => - await Docs.ConvertsToContainingHtml( + [Test, DisplayName("renders HTML")] + public async Task RendersHtml() => + await Docs.ConvertsToHtml( """

Get hands-on

Follow a guided quickstart.

+ """ ); - [Test, DisplayName("renders the card with its description")] - public async Task RendersCardDescription() => - await Docs.ConvertsToContainingHtml("""

Author a page and preview it.

"""); - [Test, DisplayName("has no errors")] public async Task HasNoErrors() => await Docs.HasNoErrors(); } @@ -62,8 +73,28 @@ public class CardGroupWithLinksInTheIntro : MarkdownTest :::: """; - [Test, DisplayName("renders inline links in the intro")] - public async Task RendersInlineLinksInTheIntro() => await Docs.ConvertsToContainingRawHtml("""solutions"""); + [Test, DisplayName("renders HTML")] + public async Task RendersHtml() => + await Docs.ConvertsToHtml( + """ +
+

Components

+

They power + solutions + and have several ways to + deploy.

+
+ + """ + ); [Test, DisplayName("has no errors")] public async Task HasNoErrors() => await Docs.HasNoErrors(); @@ -84,8 +115,26 @@ public class CardGroupWithAMarkdownLinkInTheIntro : MarkdownTest :::: """; - [Test, DisplayName("turns the markdown path into a page link")] - public async Task TurnsMarkdownPathIntoPageLink() => await Docs.ConvertsToContainingRawHtml("""Compare options"""); + [Test, DisplayName("renders HTML")] + public async Task RendersHtml() => + await Docs.ConvertsToHtml( + """ +
+

Deploy

+

Choose where to run it. + Compare options.

+
+ + """ + ); [Test, DisplayName("has no errors")] public async Task HasNoErrors() => await Docs.HasNoErrors(); @@ -105,9 +154,26 @@ public class CardGroupWithATitledLinkInTheIntro : MarkdownTest :::: """; - [Test, DisplayName("resolves the link and keeps its title")] - public async Task ResolvesLinkAndKeepsTitle() => - await Docs.ConvertsToContainingRawHtml("""Compare options"""); + [Test, DisplayName("renders HTML")] + public async Task RendersHtml() => + await Docs.ConvertsToHtml( + """ +
+

Deploy

+

Choose where to run it. + Compare options.

+
+ + """ + ); [Test, DisplayName("has no errors")] public async Task HasNoErrors() => await Docs.HasNoErrors(); @@ -127,8 +193,27 @@ public class CardGroupWithLinkSyntaxInCodeInTheIntro : MarkdownTest :::: """; - [Test, DisplayName("keeps the code span as written")] - public async Task KeepsCodeSpan() => await Docs.ConvertsToContainingRawHtml("[guide](/does-not-exist.md)"); + [Test, DisplayName("renders HTML")] + public async Task RendersHtml() => + await Docs.ConvertsToHtml( + """ +
+

Deploy

+

Write links as + [guide](/does-not-exist.md) + in your text.

+
+ + """ + ); [Test, DisplayName("does not report a link inside code")] public async Task HasNoErrors() => await Docs.HasNoErrors(); @@ -148,8 +233,11 @@ public class CardGroupWithABrokenLinkInTheIntro : MarkdownTest :::: """; - [Test, DisplayName("reports a link to a page that does not exist")] - public async Task ReportsMissingPage() => await Docs.HasError("does-not-exist"); + [Test, DisplayName("reports diagnostics")] + public async Task ReportsDiagnostics() => + await Docs.HasDiagnostics( + "error {repo}/docs/index.md:2 Directive link `/does-not-exist.md` does not exist. If it was recently removed add a redirect." + ); } public class CardGroupWithSolutionsVariant : MarkdownTest @@ -166,10 +254,13 @@ public class CardGroupWithSolutionsVariant : MarkdownTest :::: """; - [Test, DisplayName("locks the three column grid")] - public async Task LocksThreeColumnGrid() => - await Docs.ConvertsToContainingHtml( + [Test, DisplayName("renders HTML")] + public async Task RendersHtml() => + await Docs.ConvertsToHtml( """ +
+

Browse by area

+