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
Right now I have to rely on an API to be available use cy.request to hit an endpoint to perform the actions I need. However, we do have some functionality that can only be done through the CLI and it would be nice to have access to that through Cypress.
Suggestion
It would be nice to be able to run a CLI command from Cypress, e.g. with cy.spawn.
An example usage could be to ssh into a host and kill a certain process. It could look something like this:
cy.spawn('ssh {host_ip}','kill -9 {process_id}');
I'm not sure that's the best API, but this is just to give an idea of what I am looking for.
The text was updated successfully, but these errors were encountered:
Executing arbitrary shell commands is easy, but issuing commands to a ssh connection is quite a bit more challenging. ssh is likely something we'd have to implement natively using a specific cy.ssh command but possibly it's better to do this logic in your own application.
What I mean is, you could simply provide a CLI client which handles the internal ssh connection stuff which Cypress doesn't know about.
Example:
// simple script execcy.spawn("npm run ssh-kill")
And then you implement the ssh-kill script yourself in bash or in node or whatever you'd like to do.
Also after thinking about it, the command will likely be cy.exec and not cy.spawn. Exec is a better fit because cy.exec would likely expect your process to exit and would block until it does. This is functionally more equivalent to node's exec vs spawn.
Can you think of another / different use case other than establishing a ssh connection?
Yes, I think that would cover all of our cases!
One other use case specific to our case is to run a subcommand from our CLI, since it allows for subcommands to be installed for each service. So running a subcommand through our CLI would allow easier access to change the state of different service in the same way.
In general I think we need the ability to change our system in a way that we don't expect the service to able to, and then test how it acts towards it. My initial example was to kill a specific process, but it could also be to shutdown a host or kill a network connection between a service and our system to test if it re-establishes the connection.
Problem
Right now I have to rely on an API to be available use cy.request to hit an endpoint to perform the actions I need. However, we do have some functionality that can only be done through the CLI and it would be nice to have access to that through Cypress.
Suggestion
It would be nice to be able to run a CLI command from Cypress, e.g. with
cy.spawn
.An example usage could be to ssh into a host and kill a certain process. It could look something like this:
I'm not sure that's the best API, but this is just to give an idea of what I am looking for.
The text was updated successfully, but these errors were encountered: