2023 Trialbee Internship - Cypress
[Internship] Cypress E2E Web Automation | Hooks & Tags
olivia_yj
2023. 4. 27. 17:33
Before executes one time before the whole code, and for after it's vice versa
BeforeEach and AfterEach executes every before and after.
// before
// after
// beforeEach
// AfterEach
describe("MyTestSuite", () => {
before(() => {
cy.log("***** Launch app *****");
});
after(() => {
cy.log("***** close app *****");
});
beforeEach(() => {
cy.log("****** Login *******");
});
afterEach(() => {
cy.log("****** Logout *******");
});
it("search", () => {
cy.log("***** Searching *****");
});
it("advanced search", () => {
cy.log("***** advanced searching *****");
});
it("listing products", () => {
cy.log("***** listing products *****");
});
});
Sources
Mocha - the fun, simple, flexible JavaScript test framework
mochajs.org