Skip to content

Commit 9fddab8

Browse files
committed
fix websocket tests
1 parent 4b65445 commit 9fddab8

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

cypress/e2e/tests/pages/explorer/dashboard/websockets/connection.spec.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,31 @@ describe('Pod management and WebSocket interaction', { tags: ['@jenkins', '@admi
6464

6565
it('should create a new folder', () => {
6666
executeWebSocket('mkdir test-directory && echo "Directory created successfully"', podName, nsName, 'container-0', token).then((messages: any[]) => {
67-
expect(messages[2]).not.to.equal(undefined);
68-
expect(messages[2]).to.include('Directory created successfully');
67+
// Find the message containing the success text
68+
const successMessage = messages.find((msg) => msg && msg.includes('Directory created successfully'));
69+
70+
expect(successMessage).not.to.equal(undefined);
71+
expect(successMessage).to.include('Directory created successfully');
6972
});
7073
});
7174

7275
it('should validate the folder name', () => {
7376
executeWebSocket('ls', podName, nsName, 'container-0', token).then((messages: any[]) => {
74-
expect(messages[2]).not.to.equal(undefined);
75-
expect(messages[2]).to.include('test-directory');
77+
// Find the message containing the directory listing
78+
const lsMessage = messages.find((msg) => msg && msg.includes('test-directory'));
79+
80+
expect(lsMessage).not.to.equal(undefined);
81+
expect(lsMessage).to.include('test-directory');
7682
});
7783
});
7884

7985
it('should delete the folder', () => {
8086
executeWebSocket('rm -rf test-directory && echo "Directory deleted successfully"', podName, nsName, 'container-0', token).then((messages: any[]) => {
81-
expect(messages[2]).not.to.equal(undefined);
82-
expect(messages[2]).to.include('Directory deleted successfully');
87+
// Find the message containing the deletion success text
88+
const deleteMessage = messages.find((msg) => msg && msg.includes('Directory deleted successfully'));
89+
90+
expect(deleteMessage).not.to.equal(undefined);
91+
expect(deleteMessage).to.include('Directory deleted successfully');
8392
});
8493
});
8594
after(() => {

0 commit comments

Comments
 (0)