Skip to content

empty diff folders created when there is no baselines #879

Open
@alcpereira

Description

@alcpereira

Environment (please complete the following information):

  • Node.js version: 22.14.0
  • NPM version: yarn 4.4.0
  • Browser name and version: Chrome 117
  • Platform name and version: Linux CI
  • WebdriverIO version: 9.12.2
  • @wdio/visual-service version: 6.4.0

Config of WebdriverIO + @wdio/visual-service

const imageServiceOpts: VisualServiceOptions = {
  autoSaveBaseline: false,
  baselineFolder: path.join("storybook-visual-tests", "storybookTestBaseline"),
  screenshotPath: "storybook-visual-tests",
  waitForFontsLoaded: true,
  disableCSSAnimation: true,
  disableBlinkingCursor: true,
  clearRuntimeFolder: true,
  ignoreAntialiasing: true,
  storybook: {
    url: baseUrlDomain,
    additionalSearchParams: new URLSearchParams({ globals: `cssVariables:${THEMES[themeId]}` }),
    getStoriesBaselinePath: (category, component) => `${category}/${component}/${themeId}`,
    numShards: 32,
    skipStories: createRegex(),
  },
};

const config: WebdriverIO.Config = {
  runner: "local",
  specs: [],
  exclude: [],
  maxInstances: 20,
  capabilities: [],
  waitforTimeout: 10_000,
  logLevel: "error",
  services: [["visual", imageServiceOpts]],
  framework: "mocha",
  reporters: ["spec"],
  hostname: "localhost",
  port: 4444,
  path: "/wd/hub",
};

Describe the bug
When there is no baselines (new project, new folder structure -change in getStoriesBaselinePath()-),

To Reproduce

  • Use a project with various visual tests in Storybook mode with the default getStoriesBaselinePath or use a custom one.
  • Remove the baselines folders
  • Run the tests
  • Check the diff folder

Expected behavior
When the test pass, there should be no folders created in the diff. Only if there is failed test.

Additional context
The issue seems to be in getAndCreatePath that is called too soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions