top of page
Search

Writing your First Test in Cypress

Updated: Apr 20, 2021

In the folder you have created, you can see the default Integration folder, Inside that create a new Java script file and enter the code and save the file.



ree

ree

describe("A suite", ()=> {
  it("contains spec with an expectation", function() {
    expect(true).to.equal(true);
  });

it("second test",()=>{
cy.visit("https://coderscamp.wixsite.com/codeit");
cy.url().should("include","/codeit");
cy.contains('forum').click();
cy.get('#content-wrapper > div._3r1lL.header-background-color > div > div > div > div > div > form > input').type('arrays');
});
});

Now open cypress GUI, you can see the file you have created.


ree

Now select the browser from the top right corner in which you want to execute the test. And click on the test you want to run.


You can now see, your test is executing in the browser you have selected.


ree

ree

You can see the results of all passed and failed test cases and the respective error messages.


Time Travel:

You can see before and after screenshots by clicking on the respective message.


ree

Console Output:

Open your developer tools to see log in console.

ree

Errors:

If your test is failed, you can see error message in the log.

ree

So you have today learnt how to created your first test in cypress. Happy Testing!!

 
 
 

Recent Posts

See All

Comments


bottom of page