<?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: Lasitha Wijenayake</title>
    <description>The latest articles on Forem by Lasitha Wijenayake (@lasithdilshan20).</description>
    <link>https://forem.com/lasithdilshan20</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%2F929749%2F847848ec-4f6c-4187-b4ca-579ac6afa997.png</url>
      <title>Forem: Lasitha Wijenayake</title>
      <link>https://forem.com/lasithdilshan20</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/lasithdilshan20"/>
    <language>en</language>
    <item>
      <title>Simplify Your Cypress Intercept Assertions: cypress-intercept-search</title>
      <dc:creator>Lasitha Wijenayake</dc:creator>
      <pubDate>Sat, 10 May 2025 18:38:46 +0000</pubDate>
      <link>https://forem.com/cypress/simplify-your-cypress-intercept-assertions-cypress-intercept-search-53mp</link>
      <guid>https://forem.com/cypress/simplify-your-cypress-intercept-assertions-cypress-intercept-search-53mp</guid>
      <description>&lt;p&gt;When writing end-to-end tests with Cypress, you must often validate that your application sends or receives the correct data. Cypress’s &lt;code&gt;cy.intercept()&lt;/code&gt; gives you robust control over network requests. However, digging through nested bodies, headers, and query parameters to find the exact key/value you care about can become repetitive and error-prone.&lt;/p&gt;

