Skip to main content

Baseline Branches

Applitools supports branching and merging to align with your development workflow, facilitating collaboration and maintaining consistency across your application.

Applitools allows teams to create branches that contain versions of their baselines. This feature works seamlessly with Source Control tools like Github and Bitbucket (See our Integrations Guide for more information).

Teams can leverage Applitools' branching system to coincide with development in order to maintain and ultimately merge different versions of baselines.

How It Works

Configuring Branches

Baseline Logic

No Branches Configured

When a test is run, Applitools Eyes will take the Baseline information for the given test (App Name, Test Name, Browser, Operating System and Viewport Size) and look for an existing baseline to compare with. If no branchName is configured, then Applitools will only check the default branch for an existing baseline. If a baseline is found, it will compare against it. If no baseline is found, a New baseline will be saved in the default branch for future runs.

Branch Configured

If a branchName is configured, Applitools will first check the specified branch for an existing baseline. If one is found, the comparison will occur against the baseline in the specified branch. If one is not found, Applitools will then check the default branch for a matching baseline as normal. If no baseline is found in either the specified branch or the default branch, then a New baseline will be created in the specified branch.

Branch and ParentBranch Configured

If both a branchName and a parentBranchName are configured, Applitools will then follow a similar pattern and check first the branch specified as the branchName, then the parentBranchName followed by the default branch. Once again if no baseline is found, then a New baseline will be created in the specified branch.

Managing Branches on the Branch Baselines View

When a test is run without branchName configured, the test will use the default branch. However, when the branchName property is configured, the test will run within the context of the branch specified.

On the Branch Baselines Screen, users can review all branches that have been created as well as see the status of each baseline image on the selected branch. See the Branch Baselines guide for more information.

Merging Branches

Applitools offers the capability to merge two branches together. This process is very similar to a Pull Request in Source Control tools. Check out the Compare & Merge Branches guide for more details.

Source Control Integration

When a Source Control integration is configured, branches are handled automatically by the integration when tests are triggered through CI/CD. Checkout one of our guides on Source Control integrations for more information.

Managing Baselines

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:

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:

    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.

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.