2017-01-10 2 views
2

셀레늄 독립 실행 형 크롬 서비스를 설정하여 내 코드 수트를 테스트하려고합니다.셀레늄 서비스를 사용하는 Gitlab CI 코드 테스트

나는 서비스로 크롬 독립을 실행

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

그리고 내 Codeception 테스트를위한 I 설정의 연결은 extension for WordPress와 WebDriver를 사용

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

은 다른 모든 테스트가 잘 실행되지만 때를 내가 연결을 거부하는 셀레늄을 사용하는 스위트 룸에 온다 :

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 

내가 뭘 잘못하고 있는지에 대한 아이디어가 있습니까?

답변

0

아마 http://localhost url을 사용하고 별도의 호스트에서 Selenium Server를 실행하고있는 것이 문제입니다.

Selenium은 테스트를 실행중인 시스템이 아닌 자체 포트 80에 연결을 시도합니다.

+0

이제 실제로 이것이 문제라는 것을 알았습니다. 하지만 내 이미지''tutum__wordpress ''의 호스트 이름을 사용해 보았는데 작동하지 않았습니다. 기본 컨테이너의 호스트 이름을 검색하려했지만 [docs] (https://docs.gitlab.com/ee/ci/variables/README.html)에없는 것으로 나타났습니다. 변수를 제공하십시오. – Greg36

0

gitlab 러너 실제 호스트 이름을 찾으려면 환경 변수 HOSTNAME을 사용하십시오.