Member-only story
Testing Links on Pages with Nightwatch.js
In this article I will focus on test the links on the page with Nightwatch.js. We can perform this test on the asyasofttech.com site that I have chosen. To do this, we need to create the folders and files we made in the previous article.
Before we write the test cases, let’s create three folders named Pages, Tests and Screenshots. Next, let’s open the files named pathTest.js inside the Pages and Tests folders. We will write the selectors and the commands we have specified in pathTest.js in Pages. In our test codes, we will write in pathTest.js in the Tests folder. Finally, we will send the screenshots in our test into the Screenshots folder. Now that we have done these, we can start writing our test scenarios:
Test Case-1: Go to asyasofttech.com, check the page title and the elements on the main page are visible and take a screenshot.
Test Case-2: Check if the links in the navigation menu section at the top of the page are visible.
Test Case-3: Then visit all the links in order and check if the body part is visible and take a screenshot. (Instead of the body part, you can write a selector or element that you specify.)
As you can see, we have prepared what we want to do in our test with 3 scenarios. In our test, we paste the selectors and the commands we have determined…