Skip to content

Add markdown support for notes field in TestCase and TestRun#4267

Open
veenone wants to merge 7 commits intokiwitcms:masterfrom
veenone:feat/notes-markdown
Open

Add markdown support for notes field in TestCase and TestRun#4267
veenone wants to merge 7 commits intokiwitcms:masterfrom
veenone:feat/notes-markdown

Conversation

@veenone
Copy link
Copy Markdown

@veenone veenone commented Feb 11, 2026

I'm trying to update notes part in test case and test run to support markdown since currently it's only plain text .

In my usage, I have used markdown syntax in notes since I have multiple entries like below

IuEOOBbK5Y

this leads to mixed formatting in view page

image

so my update is to enable markdown just like description so we can have better view like this :

rvREwaZx4G

what has been implemented :

  • Use SimpleMDENotes widget in TestCase and TestRun forms
  • Render notes with markdown2html filter in display templates
  • Render notes with markdown2HTML() in testplan JS expand area

Copilot AI review requested due to automatic review settings February 11, 2026 02:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables Markdown editing/rendering for the notes field (primarily for TestCase/TestRun) by switching notes inputs to SimpleMDE-based widgets and rendering notes as Markdown in some UI surfaces.

Changes:

  • Use a SimpleMDE-based widget for notes in TestCase/TestRun forms and render it via {{ form.notes }}.
  • Render TestCase notes via the markdown2html template filter; render notes in TestPlan’s expand area via markdown2HTML() in JS.
  • Adjust SimpleMDE autosave IDs and introduce SimpleMDENotes (separate upload element ID for notes).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tcms/testruns/templates/testruns/mutable.html Switch notes input to widget rendering ({{ form.notes }})
tcms/testruns/forms.py Add SimpleMDE-based widget for TestRun notes
tcms/testplans/static/testplans/js/get.js Render TestCase notes via markdown2HTML() in expand area; propagate from_plan in links
tcms/testcases/templates/testcases/mutable.html Switch notes input to widget rendering ({{ form.notes }}) and propagate from_plan
tcms/testcases/templates/testcases/get.html Render notes via markdown2html; adds new breadcrumbs/navigation markup
tcms/testcases/forms.py Add SimpleMDE-based widget for TestCase notes
tcms/static/js/index.js Make SimpleMDE autosave IDs unique per textarea
tcms/core/widgets.py Add SimpleMDENotes widget (distinct file upload element ID)
Comments suppressed due to low confidence (1)

tcms/testcases/templates/testcases/mutable.html:33

  • This form can submit two from_plan hidden inputs (one from request.GET.from_plan and one from test_plan.pk). Multiple values for the same field name can lead to ambiguous behavior (Django's request.POST.get('from_plan') will pick one value). Ensure only one from_plan input is rendered, or make sure they cannot diverge.
            {% if request.GET.from_plan %}
            <input type="hidden" name="from_plan" value="{{ request.GET.from_plan }}">
            {% endif %}
            <input type="hidden" name="author" value="{{ form.author.value }}">
            <div class="form-group">
                <label class="col-md-1 col-lg-1" for="id_summary">{% trans "Summary" %}</label>
                <div class="col-md-11 col-lg-11 {% if form.summary.errors %}has-error{% endif %}">
                    <input type="text" id="id_summary" name="summary" value="{{ form.summary.value|default:'' }}" class="form-control" required>
                    {% if test_plan %}
                        <p class="help-block"><a href="{% url 'test_plan_url' test_plan.pk %}">TP-{{ test_plan.pk }}: {{ test_plan.name }}</a></p>
                        <input type="hidden" name="from_plan" value="{{ test_plan.pk }}">
                    {% endif %}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@atodorov atodorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR.

Please leave only the changes related to markdown support for notes field here and move changes related to breadcrumbs and anythhing not related to markdown into a separate pull request so that it is easier to review. See comments from Copilot.

@veenone veenone requested a review from atodorov February 14, 2026 07:45
Copy link
Copy Markdown
Member

@atodorov atodorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added couple of comments/small changes requested.

}

function getTestCaseRowContent (rowContent, testCase, permissions) {
function getTestCaseRowContent (rowContent, testCase, permissions, testPlanId) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testPlanId is unused and I am assuming it is a left over. Please remove unnecessary changes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok it's removed

Copy link
Copy Markdown
Member

@atodorov atodorov Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 notes:

  1. Please don't mark comments as resolved. Strictly speaking that's responsibility of the reviewer but more importantly when comments stay open it is easier to to review again and focus only on the last set of changes. Otherwise I need to double check everything from scratch.

  2. When you remove an unused argument from this function don't update only the function signature but also every single place in which this function is called from otherwise there will be errors. I see at least 2 more locations which need changing.

  3. Please test these changes on your side before declaring them ready for review. From what I can see these 2 calls will fail b/c the function doesn't take so many arguments:

image

// it with something different, restore the server value.
if (serverValue && simpleMDE.value() !== serverValue) {
simpleMDE.value(serverValue)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is this related to the markdown rendering functionality? Doesn't seem to be IMO so please remove it. Otherwise please explain what the idea here is.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed since this is coming from previous trials

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment to above.

There is a danglign variable called serverValue left in this file + another code snippet which doesn't appear related to the markdown rendering functionality.

@veenone
Copy link
Copy Markdown
Author

veenone commented Mar 5, 2026

update code based on review. and add the same implementation for testcase view in testrun @atodorov

veenone and others added 7 commits March 5, 2026 08:29
- Add SimpleMDENotes widget with unique file upload ID to prevent
  conflicts when both text and notes editors are on the same page
- Use SimpleMDENotes widget in TestCase and TestRun forms
- Render notes with markdown2html filter in display templates
- Render notes with markdown2HTML() in testplan JS expand area
- Fix SimpleMDE autosave ID to use textarea id for uniqueness
@veenone veenone force-pushed the feat/notes-markdown branch from c7439a0 to 02a3682 Compare March 5, 2026 01:29
@veenone veenone requested a review from atodorov March 5, 2026 01:30
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.

3 participants