Skip to content

Commit

Permalink
fix: don't inherit default message for request logging (#28411)
Browse files Browse the repository at this point in the history
  • Loading branch information
mschile authored Nov 28, 2023
1 parent 650d5cb commit d5678c7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ _Released 12/5/2023 (PENDING)_
**Bugfixes:**

- Fixed an issue where pages or downloads opened in a new tab were missing basic auth headers. Fixes [#28350](https://github.com/cypress-io/cypress/issues/28350).
- Fixed an issue where request logging would default the `message` to the `args` of the currently running command even though those `args` would not apply to the request log and are not displayed. If the `args` are sufficiently large (e.g. when running the `cy.task` from the [code-coverage](https://github.com/cypress-io/code-coverage/) plugin) there could be performance/memory implications. Addressed in [#28411](https://github.com/cypress-io/cypress/pull/28411).

## 13.6.0

Expand Down
21 changes: 21 additions & 0 deletions packages/driver/cypress/e2e/cypress/proxy-logging.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,27 @@ describe('Proxy Logging', () => {
img.src = `/fixtures/media/cypress.png?${Date.now()}`
})

it('does not inherit the message of the currently running command', () => {
const logs: any[] = []

cy.on('log:added', (log) => {
if (log.name !== 'request') return

logs.push(log)
})

// delay the fetch call by 100ms to ensure it gets
// triggered during the cy.wait() below
setTimeout(() => {
fetch('/some-url')
}, 100)

cy.wait(200).then(() => {
expect(logs).to.have.length(1)
expect(logs[0].message).to.eq('')
})
})

context('with cy.intercept()', () => {
it('shows non-xhr/fetch log if intercepted', (done) => {
const src = `/fixtures/media/cypress.png?${Date.now()}`
Expand Down
1 change: 1 addition & 0 deletions packages/driver/src/cypress/proxy-logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function getRequestLogConfig (req: Omit<ProxyRequest, 'log'>): Partial<Cypress.I
url: req.preRequest.url,
method: req.preRequest.method,
timeout: 0,
message: '', // set to empty string so that we don't inherit the default message
consoleProps: () => req.consoleProps,
renderProps: () => {
function getIndicator (): 'aborted' | 'pending' | 'successful' | 'bad' {
Expand Down

5 comments on commit d5678c7

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d5678c7 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.1/linux-arm64/develop-d5678c794ff9a9850a968b03391b826a1389dc9c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d5678c7 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.1/linux-x64/develop-d5678c794ff9a9850a968b03391b826a1389dc9c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d5678c7 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.1/darwin-x64/develop-d5678c794ff9a9850a968b03391b826a1389dc9c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d5678c7 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.1/darwin-arm64/develop-d5678c794ff9a9850a968b03391b826a1389dc9c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d5678c7 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.6.1/win32-x64/develop-d5678c794ff9a9850a968b03391b826a1389dc9c/cypress.tgz

Please sign in to comment.