import {test, expect} from '../../fixtures/test' // Canvas discussion posts combine formatted text, embedded images, links to // course files, and quoted replies. Instructors write prompts and students // paste rich content. These realistic full-post patterns verify the complete // formatting pipeline works end-to-end for the second most-used Canvas editor. test.describe('Canvas discussion post 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('discussion prompt with questions and links — all text preserved', async ({page}) => { const content = await setAndGet( page, `

Week 3 Discussion: Ethical Implications of AI

Read the article AI Ethics in Education before responding.

Please address all three of the following questions in your initial post:

  1. How might AI tools affect academic integrity in higher education?
  2. What safeguards should institutions implement?
  3. How do you personally plan to use AI tools ethically in your coursework?

Your response should be at least 250 words and cite at least two sources.

`, ) expect(content).toContain('Ethical Implications of AI') expect(content).toContain('AI Ethics in Education') expect(content).toContain('academic integrity') expect(content).toContain('at least 250 words') }) test('student reply quoting original post — blockquote and response preserved', async ({ page, }) => { const content = await setAndGet( page, `

Original post: How might AI tools affect academic integrity?

Building on the original question, I think the key concern is not the tools themselves but how students choose to use them. When I used ChatGPT for brainstorming my last essay, I was transparent about it in my methods section.

According to Johnson (2024), "the responsibility for ethical AI use rests with both institutions and individual learners."

`, ) expect(content).toContain('academic integrity') expect(content).toContain('transparent about it') expect(content).toContain('responsibility for ethical AI use') }) test('discussion post with embedded image and text — all preserved', async ({page}) => { const content = await setAndGet( page, `

I found this diagram in the textbook very helpful:

Software development lifecycle diagram

As you can see from the diagram, the testing phase often takes as long as the development phase itself. This surprised me because I assumed most time was spent writing code.

`, ) expect(content).toContain('Software development lifecycle diagram') expect(content).toContain('testing phase often takes') }) })