Skip to content

Conversation

@jcfranco
Copy link
Member

@jcfranco jcfranco commented Jan 5, 2026

Related Issue: #11268

Summary

Continues migration of Puppeteer-based common test helpers to Vitest browser mode.

@github-actions github-actions bot added the refactor Issues tied to code that needs to be significantly reworked. label Jan 5, 2026
@jcfranco jcfranco requested a review from Copilot January 5, 2026 09:29
@jcfranco jcfranco added the skip visual snapshots Pull requests that do not need visual regression testing. label Jan 5, 2026
Copy link
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 migrates the openClose common test helper from Puppeteer-based E2E testing to Vitest browser mode, continuing the modernization effort outlined in issue #11268.

Key Changes

  • Removed Puppeteer-based openClose.ts implementation
  • Added new browser-mode implementation in open-close.ts
  • Updated export statements to reflect the migration
  • Migrated test usage across 13 component test files from Puppeteer to browser mode

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/components/src/tests/commonTests/openClose.ts Removed legacy Puppeteer implementation
packages/components/src/tests/commonTests/index.ts Removed openClose export from legacy module
packages/components/src/tests/commonTests/browser/open-close.ts New browser-mode implementation
packages/components/src/tests/commonTests/browser/index.ts Added openClose export for browser module
packages/components/src/components/tooltip/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/sort-handle/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/sheet/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/popover/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/notice/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/input-time-zone/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/input-time-picker/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/input-date-picker/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/dropdown/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/dialog/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/combobox/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/block/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/autocomplete/*.tsx Migrated tests from Puppeteer to browser mode
packages/components/src/components/alert/*.tsx Migrated tests from Puppeteer to browser mode

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


try {
const renderResult = await setup();
await setUpEventListeners(renderResult.el.localName as keyof DeclareElements);
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The type casting to keyof DeclareElements could fail at runtime if renderResult.el.localName is not a recognized component tag. Add validation or use a safer type pattern to prevent invalid component tags from being passed to setUpEventListeners.

Copilot uses AI. Check for mistakes.
Comment on lines +174 to +180
if (startOpen) {
const component = document.createElement(tag);
component[openPropName] = true;

document.body.append(component);
}

Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

When startOpen is true, this creates a duplicate element in addition to the one already created by setup(). The newly created component is appended to document.body but renderResult.el from the setup function is used for the test assertions, potentially causing test failures. Either remove this block or ensure only one element is created.

Suggested change
if (startOpen) {
const component = document.createElement(tag);
component[openPropName] = true;
document.body.append(component);
}

Copilot uses AI. Check for mistakes.
await testOpenCloseEvents({
animationsEnabled: !effectiveOptions.willUseFallback,
collapsedOnClose: effectiveOptions.collapsedOnClose,
openPropName: effectiveOptions.openPropName!,
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The non-null assertion operator (!) assumes openPropName is always defined, but this relies on the defaultOptions merge. Consider explicitly checking this value or refining the type definition to make this guarantee explicit.

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +73
describe("openClose", () => {
openClose(() => mount("calcite-notice"));
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

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

The migrated test no longer includes the collapsedOnClose: \"vertical\" option that was present in the Puppeteer version. This removes test coverage for vertical collapse behavior in the notice component.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Issues tied to code that needs to be significantly reworked. skip visual snapshots Pull requests that do not need visual regression testing. Stale Issues or pull requests that have not had recent activity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants