{"action":"created","issue":{"url":"https://api.github.com/repos/lucatume/wp-browser/issues/140","repository_url":"https://api.github.com/repos/lucatume/wp-browser","labels_url":"https://api.github.com/repos/lucatume/wp-browser/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/lucatume/wp-browser/issues/140/comments","events_url":"https://api.github.com/repos/lucatume/wp-browser/issues/140/events","html_url":"https://github.com/lucatume/wp-browser/issues/140","id":298196458,"number":140,"title":"Using wp-browser within docker","user":{"login":"indietravel","id":1871486,"avatar_url":"https://avatars2.githubusercontent.com/u/1871486?v=4","gravatar_id":"","url":"https://api.github.com/users/indietravel","html_url":"https://github.com/indietravel","followers_url":"https://api.github.com/users/indietravel/followers","following_url":"https://api.github.com/users/indietravel/following{/other_user}","gists_url":"https://api.github.com/users/indietravel/gists{/gist_id}","starred_url":"https://api.github.com/users/indietravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indietravel/subscriptions","organizations_url":"https://api.github.com/users/indietravel/orgs","repos_url":"https://api.github.com/users/indietravel/repos","events_url":"https://api.github.com/users/indietravel/events{/privacy}","received_events_url":"https://api.github.com/users/indietravel/received_events","type":"User","site_admin":false},"labels":[{"id":107282453,"url":"https://api.github.com/repos/lucatume/wp-browser/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":{"login":"lucatume","id":2749650,"avatar_url":"https://avatars1.githubusercontent.com/u/2749650?v=4","gravatar_id":"","url":"https://api.github.com/users/lucatume","html_url":"https://github.com/lucatume","followers_url":"https://api.github.com/users/lucatume/followers","following_url":"https://api.github.com/users/lucatume/following{/other_user}","gists_url":"https://api.github.com/users/lucatume/gists{/gist_id}","starred_url":"https://api.github.com/users/lucatume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucatume/subscriptions","organizations_url":"https://api.github.com/users/lucatume/orgs","repos_url":"https://api.github.com/users/lucatume/repos","events_url":"https://api.github.com/users/lucatume/events{/privacy}","received_events_url":"https://api.github.com/users/lucatume/received_events","type":"User","site_admin":false},"assignees":[{"login":"lucatume","id":2749650,"avatar_url":"https://avatars1.githubusercontent.com/u/2749650?v=4","gravatar_id":"","url":"https://api.github.com/users/lucatume","html_url":"https://github.com/lucatume","followers_url":"https://api.github.com/users/lucatume/followers","following_url":"https://api.github.com/users/lucatume/following{/other_user}","gists_url":"https://api.github.com/users/lucatume/gists{/gist_id}","starred_url":"https://api.github.com/users/lucatume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucatume/subscriptions","organizations_url":"https://api.github.com/users/lucatume/orgs","repos_url":"https://api.github.com/users/lucatume/repos","events_url":"https://api.github.com/users/lucatume/events{/privacy}","received_events_url":"https://api.github.com/users/lucatume/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-02-19T08:42:26Z","updated_at":"2018-03-13T04:03:23Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm using the [10up local docker](https://github.com/10up/wp-local-docker)  with everything as default.\r\n\r\nI can install Codeception and wp-browser using composer following the QuickStart instructions and successfully use init wp-browser  to scaffold things. The problem lies with running a basic acceptance test to look at the homepage.\r\n\r\nIn my browser, outside of docker, I access the homepage at `localhost`. Within docker, a curl of that fails.\r\n ```\r\nroot@5970229fa5b9:/var/www/html# curl localhost\r\ncurl: (7) Failed to connect to localhost port 80: Connection refused\r\n```\r\nWithin docker, I can see the homepage  by using `curl nginx`.\r\n\r\nMy acceptance.suite.yml file reads:\r\n```\r\n# Codeception Test Suite Configuration\r\n#\r\n# Suite for acceptance tests.\r\n# Perform tests in browser using the WPWebDriver or WPBrowser.\r\n# Use WPDb to set up your initial database fixture.\r\n# If you need both WPWebDriver and WPBrowser tests - create a separate suite.\r\n\r\nactor: AcceptanceTester\r\nmodules:\r\n    enabled:\r\n        - WPDb\r\n        - WPBrowser\r\n        - \\Helper\\Acceptance\r\n    config:\r\n        WPDb:\r\n            dsn: 'mysql:host=mysql;dbname=wordpress'\r\n            user: 'wordpress'\r\n            password: 'password'\r\n            url: 'localhost'\r\n            tablePrefix: 'wp_'\r\n        WPBrowser:\r\n            url: 'localhost'\r\n            adminUsername: 'test'\r\n            adminPassword: 'test'\r\n            adminPath: '/wp-admin'\r\n```\r\nBut `php vendor/codeception/codeception/codecept run acceptance` returns:\r\n```\r\nroot@5970229fa5b9:/var/www/html# php vendor/codeception/codeception/codecept run acceptance\r\nCodeception PHP Testing Framework v2.3.8\r\nPowered by PHPUnit 6.5.6 by Sebastian Bergmann and contributors.\r\n\r\nAcceptance Tests (2) ----------------------------------------------------------------------------------------------------------------------------------------------------------------\r\nE WPFirstCest: Try to see home (0.11s)\r\nE WPFirstCest: Try to test (0.01s)\r\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r\n\r\n\r\nTime: 2.21 seconds, Memory: 12.00MB\r\n\r\nThere were 2 errors:\r\n\r\n---------\r\n1) WPFirstCest: Try to see home\r\n Test  tests/acceptance/WPFirstCest.php:tryToSeeHome\r\n                                                                                                                                                                            \r\n  [GuzzleHttp\\Exception\\ConnectException] cURL error 7: Failed to connect to localhost port 80: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)  \r\n                                                                                                                                                                            \r\n\r\nScenario Steps:\r\n\r\n 1. $I->amOnPage(\"/\") at tests/acceptance/WPFirstCest.php:16\r\n\r\n#1  /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:186\r\n#2  /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:150\r\n#3  /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:103\r\n#4  /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:43\r\n#5  /var/www/html/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:37\r\n#6  /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php:36\r\n#7  /var/www/html/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:54\r\n#8  /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php:59\r\n#9  /var/www/html/vendor/guzzlehttp/guzzle/src/HandlerStack.php:67\r\n#10 /var/www/html/vendor/guzzlehttp/guzzle/src/Client.php:277\r\n```\r\n(and the same for test 2).  if I switch `localhost `for `nginx`, I get\r\n```\r\n---------\r\n1) WPFirstCest: Try to see home\r\n Test  tests/acceptance/WPFirstCest.php:tryToSeeHome\r\n Step  See \"This is your first post. Edit or delete it, then start writing!\"\r\n Fail  Failed asserting that  on page nginx/\r\n-->  400 Bad Request 400 Bad Request nginx/1.13.8 \r\n--> contains \"this is your first post. edit or delete it, then start writing!\".\r\n```\r\n\r\nI obviously need to do _something_ to allow codeception / wp-browser to see the browser, but I'm stuck as to what that is. Any help appreciated."},"comment":{"url":"https://api.github.com/repos/lucatume/wp-browser/issues/comments/372539948","html_url":"https://github.com/lucatume/wp-browser/issues/140#issuecomment-372539948","issue_url":"https://api.github.com/repos/lucatume/wp-browser/issues/140","id":372539948,"user":{"login":"indietravel","id":1871486,"avatar_url":"https://avatars2.githubusercontent.com/u/1871486?v=4","gravatar_id":"","url":"https://api.github.com/users/indietravel","html_url":"https://github.com/indietravel","followers_url":"https://api.github.com/users/indietravel/followers","following_url":"https://api.github.com/users/indietravel/following{/other_user}","gists_url":"https://api.github.com/users/indietravel/gists{/gist_id}","starred_url":"https://api.github.com/users/indietravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indietravel/subscriptions","organizations_url":"https://api.github.com/users/indietravel/orgs","repos_url":"https://api.github.com/users/indietravel/repos","events_url":"https://api.github.com/users/indietravel/events{/privacy}","received_events_url":"https://api.github.com/users/indietravel/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T04:03:22Z","updated_at":"2018-03-13T04:03:22Z","author_association":"NONE","body":"Unfortunately a busted arm has stopped me from coming back to this in a\ntimely manner. I’ll feed back as soon as I can.\nOn Sun, 4 Mar 2018 at 03:53, theAverageDev (Luca Tumedei) <\nnotifications@github.com> wrote:\n\n> Ok, I've installed the setup and spun it up.\n>\n> I've run all the commands below from within the php_fpm container of the\n> stack:\n>\n>    1. I've required lucatume/wp-browser:^2.0 and vlucas/phpdotenv as dev\n>    dependencies\n>    2. I've created the tests databasethat I will use to run thewpunit\n>    tests;mysql -u root -p -h mysql -e \"create database if not exists\n>    tests;\", root password ispassword(from thedocker-compose.yml` file)\n>    3. I've bootstrapped wp-browser with vendor/bin/codecept init wpbrowser;\n>    relevant answers are http://nginx as URL and /var/ww/html as WP root\n>    folder\n>    4. I've modified the bootstrapped suites configuration files to use\n>    the .env based configuration; to do so I've added this line in the\n>    codeception.yml file:\n>\n>    params:\n>      - .env\n>\n>    5. I've modified all the suites configuration files to use the env\n>    placeholders (see below).\n>\n> This is my .env file to run the tests *from within* the Docker php_fpm\n> container:\n>\n> ROOT_FOLDER=\"/var/www/html\"\n> URL=\"http://nginx\"\n> DOMAIN=\"nginx\"\n> DB_HOST=\"mysql\"\n> DB_NAME=\"wordpress\"\n> DB_USER=\"root\"\n> DB_PASSWORD=\"password\"\n> ADMIN_USERNAME=\"admin\"\n> ADMIN_PASSWORD=\"admin\"\n> TEST_DB_NAME=\"tests\"\n>\n> The codeception.yml file:\n>\n> paths:\n>     tests: tests\n>     output: tests/_output\n>     data: tests/_data\n>     support: tests/_support\n>     envs: tests/_envsactor_suffix: Testerextensions:\n>     enabled:\n>         - Codeception\\Extension\\RunFailed\n>     commands:\n>         - Codeception\\Command\\GenerateWPUnit\n>         - Codeception\\Command\\GenerateWPRestApi\n>         - Codeception\\Command\\GenerateWPRestController\n>         - Codeception\\Command\\GenerateWPRestPostTypeController\n>         - Codeception\\Command\\GenerateWPAjax\n>         - Codeception\\Command\\GenerateWPCanonical\n>         - Codeception\\Command\\GenerateWPXMLRPC\n>         - Codeception\\Command\\DbSnapshot\n>         - tad\\Codeception\\Command\\SearchReplaceparams:\n>   - .env\n>\n> And this is the tests/acceptance.suite.yml file:\n>\n> # Codeception Test Suite Configuration## Suite for acceptance tests.# Perform tests in browser using the WPWebDriver or WPBrowser.# Use WPDb to set up your initial database fixture.# If you need both WPWebDriver and WPBrowser tests - create a separate suite.\n> actor: AcceptanceTestermodules:\n>     enabled:\n>         - WPDb\n>         - WPBrowser\n>         - \\Helper\\Acceptance\n>     config:\n>         WPDb:\n>             dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%'\n>             user: '%DB_USER%'\n>             password: '%DB_PASSWORD%'\n>             dump: 'tests/_data/dump.sql'\n>             populate: true #import the dump before the tests\n>             cleanup: true #import the dump between tests\n>             url: '%URL%'\n>             urlReplacement: true #replace the hardcoded dump URL with the one above\n>             tablePrefix: 'wp_'\n>         WPBrowser:\n>             url: '%URL%'\n>             adminUsername: '%ADMIN_USERNAME%'\n>             adminPassword: '%ADMIN_PASSWORD%'\n>             adminPath: '/wp-admin'\n>\n> The tests/functional.suite.yml file:\n>\n> # Codeception Test Suite Configuration## Suite for functional tests# Emulate web requests and make WordPress process them\n> actor: FunctionalTestermodules:\n>     enabled:\n>         - WPDb\n>         - WordPress\n>         - Asserts\n>         - \\Helper\\Functional\n>     config:\n>         WPDb:\n>             dsn: 'mysql:host=%DB_HOST%;dbname=%DB_NAME%'\n>             user: '%DB_USER%'\n>             password: '%DB_PASSWORD%'\n>             dump: 'tests/_data/dump.sql'\n>             populate: true\n>             cleanup: true\n>             url: '%URL%'\n>             urlReplacement: true\n>             tablePrefix: 'wp_'\n>         WordPress:\n>             depends: WPDb\n>             wpRootFolder: '%ROOT_FOLDER%'\n>             adminUsername: '%ADMIN_USERNAME%'\n>             adminPassword: '%ADMIN_PASSWORD%'\n>             adminPath: '/wp-admin'\n>\n> The tests/wpunit.suite.yml file:\n>\n> # Codeception Test Suite Configuration## Suite for unit or integration tests that require WordPress functions and classes.\n> actor: WpunitTestermodules:\n>     enabled:\n>         - WPLoader\n>         - \\Helper\\Wpunit\n>     config:\n>         WPLoader:\n>             wpRootFolder: \"%ROOT_FOLDER%\"\n>             dbName: \"%TEST_DB_NAME%\"\n>             dbHost: \"%DB_HOST%\"\n>             dbUser: \"%DB_USER%\"\n>             dbPassword: \"%DB_PASSWORD%\"\n>             tablePrefix: \"wp_\"\n>             domain: \"%DOMAIN%\"\n>             adminEmail: \"amdin@wplocal.local\"\n>             title: \"Test\"\n>             plugins: ['test-plugin/plugin.php']\n>             activatePlugins: ['test-plugin/plugin.php']\n>\n> I had no issues running this test:\n>\n> <?phpclass WPFirstCest {\t/**\t * It should be able to reach the homepage\t *\t * @test\t */\tpublic function should_be_able_to_reach_the_homepage( AcceptanceTester $I ) {\t\t$I->havePostInDatabase(['post_title' => 'A test post']);\t\t$I->amOnPage( '/' );\t\t$I->see('A test post');\t}}\n>\n> Let me know if this helps you.\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/lucatume/wp-browser/issues/140#issuecomment-370153037>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AByOfvoxQi33fG10RFEJZmXIoD44TImRks5taq5VgaJpZM4SKM99>\n> .\n>\n-- \nCraig Martin\nOwner/Director, Performance Foundry\nhttp://performancefoundry.com\n\nOwner, Indie Travel Media\nhttp://indietravelmedia.com\n"}}
{"actor":{"display_login":"indietravel"}}