-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
306 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
{ | ||
"testDirectory": "./sample_tests", | ||
"rules": [ | ||
{ | ||
"id": "no-hardcoded-wait", | ||
"description": "Disallow the use of hardcoded wait times.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "use-data-attributes", | ||
"description": "Use data-* attributes for selectors.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "avoid-tag-class-id-selectors", | ||
"description": "Avoid using tag, class, or ID selectors.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "avoid-command-return-value-assignments", | ||
"description": "Avoid assigning the return value of Cypress commands with const, let, or var.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-external-site-visit", | ||
"description": "Avoid visiting external sites or servers you do not control.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-test-state-dependence", | ||
"description": "Avoid having tests rely on the state of previous tests.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-web-server-in-cypress", | ||
"description": "Avoid starting a web server from within Cypress scripts with cy.exec() or cy.task().", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "at-least-one-assertion", | ||
"description": "There should be at least one assertion in each it block.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "use-base-url", | ||
"description": "Use base URL from config instead of full URLs.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-hardcoded-credentials", | ||
"description": "Avoid using hardcoded credentials in tests, use environment variables or fixtures instead.", | ||
"enabled": true | ||
} | ||
] | ||
} | ||
"testDirectory": "./sample_tests", | ||
"rules": [ | ||
{ | ||
"id": "no-hardcoded-wait", | ||
"description": "Disallow the use of hardcoded wait times.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "use-data-attributes", | ||
"description": "Use data-* attributes for selectors.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "avoid-tag-class-id-selectors", | ||
"description": "Avoid using tag, class, or ID selectors.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "avoid-command-return-value-assignments", | ||
"description": "Avoid assigning the return value of Cypress commands with const, let, or var.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-external-site-visit", | ||
"description": "Avoid visiting external sites or servers you do not control.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-test-state-dependence", | ||
"description": "Avoid having tests rely on the state of previous tests.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-web-server-in-cypress", | ||
"description": "Avoid starting a web server from within Cypress scripts with cy.exec() or cy.task().", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "at-least-one-assertion", | ||
"description": "There should be at least one assertion in each it block.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "use-base-url", | ||
"description": "Use base URL from config instead of full URLs.", | ||
"enabled": true | ||
}, | ||
{ | ||
"id": "no-hardcoded-credentials", | ||
"description": "Avoid using hardcoded credentials in tests, use environment variables or fixtures instead.", | ||
"enabled": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
"use strict"; | ||
// sample_tests/example.spec.ts | ||
describe("Sample test suite", () => { | ||
it("Sample test case", () => { | ||
cy.visit("/"); | ||
cy.wait(1000); | ||
cy.get("#element"); | ||
}); | ||
it("Sample test case", () => { | ||
cy.visit("/"); | ||
cy.wait(1000); | ||
cy.get("#element"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
"use strict"; | ||
describe("Violations of all rules", () => { | ||
it("State dependence violation", () => { | ||
cy.visit("/users/new"); | ||
cy.get('[data-testid="first-name"]').type("Johnny"); | ||
cy.get('[data-testid="last-name"]').type("Appleseed"); | ||
cy.get("form").submit(); | ||
it("State dependence violation", () => { | ||
cy.visit("/users/new"); | ||
cy.get('[data-testid="first-name"]').type("Johnny"); | ||
cy.get('[data-testid="last-name"]').type("Appleseed"); | ||
cy.get("form").submit(); | ||
}); | ||
it("No assertion violation", () => { | ||
cy.visit("/users"); | ||
// No assertions here | ||
}); | ||
describe("Base URL violation", () => { | ||
it("does something", () => { | ||
cy.visit("https://example.com/users"); | ||
}); | ||
it("No assertion violation", () => { | ||
cy.visit("/users"); | ||
// No assertions here | ||
}); | ||
describe("Hardcoded credentials violation", () => { | ||
beforeEach(() => { | ||
cy.visit("/login"); | ||
cy.get("#username").type("test_user"); | ||
cy.get("#password").type("test_password"); | ||
}); | ||
describe("Base URL violation", () => { | ||
it("does something", () => { | ||
cy.visit("https://example.com/users"); | ||
}); | ||
}); | ||
describe("Hardcoded credentials violation", () => { | ||
beforeEach(() => { | ||
cy.visit("/login"); | ||
cy.get("#username").type("test_user"); | ||
cy.get("#password").type("test_password"); | ||
}); | ||
it("does something with hardcoded credentials", () => { | ||
// Test code here | ||
}); | ||
it("does something with hardcoded credentials", () => { | ||
// Test code here | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.