How to manually upload baseline screenshots in Percy for base branch

927 Views Asked by At

I am currently working on a react-native application and want to use Percy, a visual testing service to catch UI changes in my app.

I don't go the storybook way.

Currently, we use detox for testing, it generates screenshots artifacts which we directly upload to Percy.

But the test comparison always fails right now because we don't have corresponding baseline snapshots for the base branch, develop.

So, I want to be able to upload those baseline snapshots for the default branch manually and change them when I want.

I need help with that.

I have already checked the @percy/cli docs, I only see a way to upload manually but I don't see how to do it for the base branch.

Thanks

1

There are 1 best solutions below

0
On

You can use PERCY_BRANCH to change the builds git branch and run a build to upload a set of screenshots you'd like to use for a baseline. https://docs.percy.io/docs/environment-variables#optional Something like:

PERCY_BRANCH="your-baseline-branch-name-here" npx percy upload ./screenshots (or whatever the CLI command you're running -- if it's the CLI the PERCY_BRANCH env var will work)