gpt4 book ai didi

php - Docker PHP7.x Codeception Selenium WebDriver 抛出 net::ERR_CONNECTION_REFUSED

转载 作者:行者123 更新时间:2023-12-04 11:43:51 24 4
gpt4 key购买 nike

我正在尝试设置 Codeception 来对我的 Web 应用程序进行验收和功能测试。以下是我的文件:
docker-compose.yml

version: '3.7'

services:
# nginx - web server
nginx:
build:
context: ./docker-config/nginx
dockerfile: ./Dockerfile
env_file: &env
- ./cms/.env
init: true
ports:
- "8000:80"
volumes:
- cpresources:/var/www/project/cms/web/cpresources
- ./cms/web:/var/www/project/cms/web:cached
networks:
mmc-network:
aliases:
- mmc.nginx
# php - run php-fpm
php:
build: &php-build
context: ./docker-config/php-prod-craft
dockerfile: ./Dockerfile
depends_on:
- "mysql"
- "redis"
env_file:
*env
expose:
- "9000"
init: true
volumes: &php-volumes
- some volumes............
networks:
mmc-network:
aliases:
- mmc.php

# mysql - database
mysql:
build:
context: ./docker-config/mysql
dockerfile: ./Dockerfile
cap_add:
- SYS_NICE # CAP_SYS_NICE
env_file:
*env
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
init: true
ports:
- "3306:3306"
volumes:
- db-data:/var/lib/mysql
- ./db-seed/:/docker-entrypoint-initdb.d
networks:
- MMC-network

# redis - key/value database for caching & php sessions
redis:
build:
context: ./docker-config/redis
dockerfile: ./Dockerfile
expose:
- "6379"
init: true
networks:
- mmc-network

# webpack - frontend build system
webpack:
build:
context: ./docker-config/node-dev-webpack
dockerfile: ./Dockerfile
env_file:
*env
init: true
ports:
- "8080:8080"
volumes:
- some volumes..........
networks:
- mmc-network

# selenium - web driver for codeception testing
selenium:
container_name: mmc-selenium
ports:
- "4444:4444"
volumes:
- ./cms:/data
build:
context: ./docker-config/selenium
dockerfile: ./Dockerfile
networks:
mmc-network:
aliases:
- mmc.selenium

volumes:
db-data:
cpresources:
storage:

networks:
mmc-network:

accept.suite.dist.yml:
actor: AcceptanceTester
extensions:
enabled:
- Codeception\Extension\RunFailed
- Codeception\Extension\Recorder
modules:
error_level: "E_ALL"
enabled:
- WebDriver:
url: 'http://mmc.nginx'
host: mmc.selenium
port: '4444'
window_size: 1920x1200
browser: 'chrome'
wait: 60
capabilities:
os: Windows
os_version: 10
browserstack.local: true
- \Helper\Acceptance
NavigationCept.php
<?php 
$I = new AcceptanceTester($scenario);

# define purpose of the test
$I->wantTo("check that navigation is functional.");

# check all menu items
$I->amOnPage('/');
$I->see('Search');
***现在,请注意, Codeception已经安装在我的 PHP 容器中并且运行良好。
当我尝试运行测试时,出现以下错误,表明与我的主机(即我的 Nginx 服务器)的连接已被拒绝。
enter image description here
我尝试使用不同的 url ,例如, https://google.com它只是连接良好,一切都成功了。我在这里做错了吗?是我的 url参数不正确?如果可以,请帮帮我。提前致谢。

最佳答案

我之前在 Codeception + Selenium 中看到过这样的异常。我没有那个项目配置文件与你分享。
我强烈的猜测是 此错误可能是由于 Codeception-ChromeDriver-Selenium 版本的冲突引起的

  • 您是否尝试在较低的 ChromeDriver 版本(例如 80 或 75)上执行此操作?
  • 或者更改Selenium版本?

  • 您可以查看以下说明,这可能会帮助您进行更多调试
  • https://github.com/Codeception/Codeception/issues/5062
  • https://stackoverflow.com/a/63760572/2923098

  • 如果我找到其他资源来解决这个问题,我会更新这个答案。

    关于php - Docker PHP7.x Codeception Selenium WebDriver 抛出 net::ERR_CONNECTION_REFUSED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68005504/

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