&lt;p&gt;That’s why I created cypress-intercept-search, a small plugin that lets you recursively search through every part of one or more intercepted requests or responses for a given key and (optionally) a matching value. Then, wrap the results in a chainable Cypress command for easy assertions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;## Why Built &lt;code&gt;cypress-intercept-search&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
When you’re writing end-to-end tests in Cypress, it’s all too easy to end up with the same boilerplate over and over:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cy.wait('@savePlay').then((i) =&amp;gt; {
  const { players } = i.request.body;
  expect(players).to.exist;
  Object.entries(players).forEach(([role, p]) =&amp;gt; {
    expect(p.id).to.not.equal('00000000-0000-0000-0000-000000000000');
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Consider a scenario where your JSON structure contains multiple nested levels or headers, query parameters, request bodies, and response bodies that must be examined simultaneously. Copying and pasting recursive helpers across specifications can rapidly become a significant maintenance challenge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;## Key Advantages&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Zero Boilerplate, Maximum Clarity
Drop in a single call:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cy.wait('@savePlay')
  .search('playerID', '00000000-0000-0000-0000-000000000000')
  .should('have.length', 1);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No more manual tree-walking. Tests read like plain English: “wait, search for this key/value, assert I found one.”&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Chainable &amp;amp; Composable
Because &lt;code&gt;.search()&lt;/code&gt; wraps its results in a Cypress chainable, you can combine it with any built-in assertion:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cy.wait('@echo')
  .search('foo')             // just look for key presence
  .should('not.be.empty')    // assert at least one hit
  .then((matches) =&amp;gt; {
    // inspect where you found it
    expect(matches[0].path.join('.')).to.equal('nested.level1.level2.foo');
  });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Deep &amp;amp; Wide Coverage
Under the hood, it scans:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;request.query&lt;/code&gt;&lt;br&gt;
&lt;code&gt;request.headers&lt;/code&gt;&lt;br&gt;
&lt;code&gt;request.body&lt;/code&gt;&lt;br&gt;
&lt;code&gt;response.headers&lt;/code&gt;&lt;br&gt;
&lt;code&gt;response.body&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your tests no longer need five separate helpers — one command does it all.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rich Cypress-Log Integration
Every &lt;code&gt;.search()&lt;/code&gt; call produces a custom entry in the Cypress Command Log, complete with:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;the key/value you searched&lt;/li&gt;
&lt;li&gt;number of matches&lt;/li&gt;
&lt;li&gt;which part of the HTTP cycle they came from&lt;/li&gt;
&lt;li&gt;exact property paths&lt;/li&gt;
&lt;li&gt;That means you get full visibility without extra cy.log() calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Repository &amp;amp; Links&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;npm package: &lt;a href="https://www.npmjs.com/package/cypress-intercept-search?activeTab=readme" rel="noopener noreferrer"&gt;cypress-intercept-search&lt;/a&gt;&lt;br&gt;
GitHub source: &lt;a href="https://github.com/lasithdilshan20/cypress-intercept-search" rel="noopener noreferrer"&gt;lasithdilshan20/cypress-intercept-search&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;## Contributing &amp;amp; Roadmap&lt;/strong&gt;&lt;br&gt;
I welcome issues and PRs! Here are a few ideas on the horizon:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sugar methods like &lt;code&gt;.shouldExist() / .shouldNotExist()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Value‐range matching (e.g. regex or partial matches)&lt;/li&gt;
&lt;li&gt;Performance tuning for very large payloads&lt;/li&gt;
&lt;li&gt;Type‐safe search with generic key/value types&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Feel free to open an issue or submit a pull request on GitHub.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>cypress</category>
      <category>testautomation</category>
      <category>apitest</category>
    </item>
    <item>
      <title>My Experience with Cypress’s UI Coverage: Transforming Test Coverage</title>
      <dc:creator>Lasitha Wijenayake</dc:creator>
      <pubDate>Wed, 12 Feb 2025 09:23:13 +0000</pubDate>
      <link>https://forem.com/cypress/my-experience-with-cypresss-ui-coverage-transforming-test-coverage-g4n</link>
      <guid>https://forem.com/cypress/my-experience-with-cypresss-ui-coverage-transforming-test-coverage-g4n</guid>
      <description>&lt;p&gt;This is Cypress's latest feature and will be incredibly helpful for my automation testing. UI Coverage enhances efficiency and ensures comprehensive application testing by providing a user-centric approach to test coverage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6rg9t4cyfbtew7vg5qpz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6rg9t4cyfbtew7vg5qpz.png" alt="New Feature in cypress cloud" width="688" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the fast-paced world of software development, ensuring comprehensive test coverage is crucial for delivering high-quality applications. Traditional code coverage tools often fall short, focusing solely on code execution without considering the user experience. Cypress’s UI Coverage addresses this gap by providing a visual, user-centric approach to test coverage, enhancing efficiency and application quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding UI Coverage
&lt;/h2&gt;

&lt;p&gt;Unlike traditional code coverage, which tracks the percentage of code executed during tests, UI Coverage focuses on the elements and interactions that users engage with. It offers a visual map of your application’s test coverage, highlighting which interactive elements have been tested and identifying untested areas. This user-centric perspective thoroughly examines critical user flows, aligning testing efforts with real-world usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Experience with Cypress’s UI Coverage
&lt;/h2&gt;

&lt;p&gt;As a QA engineer, I’ve always strived to deliver the highest quality applications. However, one of the challenges I often faced was ensuring comprehensive coverage of critical user flows. Traditional code coverage tools provided numbers but fell short regarding the real-world user perspective. When I started using Cypress’s UI Coverage, it felt like a game-changer for my testing workflow.&lt;/p&gt;

&lt;p&gt;One specific instance stands out. I was working on an application with complex user interactions across multiple pages. Despite thorough testing, I noticed bugs occasionally slipping through because certain interactive elements weren’t being tested. With UI Coverage, I quickly visualized the gaps in our test suite and identified untested elements. This allowed me to refine my tests and ensure those critical flows were fully covered. The visual insights made communicating these findings to my team easy, fostering better collaboration and saving us valuable time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F439c9pzcizj3mgars9lx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F439c9pzcizj3mgars9lx.png" alt="Cypress Cloud Execution Report" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I first began using Cypress’s UI Coverage, I didn’t realize how much it would change my testing approach. There was one project where UI bugs had been a recurring issue some user interface elements weren’t being tested consistently, leading to occasional oversight. This tool helped me pinpoint those gaps immediately.&lt;/p&gt;

&lt;p&gt;For example, I once missed testing a critical dropdown menu because it wasn’t part of the regular automation flow. UI Coverage visually highlighted this oversight, ensuring I never missed testing an important UI element again. It has also allowed me to help my team by aligning test coverage to real-world user journeys, making our testing process more effective and reliable.&lt;/p&gt;

&lt;p&gt;One of the biggest benefits is that it’s now easier to collaborate with developers and product managers. Sharing these visual coverage reports enables better communication, leading to quicker fixes and enhanced collaboration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Enhanced Collaboration: The visual nature of UI Coverage reports makes them accessible to all team members, fostering better communication and collaboration across development, QA, and product teams.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data-Driven Decisions: With clear insights into test coverage, teams can make informed decisions about where to focus testing efforts, optimizing resource allocation and improving efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved Application Quality: By ensuring that all critical user interactions are tested, UI Coverage helps prevent regressions and enhances the overall user experience.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started with UI Coverage
&lt;/h2&gt;

&lt;p&gt;Integrating UI Coverage into your testing workflow is straightforward. If you’re already recording test runs to Cypress Cloud with Test Replay, UI Coverage requires no additional setup. Start a free trial to begin visualizing your test coverage and identifying gaps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.cypress.io/ui-coverage" rel="noopener noreferrer"&gt;Learn more and start your free trial here.&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Cypress’s UI Coverage transforms how teams approach test coverage by focusing on the user interface and real user interactions. Its visual, intuitive reports provide actionable insights that help teams enhance test coverage, reduce redundancies, and deliver higher-quality applications. By adopting UI Coverage, development teams can ensure their testing strategies align with user needs, leading to more reliable and user-friendly software.&lt;/p&gt;

&lt;p&gt;Would you be ready to redefine your testing strategy? &lt;a href="https://www.cypress.io/ui-coverage" rel="noopener noreferrer"&gt;Explore Cypress UI Coverage today.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>testautomation</category>
      <category>testing</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Lasitha Wijenayake</dc:creator>
      <pubDate>Tue, 11 Feb 2025 21:23:32 +0000</pubDate>
      <link>https://forem.com/lasithdilshan20/-4en6</link>
      <guid>https://forem.com/lasithdilshan20/-4en6</guid>
      <description></description>
    </item>
  </channel>
</rss>
