Behat "current page administration" not working in 3.3

Behat "current page administration" not working in 3.3

by Mike Churchward -
Number of replies: 8
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi -

All of my tests for 'I navigate to "[string name]" in current page administration' steps are not working under Moodle 3.3. Previously these steps used the old 'I navigate to "[string name]" node in "[plugin] administration"' prior to 3.3. They still worked in 3.2 but should have been changed to the "current page administration" step.

Under 3.3, the old way does  not work, but when I change them to the the new way, they still do not work.

The error I get is: "Xpath matching locator "//div[contains(@class,'block_settings')]//div[@id='settingsnav']/ul/li[1]/p[1]/span" not found. (Behat\Mink\Exception\ElementNotFoundException)".

The items get added to the module administration menu using the "extend_settings_navigation" hook, so I don't know why these tests are not working. Anyone have any ideas?

mike


Average of ratings: -
In reply to Mike Churchward

Re: Behat "current page administration" not working in 3.3

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

As an update, the problems are happening when I run Behat like:

vendor/bin/behat ...

If I run:

php admin/tool/behat/cli/run.php

everything works fine.

thoughtful

In reply to Mike Churchward

Re: Behat "current page administration" not working in 3.3

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

This is still the case...

Does anyone know why "php admin/tool/behat/cli/run.php" works properly, while "vendor/bin/behat" does not? Shouldn't they run identically?

mike

In reply to Mike Churchward

Re: Behat "current page administration" not working in 3.3

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Ping!

Anyone have any ideas how to get "vendor/bin/behat" working? I was going to try to use it within PHPStorm, and I don't think I can use the alternate "php admin/tool/behat/cli/run.php".

mike

In reply to Mike Churchward

Re: Behat "current page administration" not working in 3.3

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

vendor/bin/behat runs a specific configuration (--config=...../behatrun/behat/behat.yml) while admin/tool/behat/cli/run.php can run single or parallel test (depending on the $CFG->behat_profiles, $CFG->behat_config, $CFG->behat_parallel_run settings)

Try comparing the different behat.yml files in your behat datadirectory.

In reply to Renaat Debleu

Re: Behat "current page administration" not working in 3.3

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Renaat -

Not sure I completely understand... I have this in my config.php file for Behat:

//=========================================================================
// 11. BEHAT SUPPORT
//=========================================================================
// Behat test site needs a unique www root, data directory and database prefix:
//
$CFG->behat_wwwroot = 'http://127.0.0.1/moodlehq.git';
$CFG->behat_prefix = 'bht_';
$CFG->behat_dataroot = '/Users/mikechurchward/www/moodlehq.git/bht_moodledata';
$CFG->behat_config = array(
'default' => array(
'extensions' => array(
'Behat\MinkExtension\Extension' => array(
'selenium2' => array(
'browser' => 'chrome'
)
)
)
)
);
$CFG->behat_faildump_path = '/Users/mikechurchward/www/moodlehq.git/bht_moodledata/faildump';
The only "behat.yml" files seem to be the ones in 'bht_moodledata/behat' and 'bht_moodledata/behatrun/behat/behat.yml'. Those two files are significantly different. The one in 'behatrun' seems to have been created most recently; probably with the last "init"? I'll try copying the newer one over the older one and see what happens.

mike

In reply to Renaat Debleu

Re: Behat "current page administration" not working in 3.3

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Okay. So copying 'bht_moodledata/behatrun/behat/behat.yml' to 'bht_moodledata/behat/behat.yml' allowed 'vendor/bin/behat' to work correctly. Is there something I should configure so that it uses the one in 'behatrun'?

mike

In reply to Mike Churchward

Re: Behat "current page administration" not working in 3.3

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I would run something like

 vendor/bin/behat --config /Users/mikechurchward/www/moodlehq.git/bht_moodledata/behatrun/behat/behat.yml

All my behat sites are ran using   behatrun/behat/beyat.yml locations. Even when running in parallel, I get behatrun1/behat/behat.yml - behatrun2/behat/behat.yml - behatrun3/behat/behat.yml - ...
In reply to Renaat Debleu

Re: Behat "current page administration" not working in 3.3

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Of course blush

The weird thing is, I just realized I have been specifying:

--config /Users/mikechurchward/www/moodlehq.git/bht_moodledata/behat/behat.yml

for both the "vendor/bin/behat" and the "php admin/tool/behat/cli/run.php" commands. I guess the second one doesn't actually pay attention to the "--config " argument?

Anyway, thanks for your help.

mike