how to run intern against webdriver on remote machine - intern

I've setup Intern tests on my local machine. Now I'm trying to run those tests against a webdriver server on a remote machine.
I've started a webdriver server on the remote machine, with the command:
C:\> java -jar selenium-server-standalone-2.44.0.jar
I set my intern config options to point to that remote machine:
intern.tunnel = "NullTunnel";
intern.tunnelOptions = {
hostname: "192.168.1.4",
port: 4444
};
That works enough to start firefox on the remote machine, but then firefox navigates to the URL:
http://localhost:9000/__intern/client.html?config=...
That doesn't work, since the port=9000 listener is running on my local machine, 192.168.1.12. How do I make it navigate back to the URL on my main machine, instead of localhost?

The piece you are missing is to set proxyUrl to point back from your remote machine to the machine with the actual code.
So in sum, given host1 containing the files and host2 running the Selenium server, you should have the following:
intern.tunnelOptions.hostName set to host2
intern.proxyUrl set to http://host1:9000/

Related

How to connect to remote server using linux ssh tunel command

I have an easy-one here, I'm new using linux to connect to other linux server, the issue is that on a remote server which I can reach from my vpn, I have a GUI running on the port x.x.x.x:6500
I did not have any problem using putty/xshell to make a tunnel to the server and then to see the GUI in my laptop using the localhost:6500.
I'm trying to do the same on my Manjaro VM but I'm having troubles to see the GUI since there. The page says connection refused...
I'm using the following command:
$ ssh -L 6500:127.0.0.1:6500 x.x.x.x -v
Maybe the command is wrong, that's not the correct syntax?

How to display the webapp which is running in local host of a server in my laptop's browser

I have to say that, I am not a web developer and I don't know anything about how a web application works.
I've connected to a remote server via ssh, downloaded a project (Python, flask app) from github and run it there:
zwlayer#personalcomputer $ ssh myusername#ku.edu
myusername#ku.edu $ git clone https://github.com/.../project
myusername#ku.edu $ cd project
myusername#ku.edu $ env FLASK_APP=app.py FLASK_ENV=development env USE_CUDA=False flask run --host=0.0.0.0
Now, is it possible to get interact with that through my browser from my personalcomputer ?
You can use local port forwarding in SSH.
SSH to the server with command:
ssh -L 5000:127.0.0.1:5000 myusername#ku.edu
This will forward port 5000 on your host to port 5000 on the server
Run app with command:
flask run --host=127.0.0.1 --port=5000 (host and port options are used for the purpose of explicitness)
and you should be able to access the application by entering http://127.0.0.1:5000 in your browser.
Read more at https://www.booleanworld.com/guide-ssh-port-forwarding-tunnelling/
When starting a Flask development server using flask run, it starts listening on the loopback interface on port 5000 by default. By adding --host=0.0.0.0 you make the flask server listen on all network interfaces of the host. So, if you have full network access to the host, you should be able to point your browser to it. With the addresses given in your question, just enter http://ku.edu:5000 into the address bar of your browser to interact with your Flask web application.
However, this is not recommended, for security reasons! Since the server is listening on every network interfaces, any person with network access to the host computer can access the application. You're running the application with the Flask development server in development mode, which is not safe for production use.
Instead, I would suggest to use ssh port forwarding to access the flask development server, bound to the loopback interface of the remote host:
zwlayer#personalcomputer $ ssh -L 5000:localhost:5000 myusername#ku.edu
myusername#ku.edu $ git clone https://github.com/.../project
myusername#ku.edu $ cd project
myusername#ku.edu $ env FLASK_APP=app.py FLASK_ENV=development env USE_CUDA=False flask run
This way, ssh forwards all traffic directed to port 5000 of your local computer through the ssh tunnel to localhost:5000 at the remote host, i.e. to port 5000 of the remote host itself.
So, you can point your browser to http://localhost:5000, which is forwarded to the remote server's localhost:5000, which is where your flask server is listening. But—in contrast to the above solution—only local or ssh users at the remote host can access your application.

How to run an FTP server locally that a docker container can connect to

I'm currently running vsftpd locally on port 21 and have a node program that pulls data from it and that also works great.
I have containerised the deployment of the program on my local machine and it deploys fine but complains it can't connect to the FTP server on port 21 which I realised was because that port wasn't open.
Now if I open that port with something like -p 21:21 then this is blocking the FTP server which is bound to 21. I don't understand how I can run a test FTP server and this container at the same time?
Is it possible?
If the "containerised program" is only the node app, then if you connect to the ftp server via localhost:21 it will fail because inside that container there is no ftp server running on port 21. If you want to use the ftp server that runs on your host os, you need to run the container with --net="host", then the node app should connect to the ftp server with 127.0.0.1:21.
Another approach would be creating another container for the ftp server and using docker dns system to communicate the containers.

Remote access to web server on linux

I have access to a server running CentOS 6.7 on which I installed apache and configured the /etc/httpd/conf/httpd.conf file.
I can see the webpage if I ssh to the server and run
$ lynx http://192.99.x.x
but I would like to access it using a real browser. If I try to access it from my computer, it tells me that this webpage is unavailable and if I try to run firefox on the CentOS terminal, I get error: No Display specified.
Is there a way to see the webpage in a browser without port forwarding ?
Without port forwarding, you will need to setup X11 forwarding in SSH. This will allow you to open graphical applications remotely. Below is a link to configure X11 forwarding for SSH.
X11 Forwarding with SSH
CentOS 6 SSH Configuration

Running protractor tests on IE

I was using vm xp on MAC. MAC and vm are in a network but I'm unable to run protractor tests.
When I run, after pointing Selenium address to vm PC IP in n config file, I can see the IE browser initiating and see the nodejs app URL but I'm unable to access the app.
The nodejs server is running on port 9001 and the app is running on 9009 on my local computer which is a Mac PC.
I can browse the app manually with the IP address 10.0.2.2 on vm but not with protractor config.
I am missing something. Don't I need to open ports on the Mac?
What baseurl in protractor config should I use?
I have pointed selenium address to vm ip address and it is working.
And also the nodejs server is running at 0.0.0.0:9001 port.
The testing story for VM's is a little rough, but there are a few approaches to this:
adding a common hostname (myapp.local) to /etc/hosts (and the windows host file) and using that as the protractor baseUrl
Separating the IE tests from other tests and using the host machine's ip as your baseUrl: baseUrl: 'http://10.0.2.2:9000/'
Alternately, you can use a service like SauceLabs or BrowserStack and run your tests on IE through "the cloud". If you can afford the cost i'd highly recommend them.

Resources