Skip to content

Build: Fix and improve mcp addon e2e test#33905

Merged
yannbf merged 1 commit into
nextfrom
yann/fix-mcp-e2e
Feb 23, 2026
Merged

Build: Fix and improve mcp addon e2e test#33905
yannbf merged 1 commit into
nextfrom
yann/fix-mcp-e2e

Conversation

@yannbf
Copy link
Copy Markdown
Member

@yannbf yannbf commented Feb 23, 2026

Closes #

What I did

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

Release Notes

  • Tests
    • Enhanced test coverage to validate support for an additional toolset with accessibility tools and status indicators.

@yannbf yannbf self-assigned this Feb 23, 2026
@yannbf yannbf added build Internal-facing build tooling & test updates ci:normal labels Feb 23, 2026
@yannbf yannbf moved this to In Progress in Core Team Projects Feb 23, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Feb 23, 2026

View your CI Pipeline Execution ↗ for commit 5eb1409

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ❌ Failed 7m 44s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-23 11:13:15 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

This pull request updates an e2e test to verify a newly added third "test" toolset and its accessibility tool, replacing previous assertions that checked for two enabled toolsets with more granular visibility and status checks.

Changes

Cohort / File(s) Summary
E2E Test Update
code/e2e-tests/addon-mcp.spec.ts
Removed assertion counting enabled toolsets; added assertions to verify presence, visibility, and status of a third "test" toolset and its nested accessibility tool.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • storybookjs/storybook#33514: Modifies the same e2e test file and adjusts MCP toolset assertions, likely related to the same feature or test scenario being developed.
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
code/e2e-tests/addon-mcp.spec.ts (2)

134-134: Test name is now misleading.

The test name says "should show both toolsets as enabled" but now verifies three toolsets (dev, docs, and test). Consider updating it to reflect the actual assertion count.

✏️ Suggested rename
-      test('should show both toolsets as enabled', async ({ page }) => {
+      test('should show all toolsets as enabled', async ({ page }) => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/e2e-tests/addon-mcp.spec.ts` at line 134, Rename the misleading test
title in the test call whose current name is "should show both toolsets as
enabled" to accurately reflect the assertions (e.g., "should show all three
toolsets as enabled (dev, docs, test)"); update the string passed to the
test(...) invocation so the test name matches the actual verification of the
dev, docs, and test toolsets.

147-150: Consider using exact text matching for the "test" selector.

The text=test selector performs substring matching in Playwright, which could inadvertently match elements containing "test" elsewhere (e.g., "toolset", "contest", etc.). Using exact matching would make this more robust.

Additionally, using .first() on .toolset-status suggests multiple status elements may exist within the toolset. If the first match isn't the intended element (e.g., due to DOM reordering), this could lead to flaky failures.

♻️ Proposed fix using exact text matching
-        const testToolset = page.locator('.toolset', { has: page.locator('text=test') });
+        const testToolset = page.locator('.toolset', { has: page.locator('text="test"') });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@code/e2e-tests/addon-mcp.spec.ts` around lines 147 - 150, The selector uses
substring matching and .first() which can be flaky; change the locator to use
exact text matching (replace page.locator('.toolset', { has:
page.locator('text=test') }) with page.locator('.toolset', { has:
page.locator('text=\"test\"') }) or equivalent exact-text syntax) and stop
relying on .first() — instead assert that the toolset contains a status element
with the exact text 'enabled' (e.g., use testToolset.locator('.toolset-status',
{ hasText: 'enabled' }) and expect(...).toBeVisible() or
expect(testToolset.locator('.toolset-status')).toHaveText('enabled') if a single
status is guaranteed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@code/e2e-tests/addon-mcp.spec.ts`:
- Line 134: Rename the misleading test title in the test call whose current name
is "should show both toolsets as enabled" to accurately reflect the assertions
(e.g., "should show all three toolsets as enabled (dev, docs, test)"); update
the string passed to the test(...) invocation so the test name matches the
actual verification of the dev, docs, and test toolsets.
- Around line 147-150: The selector uses substring matching and .first() which
can be flaky; change the locator to use exact text matching (replace
page.locator('.toolset', { has: page.locator('text=test') }) with
page.locator('.toolset', { has: page.locator('text=\"test\"') }) or equivalent
exact-text syntax) and stop relying on .first() — instead assert that the
toolset contains a status element with the exact text 'enabled' (e.g., use
testToolset.locator('.toolset-status', { hasText: 'enabled' }) and
expect(...).toBeVisible() or
expect(testToolset.locator('.toolset-status')).toHaveText('enabled') if a single
status is guaranteed).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b4b575 and 5eb1409.

📒 Files selected for processing (1)
  • code/e2e-tests/addon-mcp.spec.ts

@yannbf yannbf merged commit af35766 into next Feb 23, 2026
17 of 23 checks passed
@yannbf yannbf deleted the yann/fix-mcp-e2e branch February 23, 2026 11:11
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Core Team Projects Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Internal-facing build tooling & test updates ci:normal

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants