import {test, expect} from '../../fixtures/test' // STEM courses in Canvas contain specialized content: chemical formulas with // subscripts, physics equations with superscripts, code blocks with algorithms, // data tables with measurement units, and diagram captions. These patterns test // whether dense scientific content survives the RCE pipeline intact. test.describe('Canvas STEM course 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('chemistry: molecular formula with subscripts — text preserved', async ({page}) => { const content = await setAndGet( page, `

The combustion of glucose (C6H12O6) produces carbon dioxide (CO2) and water (H2O) according to the balanced equation:

C6H12O6 + 6O2 → 6CO2 + 6H2O

`, ) expect(content).toContain('combustion of glucose') expect(content).toContain('carbon dioxide') expect(content).toContain('balanced equation') }) test('physics: measurement table with units — data preserved', async ({page}) => { const content = await setAndGet( page, `
Pendulum experiment: period vs. length
Length (cm)Trial 1 (s)Trial 2 (s)Average (s)
251.010.991.00
501.431.411.42
1002.012.032.02
`, ) expect(content).toContain('Pendulum experiment') expect(content).toContain('period vs. length') expect(content).toContain('1.42') }) test('biology: cell cycle description with terms — all preserved', async ({page}) => { const content = await setAndGet( page, `

Phases of Mitosis

Prophase
Chromosomes condense; spindle apparatus begins to form
Metaphase
Chromosomes align along the metaphase plate
Anaphase
Sister chromatids separate and move to opposite poles
Telophase
Nuclear envelope reforms; chromosomes decondense
`, ) expect(content).toContain('Prophase') expect(content).toContain('metaphase plate') expect(content).toContain('Sister chromatids separate') expect(content).toContain('Nuclear envelope reforms') }) test('computer science: algorithm pseudocode in pre block — preserved', async ({page}) => { const content = await setAndGet( page, `

Binary search algorithm pseudocode:

function binarySearch(arr, target):
    low = 0
    high = length(arr) - 1
    while low <= high:
        mid = (low + high) / 2
        if arr[mid] == target: return mid
        if arr[mid] < target: low = mid + 1
        else: high = mid - 1
    return -1

Time complexity: O(log n) — much faster than linear search for sorted arrays.

`, ) expect(content).toContain('binarySearch') expect(content).toContain('linear search') }) test('engineering: requirements table — specifications preserved', async ({page}) => { const content = await setAndGet( page, `

Project Requirements

ParameterMinimumMaximumUnit
Input voltage3.05.5V
Operating temperature-4085°C
Current draw (idle)050mA
`, ) expect(content).toContain('Input voltage') expect(content).toContain('Operating temperature') expect(content).toContain('Current draw') }) })