-
Notifications
You must be signed in to change notification settings - Fork 1
/
cypressException.cy.js
41 lines (37 loc) · 1.39 KB
/
cypressException.cy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
describe("Cypress Exception Handling", () => {
it("Fail on status code by opening url in browser", () => {
cy.visit(
"https://ecommerce-playground.lambdatest.io/index.php?route=account/login/1",
{ failOnStatusCode: false }
);
});
it("Fail on status code by calling api", () => {
cy.request({
url: "https://ecommerce-playground.lambdatest.io/index.php?route=account/login/1",
failOnStatusCode: false,
});
});
it("Test Failure when trying to find incorrect locator- error Message", () => {
cy.visit(
"https://ecommerce-playground.lambdatest.io/index.php?route=account/login"
);
cy.get('[id="input-email"]').type("lambdatest.Cypress@disposable.com");
cy.get('[id="input-password"]').type("Cypress1234!!");
cy.get('[value="Login"]').click();
cy.get(".error-message").should("be.visible");
cy.log("test");
cy.get('[name="search"]').eq(0).type("Macbook");
});
it("Test Failure when trying to find incorrect locator - Password", () => {
cy.visit(
"https://ecommerce-playground.lambdatest.io/index.php?route=account/login"
);
cy.get('[id="input-email"]').type("lambdatest.Cypress@disposable.com");
//cy.get('[id="input-password1"]').type("Cypress1234!!");
});
it("Uncaught Exception - Due to application error", () => {
cy.visit("index.html");
cy.get("button#error").click();
cy.wait(1000);
});
});