Skip to content

Add substitutions to GLFM static HTML snapshot examples

Chad Woolley requested to merge caw-glfm-regex-ignores into master

What does this MR do and why?

Relates: Tracking Issue: Implement GLFM scripts per the ... (#361241)

Add support for normalizing entries in GitLab Flavored Markdown static HTML snapshot entries, to replace variable values in actual HTML API responses.

This is done by replacing variable values via regexes specified in spec/fixtures/glfm/example_snapshots/html.yml.

This is a port and improvement of the "substitutions" logic from Golden Master specs in spec/fixtures/markdown/markdown_golden_master_examples.yml.

Tasks

  • Update doc/development/gitlab_flavored_markdown/specification_guide/index.md for new substitutions file.

How to set up and validate locally

  1. Review the new normalization documentation which was added in this MR in doc/development/gitlab_flavored_markdown/specification_guide/index.md to understand how it works.
  2. Run spec/requests/api/markdown_snapshot_spec.rb with FOCUSED_MARKDOWN_EXAMPLES=07_01__gitlab_specific_markdown__footnotes__001
  3. The spec should pass
  4. Comment the line 07_01_href: *07_01_href in glfm_specification/input/gitlab_flavored_markdown/glfm_example_normalizations.yml
  5. Run again and see it fail because the href value was not normalized.
  6. Uncomment the line 07_01_href: *07_01_href and instead comment the line 07_01_id: *07_01_id
  7. Run again and see it fail because id value was not normalized.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Chad Woolley

Merge request reports