yiisoft/yii2-app-basic

Cannot Get Working Setup for Running Acceptance Tests according to README

juppwerner opened this issue · 2 comments

I wanted to understand how testing works with Yii2. I cannot run the acceptance tests.
I am refering to the section Running acceptance tests the READMEof this application template repository.

What steps will reproduce the problem?

Install Yii2 basic app template: composer create-project --prefer-dist yiisoft/yii2-app-basic yii2-app-basic-testing => App and packages are installed OK

Rename tests/acceptance.suite.yml.example to tests/acceptance.suite.yml => done

Install codeception/codeception: The package codeception/codeception is already installed by default composer requirement (so the related line in README seems redundant)

Run Selenium standalone: java -jar -Dwebdriver.chrome.driver=~/chromedriver.exe selenium-server-standalone-3.141.59.jar => app is installed OK

Start web server: tests/bin/yii serve => server is running OK

Run tests: vendor\bin\codecept run => Error, see below

What's expected?

Have all tests run

What do you get instead?

The following error is shown:

In ModuleContainer.php line 115:

Module WebDriver is not installed.
Use Composer to install corresponding package:

composer require codeception/module-webdriver --dev

Install codeception/module-webdriver as per above results in

Your requirements could not be resolved to an installable set of packages.

Also with option --with-all-dependencies (-W)

Additional info

Q A
Yii version Current as per composer file in Yii2 App Basic
PHP version 8.1.6
Operating system Windows 11

Thank you.

Can confirm, the info in the README is a bit outdated.
Due to the current hard-wiring of phpunit (see #308), the webdriver needs to be installed with a version constrained to 3.x

composer require --dev codeception/module-webdriver:^3.0

I suggest updating the README as such:

diff --git a/README.md b/README.md
index 981a7f9..5067770 100644
--- a/README.md
+++ b/README.md
@@ -155,8 +155,11 @@ To execute acceptance tests do the following:
 
 1. Rename `tests/acceptance.suite.yml.example` to `tests/acceptance.suite.yml` to enable suite configuration
 
-2. Replace `codeception/base` package in `composer.json` with `codeception/codeception` to install full-featured
-   version of Codeception
+2. Install `codeception/module-webdriver`:
+
+   ```
+   composer require --dev codeception/module-webdriver:^3.0
+   ```
 
 3. Update dependencies with Composer 
 

(or without the version constraint once the phpunit explicit dep is gone)

Would it make more sense to add codeception/module-webdriver to the composer.json directly (in require-dev? Then step 2 could be omitted entirely.