cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.51k stars 3.2k forks source link

Unintentional POST /add-verified-command request during e2e tests execution #27245

Closed edwardzikthegreat closed 6 months ago

edwardzikthegreat commented 1 year ago

Current behavior

After updating Cypress from v10 to v12.17.0 I started to get hundreds of POST .../__cypress/add-verified-command requests with some args, key, name on url in payload... I noticed huge performance drop during tests execution (cypress open mode) - probably because of it.

Issue occur for Chrome and Firefox browser family.

image

image

image

image

Desired behavior

Test code to reproduce

Due to the project specification I cannot share my code.

Project dependencies relevant for this issue:

Cypress Version

12.17.0

Node version

18.16.1

Operating System

Windows 10 PRO

Debug Logs

2023-07-10T10:58:54.748Z cypress:server:socket-base automation:request clear:cookies []
2023-07-10T10:58:54.748Z cypress:server:automation:cookies clear:cookies 0
2023-07-10T10:58:54.751Z cypress:server:socket-base backend:request { eventName: 'reset:rendered:html:origins', args: [] }
2023-07-10T10:58:54.764Z cypress:server:browsers:chrome add X-Cypress-Is-XHR-Or-Fetch header to: http://localhost:3003/__cypress/add-verified-command
2023-07-10T10:58:54.764Z cypress:server:browsers:chrome continueRequest: { requestId: 'interception-job-20.0', headers: [ { name: 'Accept', value: '*/*' }, { name: 'Content-Type', value: 'application/json' }, { name: 'Cookie', value: '__cypress.initial=true' }, { name: 'Referer', value: 'http://localhost:3003/__cypress/iframes/cypress%5Ce2e%5Cfeatures%5Clocal%5Cgeneral%5CXXXXXXXXXXXX.feature?browserFamily=chromium' }, { name: 'User-Agent', value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' }, { name: 'sec-ch-ua', value: '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"' }, { name: 'sec-ch-ua-mobile', value: '?0' }, { name: 'sec-ch-ua-platform', value: '"Windows"' }, { name: 'X-Cypress-Is-XHR-Or-Fetch', value: 'xhr' } ] }
2023-07-10T10:58:54.810Z cypress:server:socket-base backend:request { eventName: 'run:privileged', args: [ { commandName: 'task', options: [Object], userArgs: [Array] } ] }
2023-07-10T10:58:54.811Z cypress:server:task run task cypress-cucumber-preprocessor:spec-envelopes with arg {
  messages: [
    { source: [Object] },
    { gherkinDocument: [Object] },
    { pickle: [Object] },
    { pickle: [Object] },
    { pickle: [Object] },
    { pickle: [Object] },
    { pickle: [Object] },
    { pickle: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { hook: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    { stepDefinition: [Object] },
    ... 760 more items
  ]
}
2023-07-10T10:58:54.813Z cypress:lifecycle:EventRegistrar plugin event registered? { eventName: 'task', isRegistered: true }
2023-07-10T10:58:54.813Z cypress:lifecycle:EventRegistrar execute plugin event 'task' Node 'v16.16.0' with args: 'cypress-cucumber-preprocessor:spec-envelopes' { messages: [ { source: [Object] }, { gherkinDocument: [Object] }, { pickle: [Object] }, { pickle: [Object] }, { pickle: [Object] }, { pickle: [Object] }, { pickle: [Object] }, { pickle: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { hook: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, { stepDefinition: [Object] }, ... 760 more items ] } undefined
2023-07-10T10:58:54.813Z cypress:lifecycle:ProjectConfigManager call event task for invocation id inv7
2023-07-10T10:58:54.819Z cypress:lifecycle:child:RunPlugins:15704 execute plugin event: task ({ invocationId: 'inv7', eventId: 9 })
2023-07-10T10:58:54.820Z cypress:lifecycle:ProjectConfigManager promise resolved for id 'inv7' with value true
2023-07-10T10:58:54.821Z cypress:server:task result is: true

Other

No response

edwardzikthegreat commented 1 year ago

@cacieprins any news? I just updated to Cypress 13 and issue still occurs :(

DlgSHi commented 1 year ago

@nagash77 , @cacieprins Hello, how can we able to force this? It is quite annoying to see thousands of those requests. King Regards :)

cypress-app-bot commented 7 months ago

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

cypress-app-bot commented 6 months ago

This issue has been closed due to inactivity.

cacieprins commented 6 months ago

@DlgSHi @edwardzikthegreat I'm so sorry that this fell through the cracks -

I'm not extremely familiar with this section of the codebase, but it looks like when invoking certain commands (exec, origin, readFile, selectFile, writeFile and ask) that must be executed on the host operating system (rather than in the browser), we do some extra verification. This involves registering each command with the Cypress host server (e.g., ./packages/server) before it is executed, so we can ensure it's being executed only from the spec that registered it.

If this is causing performance issues for you, you might try to combine several commands into a task, execute fewer of them, reducing the size of the arguments sent to these commands, or decreasing the number of tests in each spec.

I understand that it can be difficult to provide a reproduction case when an issue is encountered in proprietary code, but if you can create a reproduction of this issue in a fork of https://github.com/cypress-io/cypress-example-kitchensink/ or https://github.com/cypress-io/cypress-realworld-app, we can investigate further whether this is a bug, or if this is Cypress working as intended. I'm leaving this issue closed, for now - if a reproduction can be provided, please open a new issue.

Thank you!

DlgSHi commented 5 months ago

@cacieprins hi :) no worries, seems it doesn't occur in v.13.11 :)