<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Himashi Sandamini on Medium]]></title>
        <description><![CDATA[Stories by Himashi Sandamini on Medium]]></description>
        <link>https://medium.com/@sandaminihimashi?source=rss-97a71d9cb6a7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GRZrexTk2Ucl-eu0kVpx2w.jpeg</url>
            <title>Stories by Himashi Sandamini on Medium</title>
            <link>https://medium.com/@sandaminihimashi?source=rss-97a71d9cb6a7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:44:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandaminihimashi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A perfect getaway from the hassle]]></title>
            <link>https://medium.com/@sandaminihimashi/a-perfect-getaway-from-the-hassle-521738e9b5d?source=rss-97a71d9cb6a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/521738e9b5d</guid>
            <category><![CDATA[leisure]]></category>
            <category><![CDATA[vacation]]></category>
            <category><![CDATA[getaway]]></category>
            <dc:creator><![CDATA[Himashi Sandamini]]></dc:creator>
            <pubDate>Mon, 31 Oct 2022 12:22:51 GMT</pubDate>
            <atom:updated>2022-10-31T15:53:52.184Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s been months since Devochki (our girl group in the uni.) met and got around to relaxing together.</p><p>Ahh…I must say in this story, Devochki= Devochki-1 as our dearest Asii couldn’t make it. Baby priorities do matter you know. 🥺</p><p>We were planning this getaway for months but our schedules didn’t corporate.</p><p>Finally, after days of planning and procrastination here we chose The Fortress.</p><p>The Fortress is located on the southern coast of the country between Galle and Matara.</p><p>Our checking was at 2 pm but we made it to the hotel at around 1 pm. The staff warmly welcomed us and gave us a quick room tour.</p><p>Ahhh..the room. The ambiance, the view overlooking the beach and the amenities…everything was top-notch.🏬🏖👌🏽</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*yFcQ4euX4NL6xd2n_hzVwA.jpeg" /></figure><p>The staff person didn’t forget to mention the channel no.of the cricket match. 😉🏏</p><p>Next, was the most important, lunch. Hmmm…not the type of luncheon we expected but it was not bad. I would give 6/10 .. you know they could do more with the starter and main course varieties. Hmm next time may be.✌🏽</p><p>After having lunch we strolled around the hotel. Ahh I loved the different picture-perfect locations it had. The beach, lounge chairs, swing, beautiful lawn, and infinity pool caught our attention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otUnSIyMs30ZmKJQ2i9Q1g.jpeg" /></figure><p>Btw, we didn’t forget to capture some selfies and quirky photos while strolling.📸 🤪</p><p>The Sun was out bright so we headed back to the room and decided to watch the cricket match. Not the best day for lions. Better luck next time.😒</p><p>We refreshed ourselves and went back to take a walk around the hotel. The swing and the lounge chairs were already occupied so we decided to take a walk at the beach. It was the much needed vitamin sea therapy. Ahh..we didn’t get around to see the sunset as the Sun was already surrounded by clouds but the beautiful colors all over the sky were mesmerizing.😍⛅️</p><p>Stilt fishing was another unique thing caught our eyes.🐟We didn’t forget to capture the beautiful ocean view with the stilt fishers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-j8LNsWzV-jtRWSBIBNxAA.jpeg" /></figure><p>After the beach walk, we spent time on another swing (tbh I don’t know what to call it..it was more in between a swing and a lounge chair).</p><p>Time for evening tea..after having evening tea with complimentary sweets ushered by the hotel we decided to play some music to catch the vibe. Ohh their Bluetooth speaker was spot on.</p><p>Dinner time. All the seats inside the restaurants were occupied so we got a spot before the pool. It was an unexpected candlelight dinner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZEJdRmZw1bOWXnK5Bwisg.jpeg" /></figure><p>After dinner, we took a walk around the courtyard to burn the dinner calories. It was elegant and its design showcased the architectural style of the colonial era.</p><p>Hmm… time to return to the room and have a good night’s sleep.</p><p>Day 2. Our last day. Walked up to the alarm around 6.30. A sad fact, our room was not the perfect location to witness the sunrise. In fact, the sun has already risen by the time we walked up.</p><p>We had breakfast. I would rate it 8/10.</p><p>After the breakfast we thought of exploring the hotel a bit more and having some more captures around the pool. I must say the staff was really supportive in suggesting scenic views especially for awkward posers like us. 😅</p><p>We didn’t forget to do a boomerang in the swinging lounge chairs.😄</p><p>Finally, it was time to leave, ending the long overdue trip.🥺</p><p>Good Bye The Fortress. We loved your hospitality, service, aesthetics and most importantly the surrounding.</p><p>Till we meet next time.👋🏼</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=521738e9b5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Musings]]></title>
            <link>https://medium.com/@sandaminihimashi/my-musings-7dee697f4907?source=rss-97a71d9cb6a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dee697f4907</guid>
            <dc:creator><![CDATA[Himashi Sandamini]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 10:20:36 GMT</pubDate>
            <atom:updated>2022-09-21T06:52:58.942Z</atom:updated>
            <content:encoded><![CDATA[<p>To my beloved in heaven….🤍</p><p>After days of contemplation here I am putting my thoughts into words</p><p>One month has just passed since she left us for good</p><p>Though a month has passed I never feel that she is not around</p><p>But deep down my heart sores for facing the reality..the reality I hardly wanted to face</p><p>Every day I prayed for her good health..but for some reason, some strange feeling was haunting my head since she was on the sick bed</p><p>I tried hard to find the courage to see her lying on a hospital bed..but I couldn’t..caz I knew seeing her would break my heart 💔 which she would hate to see</p><p>Back when she was at home, when I visited her I never wanted her to lie on the bed as I desperately didn’t want to see her eyes closed…in hindsight, literally, I was afraid of the reality that I’m facing today..the feeling of losing her</p><p>I didn’t have the courage of looking at her dead eyes caz I didn’t want to make my last memory of her about lying in a coffin</p><p>I want to hold her hand again, make her sit on the bed, and sing<em> All the King’s Horses and All the Kings Men</em> 🐎💂 again like we sang it for the last time</p><p>I never thought that would be the last time we sang it together..now I realize moments are precious..those lil moments are the only ones left with us to cherish forever</p><p>Even though she lived a long life than an average human would ever live (but a year less than the Queen 👸😁) I always wished for a much longer life for her…well tbh, I wished my grandma to hit 💯</p><p>I wish, I wish she was here..I wish she was here to see our good times, and most importantly to sing with us all the nursery rhymes together again</p><p>For all the merits she earned in this life I know for sure that she has already gained a good life</p><p>Lastly, I want to say I love you and I miss you. Please be my grandma 👵 in my next life too ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dee697f4907" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applitools Eyes Match Levels]]></title>
            <link>https://medium.com/@sandaminihimashi/applitools-eyes-match-levels-7d638e89e27a?source=rss-97a71d9cb6a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d638e89e27a</guid>
            <category><![CDATA[automated-visual-testing]]></category>
            <category><![CDATA[image-comparison]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[visual-testing-tools]]></category>
            <category><![CDATA[visual-testing]]></category>
            <dc:creator><![CDATA[Himashi Sandamini]]></dc:creator>
            <pubDate>Mon, 10 Jan 2022 03:59:34 GMT</pubDate>
            <atom:updated>2022-01-10T03:59:34.241Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello 👋</p><p>I hope my <a href="https://medium.com/@sandaminihimashi/setting-up-applitools-eyes-in-selenium-java-project-79bdca872052">previous article</a> gave you some idea on how to set up Applitools Eyes in your Selenium Java project and execute tests with Eyes.</p><p>If you are curious about what is visual testing and what is Applitools Eyes 👀 do check out my first <a href="https://medium.com/@sandaminihimashi/automated-visual-testing-with-applitools-eyes-d71368bbf5ec">article</a> of the series.</p><p>If I give you a brief definition of Applitools Eyes, it is an automated visual testing tool that you can couple with your functional test suite.</p><p>From this article let’s see what are match levels and different types of match levels in Applitools Eyes.</p><p>In Eyes, you can compare the baseline image with your checkpoint image in different techniques to suit the right level of image matching. This option of Eyes is called <strong>Match Levels</strong>.</p><p>Now let’s check out the different types of match levels in Applitools Eyes.</p><h4>Exact</h4><p>This match level performs a <strong>pixel to pixel comparison</strong> between the baseline image and the checkpoint image where human beings would even not notice. When you execute tests with this match level across different browsers, devices or operating systems there may be slight differences in the content. Therefore, this type of image comparison is highly flaky and unreliable. Hence, this match level is discouraged to use.</p><h4>Strict</h4><p>This match level captures small changes in large UIs but not pixel to pixel. It uses artificial intelligence to capture the changes that happened on the page which are perceptible to the human eye. From strict match level, Eyes detects changes in font, text, graphics, color and position of elements.</p><p>If a match level is not specified STRICT is the default match level in Eyes. This match level can be effective when there are regression tests that run on a particular browser/OS with mostly static content.</p><h4>Content</h4><p>This match level is similar to the STRICT match level where pixel to pixel does not happen except focuses on the content changes on the page excluding style differences. This match level helps when you have an application that verifies the content not necessarily the color.</p><h4>Layout</h4><p>The Layout match level can be used to verify web pages that have dynamic content. It omits content changes but only worries about layout changes. When this match level is applied, Eyes identifies various page elements in the checkpoint image and baseline image and verifies that the relative positions of elements remain unaffected. It makes sure the structure of the webpage is correct. This match level can be useful with applications that have dynamic content, language localization or run across different platforms (operating systems, browsers, devices etc.).</p><p>Now let’s see how to configure a match level in your Selenium Java code. Make sure you have followed the prerequisites mentioned in my previous article.</p><p>The required match level can be invoked from the <strong>enum</strong> MatchLevel.</p><p>The below sample code shows how the match level is set in a test case.</p><p><strong>*Please note that the code can be further refactored naturally to configure the match level separately to support multiple test cases.</strong></p><pre>public class GoogleTest {<br>    private WebDriver webdriver;<br>    private Eyes eyes;<br><br>    <br>    @BeforeClass<br>    public void setUp() {<br>        <em>// Set executable file<br>        </em>System.<em>setProperty</em>(&quot;webdriver.chrome.driver&quot;, &quot;resources/chromedriver&quot;);<br>        <em>// Initiate the web driver object<br>        </em>webdriver = new ChromeDriver();<br><br>        <em>//Load the property file<br>        </em>Properties properties = System.<em>getProperties</em>();<br>        try {<br>            properties.load(new FileInputStream(new File(&quot;resources/test.properties&quot;)));<br>        } catch (Exception e) {<br>            e.printStackTrace();<br>            System.<em>exit</em>(-1);<br>        }<br><br>        <em>// Navigate to page url<br>        </em>webdriver.get(&quot;https://google.com&quot;);</pre><pre><em>        // Maximize window<br>        </em>webdriver.manage().window().maximize();</pre><pre>        <em>// Create Eyes constructor<br>        </em>eyes = new Eyes();<br><br>        <em>// Set the API key in property file<br>        </em>eyes.setApiKey(System.<em>getProperty</em>(&quot;applitools.api.key&quot;));<br>    }</pre><pre>    @Test<br>    public void testSearchResultsPage() {<br>       WebElement textbox =     webdriver.findElement(By.<em>xpath</em>(&quot;//input[@title=&#39;Search&#39;]&quot;));<br>       String searchTerm = &quot;apple&quot;;<br>       textbox.sendKeys(searchTerm);<br>       textbox.sendKeys(Keys.<em>ENTER</em>);<br><strong>       eyes.setMatchLevel(MatchLevel.<em>LAYOUT</em>);</strong><br>       validateWindow();<br>     }<br><br>    @AfterClass<br>    public void closureTest() {<br>        webdriver.quit();<br>        eyes.abortIfNotClosed();<br>    }<br><br>    private void validateWindow() {<br>        eyes.open(webdriver, &quot;Google Search Test&quot;, Thread.<em>currentThread</em>().getStackTrace()[2].getMethodName());<br>        eyes.checkWindow();<br>        eyes.close();<br>    }<br>}</pre><p>First, let’s see what happens when you execute the above test case without setting a match level(in the above code match level is set to Layout).</p><p>The below image shows a side by side comparison of the baseline image and checkpoint image when no match level is set.</p><p>Differences are marked in pink. Differences in texts, graphics and position of elements are highlighted in the below image. If you look carefully at both baseline and checkpoint images you can see the match level name ‘Strict’ (default match level) is displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EO1dwyxEHfbza2MnDsb1BQ.png" /><figcaption>Baseline and Checkpoint image comparison when Strict match level applied</figcaption></figure><p>Now let’s set the match level to <strong>Layout </strong>as in the above code and re-execute the test. 😃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q0pIHXDgMtp0c85NyT8a6w.png" /><figcaption>Baseline and Checkpoint image comparison when Layout match level applied</figcaption></figure><p>😱 No differences were detected. If you recall what Layout match level actually does, it worries only about the layout changes, not the content changes. Therefore, the test passed although there are content mismatches. 😃</p><p>Now let’s set the match level to <strong>Content </strong>and re-execute.</p><p>As you can see in the below image content changes are highlighted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*moImzjRBwQtTQTzOxFWDAw.png" /><figcaption>Baseline and Checkpoint image comparison when Content match level applied</figcaption></figure><p>A mismatch marked in the ‘Apple’ title is due to image displacement. This means in the checkpoint image ‘Apple’ title has moved on the page compared to the baseline image. You can simply toggle on the ‘Hide displacement diff’ button if you opt-out of such mismatches. It simply hides the differences which detect when the position of the content of the page has changed and only highlights the differences of actual changes of the content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hw-hwdw--Oue8UTvliVLfw.png" /><figcaption>Hide displacement diffs tool</figcaption></figure><p>Now let’s set the match level to <strong>Exact</strong> and execute the test again.</p><p>When you execute the test with the ‘Exact’ match level, the following tooltip might appear on Applitools dashboard. It suggests using the ‘Strict’ match level for standard verification purposes instead of ‘Exact’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*TeYmtpF4D5MiwYNmEiK99g.png" /><figcaption>Applitools tooltip for Exact match level</figcaption></figure><p>The below image shows how the differences are detected in pixel to pixel level when the ‘Exact’ match level is set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ziaxaFwTUySxq35THH-A1g.png" /><figcaption>Baseline and Checkpoint image comparison when Exact match level applied</figcaption></figure><p>If you want to preview your baseline and checkpoint images by setting a match level you can select the ‘Preview match level’ option in the Applitools dashboard and select the required match level. Note that, you need to update the match level in the code in order to persist the changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFy9sef3LqNoNlI9rRS71g.png" /><figcaption>Preview match level option</figcaption></figure><p>So looking at the Google search results page example what Match Level do you think suits most for pages that render dynamic content? 💭</p><p>Our test case passed only with the ‘Layout’ match level. Hence, for pages that render dynamic content like the google search results page, the ‘Layout’ match level is the most effective option. But keep in mind, sometimes dynamic search results may appear for the same keyword on the Google search results page replacing the current page layout. Therefore, the choice of match level highly depends on the nature of the application you are testing.</p><p>Till next time. 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d638e89e27a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Applitools Eyes in Selenium Java project]]></title>
            <link>https://medium.com/@sandaminihimashi/setting-up-applitools-eyes-in-selenium-java-project-79bdca872052?source=rss-97a71d9cb6a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/79bdca872052</guid>
            <category><![CDATA[visual-testing-tools]]></category>
            <category><![CDATA[image-comparison]]></category>
            <category><![CDATA[visual-testing]]></category>
            <category><![CDATA[functional-testing]]></category>
            <category><![CDATA[automated-visual-testing]]></category>
            <dc:creator><![CDATA[Himashi Sandamini]]></dc:creator>
            <pubDate>Fri, 31 Dec 2021 09:18:28 GMT</pubDate>
            <atom:updated>2022-01-04T11:17:19.156Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello again.👋 Hope you went through my previous article on Visual Testing with Applitools Eyes. If not, here is the <a href="https://medium.com/@sandaminihimashi/automated-visual-testing-with-applitools-eyes-d71368bbf5ec">link</a>.</p><p>Now let’s see how to set up Applitools Eyes in your existing functional test suite in Selenium Java and run your first visual validation test case. 😃 I’m using Java as it is the widely used language with Selenium among most of the testers.</p><h4>Prerequisites</h4><ol><li>You must have created your Java project using any preferable IDE and added Selenium</li><li>You should have added TestNG to your project</li></ol><h4>Setting up Applitools Eyes</h4><ol><li>Add Applitools Eyes dependency/jar</li></ol><p>Applitools Eyes can be added to the project in either of the following 2 methods.</p><p>I. Maven user — Add the Applitools Eyes dependency from Maven store to the POM</p><p><a href="https://mvnrepository.com/artifact/com.applitools/eyes-selenium-java3">https://mvnrepository.com/artifact/com.applitools/eyes-selenium-java3</a></p><p>As of this writing, below is the most recent stable version of the dependency.</p><pre>&lt;!-- <a href="https://mvnrepository.com/artifact/com.applitools/eyes-selenium-java3">https://mvnrepository.com/artifact/com.applitools/eyes-selenium-java3</a> --&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;com.applitools&lt;/groupId&gt;<br>    &lt;artifactId&gt;eyes-selenium-java3&lt;/artifactId&gt;<br>    &lt;version&gt;3.210.6&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>II. Non Maven user - Add the Applitools jar file to the project</p><p><a href="https://jar-download.com/artifacts/com.applitools"><strong>Download com.applitools JAR files with all dependencies</strong><br> <em>All Downloads are FREE. Search and download functionalities are using the official Maven repository.</em>jar-download.com</a></p><p>2. Add the API to the automation framework</p><p>Follow the below steps to obtain the API key from <a href="https://applitools.com/">applitools.com</a></p><p>I. Go to <a href="https://applitools.com/">applitools.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*uueRXzUBxjQ36aFujYPlMg.png" /></figure><p>II. Click <strong>Get Started</strong> button in top right corner</p><p>III. Sign Up with your Github account or create an account in Applitools if you are new to Applitools. If you already have an account or signed up through your GitHub account continue from step IV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*lLF2Qa8bzekGNBy681P3Og.png" /></figure><p>IV. After signing up Click the <strong>User</strong> icon in the top right corner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*iSuE0Ule4nR0t2Z-WtIN4A.png" /></figure><p>V. Click <strong>My API</strong> key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*KuTmipK7wZv45jmAnoTZSw.png" /></figure><p>VI. Copy the API key</p><p>VII. Add the copied API key to the properties file in your Selenium java project</p><pre>applitools.api.key = &lt;paste the api key here&gt;</pre><p>3. Initializing eyes</p><p>Instantiate Eyes.</p><p>In the below example code I have initialized Eyes in a sample test (e.g-GoogleTest.java) class to support a single test class.</p><p><strong>*Please note that the code can be further refactored naturally to have the initialization separately to support multiple test classes.</strong></p><p>4. Set the API key</p><p>Now in the @BeforeClass method add the API key we pasted in the property file before.</p><p>Below is a sample code I’ve written to test the google home page.</p><pre>public class GoogleTest {<br>    private WebDriver webdriver;<br>    private Eyes eyes;<br><br>    @BeforeClass<br>    public void setUp() {<br>        // <em>Set executable fil</em>e<br>        System.<em>setProperty</em>(&quot;webdriver.chrome.driver&quot;,            &quot;resources/chromedriver&quot;);</pre><pre>        <em>// Initiate the web driver object<br>        </em>webdriver = new ChromeDriver();</pre><pre>       //Load the property file<br>       Properties properties = System.<em>getProperties</em>();<br>       try {<br>       properties.load(new FileInputStream(new               File(&quot;resources/test.properties&quot;)));<br>       } catch (Exception e) {<br>       e.printStackTrace();<br>       System.<em>exit</em>(-1);<br>        }    <br>  <br>        <em>// Navigate to page url<br>        </em>webdriver.get(&quot;https://google.com&quot;);</pre><pre>        <em>// Create Eyes constructor<br>        </em>eyes = new Eyes();<br><br>        <em>// Set the API key in property file<br>        </em>eyes.setApiKey(System.<em>getProperty</em>(&quot;applitools.api.key&quot;));<br>   <em><br>    }</em><br>}</pre><p>Hurray!! Now you are done setting up Applitools Eye in your local project. 😃</p><p>Now let’s check some important methods in Eyes.</p><h4>open()</h4><p>This method is used to start a test, before calling any of the check methods.</p><p>Eyes open() method can accept up to 4 parameters. Below are the parameters accepted in order.</p><ol><li>Name of the web driver</li><li>Application name — test name (a unique name for the test which will show in Applitools dashboard)</li><li>Method name — utilizing the thread to get the current method</li><li>View port size — predefined view port size if needed</li></ol><h4>abort()</h4><p>This method will abort status in the Eyes Test Manager.</p><h4>Checkpoints</h4><p>There are multiple ways to visually check our applications. Eyes checkpoints allow to visually assert as specifically or broadly as needed either by asserting an entire window or a specific element, region or a frame. Checkpoints are various ways that the application can be asserted.</p><ul><li>checkWindow()</li></ul><p>When we test the application with a single eye view checkWindow() method in eyes can be used.</p><p>How ever, there are instances where we can’t take the entire web page into a single screenshot. In some web pages, DOM can be very long and we might need to scroll vertically and horizontally to fully verify the webpage. In that case, the webpage extends beyond our view port.</p><p>Setting setForceFullPageScreenshot() to true will scroll back and forth and up and down and will stitch all the screenshots together.</p><pre>public void validateWindow() {<br>    eyes.open(webdriver, &quot;Google Home Page Test&quot;, Thread.<em>currentThread</em>().getStackTrace()[2].getMethodName());<br>    eyes.setForceFullPageScreenshot(true);<br>}</pre><ul><li>checkElement()</li></ul><p>In a scenario where the test only validates a particular element, not the entire window checkElement() can be used. Passing the locator name (type By) to checkElement(locator)will validate only the element interested. When the test is executed it will only take the screenshot of the element.This is a good example where we can couple visual test cases with functional test cases.</p><p>Other than these major checkpoints there are additional checkpoints. checkRegion()and checkFrame()are 2 such checkpoints.checkRegion() accepts coordinates and By locators. checkFrame()check the frames within a page. checkFrame()also accepts locators.</p><p>You can refer the Applitools Eyes <a href="https://applitools.com/docs/api/eyes-sdk/classes-gen/class_eyes/method-eyes-eyes-selenium-java.html">documentation</a> for further reference on above methods.</p><p>So now, I’ve extended my sample code by adding a test method. You can see how a visual validation test case is coupled with a functional test case.</p><p>I’ve introduced 2 private methods to validate elements and window.</p><p>The final closureTest() method will quit driver and eyes.</p><p>Feel free to go through this code and understand the steps.</p><pre>public class GoogleTest {<br>    private WebDriver webdriver;<br>    private Eyes eyes;<br><br>    <br>    @BeforeClass<br>    public void setUp() {<br>        <em>// Set executable file<br>        </em>System.<em>setProperty</em>(&quot;webdriver.chrome.driver&quot;, &quot;resources/chromedriver&quot;);<br>        <em>// Initiate the web driver object<br>        </em>webdriver = new ChromeDriver();<br><br>        <em>//Load the property file<br>        </em>Properties properties = System.<em>getProperties</em>();<br>        try {<br>            properties.load(new FileInputStream(new File(&quot;resources/test.properties&quot;)));<br>        } catch (Exception e) {<br>            e.printStackTrace();<br>            System.<em>exit</em>(-1);<br>        }<br><br>        <em>// Navigate to page url<br>        </em>webdriver.get(&quot;https://google.com&quot;);<br>        <em>// Create Eyes constructor<br>        </em>eyes = new Eyes();<br><br>        <em>// Set the API key in property file<br>        </em>eyes.setApiKey(System.<em>getProperty</em>(&quot;applitools.api.key&quot;));<br><br>    }<br>   <br>    @Test<br>    public void testSearchAction() {<br>        WebElement textbox = webdriver.findElement(By.<em>xpath</em>(&quot;//input[@title=&#39;Search&#39;]&quot;));<br>        String searchTerm = &quot;apple&quot;;<br>        textbox.sendKeys(searchTerm);<br>        textbox.sendKeys(Keys.<em>ENTER</em>);<br>        validateWindow();<br>        <em>assertEquals</em>(webdriver.findElement(By.<em>xpath</em>(&quot;//input[@aria-label=&#39;Search&#39;]&quot;)).getText(),searchTerm,&quot;Search term mismatch&quot;);<br>        By imgGoogleLogo = By.<em>xpath</em>(&quot;//img[@alt=&#39;Google&#39;]&quot;);<br>        <em>assertTrue</em>(webdriver.findElement(imgGoogleLogo).isDisplayed(), &quot;Google Logo is not displayed&quot;);<br>        validateElement(imgGoogleLogo);<br>    }<br><br>    @AfterClass<br>    public void closureTest() {<br>        webdriver.quit();<br>        eyes.abortIfNotClosed();<br>    }<br><br>    private void validateWindow() {<br>        eyes.open(webdriver, &quot;Dashboard Test&quot;, Thread.<em>currentThread</em>().getStackTrace()[2].getMethodName());<br>        eyes.checkWindow();<br>        eyes.close();<br>    }<br><br>    private void validateElement(By locator) {<br>        eyes.open(webdriver, &quot;Dashboard Test&quot;, Thread.<em>currentThread</em>().getStackTrace()[2].getMethodName());<br>        eyes.checkElement(locator);<br>        eyes.close();<br>    }<br>}</pre><p>Now let’s execute the test class. ✌️</p><p>In the mean time, login to your Applitools dashboard and check how the changes are reflected.</p><p>Once you execute your test case, the results will be available in the Applitools Eyes Dashboard.</p><p>Applitools Eyes takes a snapshot of the current test and compares it with the baseline test. The first test run will be initially in unresolved state. If you want to set the output image in your very first test as the base line image, press the 👍 button and save the test. It will make the resultant image the baseline image that the subsequent tests should follow. The state of the test will now be updated to Passed.</p><p>Below is a snapshot of Applitools Eyes dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DgdlmZxm30DJJt2NElY8vQ.png" /></figure><p>If in a subsequent test a UI change is detected and it is intended, you can update the baseline image by simply changing the 👍 button in the new output image. Otherwise(if it is a bug), reject the differences by clicking 👎 button.</p><p>Make sure to click the Save button in order to save your changes. 💾</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQNS0LfWe9nZKnKscIhAzg.png" /></figure><p>If you click on the image you can view a side by side comparison like above. 👆😃</p><p>The dashboard columns contain the status of the test, test name, branch (if CI/CD integrated), OS, browser etc. You can customize these columns from the dashboard.</p><p>In Eyes, image comparisons can be performed in different techniques to suit the right level of image matching. This option is called <strong>Match Level</strong>.</p><p>From the next article let’s see how the match levels are set.</p><p>Till then. 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79bdca872052" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Visual Testing with Applitools Eyes]]></title>
            <link>https://medium.com/@sandaminihimashi/automated-visual-testing-with-applitools-eyes-d71368bbf5ec?source=rss-97a71d9cb6a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d71368bbf5ec</guid>
            <category><![CDATA[visual-testing-tools]]></category>
            <category><![CDATA[ui-testing]]></category>
            <category><![CDATA[snapshot-testing]]></category>
            <category><![CDATA[visual-testing]]></category>
            <category><![CDATA[automated-testing]]></category>
            <dc:creator><![CDATA[Himashi Sandamini]]></dc:creator>
            <pubDate>Thu, 23 Dec 2021 09:03:03 GMT</pubDate>
            <atom:updated>2022-01-30T08:32:07.554Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello!!! 👋</p><p>Are you interested in visual testing? Exhausted of manually verifying user interface(UI) elements? Looking for a tool on how to automate visual test cases?</p><p>In this article, I will explain you on visual testing and an automated visual testing tool named Applitools Eyes 👀.</p><p>First, let’s see what is a visual/UI bug….. 🐛</p><p>Below is the definition by <a href="https://www.browserstack.com/guide/what-are-visual-bugs">BrowserStack</a>.</p><blockquote>Visual bugs are problems associated with the user interface (also known as GUI) of a web or mobile application. Although these bugs do not have any functional impact, they can ruin that particular website or app’s user experience.</blockquote><p>Few examples are overlapping, misalignment, partial visibility and responsive layout issues of UI components.</p><p>Here is an example for a visual bug on TripAdvisor Mobile app. Rating options was overridden by the Hotel name, making it difficult to read the text. This does not exactly encourage potential guests to make a booking on this app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*I7Ur7YZgnBY1p89nksrGqA.png" /><figcaption>Overlapping text on TripAdvisor App</figcaption></figure><h4>What is visual validation and why do we need it?</h4><p>Visual testing is a quality assurance activity that is meant to capture visual bugs.The purpose is to verify the user interface appears correctly to the users. What is meant by the term <strong>correctly</strong> is, it should look right to the user and each UI element should appear in the precise color, shape, position and size. It needs to make sure the aesthetic accuracy of things users see and interact with.</p><p>In visual tests, the actual output (snapshot) of the application is compared against a baseline image. This is sometimes referred to as snapshot testing which compares differences in an image by looking at pixel variations.</p><p>But these types of validations are hard to automate and may end up being manual test cases most of the time. However, too many manual test cases will slow down the delivery process.</p><p>Visual bugs may also be reported as high in priority as functional bugs, because issues with certain elements of the UI may make the application unusable to the user.</p><h4><strong>How does traditional functional testing differ from visual testing?</strong></h4><p>Most of the time people confuse visual testing with traditional functional testing which is designed to test the functionality through UI.</p><p>In traditional functional testing, during UI interactions verification we focus on the functionality of specific elements (whether the element is present, clickable, enabled, selected i.e) and eventually, the test will pass.</p><p>Nevertheless, it is important to check certain aspects of the UI such as, the color, shape, position and size of the element which may not explicitly be evaluated in traditional functional testing, in order to make sure the UI is fit for use.</p><p>Visual testing is a part of UI testing and can be used to cover functional scenarios which can verify the result of the UI interaction is rendered on the screen.</p><p>In other words, visual testing helps prevent visual defects which may not covered by traditional functional testing.</p><p>Verifying these visual elements through functional testing may need additional maintenance costs due to the number of locators and the amount of test code that is required.</p><p>Let’s look in to an example scenario where a visual bug was not captured from a functional test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*qxcpLyvcxC5CdAE9ihEPdQ.png" /><figcaption>Date picker pop up</figcaption></figure><p><em>Suppose a click was performed to open a date picker but the popup was being covered by something else.The date picker was never visibly opened during the test, but the value was still being set. In this functional test the date value was successfully selected through the DOM without the date picker being visible on the screen.</em></p><p>This functional test will still give a green light although the pop up was not fully visible!!! 😱</p><p>So, the best way to omit such false positive results is to have an automated visual testing tool.</p><h4><strong>Applitools Eyes</strong></h4><p>Applitools Eyes is an automated visual testing tool powered by AI(visual AI algorithms) which helps to catch errors in pixel level and errors that the human eye would never notice. Applitools Eyes is available for open source libraries for free.</p><h4>Key features of Applitools Eyes</h4><ul><li>Cloud-based service</li><li>AI-powered tool</li><li>Fewer assertions, less code, make the code more maintainable</li><li>Designed for visual validations, solves pixels issues that most of the other visual testing tools have a hard time to handle</li><li>Can run across multiple operating system and browsers</li><li>Reliable syncing issues helps to reduce flaky tests that randomly fail due to sync issues (waits till the visually correct element loads)</li></ul><h4><strong>Executing visual tests using Applitools Eyes</strong></h4><p>There are 2 ways we can run visual tests.</p><ol><li>Run on individual components during development</li></ol><p>e.g-Storybook</p><p>2. Run on a functioning application during end-to-end test execution by integrating with automated testing frameworks like Selenium, Cypress, WebDriverIO and TestCafe</p><p>In the next article, I will explain you on how to integrate Applitools Eyes with your existing Selenium functional test suite written in Java.</p><p>Stay tuned 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d71368bbf5ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>