Search code examples
phpyii2codeception

Codeception\Extension\RunProcess not starting processes


PROBLEM:

Yesterday Codeception introduced new extension which should help with starting/stopping Selenium Server, Chrome Driver, etc (more here). However, even it shows that processes are starting - they're actually not.

acceptance.suite.yml

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            url: http://127.0.0.1:8080/
            browser: chrome
        - Yii2:
            part: orm
            entryScript: index-test.php
            cleanup: false
extensions:
    enabled:
        - Codeception\Extension\RunProcess:
            - java -jar /home/tajgeer/.executables/bin/selenium-server.jar
            - php /home/tajgeer/Repozytoria/Yii2/yii serve

output:

Acceptance Tests (5)

  [RunProcess] Starting java -jar /home/tajgeer/.executables/bin/selenium-server.jar
  [RunProcess] Starting php /home/tajgeer/Repozytoria/Yii2/yii serve

E AboutCest: Ensure that about works 
E ContactCest: Ensure that contact page works 
E ContactCest: Contact form can be submitted 
E HomeCest: Ensure that home page works 
E LoginCest: Ensure that login works 

  [RunProcess] Stopping php /home/tajgeer/Repozytoria/Yii2/yii serve
  [RunProcess] Stopping java -jar /home/tajgeer/.executables/bin/selenium-server.jar

example error:

[ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running.

I've already tried to set o+x permissions on both execs - didn't change anything. When I'm trying to run both tools by using entered commands - everything works well.

Could anyone point out what am I doing wrong?


Solution

  • SOLUTION:

    Actually... I've solved it on my own. I've forgot about sleep (processes didn't even had a chance to run as tests were very quick). I've changed acceptance.suite.xml to following:

    class_name: AcceptanceTester
    modules:
        enabled:
            - WebDriver:
                url: http://127.0.0.1:8080/
                browser: chrome
            - Yii2:
                part: orm
                entryScript: index-test.php
                cleanup: false
    extensions:
        enabled:
            - Codeception\Extension\RunProcess:
                0: java -jar /home/tajgeer/.executables/bin/selenium-server.jar
                1: php /home/tajgeer/Repozytoria/Yii2/yii serve
                sleep: 5