lucatume / wp-browser

The easy and reliable way to test WordPress with Codeception. 10 years of proven success.
https://wpbrowser.wptestkit.dev/
MIT License
606 stars 86 forks source link

[BUG] Local tests pass when test folder is capitalised, but not on CI #404

Closed dingo-d closed 4 years ago

dingo-d commented 4 years ago

Environment OS (Local): MacOs 10.15.4 OS (CI): Ubuntu 18.04.4 LTS, running Docker with wordpress:5.4.1-php7.2 image PHP version: 7.2 Installed Codeception version: 4.1.4 Installed wp-browser version: 2.5.3 WordPress version: 5.4.1 Local development environment: Valet+ and VVV WordPress structure and management: default

Can you perform the test manually?

While setting up my GitHub Actions for running test I've noticed that if my integration folder is capitalised (tests/Integration) the test run will fail with

> @php ./vendor/bin/codecept run integration
Codeception PHP Testing Framework v4.1.4
Powered by PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Running with seed: 

In Finder.php line 589:

  The "/usr/src/wordpress/wp-content/plugins/woo-solo-api/tests/integration/"  
   directory does not exist.                                                   

run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--phpunit-xml [PHPUNIT-XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--bootstrap [BOOTSTRAP]] [--no-redirect] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--coverage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--seed SEED] [--no-artifacts] [--] [<suite> [<test>]]

Script @php ./vendor/bin/codecept run integration handling the test:integration event returned with error code 1

When I changed the name of the folder to tests/integration the test run finally passed

https://github.com/dingo-d/woo-solo-api/pull/19/checks?check_run_id=693764144

The issue is that that way of naming isn't psr-4 compliant and I'm getting deprecation errors from the composer like

Deprecation Notice: Class Tests\Integration\Activation\ActivationTest located in ./tests/integration/Activation/ActivationTest.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.5/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

Codeception configuration file

https://github.com/dingo-d/woo-solo-api/blob/feature/2.0.0-update/codeception.dist.ym

Suite configuration file

https://github.com/dingo-d/woo-solo-api/tree/feature/2.0.0-update/tests

Describe the bug

I know that MacOS and Windows have case insensitive filesystem whereas Linux does not. And since I'm running the tests in a Linux based container my hunch is that this is the cause of the issue.

I'm not sure if this is codeception issue or wp-browser issue.

Can I define the paths of the tests in each separate configuration? Like I have in the codeception.dist.yml:

paths:
    tests: tests
    output: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs

Can I specify in the integration.suite.yml:

paths:
    tests: Integration

?

dingo-d commented 4 years ago

Ok I think I found the issue. If I have capitalized name of the folder then both my suite name and the codeception command have to be capitalized.

So if the folder is tests/Integration then it has to be Integration.suite.yml and the command must be /vendor/bin/codecept run Integration.

lucatume commented 4 years ago

My favourite kind of issue: the self-resolving one.

Happy coding and thanks for following up!