gpt4 book ai didi

selenium - 使用 Selenium 服务在 Gitlab CI 上测试 Codeception

转载 作者:行者123 更新时间:2023-12-03 06:38:35 26 4
gpt4 key购买 nike

我正在尝试设置 selenium 独立 chrome 服务来测试我的 Codeception 套装。

我将 chrome 独立运行为服务:

services:
- mysql:latest
- selenium/standalone-chrome:latest

然后我使用带有 extension for WordPress 的 WebDriver 为 Codeception 测试设置连接。 :

WPWebDriver:
url: 'http://localhost'
host: 'selenium__standalone-chrome'
browser: chrome
port: 4444
restart: true
wait: 2
adminUsername: admin
adminPassword: 1234
adminUrl: /wp-admin

所有其他测试都运行良好,但当涉及到我使用 Selenium 的套件时,它拒绝连接:

Time: 7.55 seconds, Memory: 16.00MB

There was 1 failure:

---------
1) SampleTestCept: Test if wp is working in selenium
Test tests/php/acceptance/SampleTestCept.php
Step See "Just another WordPress site"
Fail Failed asserting that on page /
--> This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
Reload
DETAILS
--> contains "this site can't be reached".

Scenario Steps:

2. $I->see("This site can't be reached") at tests/php/acceptance/SampleTestCept.php:6
1. $I->amOnPage("/") at tests/php/acceptance/SampleTestCept.php:4

我做错了什么有什么想法吗?

最佳答案

使用环境变量 HOSTNAME,查找 gitlab runner 的实际主机名。

关于selenium - 使用 Selenium 服务在 Gitlab CI 上测试 Codeception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41573217/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com