How to set up GUI testing automation on Ubuntu server - user-interface

I want to set up automated testing of a GUI app (say Qt) on Ubuntu Server distribution (i.e. without phisical monitor and without window manager). How can I accomplish this?

GUI applications - particularly Qt-based ones- usually need some display to connect to. Otherwise they'll have problems rendering the GUI (e.g. fonts) and receive input (e.g. mouse).
The need for a physical display can be avoided through a virtual display however. See this Squish Knowledge Base artcile for hints on the usage of Xvnc, X11vnc, Xvfb and Xnest.
Running a window manager on the virtual display is still recommended. It does not have to be a full desktop environment. A simple WM does. GUI toolkits are not necessarily prepared

Related

Is it possible to containerize a Windows GUI application on a Windows host?

I have a rather difficult to manage Windows closed-source Windows GUI application. It's messy (leaves files all over the place) and has a convoluted installation process.
It has been proposed that we containerize the application, but can this be done?
For UNIX applications there's an easy pattern - just give the app access to the port of the X11 server, and allow the app to write to that, but is there a Windows equivalent? Is there any way at all to containerize a Windows application but allow it to generate windows in the host Operating System's desktop?
If this is possible, are there any handy recipes to get started with this?
Currently, It's not possible to containerized Windows GUI application on a windows host.
From the blog Insider preview: Windows container image
Lars Iwer [MSFT] writes in the comments below the article:
"In the container image as it is right now, GUI elements will be rendered in session 0. UI automation should work with that (e.g. programmatically searching for a window etc.)."
So according to my understanding, you can run GUI apps but the rendered elements are not shown on any desktop which will only work for UI automation work but not for user interactive application.
Session 0:
Session 0 is reserved exclusively for services and other non-interactive user applications. Users
who are logged on to Windows and their user applications must run in Session 1 or higher.
- User interfaces in Session 0 are not supported. Processes running in Session 0 have no access to the graphics hardware thus user interfaces cannot be directly displayed on the monitor.

How to simulate the behavior of a remote desktop without showing the screen

I should make a program that simulates the behavior of a remote desktop but without showing the screen of the server to the client.
I can use any programming language, but the client must be on Android mobile device and the server's operating system must be Windows.
I do not know how to Start. I was thinking about two possibilities:
1- Use a socket. But the difficulty was to give commands outside of the programming environment.
2- Use a rdp already done but turn off the display screen (setting is not present in the rdp I know). Who can help me?
Thank you

How to replace or block Windows Taskbar and Desktop for security reasons, programatically?

