Hide URL in Cypress Info Panel

481 Views Asked by At

When I run a Cypress test, every time the test executes some action the URL is shown in the Info Panel on the left. Unfortunately the URL is very long and it makes the Info Panel unreadable. Is there a way to hide to URL?

describe('Test', () => {
    it('load page', () => {
        cy.visit("https://ultimateqa.com/automation")
        cy.get('.et_pb_text_inner > ul > :nth-child(3) > a').click()
    })
})

enter image description here

1

There are 1 best solutions below

2
Paolo On BEST ANSWER

This feels a bit hacky - the gist is to watch for log changes and truncate the long ones.

You could make the criteria more precise to your needs, but this works

// top of the test, or in /cypress/support/e2e.js

Cypress.on('log:changed', (log, interactive) => {
  const logs = window.top.document.querySelectorAll('.command-message-text')
  const last = [...logs][logs.length - 1]
  if (last.innerText.length > 20) {
    last.innerText = last.innerText.slice(0, 20) + '...'
  }
})

enter image description here