Skip to content

Commit 3c2efd8

Browse files
Menrathabias
authored andcommitted
Add Behat tests which cover the upstream changes of PR moodle-an-hochschulen#648
1 parent 4200f3e commit 3c2efd8

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature

+67
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,70 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
424424
| 1 | 0 | 0 | after | before | after |
425425
| 0 | 0 | 2 | before | after | after |
426426
| 0 | 1 | 2 | before | after | before |
427+
428+
@javascript
429+
Scenario: Smartmenu: Menus: Presentation - Verify that the correct menu item is displayed as active when viewing the main menu item's page.
430+
Given I log in as "admin"
431+
And I create smart menu with the following fields to these values:
432+
| Title | Quick links |
433+
| Menu location(s) | Main |
434+
| Menu mode | Inline |
435+
And I set "Quick links" smart menu items with the following fields to these values:
436+
| Title | Test node |
437+
| Menu item type | Static |
438+
| URL | /admin/tool/dataprivacy/summary.php |
439+
| CSS class | testnode01 |
440+
When I am on site homepage
441+
Then the "class" attribute of ".primary-navigation [data-key='home'] a" "css_element" should contain "active"
442+
And the "class" attribute of ".primary-navigation .testnode01 a" "css_element" should not contain "active"
443+
And "//a[@aria-current = 'true']" "xpath" should exist in the ".primary-navigation [data-key='home']" "css_element"
444+
And "//a[@aria-current = 'true']" "xpath" should not exist in the ".primary-navigation .testnode01" "css_element"
445+
And I click on "Test node" "link" in the ".primary-navigation" "css_element"
446+
Then the "class" attribute of ".primary-navigation [data-key='home'] a" "css_element" should not contain "active"
447+
And the "class" attribute of ".primary-navigation .testnode01 a" "css_element" should contain "active"
448+
And "//a[@aria-current = 'true']" "xpath" should not exist in the ".primary-navigation [data-key='home']" "css_element"
449+
And "//a[@aria-current = 'true']" "xpath" should exist in the ".primary-navigation .testnode01" "css_element"
450+
451+
@javascript
452+
Scenario: Smartmenu: Menus: Presentation - Verify that the correct menu item is displayed as active when viewing the submenu item's page.
453+
Given I log in as "admin"
454+
And I create smart menu with the following fields to these values:
455+
| Title | Quick links |
456+
| Menu location(s) | Main |
457+
| Menu mode | Submenu |
458+
| CSS class | testnode01 |
459+
And I set "Quick links" smart menu items with the following fields to these values:
460+
| Title | Test node |
461+
| Menu item type | Static |
462+
| URL | /admin/tool/dataprivacy/summary.php |
463+
When I am on site homepage
464+
Then the "class" attribute of ".primary-navigation [data-key='home'] a" "css_element" should contain "active"
465+
And the "class" attribute of ".primary-navigation .testnode01 a" "css_element" should not contain "active"
466+
And "//a[@aria-current = 'true']" "xpath" should exist in the ".primary-navigation [data-key='home']" "css_element"
467+
And "//a[@aria-current = 'true']" "xpath" should not exist in the ".primary-navigation .testnode01" "css_element"
468+
And I click on "Quick links" "link" in the ".primary-navigation" "css_element"
469+
And I click on "Test node" "link" in the ".primary-navigation" "css_element"
470+
Then the "class" attribute of ".primary-navigation [data-key='home'] a" "css_element" should not contain "active"
471+
And the "class" attribute of ".primary-navigation .testnode01 a" "css_element" should contain "active"
472+
And "//a[@aria-current = 'true']" "xpath" should not exist in the ".primary-navigation [data-key='home']" "css_element"
473+
And "//a[@aria-current = 'true']" "xpath" should exist in the ".primary-navigation .testnode01" "css_element"
474+
475+
@javascript
476+
Scenario: Smartmenu: Menus: Presentation - Verify that the correct _custom_ menu item is displayed as active when viewing the custom menu item's page (Moodle core behaviour which must not be broken by the smart menus)
477+
Given I log in as "admin"
478+
And I navigate to "Appearance > Advanced theme settings" in site administration
479+
And I set the field "Custom menu items" to multiline:
480+
"""
481+
Test node|/admin/tool/dataprivacy/summary.php
482+
"""
483+
And I click on "Save changes" "button"
484+
When I am on site homepage
485+
Then the "class" attribute of ".primary-navigation [data-key='home'] a" "css_element" should contain "active"
486+
And the "class" attribute of ".primary-navigation .nav-item:nth-child(5) a" "css_element" should not contain "active"
487+
And "//a[@aria-current = 'true']" "xpath" should exist in the ".primary-navigation [data-key='home']" "css_element"
488+
And "//a[@aria-current = 'true']" "xpath" should not exist in the ".primary-navigation .nav-item:nth-child(5)" "css_element"
489+
And I click on "Test node" "link" in the ".primary-navigation" "css_element"
490+
Then the "class" attribute of ".primary-navigation [data-key='home'] a" "css_element" should not contain "active"
491+
And the "class" attribute of ".primary-navigation .nav-item:nth-child(5) a" "css_element" should contain "active"
492+
And "//a[@aria-current = 'true']" "xpath" should not exist in the ".primary-navigation [data-key='home']" "css_element"
493+
And "//a[@aria-current = 'true']" "xpath" should exist in the ".primary-navigation .nav-item:nth-child(5)" "css_element"

0 commit comments

Comments
 (0)