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.





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.


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.



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.



Console Output:

Open your developer tools to see log in console.

Errors:

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

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

37 views0 comments

Recent Posts

See All

Minimum Deletions to Make Character Frequencies Unique

A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The f

Smallest String With A Given Numeric Value

The numeric value of a lowercase character is defined as its position (1-indexed) in the alphabet, so the numeric value of a is 1, the numeric value of b is 2, the numeric value of c is 3, and so on.

bottom of page