lensesio / cypress-websocket-testing

Test WebSocket connections with Cypress
Apache License 2.0
83 stars 12 forks source link

Using streamRequest prompt 'Cypress test was stopped while running this command.' #41

Open Shiqin-Li opened 10 months ago

Shiqin-Li commented 10 months ago

After configuring the JavaScript section, I used the plugin to prompt 'Cypress test was stopped while running this command'. The following is the code I wrote and a screenshot of the run

import { addStreamCommands } from "@lensesio/cypress-websocket-testing";
addStreamCommands();

Cypress.Commands.add('stopVm', () => {
  const config = {
    url : "wss://xxx.xxx.com/clusters/local/api/v1/namespaces/cypress/pods/vm-vmtest-cypress-0.0/exec?container=container-0&stderr=true&stdout=true&command=qga&command=execute&command=guest-shutdown",
    protocol: 'test'
  }
  const option = {
    retryDelay: 4000,
  }
  cy.streamRequest(config, option).then(results => {
    expect(results).to.not.be.undefined;
  })
});

image