user-interface - 如何在 gitlab-ci 上启动一个 selenoid?
问题描述
我正在尝试在 gitlab-ci 上运行测试,但我不知道启动 selenoid 的命令。在本地,这个命令看起来像./ Cm selenoid start
但是在从服务启动 selenoid 的情况下如何指定,我不知道。这是我的.gitlab-ci.yml:
stages:
- testing
ya_test:
stage: testing
tags:
- docker
services:
- selenoid/chrome
image: python:3.9-alpine
before_script:
- pip3 install -r requirements.txt
- selenoid/chrome start #???????
script:
- pytest -s
allow_failure: true
以及在测试夹具中指定什么地址?本地主机:4444?谢谢您的帮助!
解决方案
要使用 Chrome 启动 Selenoid,请尝试使用此 yml。使用 webdriver.Remote(command_executor="http://selenoid__chrome:4444", options=chrome_options, desired_capabilities=DesiredCapabilities.CHROME) 连接 Chrome 并在选项中添加无沙箱。
image: python:3.8
stages:
- test
test:
stage: test
services:
- name: aerokube/selenoid
- name: selenoid/chrome:89.0
before_script:
- echo "Install environment"
- apt-get update -q -y
- pip3 install -r requirements.txt
script:
- echo "Run all tests"
- py.test -s -v --junitxml=report.xml test.py
# if you want detailed report at GitLab add artifacts
artifacts:
when: always
reports:
junit: report.xml
推荐阅读
- c++ - 从 db 在 QT c++ 中实时显示数据
- html - Bulma - 在桌面上强制导航栏垂直
- ruby - 如何使用 rbenv(特别是添加到 bash_profile)?
- javascript - 读取和加载取决于文件扩展名
- python - 我有一个列表,其中一个列数据必须以这样的方式格式化,即 $ 符号和逗号应该被删除
- java - 如何在 ios 移动应用程序中单击可见 = false 的元素
- go - 使用 Go 计算经过的时间(以毫秒为单位)
- r - 在 R 中使用 apply() 来查找住房数据框中每个县的平均价格
- python - 在 Python 中对小部件进行子类化以与 Qt Designer 一起使用的最简单方法
- python - 如何刷新我的代码以便为调查提供新答案?