diff --git a/CHANGES.md b/CHANGES.md index 45f1db86401..79911339511 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2024-02-17 - Test: Use custom step to check the menus and menu items existence, resolves #365. * 2024-02-12 - Feature: Allow the admin to display activity icons in course content navigation, resolves #16. * 2024-02-11 - Child theme support: Improve namespace of class smartmenu_helper, resolves #494. * 2024-02-11 - Child theme support: Update note about grandchild themes in README.md diff --git a/tests/behat/theme_boost_union_smartmenusettings_menuitems_application.feature b/tests/behat/theme_boost_union_smartmenusettings_menuitems_application.feature index f3ab7039490..d52038972cf 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menuitems_application.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menuitems_application.feature @@ -28,12 +28,10 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | Menu item type | Static | | URL | https://moodle.org/badges | And I click on "Save changes" "button" - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - Then I should see "Badges" in the "nav.moremenu" "css_element" + And I should see smart menu "Quick links" item "Badges" in location "Main, Menu, User, Bottom" And I log out And I log in as "user1" - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - Then I should see "Badges" in the "nav.moremenu" "css_element" + And I should see smart menu "Quick links" item "Badges" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenus: Menu items: Application - Display the smart menu items in inline mode @@ -44,29 +42,9 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | Dynamic courses: Course category | Category 1 | | Menu item mode | Inline | And I should see "Available courses" in the "smartmenus_items" "table" - # Inline items in main navigation. - And I click on "Quick links" "link" in the ".primary-navigation" "css_element" - And I should not see "Available courses" in the ".primary-navigation" "css_element" - And I should see "Test course1" in the ".primary-navigation" "css_element" - And I should see "Test course2" in the ".primary-navigation" "css_element" - # Inline items in user menu. - And I click on "#user-menu-toggle" "css_element" - And I click on "Quick links" "link" in the "#usermenu-carousel" "css_element" - And I should not see "Available courses" in the "#usermenu-carousel" "css_element" - And I should see "Test course1" in the "#usermenu-carousel" "css_element" - And I should see "Test course2" in the "#usermenu-carousel" "css_element" - # Inline items in bottom menu. - And I change the viewport size to "740x900" - And I click on "Quick links" "link" in the ".bottom-navigation" "css_element" - And I should not see "Available courses" in the ".bottom-navigation" "css_element" - And I should see "Test course1" in the ".bottom-navigation" "css_element" - And I should see "Test course2" in the ".bottom-navigation" "css_element" - And I change the viewport size to "large" - # Inline items in menubar. - And I click on "Quick links" "link" in the "nav.menubar" "css_element" - And I should not see "Available courses" in the "nav.menubar" "css_element" - And I should see "Test course1" in the "nav.menubar" "css_element" - And I should see "Test course2" in the "nav.menubar" "css_element" + And I should not see smart menu "Quick links" item "Available courses" in location "Main, Menu, User, Bottom" + And I should see smart menu "Quick links" item "Test course1" in location "Main, Menu, User, Bottom" + And I should see smart menu "Quick links" item "Test course2" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenus: Menu items: Application - Display the smart menu items in submenu modes diff --git a/tests/behat/theme_boost_union_smartmenusettings_menuitems_management.feature b/tests/behat/theme_boost_union_smartmenusettings_menuitems_management.feature index 0929b526ebb..746c56fe8f3 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menuitems_management.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menuitems_management.feature @@ -42,8 +42,7 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, man | Info | And I should see "Info" in the "smartmenus_items" "table" And ".smartmenu-items-actions" "css_element" should exist in the "smartmenus_items" "table" - And I click on "Quick links" "text" in the ".menubar" "css_element" - And I should see "Info" in the "nav.moremenu" "css_element" + And I should see smart menu "Quick links" item "Info" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenus: Menu items: Management - Edit an existing smart menu item @@ -118,9 +117,8 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, man And I click on ".action-edit" "css_element" in the "table#smartmenus_items #smartmenu_items_r1" "css_element" And I set the field "Title" to "External Resources" And I click on "Save changes" "button" - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - And I should see "Info" in the "nav.moremenu" "css_element" - And I should see "External Resources" in the "nav.moremenu" "css_element" + Then I should see smart menu "Quick links" item "Info" in location "Main, Menu, User, Bottom" + And I should see smart menu "Quick links" item "External Resources" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenus: Menu items: Management - Modify the visibility of an existing smart menu item @@ -139,16 +137,13 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, man | Info | And ".action-hide" "css_element" should exist in the "Info" "table_row" And ".action-show" "css_element" should not exist in the "Info" "table_row" - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - And I should see "Info" in the "nav.moremenu" "css_element" + Then I should see smart menu "Quick links" item "Info" in location "Main, Menu, User, Bottom" And I click on ".action-hide" "css_element" in the "Info" "table_row" - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - Then I should not see "Info" in the "nav.moremenu" "css_element" + Then I should not see smart menu "Quick links" item "Info" in location "Main, Menu, User, Bottom" And ".action-hide" "css_element" should not exist in the "Info" "table_row" And ".action-show" "css_element" should exist in the "Info" "table_row" And I click on ".action-show" "css_element" in the "Info" "table_row" - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - Then I should see "Info" in the "nav.moremenu" "css_element" + Then I should see smart menu "Quick links" item "Info" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenus: Menu items: Management - Move an existing smart menu item up and down diff --git a/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature b/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature index b7b74c856e2..c6f2ccb50a1 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature @@ -29,23 +29,17 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | Link target | | And I should see "Available courses" in the "smartmenus_items" "table" # Menu items in main navigation - And I click on "Quick links" "link" in the ".primary-navigation" "css_element" - And I should see "Test course1" in the ".primary-navigation" "css_element" + Then I should see smart menu "Quick links" item "Test course1" in location "Main" And the "target" attribute of "//div[@class='primary-navigation']//a[contains(normalize-space(.), 'Test course1')]" "xpath_element" # Menu items in user menu. - And I click on "#user-menu-toggle" "css_element" - And I click on "Quick links" "link" in the "#usermenu-carousel" "css_element" - And I should see "Test course1" in the "#usermenu-carousel" "css_element" + And I should see smart menu "Quick links" item "Test course1" in location "User" And the "target" attribute of "//div[contains(@class, 'carousel-item')]//a[contains(normalize-space(.), 'Test course1')]" "xpath_element" # Menu items in bottom menu. - Then I change the viewport size to "740x900" - And I click on "Quick links" "link" in the ".bottom-navigation" "css_element" - And I should see "Test course1" in the ".bottom-navigation" "css_element" + Then I should see smart menu "Quick links" item "Test course1" in location "Bottom" And the "target" attribute of "//div[@class='bottom-navigation']//a[contains(normalize-space(.), 'Test course1')]" "xpath_element" Then I change the viewport size to "large" # Menu items in menubar. - And I click on "Quick links" "link" in the "nav.menubar" "css_element" - And I should see "Test course1" in the "nav.menubar" "css_element" + And I should see smart menu "Quick links" item "Test course1" in location "Menu" And the "target" attribute of "//nav[contains(@class, 'menubar')]//a[contains(normalize-space(.), 'Test course1')]" "xpath_element" Examples: @@ -96,9 +90,8 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | Dynamic courses: Course name presentation | | | Dynamic courses: Number of words | | And I should see "Available courses" in the "smartmenus_items" "table" - And I click on "Quick links" "link" in the ".primary-navigation" "css_element" - And I should see "" in the ".primary-navigation" "css_element" - And I should not see "" in the ".primary-navigation" "css_element" + And I should see smart menu "Quick links" item "" in location "Main, Menu, User, Bottom" + And I should not see smart menu "Quick links" item "" in location "Main, Menu, User, Bottom" Examples: | selectnamefield | numberofwords | showntitle | notshowntitle | @@ -322,21 +315,19 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app And I set the following fields to these values: | Title | Lorem ipsumDolor sit amet | | Menu item type | Static | - | URL | https://moodle.org/foo | + | URL | https://moodle.org/foo | And I click on "Save changes" "button" And I follow "Preferences" in the user menu And I click on "Preferred language" "link" And I set the field "Preferred language" to "English ‎(en)‎" And I press "Save changes" And I am on site homepage - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - Then I should see "Lorem ipsum" in the "nav.moremenu" "css_element" - And I should not see "Dolor sit amet" in the "nav.moremenu" "css_element" + Then I should see smart menu "Quick links" item "Lorem ipsum" in location "Main, Menu, User, Bottom" + And I should not see smart menu "Quick links" item "Dolor sit amet" in location "Main, Menu, User, Bottom" And I follow "Preferences" in the user menu And I click on "Preferred language" "link" And I set the field "Preferred language" to "Deutsch ‎(de)‎" And I press "Save changes" And I am on site homepage - And I click on "Quick links" "link" in the "nav.moremenu" "css_element" - Then I should see "Dolor sit amet" in the "nav.moremenu" "css_element" - And I should not see "Lorem ipsum" in the "nav.moremenu" "css_element" + Then I should see smart menu "Quick links" item "Dolor sit amet" in location "Main, Menu, User, Bottom" + And I should not see smart menu "Quick links" item "Lorem ipsum" in location "Main, Menu, User, Bottom" diff --git a/tests/behat/theme_boost_union_smartmenusettings_menus_application.feature b/tests/behat/theme_boost_union_smartmenusettings_menus_application.feature index ae02a3d2e6f..1c9358dc197 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menus_application.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menus_application.feature @@ -18,10 +18,10 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | Title | Links | | Menu location(s) | Main | And I click on "Save and return" "button" - Then I should see "Links" in the "nav.moremenu" "css_element" + Then I should see smart menu "Links" in location "Main" And I log out And I log in as "user1" - And I should see "Links" in the "nav.moremenu" "css_element" + Then I should see smart menu "Links" in location "Main" @javascript Scenario: Smartmenu: Menus: Application - Show a single smart menu in multiple locations @@ -44,16 +44,7 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app And I should see "Menu" in the "Links" "table_row" And I should see "User" in the "Links" "table_row" And I should see "Bottom" in the "Links" "table_row" - And I should see "Links" in the ".primary-navigation" "css_element" - And I click on "#user-menu-toggle" "css_element" - And "#user-action-menu" "css_element" should be visible - And I should see "Links" in the "#user-action-menu" "css_element" - And ".boost-union-menubar" "css_element" should be visible - And I click on "Links" "link" in the ".boost-union-menubar" "css_element" - And I should see "Smartmenu Resource" in the ".boost-union-menubar" "css_element" - And I change viewport size to "740x900" - And ".boost-union-bottom-menu" "css_element" should be visible - And I should see "Links" in the ".boost-union-bottom-menu" "css_element" + Then I should see smart menu "Links" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenu: Menus: Application - Show a smart menu in different locations @@ -65,7 +56,7 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | Menu location(s) | Main | And I click on "Save and return" "button" Then I should see "Main" in the "Links" "table_row" - And I should see "Links" in the ".primary-navigation" "css_element" + And I should see smart menu "Links" in location "Main" And I click on "Create menu" "button" And I set the following fields to these values: | Title | External resources | @@ -80,9 +71,7 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app And I click on "Save changes" "button" And I click on "Smart menus" "link" in the "#page-navbar .breadcrumb" "css_element" Then I should see "Menu" in the "External resources" "table_row" - And ".boost-union-menubar" "css_element" should be visible - And I click on "External resources" "link" in the ".boost-union-menubar" "css_element" - And I should see "Smartmenu Resource" in the ".boost-union-menubar" "css_element" + And I should see smart menu "External resources" item "Smartmenu Resource" in location "Menu" And I click on "Create menu" "button" And I set the following fields to these values: | Title | Certificates | @@ -90,17 +79,11 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app And I click on "Save and return" "button" Then I should see "User" in the "Certificates" "table_row" And I should not see "Main" in the "Certificates" "table_row" - And I click on "#user-menu-toggle" "css_element" - And "#user-action-menu" "css_element" should be visible - And I should see "Certificates" in the "#user-action-menu" "css_element" - And I should not see "Links" in the "#user-action-menu" "css_element" + And I should see smart menu "Certificates" in location "User" And I click on "Create menu" "button" And I set the following fields to these values: | Title | SmartMenu Policy | | Menu location(s) | Bottom | And I click on "Save and return" "button" Then I should see "Bottom" in the "SmartMenu Policy" "table_row" - And ".boost-union-bottom-menu" "css_element" should not be visible - And I change viewport size to "740x900" - And ".boost-union-bottom-menu" "css_element" should be visible - And I should see "SmartMenu Policy" in the ".boost-union-bottom-menu" "css_element" + And I should see smart menu "SmartMenu Policy" in location "Bottom" diff --git a/tests/behat/theme_boost_union_smartmenusettings_menus_management.feature b/tests/behat/theme_boost_union_smartmenusettings_menus_management.feature index 3529c8293c4..5c95c6a61ce 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menus_management.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menus_management.feature @@ -31,7 +31,7 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, man | Links | Main | And I should see "Links" in the "smartmenus" "table" And ".smartmenu-actions" "css_element" should exist in the "smartmenus" "table" - And I should see "Links" in the "nav.moremenu" "css_element" + And I should see smart menu "Links" in location "Main" @javascript Scenario: Smart menus: Menus: Management - Edit an existing smart menu @@ -88,8 +88,8 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, man And I click on ".action-edit" "css_element" in the "table#smartmenus #smartmenus_r1" "css_element" And I set the field "Title" to "Useful Links" And I click on "Save and return" "button" - And I should see "Links" in the "nav.moremenu" "css_element" - Then I should see "Useful Links" in the "nav.moremenu" "css_element" + Then I should see smart menu "Links" in location "Main" + And I should see smart menu "Useful Links" in location "Main" @javascript Scenario: Smartmenus: Menus: Management - Modify the visibility of an existing smart menu @@ -97,20 +97,20 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, man And I navigate to smart menus And I click on "Create menu" "button" And I set the following fields to these values: - | Title | Links | - | Menu location(s) | Main | + | Title | Links | + | Menu location(s) | Main, Menu, User, Bottom | And I click on "Save and return" "button" And I should see "Links" in the "smartmenus" "table" And ".action-hide" "css_element" should exist in the "Links" "table_row" And ".action-show" "css_element" should not exist in the "Links" "table_row" - And I should see "Links" in the "nav.moremenu" "css_element" + Then I should see smart menu "Links" in location "Main, Menu, User, Bottom" And ".action-hide" "css_element" should exist in the "Links" "table_row" And I click on ".action-hide" "css_element" in the "Links" "table_row" - Then I should not see "Links" in the "nav.moremenu" "css_element" + Then I should not see smart menu "Links" in location "Main, Menu, User, Bottom" And ".action-show" "css_element" should exist in the "Links" "table_row" And ".action-hide" "css_element" should not exist in the "Links" "table_row" And I click on ".action-show" "css_element" in the "Links" "table_row" - Then I should see "Links" in the "nav.moremenu" "css_element" + Then I should see smart menu "Links" in location "Main, Menu, User, Bottom" Scenario: Smartmenus: Menus: Management - Move an existing smart menu up and down When I log in as "admin" diff --git a/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature b/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature index 76a956310e2..19bcf9cb0ff 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature @@ -187,22 +187,22 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app And I click on "Create menu" "button" And I set the following fields to these values: | Title | Lorem ipsumDolor sit amet | - | Menu location(s) | Main | + | Menu location(s) | Main, Menu, User, Bottom | And I click on "Save and return" "button" And I follow "Preferences" in the user menu And I click on "Preferred language" "link" And I set the field "Preferred language" to "English ‎(en)‎" And I press "Save changes" And I am on site homepage - Then I should see "Lorem ipsum" in the "nav.moremenu" "css_element" - And I should not see "Dolor sit amet" in the "nav.moremenu" "css_element" + Then I should see smart menu "Lorem ipsum" in location "Main, Menu, User, Bottom" + And I should not see smart menu "Dolor sit amet" in location "Main, Menu, User, Bottom" And I follow "Preferences" in the user menu And I click on "Preferred language" "link" And I set the field "Preferred language" to "Deutsch ‎(de)‎" And I press "Save changes" And I am on site homepage - Then I should see "Dolor sit amet" in the "nav.moremenu" "css_element" - And I should not see "Lorem ipsum" in the "nav.moremenu" "css_element" + Then I should see smart menu "Dolor sit amet" in location "Main, Menu, User, Bottom" + And I should not see smart menu "Lorem ipsum" in location "Main, Menu, User, Bottom" @javascript Scenario: Smartmenu: Menus: Presentation - Display the menus inside and outside more menu