Like some cyber coffee applications that disables the user ability to use any other application but only the ones started inside that cyber admin application panel, I searched the Internet for some way of doing it in Delphi:
Remove the Windows Task bar;
Disable the Alt+Tab function;
Disable the Task Manager;
Be able to do/undo that changes in a configuration panel.
These needs are for keeping users from downloading viruses and making changes to Windows configuration or even play games, if it is the system administrator's preference. The own program would serve as a container for authorized applications to run inside then as if it were a MDI application. That is already working
Of course that the system manager will have the options to disable that or revert.
Is there a way to make those four configurations in run-time with Delphi XE3?
I'm not familiar with Delphi. I'm also not sure if it is possible during run-time. But you could do the following:
Write to the registry to prevent alt-tab see this.
Again write to the registry to disable Task Manager see this.
Sounds like you can disable the task bar too by the registry see this.
On your control panel have options and when they hit save, save and restart the computer.
This is provided that Delphi can write to the registry (I believe C# and C++ can). If not, you could create .reg files and execute those by calling cmd.exe with arguments. This I think will cause some pop-ups though.
Update: You may be able to load in the registry changes without a signing out by killing explorer.exe and then loading it again. This may only load parts of the updated registry though.
I'd suggest booting your hardware into Linux, and then run a Windows virtual machine that is as locked down as possible using the existing kiosk mode security settings in Windows. This VM then runs your MDI application when the VM boots. When the MDI application exists the VM reverts to a snapshot of the known good Windows configuration.
You strip down a Linux OS to include only the bare minimum components needed to host your Windows VM.
I'm assuming your MDI windows will only host applications your organization has written, not arbitrary Windows executables. Otherwise you are asking to re-write Windows itself, which will prove impossible.

Detecting a Citrix XenDesktop Session

I'm looking to determine if our application is running on a XenDesktop session rather than locally. Here is what I have found so far:
We currently have code to detect a Citrix XenApp session similar to the solution mentioned by Helge Klein in "API for Determining if App is Running on Citrix or Terminal Services".
Sadly that solution in a XenDesktop environment is returning back a WTSClientProtocolType of 0 which signifies a local console session.
In response to the same question Josh Weatherly mentioned checking the sessionname environment variable.
However a quick console check with echo %sessionname% on the XenDesktop environment returns back 'Console'.
From "Detect citrix “application mode”?" John Sibly suggested a solution for detecting a remote session (not Citrix in particular):
GetSystemMetrics(SM_REMOTESESSION) however returns 0 which also means that it is a local session.
Does anyone know of a way to detect that it is a XenDesktop session? So far as you can see all my attempts are returning that the session is a local console session.
I'm using XenDesktop Express 5.5, accessing the desktop using the Citrix Receiver Web Plug-In.
If you are using XenDesktop for VDI, then as far as the application is concerned, the application is executing locally. VDI, or virtual desktop infrastructure, consists of delivering the GUI from a full featured desktop operating system to a remote device. Typically, the desktop O/S executes in a virtual machine on a hypervisor in a data center, and the GUI is transmitted to the remote device using Citrix' ICA stack. For example, this happens in the pooled desktops scenario.
XenApp offers virtual desktops, which is a slightly different concept. Again, the desktop is delivered to a remote device using the ICA stack. However, the desktop is no longer running on a dedicated O/S. Rather, it is one of a number of user sessions on a single Windows Server. There may be any number of users logged on to that server. This places limits on the applications that can be run, which is why applications might want to know that they are on a multi-user O/S.
What you might try to do is determine whether the GUI is being delivered remotely using the ICA stack. A simple check would involve looking for the "ProticaService", which is responsible for implementing the ICA stack.
Alternatively, you may be trying to determine if your machine is running in a VM or native to a machine. Besides the pooled scenario described in the first paragraph, XenDesktop can deliver desktop running native. This overcomes limits on virtualision I/O devices such as graphics cards used by CAD applications. In this case, you need to rule out the presence of a VMM, or hypervisor.
I have updated my answer linked to in the question with a description of how to determine the remoting protocol type in XenDesktop sessions.
You need the (not really well documented) function WFGetActiveProtocol from Citrix' WFAPI SDK. Proceed as follows:
Download the SDK (link)
Install WFApiSDK64-65.msi
In your C++ project include wfapi.h and link to wfapi[64].lib
Use the undocumented function WFGetActiveProtocol
More detail and sample code here.

Different User Agents in the browsers

I have noticed that some browsers via a build in development feature allow you to choose different user agents.
Does this mean that they change their rendering engine?
Say for example, if I set Safari's user agent to internet explorer - will that then change the rending engine from webkit to trident?
At the moment on my mac I have Safari, Chrome, Firefox and iCab installed. I would imagine they would represent the different engine's better than the user agent function built in.
However you are only limited to installing 1 version of each unless you go the virtual machine or dual boot way.
So what is your advice? Run multiple virtual machine and of course the extra licenses to do it legal will need to be purchased. or stick with the user agent function built in and that gives a good enough interperatation of the differences??
Cheers Jeff
Say for example, if I set Safari's user agent to internet explorer - will that then change the rending engine from webkit to trident?
No. A user agent is just a string that the browser sends to identify itself. I could set my user agent to cheeseburger if I wanted. It won't use a cheeseburger to try and render the page.
Officially, the only correct way to run Internet Explorer is on Windows - which would require a Windows installation - a VM is a perfect valid and common solution. On a Mac you also have the option of Bootcamp.
There are other services, like http://browsershots.org/, that allow you to specify a URL and they will send you a screenshot of what the URL likes like in a particular browser. I typically don't like these solutions because they are slow, you don't have any debugging tools, etc.
the user agent setting in safari (and other browsers) only spoofs the user agent, it doesn't change the rendering engine. you can use that spoofing, to get for example the iPhone version of a webpage in your desktop safari. to check your page in different browsers, you could use some web service like http://browsershots.org/ (thats just the first google result) or setup an array of virtual machines. we do the latter, which ineed costs you 2-3 windows licenses, but you can pack a lot of browsers into one virtual machine, just distribute the different versions among different machines

Resources