import {test, expect} from '../../fixtures/test' // Instructors write gradebook comments to give students detailed feedback on // their work. These comments may include formatted text, code snippets for CS // courses, mathematical notation, tables for rubric feedback, and links to // resources. This spec verifies realistic gradebook comment content survives // the RCE round-trip intact. test.describe('Canvas gradebook comment content patterns', () => { test.beforeEach(async ({page, rcePage}) => { await page.goto('/scenarios/basic') await rcePage.waitForEditor() }) async function setAndGet(page: any, html: string): Promise { return page.evaluate((content: string) => { // @ts-expect-error -- TinyMCE global window.tinymce.activeEditor.setContent(content) // @ts-expect-error -- TinyMCE global return window.tinymce.activeEditor.getContent() }, html) } test('essay feedback with inline suggestions — all text preserved', async ({page}) => { const content = await setAndGet( page, `

Your thesis statement is strong and clearly articulates your argument. However, the supporting evidence in paragraphs 2 and 3 could be more directly connected to your central claim.

Strengths:

Areas for improvement:

`, ) expect(content).toContain('arguable thesis') expect(content).toContain('primary sources') expect(content).toContain('restates rather than synthesizes') }) test('code feedback with inline corrections — code text preserved', async ({page}) => { const content = await setAndGet( page, `

Your implementation is mostly correct. A few notes:

Instead of:

for i in range(len(items)):
    print(items[i])

Prefer the Pythonic:

for item in items:
    print(item)

This avoids unnecessary index arithmetic and is more readable.

`, ) expect(content).toContain('Pythonic') expect(content).toContain('index arithmetic') expect(content).toContain('for item in items') }) test('rubric feedback table — all criteria comments preserved', async ({page}) => { const content = await setAndGet( page, `
CriterionPointsFeedback
Argument clarity18/20Well-structured but intro paragraph is too broad
Evidence quality15/20Relies too heavily on secondary sources
Citation format10/10APA style applied correctly throughout
Grammar9/10One sentence fragment in paragraph 4
`, ) expect(content).toContain('Argument clarity') expect(content).toContain('secondary sources') expect(content).toContain('APA style applied correctly') expect(content).toContain('sentence fragment') }) test('lab report feedback with data reference — numbers preserved', async ({page}) => { const content = await setAndGet( page, `

Your experimental data shows a 12.3% deviation from the theoretical value of 9.81 m/s. This is outside the acceptable error range of 5%.

Possible sources of error:

  1. Air resistance was not accounted for in your model
  2. The timing method introduced systematic error (reaction time ~0.15s)
  3. Surface friction was assumed negligible

Please revise your error analysis section and resubmit by next Friday.

`, ) expect(content).toContain('12.3%') expect(content).toContain('systematic error') expect(content).toContain('revise your error analysis') }) test('encouraging comment with resource links — text preserved', async ({page}) => { const content = await setAndGet( page, `

Excellent work this week! Your discussion post demonstrated a sophisticated understanding of the material.

To continue developing these ideas, I recommend:

`, ) expect(content).toContain('sophisticated understanding') expect(content).toContain('Keynesian economics') expect(content).toContain('macroeconomic policy') }) })