After SSH Connection in TestCafe while executing Commands I am not able to load Aliases for them, how to handle and resolve this? #8354
Labels
TYPE: bug
The described behavior is considered as wrong (bug).
What is your Scenario?
In TestCafe I made a SSH Connection, forming a non-interactive session, now when I execute command with aliases I am unable to execute the commands as error is coming that command not found.
If I am doing it in an interactive session, the commands are executing fine.
What is the Current behavior?
The current behaviour is that the commands with aliases are executing fine in interactive session of SSH but not in non-interactive session of SSH as aliases are not loading, if I remove the aliases and replace it with the actual command, it runs fine and no error is coming then.
What is the Expected behavior?
In non-interactive session also I want that the commands with aliases should execute fine and the aliases should load.
What is the public URL of the test page? (attach your complete example)
I have shared the Sample Code you can create sample using the steps mentioned in Steps to Reproduce.
Repo for reference - https://github.com/yashsharma115/testCafeExample
What is your TestCafe test code?
const { NodeSSH } = require('node-ssh');
const ssh = new NodeSSH();
// SSH Configuration
const sshConfig = {
host: 'your_hostname', // Replace with your server's IP or hostname
username: 'your_username', // Replace with the SSH username
password: 'your_password', // Use password or privateKey
// privateKey: '/path/to/your/private-key', // Optional if using SSH key authentication
};
async function executeSSHCommands() {
try {
// Establish SSH connection
console.log('Connecting to the server...');
await ssh.connect(sshConfig);
console.log('SSH connection established!');
} catch (error) {
console.error('Error during SSH execution:', error.message);
} finally {
ssh.dispose(); // Close the SSH connection
console.log('SSH connection closed.');
}
}
// Run the function
executeSSHCommands();
Your complete configuration file
No response
Your complete test report
No response
Screenshots
For Non-Interactive session by node-ssh
For Interactive session
Steps to Reproduce
I have Rocky Linux Container in which I create SSH connection and the steps followed are -
TestCafe version
3.7.0
Node.js version
16.2.0
Command-line arguments
node sshCommand.js
Browser name(s) and version(s)
No response
Platform(s) and version(s)
No response
Other
No response
The text was updated successfully, but these errors were encountered: