【发布时间】:2021-03-20 04:30:41
【问题描述】:
我们实际上正在将我们的存储库移动到 github,并且我们希望将 github 操作用于我们的管道,以及我们基于 WebdriverIO 的测试自动化框架。我对 github 操作完全陌生,我更擅长 Jenkins 和 Jenkins 管道。
所以,WebdriverIO webpage 上有一个非常小的 github 操作示例,但它对我们/我并没有真正的帮助。我尝试只执行一些测试,将一些东西推送到分支。我们目前正在“ubuntu-latest”图像上运行它,我尝试只执行一些简单的网络测试,但这并不容易。我一开始尝试了以下几种方式:
-
直接在ubuntu-latest镜像上使用chromedriver执行测试会报错:
ERROR webdriver: Request failed with status 500 due to unknown error: unknown error: Chrome failed to start: exited abnormally. -
将 wdio docker 服务与 docker 映像“selenium/standalone-chrome-debug”一起使用也会产生错误。如果我重新运行这项工作,那么一切都很好。第一次运行也是一个问题,第一次运行更有趣;):
ERROR wdio-docker-service: Failed to run container: request to http://localhost:4444/ failed, reason: connect ECONNREFUSED 127.0.0.1:4444
也许您有一些经验、建议或示例可以让我解决这个问题?通过 GitHub 操作执行 WebdriverIO 测试的最佳方式是什么?
这是我的 github 操作工作流 yaml:
name: Testautomation Example
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup
run: npm install
- name: Test
# 1. issue with chromedriver
#run: ENV_PATH=environment/QS npm run clear-test -- "wdio-configs/wdio.conf.chrome.chromedriver.js --cucumberOpts.tagExpression=@example"
# 2. issue with wdio docker service
run: ENV_PATH=environment/QS npm run clear-test -- "wdio-configs/wdio.conf.chrome.docker.debug.js --cucumberOpts.tagExpression=@example"
- name: Upload Test Reports
uses: actions/upload-artifact@v2
with:
name: reports
path: tests/reports/
- name: Upload Logs
uses: actions/upload-artifact@v2
with:
name: logs
path: log/
【问题讨论】:
-
你不需要在 github 管道中运行 docker。它已经在 docker 上下文中运行。我有一个在管道github.com/mgrybyk/webdriverio-devtools 中运行 WebdriverIO 测试的示例
标签: selenium github webdriver github-actions webdriver-io