Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Test Runner can't detect Angular Storybook Instance #506

Closed
fabianvieri opened this issue Aug 20, 2024 · 1 comment
Closed

[Bug]: Test Runner can't detect Angular Storybook Instance #506

fabianvieri opened this issue Aug 20, 2024 · 1 comment
Labels
bug Something isn't working needs triage

Comments

@fabianvieri
Copy link

Describe the bug

I got this error when try to run test runner on angular 17 with storybook, while the storybook instance already running on port 6006

[test-storybook] It seems that your Storybook instance is not running at: http://127.0.0.1:6006. Are you sure it's running?

If you're not running Storybook on the default 6006 port or want to run the tests against any custom URL, you can pass the --url flag like so:

yarn test-storybook --url http://127.0.0.1:9009

More info at https://github.com/storybookjs/test-runner#getting-started

To Reproduce

Application created using Angular 17.3.0 and Storybook 8.2.6,
Stories created like below,

import { Meta, StoryObj } from '@storybook/angular';
import { expect } from '@storybook/jest';
import { within } from '@storybook/test';
import { ButtonComponent } from './button.component';

export default {
  title: 'Component/Button',
  component: ButtonComponent,
  tags: ['autodocs'],
  render: (args) => ({ props: { ...args } }),
} as Meta<ButtonComponent>;

type ButtonComponentStory = StoryObj<ButtonComponent>;

export const Primary: ButtonComponentStory = {
  args: {
    primary: true,
    label: 'Button',
  },
  play: async ({ canvasElement }) => {
    const canvas = within(canvasElement);
    let primaryButton = canvas.getByTestId('button');
    await expect(primaryButton.innerText).toBe('Button');
  },
};

System

Storybook Environment Info:
  System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
  Binaries:
    Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD <----- active
    pnpm: 8.9.0 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
  npmPackages:
    @storybook/addon-essentials: ^8.2.6 => 8.2.6
    @storybook/addon-interactions: ^8.2.6 => 8.2.6
    @storybook/addon-links: ^8.2.6 => 8.2.6
    @storybook/addon-onboarding: ^8.2.6 => 8.2.6
    @storybook/angular: ^8.2.6 => 8.2.6
    @storybook/blocks: ^8.2.6 => 8.2.6
    @storybook/jest: ^0.2.3 => 0.2.3
    @storybook/test: ^8.2.6 => 8.2.6
    @storybook/test-runner: ^0.19.1 => 0.19.1
    storybook: ^8.2.6 => 8.2.9

Additional context

No response

@fabianvieri fabianvieri added bug Something isn't working needs triage labels Aug 20, 2024
@janettempt
Copy link

i also facing this problem. pls help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants