sezertunca
sezertunca

Reputation: 47

Codeception REST timeout issue

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?

Upvotes: 0

Views: 3418

Answers (3)

EleQ
EleQ

Reputation: 96

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 :)

Upvotes: 8

Lysak
Lysak

Reputation: 393

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]

Upvotes: 0

sezertunca
sezertunca

Reputation: 47

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

Upvotes: 1

Related Questions