<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: KienHT</title>
    <description>The latest articles on Forem by KienHT (@kienht).</description>
    <link>https://forem.com/kienht</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1929376%2Fe2df93c9-bc7c-4d90-a27d-a83a9f524da6.png</url>
      <title>Forem: KienHT</title>
      <link>https://forem.com/kienht</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kienht"/>
    <language>en</language>
    <item>
      <title>Enhance Visual Testing CI Pipelines with Cypress Image Diff GitHub App</title>
      <dc:creator>KienHT</dc:creator>
      <pubDate>Wed, 14 Aug 2024 16:19:37 +0000</pubDate>
      <link>https://forem.com/kienht/enhance-visual-testing-ci-pipelines-with-cypress-image-diff-github-app-4ci0</link>
      <guid>https://forem.com/kienht/enhance-visual-testing-ci-pipelines-with-cypress-image-diff-github-app-4ci0</guid>
      <description>&lt;p&gt;In the realm of continuous integration (CI), ensuring that your application maintains visual consistency is as crucial as functional accuracy. &lt;a href="https://www.npmjs.com/package/cypress-image-diff-js" rel="noopener noreferrer"&gt;cypress-image-diff&lt;/a&gt; has just launched their Github app, making it a CI/CD game-changer for developers and QA engineers. This article explores how this GitHub app can streamline your visual testing process and provides a step-by-step guide on getting started.&lt;/p&gt;

&lt;p&gt;Cypress Image Diff has gained significant traction in the open-source community over the past few years, becoming one of the most popular and widely downloaded visual regression tools for Cypress.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Cypress Image Diff Github app?
&lt;/h2&gt;

&lt;p&gt;Cypress Image Diff GitHub App integrates with Github CI pipelines and utilizes CircleCI pipelines to produce test artifacts, providing visual testing for Cypress, ensuring pixel-perfect UIs by comparing screenshots and highlighting discrepancies. As the first open-source GitHub App for Cypress visual regression testing, it offers detailed HTML reports and seamless GitHub CI/CD integration, making it a crucial tool for UI testing.&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-click Approval:&lt;/strong&gt; Directly commit baseline changes within your CI environment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detailed HTML Reporting:&lt;/strong&gt; Gain in-depth insights into visual differences with extensive HTML reports that showcase discrepancies clearly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free Of Charge:&lt;/strong&gt; Very first open-source project in visual regression test for Cypress that integrates with Github CI pipelines.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick Start Guide
&lt;/h2&gt;

&lt;p&gt;Getting started with Cypress Image Diff Github app is straightforward. Follow these steps to integrate it into your project:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Create a Cypress Image Diff Account
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Visit &lt;a href="https://cypress-image-diff.netlify.app/" rel="noopener noreferrer"&gt;Cypress Image Diff&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click “Sign up with GitHub” and authorize the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Link Your GitHub Repositories
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;After signing up, you will be redirected to the projects page or visit it &lt;a href="https://cypress-image-diff.netlify.app/projects" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click “Link GitHub repositories” and select the repositories where you want to install the app.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Set Up CircleCI
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Log in or create a CircleCI account &lt;a href="https://circleci.com/vcs-authorize/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.
&amp;gt; &lt;strong&gt;Note:&lt;/strong&gt; Only the login/register with email option is supported.&lt;/li&gt;
&lt;li&gt;Create a new project and link it to your GitHub repository.&lt;/li&gt;
&lt;li&gt;Configure your &lt;code&gt;.circleci/config.yml&lt;/code&gt; file as follows. If you don’t have one, create it. If you already have a configuration file, append the workflow:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;

  &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;visual-test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;docker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cypress/base:latest&lt;/span&gt;
      &lt;span class="na"&gt;working_directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
      &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Install Dependencies and Required Libraries&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
              &lt;span class="s"&gt;npm install&lt;/span&gt;
              &lt;span class="s"&gt;apt-get update &amp;amp;&amp;amp; apt-get install -y \&lt;/span&gt;
                &lt;span class="s"&gt;libgtk2.0-0 \&lt;/span&gt;
                &lt;span class="s"&gt;libgtk-3-0 \&lt;/span&gt;
                &lt;span class="s"&gt;libgbm-dev \&lt;/span&gt;
                &lt;span class="s"&gt;libnotify-dev \&lt;/span&gt;
                &lt;span class="s"&gt;libnss3 \&lt;/span&gt;
                &lt;span class="s"&gt;libxss1 \&lt;/span&gt;
                &lt;span class="s"&gt;libasound2 \&lt;/span&gt;
                &lt;span class="s"&gt;libxtst6 \&lt;/span&gt;
                &lt;span class="s"&gt;xauth \&lt;/span&gt;
                &lt;span class="s"&gt;xvfb&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Tests&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm run test&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_artifacts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cypress-image-diff-screenshots&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;store_artifacts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cypress-image-diff-html-report&lt;/span&gt;

  &lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
    &lt;span class="na"&gt;cypress-image-diff&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;visual-test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Commit and push the updated configuration to your GitHub repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Share CircleCI Project Token with Cypress Image Diff
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to your CircleCI project settings.&lt;/li&gt;
&lt;li&gt;Select “API Permissions” and create a new token with readonly scope.&lt;/li&gt;
&lt;li&gt;Copy this token, then go to the &lt;a href="https://cypress-image-diff.netlify.app/projects" rel="noopener noreferrer"&gt;Cypress Image Diff projects page&lt;/a&gt;, locate your project, access the settings, and save this token.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Start Pushing Commits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Push a commit to your repository. You will see commit statuses for both CircleCI and Cypress Image Diff.&lt;/li&gt;
&lt;li&gt;Once the Cypress Image Diff pipeline completes, click the “Details” link to view the detailed visual report.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why You Should Use Cypress Image Diff Github app
&lt;/h2&gt;

&lt;p&gt;From a developer’s perspective, integrating Cypress Image Diff Github app into your CI pipeline offers several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simplifies the process for developers by running tests within CI pipelines, eliminating the need to run them locally to view changes.&lt;/li&gt;
&lt;li&gt;Enhances team collaboration by allowing team members to review and approve pull requests without needing to run tests locally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re looking to boost your visual testing strategy, Cypress Image Diff Github app is a must-try. Its ease of setup and powerful features make it an invaluable tool for modern CI workflows.&lt;/p&gt;

&lt;p&gt;Feel free to share your experiences or ask questions about the app in the comments below!&lt;/p&gt;

&lt;p&gt;📚&lt;a href="https://github.com/kien-ht/cypress-image-diff-github-app" rel="noopener noreferrer"&gt;Learn more about Cypress Image Diff Github app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>testing</category>
      <category>ci</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
