Skip to content

Snapshot the authorization section tests - #4686

Merged
akira28 merged 1 commit into
mainfrom
test/authorization-section-snapshots
Nov 4, 2026
Merged

akira28 merged 1 commit into
mainfrom
test/authorization-section-snapshots

Conversation

@akira28

@akira28 akira28 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Three AuthorizationSectionRenderingTests now compare the rendered block against a verified HTML snapshot instead of 21 Contain/NotContain assertions.

Affects: Internals only

Prompt summary: Continue the test-growth reduction by converting the next ApiExplorer rendering tests to snapshots, as a separate PR after the responses block (#4684).

Why

The three tests assert on the same rendered block with many string checks. Each new markup detail adds another line, and a reviewer cannot see the whole block at once.

What

Snapshots replace string checks

Render_RequirementWithTwoSchemes_SharesOneTabAndSaysToSendBoth, Render_OneRequirementWithTwoSchemes_HasNoTabsAndShowsBothSchemes and Render_PrivilegesNeededTogether_AreSummarisedAsSeparateNamesJoinedWithPlus call MatchHtmlSnapshot(). The snapshots are 53, 39 and 29 lines under .snapshots/AuthorizationSectionRenderingTests/.

Intent assertions stay

One Contain or NotContain per test keeps the reason visible, such as "a single requirement needs no tabs". The four small tests are unchanged.

Verify

dotnet test --project tests/Elastic.ApiExplorer.Tests --treenode-filter "/*/*/AuthorizationSectionRenderingTests/*"

All 21 removed assertions hold on the new output. Renaming the tab label class, turning the scheme <h3> into <h4> and changing the summary item markup each fail the converted tests.

🤖 Generated with Claude Code

Three tests in `AuthorizationSectionRenderingTests` checked the same rendered block with 21 `Contain`/`NotContain` assertions. Each now compares against a verified HTML snapshot, plus one targeted assertion that states its intent. The four small tests stay as they are.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@akira28
akira28 requested a review from a team as a code owner November 4, 2026 15:56
@akira28 akira28 added the chore label Nov 4, 2026
@akira28
akira28 requested a review from theletterf November 4, 2026 15:56
@akira28
akira28 enabled auto-merge (squash) November 4, 2026 15:58
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4686/

@akira28
akira28 disabled auto-merge November 4, 2026 16:27
@akira28
akira28 merged commit 93a12ff into main Nov 4, 2026
42 checks passed
@akira28
akira28 deleted the test/authorization-section-snapshots branch November 4, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants