Can web component tester and/or selenium run the browser on another machine - selenium

I have the following scenario:-
I am developing an SPA using Polymer for the client and a bespoke server using nodejs. It talks to an SQL Server Database on another computer entirely
The production version will run on a raspberry pi INSIDE a Docker container
I am trying to set up a CI system using jenkins on a desktop computer as the master, with a slave node as the raspberry pi. This system will operate in pairs - one pair will work at home (where the desktop is linux) and one pair will operate in an office (where the desktop is windows). A global git repository will allow me transfer between the two, and allow the jenkins machine and its slave to be driven by the same repository (exposed to the raspberry pi via ssh)
I am thinking it unlikely that I can install Docker on the desktop computer in the office
I would like to find a way to test the client aspect of this SPA against the content of the production Docker image. I can produce a test Docker image using the production image as a base in order to include additional test tools such as polymer-cli (which in turn includes web-component-tester and selenium). But that image would have to run on the raspberry pi where there isn't much choice of browser.
I currently run tests on my linux desktop with a nodejs javascript call like const child = spawn('xvfb-run', ['-a', 'wct', '--color'], {cwd: path.resolve(__dirname, 'client')});
What I can't quite get my head around is some portion of web testing is driven by nodejs talking to selenium which then fires up a browser, but where? and then nodejs is serving the content to the browser where it is run (and I am using xvfb-run to capture the output from the browser). Is it possible to have the browser run on another machine (either the windows desktop machine or the place where the global git repository is located)

Related

Host Nuxt.js and Express.js On Ubuntu server via putty and run it all the time

I have done a project for BE and FE (Express.js and Nuxt.js), but when it build and run it via putty on ubuntu server, this is what I get
Is that a way to make it live using Putty?
And what happens if I close Putty, will Express and Nuxt still be running on the server?
This is not a conventional way of exposing something to the Internet since it's not publicly facing the Internet (the only way right now to have access to your apps is to know the IP of the server, username + password of the SSH account).
Also, you're running the server in dev mode here, not something optimized in terms of speed.
You will need to use yarn generate (or yarn build) then yarn start on Netlify, Vercel or any platform like that for your Frontend (free service usually if using SSG).
Here is a whole list of places and how to host there for the frontend: https://nuxtjs.org/deployments
As for your backend, you may host it on Heroku, Render.com, Railway or any place of your choice (with a Node.js available).
Even a bare metal SSD can be good for such but it will require more setup overall.

Running tests on VM does not work unless window is open

We are attempting to do our testing remotely, so we set up some Virtual Machines to run our GUI tests and to free up our local machines. What we were hoping for was to have the tests run just like they would on a physical machine, however they seem to require an active Remote Desktop Connection up in order to run properly. These tests are written using LeanFT and it is a windows app so this is not mobile GUI testing.
Is there a certain way to configure this VM to set it up properly for automated GUI testing that does not require an active Remote Desktop Connection? It seems as if its sharing the controls on our physical machine..
Or am I completely wrong here.. Is a Remote Machine different than a Virtual Machine? Thanks!
It's possible to run a GUI test without an active Remote Desktop Connection
I achieved this with leanft through the following 2 steps:
Configure how you execute your tests
Whether you're running via a Jenkins slave or through another kind of "listener" (maybe ssh, or bamboo, etc.), you need to configure this listener to start after a specific user is logged on.
In my case I was running through the Jenkins slave, so I've configured the startup of the slave to launch as soon the user logged in.
Tell windows to login the user when the computer starts. You can achieve that via the following registry:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultDomainName"="DOMAIN"
"DefaultUserName"="USERNAME"
"AutoAdminLogon"="1"
"DefaultPassword"="PASSWORD"
The core requirement is that you need to have an active session (regardless of whether you are using Jenkins, TeamCity, Grid or other tools to launch the tests).
For your virtual machine, you will need to have access to the console. For VMWare vSphere, there is a native client or website. For VMWare Workstation or VirtualBox, these automatically display.
Using the console access, log into the system and set it up to never log out or sleep or hibernate. This is a variety of OS settings that you can look up.
Essentially, these boxes need to always be logged in. With this setup, you need to be sure access to these systems is controlled so that you don't have random people logging in / or logging out.

