Webship-js: Then the "item" link should contain "url"

Image
then_the _item_ link_should_contain _ur

Webship-js: Then the "item" link should contain "url"

In website testing, every detail matters. One small broken link can damage trust and user experience. That’s why checking if important links, like social media icons, lead to the right place is a vital step. This kind of step ensures that users are never left wondering or lost.
 

One of the key steps in automated functional acceptance testing is verifying that each link leads where it should. In this article, we’ll focus on the step:


Then the "item" link should contain "url"


This definition step ensures that the the href attribute of a link element includes a URL or part of a URL, with the element located using its link text.

Example:

Then the "Login" link should contain "/log-in"

 

Real Testing Context
Now, let’s apply this step in a real-world scenario by testing the social media links on the official UNICEF Canada website.

Tested Website: https://www.unicef.ca/en

Feature: Check social media links
  As an anonymous user
  I want to be able to visit the home page
  So that I can verify the social media links are correct
  
  Scenario: Check social media links
    Given I am on the homepage
    When I scroll to the bottom
     And I press "cky-btn-accept" by attribute
    Then the "icon-facebook-official" link should contain "https://www.facebook.com/UNICEF-Canada" by attribute
     And the "icon-instagram" link should contain "https://www.instagram.com/unicefcanada/" by attribute
     And the "icon-twitter-x" link should contain "https://twitter.com/UNICEFCanada" by attribute
     And the "icon-youtube-play" link should contain "https://www.youtube.com/user/unicefcanada" by attribute
     And the "icon-linkedin-squared" link should contain "https://www.linkedin.com/company/unicef-canada" by attribute
     And the "icon-tiktok" link should contain "https://www.tiktok.com/@unicefcanada" by attribute

 

Watch the recorded video of the robot while running the automated functional testing feature

 

Display the results in the form of a report

You can see that all steps have been completed successfully

 

Conclusion
Behind every working website is a team that pays attention to the little things. Verifying that a link works may seem minor, but it reflects care, quality, and a commitment to user trust. Keep checking because small steps build strong experiences.

Double-check your links… before your users think their browser is haunted! 👻

 

 

Learn more about Step Definitions in Webship-js

Visit the documentation site:- https://webship.co/docs