我目前正在尝试为下一个React project设置基本回购。 为此我想通过webdriverio + cucumber进行端到端的测试。
虽然只是在本地运行wdio
,但我无法在我的docker容器中运行它。即使我添加wdio-docker-service,它告诉我:
(service: reap) (step: feature_tests) A service failed in the
'onPrepare' hook (service: reap) (step: feature_tests) Error: not
found: java
当我在Dockerfile中手动安装java时,它会抱怨:
(service: reap) (step: feature_tests) A service failed in the
'onPrepare' hook (service: reap) (step: feature_tests) Error: Selenium
server did not start. (service: reap) (step: feature_tests) Another
Selenium process may already be running or your java version may be
out of date. (service: reap) (step: feature_tests) Be sure to check
the official Selenium release notes for minimum required java version:
https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG
答案 0 :(得分:1)
第一个错误似乎来自您正在加载的'selenium-standalone'服务,它试图通过Java启动Selenium。由于您使用的是“节点”泊坞窗映像,因此它没有安装Java。
要使用'wdio-docker-service',您需要在your services line中将'selenium-standalone'替换为'docker'。
将运行两个docker镜像,一个用于运行WebdriverIO的测试(Node),另一个运行selenium standalone(由wdio-docker-service启动)。
或者,您可以在本地运行WebdriverIO命令,只需将Docker用于selenium独立实例。这可能更容易,但不太便携。