如何在Docker容器中运行无头浏览器testing

我有一个使用chimp运行摩卡testing的node.js应用程序,在我的本地操作系统中运行时,它正常工作。 它使用Google Chrome进行UItesting。

目前,我是dockerizing这个应用程序…但是,我不确定我需要什么来运行在浏览器方面的uitesting。

我使用了https://github.com/workflow/docker-chimp/blob/master/Dockerfile中的一些命令来安装无头Chrome浏览器。

我的testing在“最终”挂钩上失败…但我不知道这是什么,也不知道为什么会发生。testing通常在主机操作系统中运行。

> pluto_integ_test@1.0.0 test /PlutoD2D/itest > chimp --mocha [chimp] Running... 1) "before all" hook 0 passing (1m) 1 failing 1) "before all" hook: Error: timeout of 60000ms exceeded. Ensure the done() callback is being called in this test Mocha failed npm ERR! Test failed. See above for more details. 

我怎样才能找出问题所在?

尝试使用mocha-headless-chrome软件包。

 npm i mocha-headless-chrome mocha-headless-chrome -f test-page.html 

你还需要一些库来执行Docker容器中的无头铬:

 apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget 

看到细节 。

Interesting Posts