Set up markdown processing tests for the content editor
What does this MR do?
It creates a test that ensures the Content Editor knows how to process the HTML Output of the Markdown API and generate the exact original Markdown that the Markdown API received as input in the first place.
Context
Read the Rich Text Editor technical design document for more information about the Markdown import / export flow.
Documenting the examples
-
spec/frontend/fixtures/api_markdown.yml
is an array of markdown examples, with aname
(name of the type of mark) andmarkdown
example (raw markdown for the example) for each. -
spec/frontend/fixtures/api_markdown.rb
generates frontend fixtures intmp/tests/frontend/fixtures-ee/api/markdown/${name}.json
for each examplename
(viarake frontend:fixtures
ORbin/rake spec/frontend/fixtures/api_markdown.rb
) -
markdown_processing_spec.js
reads thespec/frontend/fixtures/api_markdown.yml
file, and for eachname
example, ensures that the editor can load thetmp/tests/frontend/fixtures-ee/api/markdown/${name}.json
and generate the same original markdown.
Preventing regressions
We use the CI environment to make sure the Markdown API does not break the expectations of the Rich Text Editor markdown processing services:
graph TD
A[`rake frontend:fixtures` OR `bin/rake spec/frontend/fixtures/api_markdown.rb`] -->|generates `tmp/tests/frontend/fixtures-ee/api/markdown/bold.json` fixture| B[jest:job]
B --> |compares editor markdown output against original markdown|C{Matches?}
C -->|No| D[Test fails!]
C -->|Yes| E[Test passes!]
If the Markdown API output changes, the jest test will fail because the markdown doesn't match the markdown originally sent to the API.
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because this MR does not introduce user-facing changes.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team