Repository navigation
test(consumer): use case story body keeps safe formatting, drops the rest - #398
Draft
saqibmanan wants to merge 1 commit into
Draft
saqibmanan wants to merge 1 commit into
saqibmanan wants to merge 1 commit into
Conversation
…rest
DataSpaceFrontend#566: RichTextEditor/RichTextRenderer now sanitize the
use case summary before it reaches the DOM (sanitizeRichText.ts).
Publishes a throwaway use case whose summary mixes markup the rich-text
editor can produce (kept) with markup it cannot (must not reach the page),
and reads the rendered story body back on the public detail page:
- `tests/consumer/smoke/test_con_usecase_rich_text_sanitization.py`:
keeps basic formatting (bold/italic); strips script tags, event-handler
attributes, and unsupported URL schemes on links. Markers `smoke` +
`deployed_pr("DataSpaceFrontend#566")`.
- `locators/consumer/usecase_locators.py` / `pages/consumer/usecase_page.py`:
adds `STORY_BODY` / `story_body_html()` — no existing Page Object exposed
the story body's rendered HTML.
- `tests/consumer/smoke/conftest.py`: re-exports the API auth/client
fixtures from tests/api/conftest.py so this directory's smoke tests can
create/publish/delete the throwaway record through GraphQL.
Checked:
- dev: 2 runs, `4 passed` each
- red: reconstructed the pre-fix output (the raw, unsanitized summary string)
and ran the same three assertions against it — all three fail
- prod: not run (write mutation; gated by deployed_pr instead)
Gaps: the companion change in the same source PR (lib/utils.ts
generateJsonLd now escapes "<" so embedded JSON-LD can't be broken out of)
is a pure utility fix with no reachable E2E path here without constructing
a breakout payload, which this file deliberately does not do; a frontend
unit test is the right place for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers DataSpaceFrontend#566 (merge
033309624851d6f209227aa11c22af207dc7972a): RichTextEditor/RichTextRenderer now sanitize the use case summary before it reaches the DOM.tests/consumer/smoke/test_con_usecase_rich_text_sanitization.py: publishes a throwaway use case whose summary mixes markup the editor can produce (bold/italic, kept) with markup it cannot (script tags, event-handler attributes, unsupported URL schemes on a link), and reads the rendered story body back on the public detail page. Markerssmoke+deployed_pr("DataSpaceFrontend#566").locators/consumer/usecase_locators.py/pages/consumer/usecase_page.py: addsSTORY_BODYlocator /story_body_html()— no existing Page Object exposed the story body's rendered HTML, so this was a real gap, not raw selectors in the test.tests/consumer/smoke/conftest.py: re-exports the API auth/client fixtures fromtests/api/conftest.pyso this directory's smoke tests can create/publish/delete the throwaway record.Checked:
4 passedeachdeployed_prinstead)Gaps: the companion change in the same source PR (
lib/utils.tsgenerateJsonLdnow escapes<) is a pure utility fix with no E2E path here that doesn't mean constructing a breakout payload, which this file deliberately avoids; better suited to a frontend unit test.