Skip to content

Commit

Permalink
- tests/behat/behat_theme_adaptable_behat_auth.php duplicated the pat…
Browse files Browse the repository at this point in the history
…tern /^I log out$/ which Behat doesn't like. As it turns out, this isn't required as the core step definition works.

- tests/behat/core_auth/behat_theme_adaptable_behat_core_auth.php is not how you extending existing Behat steps.  https://moodledev.io/general/development/tools/behat/writing#override-behat-core-context-for-theme-suite describes how to do this.  Regardless, ss it turns out, this isn't required as the core step definition works.

- Changes to behat_theme_adaptable_behat_navigation.php and behat_theme_adaptable_behat_permissions.php are required because they define duplicate step definition patters which is not something Behat likes.  If you take a look at Moodle's \behat_theme_boost_behat_navigation::i_should_see_is_active_in_navigation, they provide an example of how to deal with this.

- blacklist.json excludes behat_theme_boost_behat_navigation from the list of contexts for the adaptable suite which gets built when you init Behat.  For reference, /var/www/behatdata/behatrun/behat/behat.yml should be referred to to better understand why gets configured when Behat is initialized.

- navigation.feature is a simple Behat test which logs in and out as admin both with javascript enabled and not.
  • Loading branch information
ericherdualcode committed Aug 8, 2024
1 parent c5a0abc commit 4ce69ca
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 102 deletions.
49 changes: 0 additions & 49 deletions tests/behat/behat_theme_adaptable_behat_auth.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/behat/behat_theme_adaptable_behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function i_follow_asset_link($assettitle) {
*
* This can be used on front page, course, category or modules pages.
*
* @Given /^I navigate to "(?P<nodetext_string>(?:[^"]|\\")*)" in current page administration$/
* @override /^I navigate to "(?P<nodetext_string>(?:[^"]|\\")*)" in current page administration$/
*
* @throws ExpectationException
* @param string $nodetext navigation node to click, may contain path, for example "Reports > Overview"
Expand Down Expand Up @@ -170,7 +170,7 @@ public function i_navigate_to_in_site_administration($nodetext) {

/**
* Click on an entry in the user menu.
* @Given /^I follow "(?P<nodetext_string>(?:[^"]|\\")*)" in the user menu$/
* @override /^I follow "(?P<nodetext_string>(?:[^"]|\\")*)" in the user menu$/
*
* @param string $nodetext
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/behat_theme_adaptable_behat_permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class behat_theme_adaptable_behat_permissions extends behat_permissions {
/**
* Set system level permissions to the specified role. Expects a table with capability name
* and permission (Inherit/Allow/Prevent/Prohibit) columns.
* @Given /^I set the following system permissions of "(?P<rolefullname_string>(?:[^"]|\\")*)" role:$/
* @override /^I set the following system permissions of "(?P<rolefullname_string>(?:[^"]|\\")*)" role:$/
* @param string $rolename
* @param TableNode $table
*/
Expand Down
6 changes: 6 additions & 0 deletions tests/behat/blacklist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"contexts": [
"behat_theme_boost_behat_navigation"
],
"features": []
}
50 changes: 0 additions & 50 deletions tests/behat/core_auth/behat_theme_adaptable_behat_core_auth.php

This file was deleted.

10 changes: 10 additions & 0 deletions tests/behat/navigation.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Basic navigation scenarios through Moodle.

Background: User "admin" logs into Moodle and then logs out
And I log in as "admin"
Then I log out

Scenario: Basic navigation without JavaScript

@javascript
Scenario: Basic navigation with JavaScript

0 comments on commit 4ce69ca

Please sign in to comment.