0

I'm trying to increase the Codeception REST timeout, but it doesn't seem to be working.

That's what I have

class_name: ApiTester
modules:
    enabled:
        - \Helper\Api:
        - REST:
            depends: PhpBrowser
            timeout: 90

Timeout error I'm getting

[GuzzleHttp\Exception\ConnectException] cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received

What am I doing wrong?

3 Answers 3

8

I had this problem too. This was my Fix

in acceptance.suite.yml

    # Codeception Test Suite Configuration

# suite for acceptance tests.
# perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser
        - REST
    config:
        REST:
            timeout: 90 # or 90000 the same result
        PhpBrowser:
            url: 'http://YOUR_URL_TO_YOUR_PUBLIC_FOLDER/public'
            curl:
                CURLOPT_TIMEOUT: 300 // in Seconds

My problem was that i put only the REST in it with "depends" to PhpBrowser but you need to configure the PhpBrowser to setup the Timeout.

I hope i could help and sorry for my bad english :)

Sign up to request clarification or add additional context in comments.

Comments

1

Thanks Thomas, I've added this to my api.suite.yml file and it worked.

class_name: ApiTester modules: enabled: - \Helper\Api - REST - PhpBrowser config: REST: depends: PhpBrowser timeout: 90 PhpBrowser: url: '' curl: CURLOPT_TIMEOUT: 90

1 Comment

Delete that timeout: 90 parameter, it doesn't do anything. The only parameter used by REST module is url .
0

For Codeception 4.

Add to api.suite.yml or acceptance.suite.yml something like this

actor: ApiTester
modules:
  enabled:
    - PhpBrowser:
        url: https://localhost/index-test.php
        timeout: 5
#        curl:
#          CURLOPT_RETURNTRANSFER: true // add some curl option
    - REST:
        depends: PhpBrowser
        url: https://localhost/index-test.php
        part: Json
    - Yii2:
        configFile: 'tests/config/test.php'
        part: [orm, fixtures]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.