如何在gitlab上为nightwatch e2e测试设置正确的Selenium主机?
我想为我的vue.js应用程序添加一些e2e测试,并在管道中运行它们。 我的gitlab-ci.yml中的相应部分如下所示:如何在gitlab上为nightwatch e2e测试设置正确的Selenium主机?,selenium,vue.js,gitlab-ci,nightwatch.js,vue-cli,Selenium,Vue.js,Gitlab Ci,Nightwatch.js,Vue Cli,我想为我的vue.js应用程序添加一些e2e测试,并在管道中运行它们。 我的gitlab-ci.yml中的相应部分如下所示: e2e: image: node:8 before_script: - npm install services: - name: selenium/standalone-chrome alias: chrome stage: testing script: - cd online-leasing-frontend - npm install -
e2e:
image: node:8
before_script:
- npm install
services:
- name: selenium/standalone-chrome
alias: chrome
stage: testing
script:
- cd online-leasing-frontend
- npm install
- npm run test:e2e
和my nightwatch.js配置:
{
"selenium": {
"start_process": false
},
"test_settings": {
"default": {
"selenium_port": 4444,
"selenium_host": "chrome"
}
}
}
“Seleniu_主机”:“chrome”是将主机设置为selenium服务的正确方法吗?
我收到以下错误,表明我的e2e测试无法连接到selenium服务:
连接被拒绝!selenium服务器启动了吗
有什么建议吗?关于硒回购协议,它说: “在使用Chrome或Firefox对映像执行docker run时,请装载-v/dev/shm:/dev/shm或使用标志--shm size=2g来使用主机的共享内存。”
我不太了解gitlab ci,但恐怕无法将其作为参数添加到服务中 问题在于,根据,Gitlab CI使用的是
Kubernetes执行器
,而不是Docker执行器
,后者将所有服务映射到127.0.0.1
。将selenium\u主机设置到此地址后,一切正常
{
"selenium": {
"start_process": false
},
"test_settings": {
"default": {
"selenium_port": 4444,
"selenium_host": "127.0.0.1",
}
}
}