Skip to content

test(consumer): use case story body keeps safe formatting, drops the rest - #398

Draft
saqibmanan wants to merge 1 commit into
CIfrom
test-sync/DataSpaceFrontend-pr566
Draft

saqibmanan wants to merge 1 commit into
CIfrom
test-sync/DataSpaceFrontend-pr566

Conversation

@saqibmanan

@saqibmanan saqibmanan commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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. Markers smoke + deployed_pr("DataSpaceFrontend#566").
  • locators/consumer/usecase_locators.py / pages/consumer/usecase_page.py: adds STORY_BODY locator / 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 from tests/api/conftest.py so this directory's smoke tests can create/publish/delete the throwaway record.

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 <) 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.

…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.
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