chromaui / addon-visual-tests

Visual Tests addon for Storybook
MIT License
28 stars 1 forks source link

Baselines not transfering to branch #259

Open ghengeveld opened 3 months ago

ghengeveld commented 3 months ago

From AP-4139

How is the user affected? And what is the expected behavior?

I have a main branch with existing snapshot baselines. When I create a new branch off an existing branch like so:

main » test-branch

I'd expect that the baselines from main carry over to my new branch and get reflected in the addon panel.

Currently, I don't see the baselines from main in the addon panel. It prompts me to "create a test baseline"

image (5)

What are the steps for reproducing the issue?

On your main branch, take snapshots and accept them as baselines.

Create a new branch called test-branch. Check it out.

❌ See that you're compelled to create all new snapshots on this branch. I've tried publishing the branch and I still have to create test baselines,

❌ When I run a new build, I generate new snapshots.

NOTE:

This could be the correct behavior given this message.

image (6)

If it is, I'd expect that the addon would tell me what's going on. That it knows there are local builds on main, that I'm on test-branch which was branched from main, and that I should setup CI for the builds to carry over.

ghengeveld commented 1 month ago

This is related to, but not the same as #249.

ghengeveld commented 1 month ago

We might be able to solve this by passing the result of the Git command below to the lastBuildOnBranch query.

git for-each-ref --points-at HEAD --format="%(refname:short)"

This works when switching to a new branch, as the current commit will be pointed at by both the main and test-branch branches after creating test-branch from main. However, as soon as a new commit is made on test-branch, main will no longer be pointing at the same (new) commit.