Skip to content

Fix tests that were not being run due to missing browser context#3340

Merged
BryanValverdeU merged 3 commits into
masterfrom
revert-3338-revert-3331-u/bvalverde/fixNotRanTests
May 12, 2026
Merged

Fix tests that were not being run due to missing browser context#3340
BryanValverdeU merged 3 commits into
masterfrom
revert-3338-revert-3331-u/bvalverde/fixNotRanTests

Conversation

@BryanValverdeU
Copy link
Copy Markdown
Contributor

@BryanValverdeU BryanValverdeU commented May 12, 2026

Re-add tests not being executed and fix the coverage github action, confirmed it is working here: https://github.com/microsoft/roosterjs/actions/runs/25738247389/job/75581074727?pr=3340

@BryanValverdeU BryanValverdeU marked this pull request as ready for review May 12, 2026 13:54
@BryanValverdeU BryanValverdeU changed the title Revert "Revert "Fix tests that were not being run due to missing browser context"" Fix tests that were not being run due to missing browser context May 12, 2026
Copy link
Copy Markdown
Contributor

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

This PR updates the Karma/browser-dependent test infrastructure and several paste/image-edit tests so they execute reliably again in a real browser context (and restores/adjusts some E2E paste coverage).

Changes:

  • Adjusted Chrome-only test gating (itChromeOnly) and updated multiple E2E/unit expectations to match browser-produced models/CSS rule serialization.
  • Extended Word paste E2E coverage with an additional Word clipboard fixture (wordClipboardContent4) and a new E2E scenario.
  • Removed/avoided some test flakiness sources (e.g., clipboard write) and aligned test setup objects with required fields (e.g., globalCssRules).

Reviewed changes

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

Show a summary per file
File Description
packages/roosterjs-content-model-plugins/test/paste/plugin/ContentModelPastePluginTest.ts Adds missing globalCssRules field to the paste event setup used by plugin unit tests.
packages/roosterjs-content-model-plugins/test/paste/e2e/htmlTemplates/wordClipboardContent.ts Adds a new Word clipboard fixture (wordClipboardContent4) for E2E coverage.
packages/roosterjs-content-model-plugins/test/paste/e2e/cmPasteTest.ts Updates expected content model structures for paste E2E to match current output.
packages/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromWordTest.ts Updates existing Word paste expectations, removes clipboard write, and adds a new E2E case (currently includes a blocking debugger).
packages/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromGoggleSheetsTest.ts Updates expected table format to include legacy table attributes.
packages/roosterjs-content-model-plugins/test/paste/e2e/cmPasteFromExcelTest.ts Updates expected Excel paste table/cell/segment formatting and legacy table attributes.
packages/roosterjs-content-model-plugins/test/imageEdit/utils/generateDataURLTest.ts Makes generateDataURL tests deterministic by stubbing toDataURL and adjusting the error-case expectation.
packages/roosterjs-content-model-dom/test/testUtils.ts Changes itChromeOnly implementation to use UA sniffing instead of __karma__ config.
packages/roosterjs-content-model-core/test/command/paste/retrieveHtmlInfoTest.ts Updates expected CSS rule selector trimming and CSS text normalization; adds containsBlockElements expectation.

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

const model = editor.getContentModelCopy('disconnected');

expect(wordFile.processPastedContentFromWordDesktop).toHaveBeenCalled();
debugger;
) {
const func = __karma__.config.browser == 'Chrome' ? it : xit;
const ua = navigator.userAgent;
const isChrome = /Chrome\//.test(ua) && !/Edg\//.test(ua);
Comment on lines 39 to +44
const image = document.createElement('img');
image.width = 0; // Force error
image.height = 0;
image.src = 'https://th.bing.com/th/id/OIP.kJCCjl_yUweRlj94AdU-egHaFK?rs=1&pid=ImgDetMain';
const url = generateDataURL(image, editInfo);
expect(url).toBe(
'https://th.bing.com/th/id/OIP.kJCCjl_yUweRlj94AdU-egHaFK?rs=1&pid=ImgDetMain'
);
expect(url).toBe('data:,');
@BryanValverdeU BryanValverdeU merged commit ef08da4 into master May 12, 2026
11 checks passed
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