How can anyone run access Selenium test scripts without having to install/run it locally?

I am looking for ways to set up like a central 'hub' for Selenium in my work, allowing anyone to access in within the company. For example, Tester A writes test scripts, the Person B can run without having to manually copy over the test scripts to their local workstation)
So far, I've only thought of installing Selenium in a VM which will then execute as per normal. But if I run Selenium Grid, it will run VMs within VM (?). My only concern with VMs is that it'd run slowly.
If anyone can think of a better solution or recommendation please do give me some advice. Thank you in advance.
One idea. You can create an infrastructure combining Jenkins/Selenium/Amazon.
The following is my solution from another post.
You can do it with a grid.
First of all you need to create a Selenium hub with an EC2 ubuntu 14.04 AMI without UI and link it as a jenkins slave to your Jenkins master. Or as directly a master. What you want. Only command line. Download Selenium Server standalone. (be careful on downloading the version. If you Download the Selenium3Beta, things could change). Here you can configure the HUB. You can also add the Selenium Hub as a service and configure to run automatically at server start. its important that you open the Selenium default port (or the one that you configured) so the nodes can connect to it. You can do that on the Amazon EC2 console when you have created your instance. You just need to add a security group with an inbound rule for TCP in the port you want for the IPs you want.
Then, you can create a Windows server 2012 instance server (for example, that's what I did), and do the same process. Download the same version for Selenium and the chromedriver (there is no need to download any firefoxdriver for Selenium versions before Selenium3). Generate a txt file and prepare the Selenium command to link to the HUB as a NODE. And convert it to *.bat in order to execute it. If you want to run the bat at start you can create a service with the task scheduler or use NSSM (https://nssm.cc/). Don't forget to add the rules to the security groups for this machine too!
Next, create the Jenkins server. You can use the Selenium Hub as the Jenkins master or as a slave.
Last step is configuring a job to be run in the Jenkins-Selenium machine. This job needs to be linked to your code repository (git, mercurial...) Using the parametrized build plugion for jenkins you can tell that job to pull the revision you want (where every developer can pull the revision with the new changes and new tests) and run the Selenium tests in that build with the current breanch/revision and against one unique selenium. You can use ANT or Maven to run the Selenium tests in Jenkins.
May be it's complicated to understand because there are so many concepts here but it's robust and it works fine!
If you have doubts, tell me!
If Internet Explorer is not one of the browsers on which you must run your automation tests, I would recommend that you consider docker selenium.
Selenium is providing pre-configured docker images for both Selenium Hub and Node ( refer here for more information ). For making use of docker selenium all you need to do is find a machine (preferably unix machine), install docker on it by following instructions detailed here and then start the hub and node by starting off those containers. In the case of docker you can literally transform a VM (or) a physical machine into a VM farm and yet not have to worry about slowness etc., because I believe docker is optimised for these and it runs your VM as a process.
Resorting to using Amazon cloud for running your selenium nodes is all fine, but if you have corporate policies that prevent in-coming traffic from the internet into your intranet region, then I am not sure how far Amazon cloud would be useful.
Also remember that Jenkins is not something that is absolutely required but is more of a good to have part in the setup because it would let anyone run their tests from a web UI. This will however require that all your tests are checked-in and made available in a central version control system in your organization.
PS : The reason why called out Internet Explorer as an exception is because IE runs only on windows and there are no docker images (yet) for windows. All the docker images are UNIX based images.

The best way of develop with Open shift origin: VM or local installation

What is the best way to develop with open shift origin? Is it using vm or install it locally? I have tried installing the vm and I could not login to the vm. What is the default credential used to login to fedora vm.
Default credentials
Depending on which route you follow (see below) there might or might not be real authorization in place.
If you have the AllowAllPasswordIdentityProvider in place you can get away with test/test or whatever.
If you take the binary version (see below) this is what you'll have by default. I changed it to be HTPasswdPasswordIdentityProvider instead.
For the other options I think you will have a user called system, with the password admin coming with the setup.
Docker container version
You can quickly get OpenShift running in a Docker container using
images from Docker Hub on a Linux system. This method is supported on
Fedora, CentOS, and Red Hat Enterprise Linux (RHEL) hosts only.
Link: https://docs.openshift.org/latest/getting_started/administrators.html#running-in-a-docker-container
As per the origin folks, this setup is not (yet) a full example, but very easy to get started with. You should be able to follow the instructions to get an all-in-one instance up and running in no time. However, this approach cannot teach you how to create a cluster (master(s) and node(s))
Vagrant VM
This image is based off of OpenShift Origin and is a fully functioning
OpenShift instance with an integrated Docker registry. The intent of
this project is to allow Web developers and other interested parties
to run OpenShift V3 on their own computer. Given the way it is
configured, the VM will appear to your local machine as if it was
running somewhere off the machine.
The OpenShift Master, Node, Docker Registry, and other pieces are running in one VM. Given it's focus on application developers, it should NOT be used in production.
Link: https://www.openshift.org/vm
Binary option
Red Hat periodically publishes binaries to GitHub, which you can
download on the OpenShift Origin Releases page.
Link: https://github.com/openshift/origin/releases
This is the option I follow currently. You download the binaries, install GO, then setup the OC client tools. Next step you generate the configuration files and start adding your system components (router, ...).
Follow this page to understand the basics:
Link: https://github.com/openshift/origin/blob/master/examples/sample-app/README.md
Ansible route
For production installation you probably want to install your cluster via Ansible.
My humble advice is to do this once you got a bit of an experience via configuring by hand (see previous point). Let's hear some people with more experience though.
Link: https://docs.openshift.org/latest/install_config/install/index.html
Documentation in general
Link: https://docs.openshift.org/latest/install_config/master_node_configuration.html#creating-new-configuration-files
Spin up a Centos.7 VM, download the latest origin tools:
wget https://github.com/openshift/origin/releases/download/v1.3.0-alpha.2/openshift-origin-client-tools-v1.3.0-alpha.2-983578e-linux-64bit.tar.gz
tar xzvf openshift-origin-client-tools-v1.3.0-alpha.2-983578e-linux-64bit.tar.gz
ln -s /root/openshift-origin-client-tools-v1.3.0-alpha.2-983578e-linux-64bit/oc /usr/local/bin/oc
chmod 755 /root/openshift-origin-client-tools-v1.3.0-alpha.2-983578e-linux-64bit/oc
Bring up your single node origin cluster:
oc cluster up --use-existing-config --host-data-dir=/var/tmp/etcd
Login using the instructions provided.

pywinauto can it be made cross platform

My Python application has windows is client and server as Linux. My aim is to automate windows GUI application with pywinauto from Linux server.
Can pywinauto be made cross platform?
It's not possible using pywinauto immediately. But you may copy pywinauto script to the target Windows machine and run it remotely using Jenkins, for example. Or any other CI server. Master node can be on Linux. So Windows node can run as a slave. But there are several requirements for the Windows slave (this check list is based on my recent experience).
Windows slave can be set up with auto logon.
VNC server software (TightVNC or UltraVNC, for example) should be installed.
Video card drivers should be up-to-date for better screen resolution (and for black screen prevention).
Jenkins slave process must run as not a service (i.e. in the existing desktop, so Jenkins task would have an access to the GUI). Just do NOT click menu "Run as a service" in JNLP agent window.
Do not use Remote Desktop connection from another Windows machines (reboot may be required to restore GUI session with VNC client/server pair).
Of course, Python+pywinauto must be installed on Windows node. Just in case.
If UAC is enabled on Windows node, in some cases it should be disabled (if you have to deal with admin access like GUI installers do).
On Linux you need to set up the VNC client and Jenkins. For other CI servers steps may be similar but with some differences.