Skip to content

Add e2e test for the font chooser's marks (Notion test case 358) - #8289

Open
JohnThomson wants to merge 4 commits into
masterfrom
tc358-font-chooser
Open

Add e2e test for the font chooser's marks (Notion test case 358)#8289
JohnThomson wants to merge 4 commits into
masterfrom
tc358-font-chooser

Conversation

@JohnThomson

@JohnThomson JohnThomson commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Automates Notion test case 358 (New Font Chooser): https://app.notion.com/p/New-Font-Chooser-3904bb19df12811dab13eb2df088c16d

Bloom production code changes

None in Bloom itself. Outside src/BloomE2E the PR touches .github/workflows/nightly.yml (a step that installs the test fonts before the e2e suite) and build/testing-inputs.pin (advanced to the bloom-testing-inputs commit that carries the fonts, BloomBooks/bloom-testing-inputs#3). Nothing that ships in Bloom or builds it changes.

Fonts for the nightly runner

A windows-latest runner has 66 fonts: 5 Bloom calls usable, 51 Microsoft, and none it calls unknown or non-Microsoft unsuitable, so the first dispatch of the nightly e2e suite on this branch could not find a font of each kind. bloom-testing-inputs now carries, under fonts/, two genuinely free fonts whose internal metadata lands them in exactly those verdicts: Alef (SIL OFL; metadata says only "All rights reserved", so unsuitable) and Luciole (CC BY 4.0, stated in a form Bloom's heuristics do not read, so unknown). src/BloomE2E/scripts/install-test-fonts.ps1 installs everything under that folder for the current user and fails unless GDI+, which is what Bloom's font list reads, lists them afterwards; the workflow runs it after fetching the inputs. The test prefers Alef and Luciole, then the fonts the card names, then any font of the kind, so it behaves the same on a developer machine that has them and on the runner.

Merge order: BloomBooks/bloom-testing-inputs#3 first, then this PR. The pin already names that branch's commit, which stays reachable after the merge.

Purpose

Protects what the font chooser tells a user about each installed font: fonts Bloom may embed in a published book get a check mark and stay enabled; fonts it may not use (a Microsoft font, or one whose metadata forbids embedding) get an exclamation mark, and fonts it cannot judge a question mark, dimmed in the list yet still choosable. Hovering a mark opens the information pane with the right verdict, a summary of the font with its links, and, for anything but a usable font, the information icon that shows the raw metadata. The chosen font's mark shows in the closed chooser in colour (red, gold, Bloom blue) with the same pane.

The chooser is the same React component in the Format dialog and in the Settings dialog's Book Making tab. The test drives it in the Format dialog. The Settings dialog is a WinForms surface CDP cannot reach, so the card is split: the original keeps its id as New Font Chooser [Automated portion], and the Settings route is New Font Chooser [Manual portion] (Test Case ID 811), linked both ways.

Steps

  • Makes a Basic Book in a new one-language collection, adds a Basic Text & Image page, and asks fonts/metadata for a font of each kind, preferring the ones the card names (Andika, Times New Roman, Baskerville Old Face, Euclid) and taking another of the same kind when the machine lacks one. A machine with no font of a kind fails plainly, as the card asks.
  • Clicks in the text box, opens the Format dialog, and switches to its Characters tab (new helper showFormatDialogTab).
  • Pulls down the font list and reads every row: mark, mark colour, name colour, enabled.
  • Hovers the mark of each of the four fonts and reads the pane; clicks the information icon for the unknown font and captures the alert it raises.
  • Chooses the Microsoft font, the unknown font, then the usable font, checking the text box's computed font, the closed chooser's mark and colour, and the pane behind that mark.

How it verifies the result

Reads the DOM of the list, the pane and the chooser (MUI's icon data-testids name the marks; computed colours are mapped to the theme's named colours), the box's computed font-family, and fonts/metadata as the oracle for the pane's summary (name, styles, version, and exactly the links whose URLs the metadata carries). Eleven serial tests in one Bloom; three green runs in a row locally, no Bloom.exe left behind.

New helpers

  • helpers/fontChooser.ts: pickFont, getFontsMetadata, getFontMetadata, openFontList, isFontListOpen, getFontListItems, hoverFontMarkInList, hoverChosenFontMark, readFontInformationPane, closeFontInformationPane, showFontDetails, chooseFont, getChosenFont.
  • helpers/formatDialog.ts: showFormatDialogTab.
  • helpers/bookMaking.ts: getFontFamilyInGroup.

Problems

  • The Settings dialog route stays manual (WinForms; AUTOMATION-DEBT.md "WinForms surfaces are invisible to CDP" has a new seen-again line).
  • The card says the check mark is in a "green circle"; the product draws it in Bloom blue (kBloomBlue), and the test asserts the product's colour.
  • The card asks that the summary's links go to real websites. The test checks that every link is one the font's metadata carries and, for the usable font, that it is an absolute http(s) URL; it does not fetch them.
  • The CI runner had no unknown or non-Microsoft unsuitable font; see "Fonts for the nightly runner" above for how the PR supplies them. A machine that still lacks a kind fails with a message listing how many of each kind it has.
  • Bloom's information pane renders a manufacturer link with an empty href for a font whose metadata has no manufacturer at all (Luciole). The pane reader ignores it; it is a small product oddity, not a test problem.

🤖 Generated with Claude Code


This change is Reviewable

Devin review

The font chooser shows, beside each installed font, whether Bloom may use it in a
published book: a check mark for a usable font, an exclamation mark for one it may
not use (a Microsoft font, or one whose metadata forbids embedding), a question mark
when it cannot tell. The unusable and unknown fonts are dimmed in the list but can
still be chosen; hovering a mark opens the information pane with the verdict, a
summary of the font with its links, and (except for usable fonts) an icon that shows
the raw metadata. The chosen font's mark shows in the closed chooser in colour.

font-chooser.spec.ts drives all of that in the Edit tab's Format dialog, on a font of
each kind picked at run time from fonts/metadata (Andika, Times New Roman, Baskerville
Old Face and Euclid when the machine has them). The Settings dialog route the card also
names is WinForms, so it stays on the card's manual portion; AUTOMATION-DEBT.md records
it under the WinForms entry.

New helpers: helpers/fontChooser.ts (the chooser, its list, and its information pane),
showFormatDialogTab in formatDialog.ts (the dialog opens on Style Name; the chooser is
on Characters), and getFontFamilyInGroup in bookMaking.ts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The e2e fixture launches output/Debug/x64/Bloom.exe ahead of Debug/AnyCPU, so a stale x64
build silently runs an old Bloom; and notion_automation.py still needs a Python that not every
machine has (seen again, now with the card split the skill asks for).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
JohnThomson and others added 2 commits September 3, 2026 12:44
A windows-latest runner has only Microsoft fonts and the few Bloom ships: 66 fonts, of which
Bloom calls 5 usable and 51 Microsoft, and none unknown or non-Microsoft unsuitable. So the
font chooser test could not find a font of each kind there (nightly run 33781388018).

bloom-testing-inputs now carries two genuinely free fonts that Bloom sorts into exactly those
verdicts because of how their metadata is written: Alef (OFL; 'All rights reserved' and no
license field, so unsuitable) and Luciole (CC BY 4.0 in a form the heuristics do not read, so
unknown). The pin advances to that commit. scripts/install-test-fonts.ps1 installs every font
under output/testing-inputs/fonts for the current user (per-user folder, registry entry,
AddFontResource) and fails unless GDI+, which is what Bloom reads, lists them afterwards; the
nightly workflow runs it before the e2e suite. pickFont now takes a list of preferred names,
and the test asks for Alef and Luciole first so that it behaves the same on a developer machine
that has them and on the runner. The pane reader ignores the empty-href link the pane renders
for a font with no manufacturer, which Luciole exposed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
WPF's GlyphTypeface constructor failed with a null reference on the second font in the
nightly runner's non-interactive session (run 33786373678). GDI+'s PrivateFontCollection
is what Bloom lists fonts with anyway, so use it for the family name, and take the style
part of the registry value name from the file name.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant