Posts made by Joseph Rézeau

Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

One more attempt... Re-installed everything, now I do not make progress, in fact I regress...

Using Wampserver 3.3.3 running PHP 8.2.13 Moodle 4.3.3+ (Build: 20240308).

Wamp settings: Allow links on projects homepage.

I install Moodle in a moodletest dir. This is my config extract:

$CFG->wwwroot   = 'http://localhost/moodletest';
$CFG->dataroot  = 'C:\\wamp64\\moodledatatest';
$CFG->admin     = 'admin';

$CFG->behat_dataroot  = "C:\wamp64\www\moodledata_behat";
$CFG->behat_wwwroot = 'http://127.0.0.1/moodletest';
$CFG->behat_prefix = 'zbehat_';
require_once('C:\behat3\moodle-browser-config\init.php');

In "C:\wamp64\www\moodletest" I run php admin/tool/behat/cli/init.php

Result: Error: Composer dependencies are not installed. Ensure you set $CFG->behat_* vars in config.php and you ran admin/tool/behat/cli/init.php.

If I go to : http://127.0.0.1/moodletest/

I get: Behat config error: Behat is configured but not enabled on this test site

😒😒😒

Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Making slow progress, but still no joy. I have re-started behat and used a (local) "moodle" test site instead of "moodletest" etc.

When running: php admin/tool/behat/cli/init.php

I get:

Testing environment themes built
Acceptance tests environment enabled on http://127.0.0.1/moodle, to run the tests use:
vendor\bin\behat --config C:\wamp64\www\moodledata_behat\behatrun\behat\behat.yml

when I run C:\wamp64\www\moodle> vendor\bin\behat --config C:\wamp64\www\moodledata_behat\behatrun\behat\behat.yml

I get:
Behat requirement not satisfied: http://127.0.0.1/moodle is not available, ensure you specified correct url and that the server is set up and started.

My php_error.log shows zero errors

and in my access.log I get these lines:

127.0.0.1 - - [09/Mar/2024:16:43:00 +0100] "GET /moodle/admin/tool/behat/tests/behat/fixtures/environment.php HTTP/1.1" 303 1487
127.0.0.1 - - [09/Mar/2024:16:43:13 +0100] "GET /moodle/admin/cron.php HTTP/1.1" 200 6456

But if I type either http://localhost/moodle/ or http://127.0.0.1/moodle in my localhost URL I do arrive on my local moodle site.

Any more things I can try before definitely giving up Behat?

Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks again for your help, Renaat!

If I add $CFG->behat_dataroot_parent  = 'C:\\wamp64\www\moodledatatest_behat'; to my original Moodle test site config.php, when running vendor\bin\behat --config C:\wamp64\www\moodledatatest_behat\behatrun\behat\behat.yml

I get this error in my php_error.log:

[07-Mar-2024 17:13:04 Europe/London] Behat only can run if test mode is enabled. 

and in my access.log I get these lines:

127.0.0.1 - - [07/Mar/2024:18:17:50 +0100] "GET /moodle/admin/cron.php HTTP/1.1" 200 6462
127.0.0.1 - - [07/Mar/2024:18:17:51 +0100] "GET /moodlemaster/admin/cron.php HTTP/1.1" 200 6460
127.0.0.1 - - [07/Mar/2024:18:17:52 +0100] "GET /moodletest/admin/cron.php HTTP/1.1" 200 15702
127.0.0.1 - - [07/Mar/2024:18:17:59 +0100] "GET /admin/tool/behat/tests/behat/fixtures/environment.php HTTP/1.1" 404 316

Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators
@Renaat,
Thanks for trying to help. I do know that LInux would be faster than Windows but I want to stick with Windows... and I did manage to run behat tests last year, although being slow. I have tried all your suggestions but nothing works (except the dry run option).
So I'm still stuck.
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

Hello to all Behat fellow users/sufferers!
This is my 3rd attempt at using Behat on my local Windows Moodle site. First time was a few years ago and I gave up. Second attempt was last year and I finally managed to get it going.
I am trying again, scrupulously following the instructions at Running acceptance tests 
but I am stumped!
Using Windows 11. PHP 8.2.13. WampServer 3.3.3. Moodle 4.3.3+ (Build: 20240215)
1.- I am getting a conflict between geckodriver and selenium-server. When I launch them one after the other, they complain that they cannot use the same port 4444. So I have launched selenium with the -port 4000 param, and it seemss to satisfy both.
It says: INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4000
and geckodriver INFO Listening on 127.0.0.1:4444
2.- I have set up everything as expected in my Moodle config.php file.
3.- When I run php admin/tool/behat/cli/init.php in my local moodle test site, it does create all the behat tables in the database, etc. and it says:
Creating Behat configuration ... done in 8.79 seconds.
Building theme CSS for boost [ltr] ... done in 9.63 seconds.
Building theme CSS for classic [ltr] ... done in 9.72 seconds.
Testing environment themes built
Acceptance tests environment enabled on http://127.0.0.1, to run the tests use:
vendor\bin\behat --config C:\wamp64\www\moodledatatest_behat\behatrun\behat\behat.yml
4.- But when I try vendor\bin\behat --config C:\wamp64\www\moodledatatest_behat\behatrun\behat\behat.yml
nothing happens! no error messages, nothing, after a couple of seconds I am getting the windows prompt back.

Any help welcome...

Average of ratings: -