You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use a cy.exec call to find the ID of my server's Docker container by its service name, and then run a command on it.
Cypress.Commands.add('runBackendCommand',(command)=>{cy.log(`Running command \`${command}\` against the backend`);cy.exec('docker ps -aqf "name=backend"').then(({ stdout })=>{constbackendContainer=stdout.trim();cy.log("backendContainer",backendContainer)returncy.exec(`docker exec ${backendContainer}${command}`);},);});
The first call, cy.exec('docker ps -aqf "name=backend"'), takes around 30 seconds within Cypress. But it is eventually successful, backendContainer gets logged.
Calling it directly in a terminal returns in under a second with one line of stdout and a zero status.
What could explain such a difference in duration?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I use a
cy.exec
call to find the ID of my server's Docker container by its service name, and then run a command on it.The first call,
cy.exec('docker ps -aqf "name=backend"')
, takes around 30 seconds within Cypress. But it is eventually successful,backendContainer
gets logged.Calling it directly in a terminal returns in under a second with one line of stdout and a zero status.
What could explain such a difference in duration?
Beta Was this translation helpful? Give feedback.
All reactions