'Cypress websocket messages
I am trying to read websocket messages on my Cypress project.
I am trying to use library https://github.com/lensesio/cypress-websocket-testing on my project. However, I am not able to read websocket messages. As a PoC, I have used https://websocketstest.com/ site, in order to try to check its ws messages. However, I have no luck so far yet.
Code
type MessageType = "CONNECTED" | "LOGIN" | "RECORD" | "END" | "connected" | "version" | "echo" | "time";
interface IMessage {
type: MessageType;
data: any;
}
it.only('test 2', function () {
cy.visit('https://websocketstest.com/')
const config: WebSocketSubjectConfig<IMessage> = {
url: "wss://websocketstest.com/service"
};
const options = {};
// Wrap the request in order to bypass the defaultCommandTimeout
// Investigating alternative solutions
cy.wrap(null, { timeout: 10000 }).then(() =>
cy.streamRequest<IMessage>(config, options).then(results => {
// debugger
expect(results).to.not.be.undefined;
})
);
})
Am I missing something?
Thanks in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
