Skip to content

Commit

Permalink
Test: Use custom step to check the menus and menu items existence, so…
Browse files Browse the repository at this point in the history
…lves #365 (#518)
  • Loading branch information
prasanna-lmsace authored and abias committed Feb 18, 2024
1 parent 7c4434f commit 5a43af6
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 95 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,17 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
| Link target | <setting> |
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" <should>
# 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" <should>
# 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" <should>
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" <should>

Examples:
Expand Down Expand Up @@ -96,9 +90,8 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
| Dynamic courses: Course name presentation | <selectnamefield> |
| Dynamic courses: Number of words | <numberofwords> |
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 "<showntitle>" in the ".primary-navigation" "css_element"
And I should not see "<notshowntitle>" in the ".primary-navigation" "css_element"
And I should see smart menu "Quick links" item "<showntitle>" in location "Main, Menu, User, Bottom"
And I should not see smart menu "Quick links" item "<notshowntitle>" in location "Main, Menu, User, Bottom"

Examples:
| selectnamefield | numberofwords | showntitle | notshowntitle |
Expand Down Expand Up @@ -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 | <span lang="en" class="multilang">Lorem ipsum</span><span lang="de" class="multilang">Dolor sit amet</span> |
| 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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 |
Expand All @@ -80,27 +71,19 @@ 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 |
| Menu location(s) | User |
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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,29 +88,29 @@ 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
When I log in as "admin"
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"
Expand Down
Loading

0 comments on commit 5a43af6

Please sign in to comment.