Skip to content

[Feature]: Allow image index to be excluded #314

New issue

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

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

Already on GitHub? # to your account

Open
1 task done
gigaSproule opened this issue Sep 6, 2024 · 2 comments
Open
1 task done

[Feature]: Allow image index to be excluded #314

gigaSproule opened this issue Sep 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@gigaSproule
Copy link

gigaSproule commented Sep 6, 2024

Is your feature request related to a problem? Please describe.

When using GitHub, the PR diff logic seems to fall over when # is used in the file name. By being able to specify the image title, it should be possible to exclude the index, or having a way to use a different character instead of #, therefore getting around this limitation.

Describe the solution you'd like

It would be good if there was a global property to disable the image #index if a title is provided, or have a global property to alter the character used (so it could be set to - to create test name -0.png instead of test name #0.png.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gigaSproule gigaSproule added the enhancement New feature or request label Sep 6, 2024
@gigaSproule
Copy link
Author

As a work around, I've created a custom command to wrap around the matchImage command.

Cypress.Commands.add(
  "matchSnapshot",
  {
    prevSubject: "optional"
  },
  (subject, options?: Cypress.MatchImageOptions) => {
    (subject ? cy.wrap(subject) : cy).matchImage({
      ...options,
      matchAgainstPath: `${Cypress.spec.absolute.replace(Cypress.spec.baseName ?? "", "")}/__image_snapshots__/${options?.title ?? Cypress.currentTest.titlePath.join(" ")}.png`
    });
  }
);

@FRSgit
Copy link
Member

FRSgit commented Sep 14, 2024

Hey! I believe your issue will be fixed once this change will be fixed. And this will happen as a part of ongoing v4 release work. Please wait a moment for it to happen 🙏

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants