IssueRaiser

Proposal: Add a group to commands for nicer command logging

I've been playing around with ways of defining reusable helpers (blog post coming) and have been using the Cypress log API and passing `{ log: false }` to allow control of the log output of these helpers/commands. This has been useful, but there are some times that I want to dive into that abstraction (most likely on failure) to see what step of the helper failed. I think a concept of a `group` would be useful here. Instead of passing `{ log: false }` to every encapsulated command, having a group would help a lot more ### Current behavior: ```js // This will work on https://github.com/cypress-io/cypress-example-todomvc export const createTodo = (name) => { const log = Cypress.log({ name: 'createTodo', message: name, consoleProps() { return { 'Inserted Todo': name, } } }) cy.get('.new-todo', { log: false }).type(`${name}{enter}`, { log: false }) return cy .get('.todo-list li', { log: false }) .contains('li', name.trim(), { log: false }) .then(($el) => { log.set({ $el }).snapshot().end() }) } // to use this helper: createTodo('Learn the Cypress Log API') .then(console.log) // logs the created todo element from the TodoMVC Cypress example ``` Screenshot of the above: <img width="548" alt="screen shot 2018-02-06 at 12 30 46 am" src="https://user-images.githubusercontent.com/338257/35846734-1052101e-0ad5-11e8-80e7-a498151f74e5.png"> ### Proposed behavior: ```js export const createTodo = (name) => { const g

Posted by NicholasBoll on Feb 6, 2018, 7:45 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Software)

Proposal: Add a group to commands for nicer command logging

NicholasBollFeb 6, 2018, 7:45 AM

I've been playing around with ways of defining reusable helpers (blog post coming) and have been using the Cypress log API and passing `{ log: false }` to allow control of the log output of these helpers/commands. This has been useful, but there are some times that I want to dive into that abstraction (most likely on failure) to see what step of the helper failed. I think a concept of a `group` would be useful here. Instead of passing `{ log: false }` to every encapsulated command, having a group would help a lot more ### Current behavior: ```js // This will work on https://github.com/cypress-io/cypress-example-todomvc export const createTodo = (name) => { const log = Cypress.log({ name: 'createTodo', message: name, consoleProps() { return { 'Inserted Todo': name, } } }) cy.get('.new-todo', { log: false }).type(`${name}{enter}`, { log: false }) return cy .get('.todo-list li', { log: false }) .contains('li', name.trim(), { log: false }) .then(($el) => { log.set({ $el }).snapshot().end() }) } // to use this helper: createTodo('Learn the Cypress Log API') .then(console.log) // logs the created todo element from the TodoMVC Cypress example ``` Screenshot of the above: <img width="548" alt="screen shot 2018-02-06 at 12 30 46 am" src="https://user-images.githubusercontent.com/338257/35846734-1052101e-0ad5-11e8-80e7-a498151f74e5.png"> ### Proposed behavior: ```js export const createTodo = (name) => { const g

Comments (0)

No comments yet. Start the discussion.

Comment on this issue