Baseline management on a child branch

When working on a branch that is a child of another branch (the parent branch) and the child branch doesn't have a baseline, Eyes will use a fallback baseline from the parent branch.

Every time that a child branch is created or merged, Eyes creates a timestamp. This timestamp is essential when identifying the correct baseline.

If there is a baseline in the child branch, Eyes uses that baseline for comparison. If there is no corresponding baseline on the child branch and the Eyes SDK has access to Git, Eyes looks for the last baseline on the parent branch based on the timestamp (the time that the child branch was last created or merged).

If the Eyes SDK does not have access to Git, you need to explicitly specify the timestamp. Use the following Git command to extract the timestamp:

Copy
HASH=$(git merge-base ${branchName} ${parentBranchName}) && git show -q --format=%aI $HASH

Once you have the timestamp, use one of the following commands to push the timestamp to Eyes:

  • Environment Variable: APPLITOOLS_GIT_MERGE_BASE_TIMESTAMP

  • Eyes Configuration object

  • API Call:

    Copy
    curl --location --request POST 'https://<eyes-server>.applitools.com/api/sessions/batches/<commitSha>/bypointerid?apiKey=<api key>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "scmSourceBranch": "feature",
      "scmTargetBranch": "main",
      "branchName": "<child-branch>",
      "parentBranchName": "<parent-branch>",
      "parentBranchBaselineSavedBefore": "<timestamp>"
    }'

If the parent branch is rebased to the child, Eyes takes the latest baseline from the child. If there is no baseline in the child, Eyes takes the baseline from the time that the child was originally created.

Resolving conflicts

If you merge the parent branch to a child branch after changes were made on the parent branch, these differences may appear as unresolved in the child branch. To resolve the issue manually:

  1. Merge the code changes of the parent branch into the child branch to make sure that you are aligned with the parent branch's last version.

  2. Perform another build that runs tests on the child branch.

  3. Re-accept the baselines that had the conflicts and save changes.

Custom properties

To set Eyes to always use the latest baseline from the parent branch even if there is a later baseline in the child branch, set ignoreGitMergeBase to true.

To force Eyes to always use the baseline from the parent branch, and ignore a baseline on the child branch, set compareWithParentBranch to true.