Write your first test in Cypress | SDET Unicorns

In this tutorial, we will cover how to write your first test in Cypress. We will go over the basic Cypress syntax and run our tests using the Cypress Test Runner.

Creating your Cypress Test

describe('Home Tests', () => {
    it('open the home page and verify the url & title', () => {
        // open the Home Page
        cy.visit('https://practice.automationbro.com/');

        // assert the url
        cy.url().should("include", "automationbro");

        // assert the title
        cy.title().should("eq", "Practice E-Commerce Site – Automation Bro");
    });
});

Running your Cypress Test in the Cypress Test Runner

To open the Cypress Test Runner, you can execute the following command below –

npx cypress open

Once the Cypress Test Runner open up, you can execute your test which will show results similar to this below –

Cypress Test Runner

Check out the video below to see how to create your first test in Cypress –


I hope this post helped you out, let me know if you have any questions in the comments below!

Happy testing! 

Leave a Reply

Your email address will not be published. Required fields are marked *