rubyautomated-testsgithub-actionscodeceptionmailcatcher

Disabling mailcatcher commandline messages


When using mailcatcher for testing the sending of mails i use codeception and the codeception-mailcatcher-module. Everything runs as a Github action and i trigger stuff like this:

php vendor/bin/codecept run "tests/codeception/acceptance/product1/backend/RecommendCest" -v --html --fail-fast

That ways i get a very compact display of testing messages on the command line.

When a test contains mail testing, mailcatcher prompts large amounts of this messages:

*   Trying 127.0.0.1:1080...
* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#0)
> GET /messages HTTP/1.0
Host: 127.0.0.1:1080
User-Agent: GuzzleHttp/7

* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 310
< X-Content-Type-Options: nosniff
< Connection: close
< Server: thin 1.5.1 codename Straight Razor
< 
* Closing connection 0
* Hostname 127.0.0.1 was found in DNS cache
*   Trying 127.0.0.1:1080...
* Connected to 127.0.0.1 (127.0.0.1) port 1080 (#1)
> GET /messages/2.json HTTP/1.0
Host: 127.0.0.1:1080
User-Agent: GuzzleHttp/7

How can that be that made less verbose or completely disabled?

Here is the acceptance.suite.yml

class_name: AcceptanceTester
params:
  - parameters.yml
step_decorators:
  - Codeception\Step\TryTo
modules:
  enabled:
    - Asserts
    - Helper\Acceptance
    - DbHelper
    - Filesystem
    - MailCatcher
  config:
    MailCatcher:
      url: "http://127.0.0.1"
      port: "1080"
      guzzleRequestOptions:
        verify: false
        debug: true
        version: 1.0
    Joomla\Browser\JoomlaBrowser:
      url: "http://127.0.0.1:8000/"
      browser: "chrome"
      curl:
        CURLOPT_TIMEOUT: 90
      restart: false
      clear_cookies: true
      window_size: 1920x1600
      connection_timeout: 10
      request_timeout: 10
      upload_max_filesize: 20M
      post_max_size: 21M
      port: 9515 
      capabilities:
        unexpectedAlertBehaviour: "accept"
        "goog:chromeOptions":
          prefs:
            download.default_directory: "%DOWNLOAD_DIR%"
            download.prompt_for_download: false
          args: [
              "headless=new",
              "whitelisted-ips",
              "disable-gpu",
              "no-sandbox",
              "window-size=1920x1600",
              "--disable-notifications",
              "--disable-dev-shm-usage",
            ]

      database host: "127.0.0.1" 
      database user: "root" 
      database password: "root" 
      database name: "%DBNAME%"
      database type: "mysqli"
      database prefix: "jos_" 
      install sample data: "no" 
      sample data: "Default English (GB) Sample Data" 
      admin email: "info@xxx.com"
      name: "admin" 
      username: "admin" 
      password: "123456789" 
      language: "English (United Kingdom)" 
      timeout: 10
      log_js_errors: true

error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED"

Solution

  • If my guess from the output format is correct, this is verbose logging of the curl HTTP client. From your description it is likely the guzzleRequestOptions:debug setting in acceptance.suite.yml for the codeception-mailcatcher-module :

    modules:
      enabled:
        # ...
        - MailCatcher
      config:
        MailCatcher:
          url: "http://127.0.0.1"
          port: "1080"
          guzzleRequestOptions:
            verify: false
            debug: true
            ###########
            version: 1.0
    

    Change it to false:

          guzzleRequestOptions:
            verify: false
            debug: false
            ############
            version: 1.0
    

    And those message should not appear any longer.