无头服务器上的端到端测试 [英] End To End Testing on Headless Server

查看:157
本文介绍了无头服务器上的端到端测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为在数字海洋上运行Ubuntu服务器12.04.3的Droplet上进行端到端测试的环境.

I am trying to set up an environment for end-to-end testing on a droplet running Ubuntu server 12.04.3 on digital ocean.

我最终想要实现的是让我的 jenkins (安装在一个液滴上)能够运行端到端测试.现在,服务器当然是 headless 了,并且端到端测试需要通过浏览器运行(我将protractor与带有chromedriver的硒独立服务器一起使用).

What I am trying to achieve in the end is for my jenkins (installed on the one droplet) to be able to run my end-to-end tests. Now, the server is ofcourse headless and the end-to-end tests need to run through a browser (I am using protractor with the selenium standalone server with chromedriver).

我的问题是:如何在该计算机上生成浏览器? 我已经安装了xorg ,如果我在服务器上执行startx,然后注销并ssh -X到它,则可以手动运行端到端测试(本地浏览器会弹出浏览器机器).但是我可以在不使用ssh -X的情况下使它工作,并且因为jenkins位于要运行测试的同一液滴上.好吧,我没有让浏览器产生.

My question is: how do I spawn a browser on that machine? I have installed xorg and if I do startx on the server, log out and ssh -X to it, I can manually run the end-to-end tests (a browser pops up on my local machine). But I can get it to work without ssh -X to it, and since jenkins is on the same droplet where the tests are to be run. Well I dont get a browser to spawn.

注意:我知道我可能在这里缺少一些琐碎的东西,因为我不完全了解配置或xorg.

NOTE: I know I might be missing something really trivial here since I don't fully understand the configuration nor the xorg.

非常感谢任何提示或完整的答案,这给了我满头白发.

Any hints or a complete answer is very much appreciated, this is giving me gray hair.

经过一番挖掘,我认为我对xorg的理解有点不对劲,我猜想X的目的是能够在远程机器(即我的本地机器)上产生一个窗口.而我所追求的却更多地是像Xvfb这样的虚拟帧缓冲区...

After a little digging I think i got the xorg stuff a bit wrong, i am guessing the purpose of X is to be able to spawn a window on a remote machine ( ie my local machine). And what i am after is more along the lines of a virtual frame buffer such as Xvfb...

推荐答案

有PhantomJS,但带有量角器的是

There is PhantomJS but with Protractor is buggy and a dead-end.

您仍然可以使用Chrome& Firefox通过 docker-selenium 无头,或者,如果您不喜欢 Xvfb .

You can still use Chrome & Firefox headless through docker-selenium or, if you don't like Docker you can do it yourself with ubuntu-headless sample. Both solutions provide Chrome & Firefox by using Xvfb even though there is no real DISPLAY.

更新2 似乎可以在OSX中运行Xvfb: http://xquartz.macosforge.org/landing/

UPDATE 2 Seems to be possible to run Xvfb in OSX: http://xquartz.macosforge.org/landing/

更新1 Mac OSX硒无头解决方案:

UPDATE 1 Mac OSX selenium headless solution:

因此可以在Mac上无头测试硒.并不是真正的无头,而是作为另一个用户,所以它不会干扰您当前的用户显示. 为此,您需要启动: http://support.apple.com/zh-cn/HT201710 开始使用kickstart实用程序

So can test selenium headless on mac. Not headless really but as another user so it doesn't interfere with your current user display. To do this you need kickstart: http://support.apple.com/en-us/HT201710 Begin using the kickstart utility

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent

激活远程桌面共享,为所有用户启用访问权限,然后重新启动ARD Agent:

Activate Remote Desktop Sharing, enable access privileges for all users and restart ARD Agent:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all 

仅Apple Remote Desktop 3.2或更高版本

允许所有用户访问,并为所有用户提供完全访问权限

Apple Remote Desktop 3.2 or later only

Allow access for all users and give all users full access

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all

Kickstart帮助命令

Kickstart help command

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help

这篇关于无头服务器上的端到端测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