Skip to content

Commit

Permalink
Missing test cases included for the menu and menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Sep 22, 2023
1 parent ca5c372 commit e9acf75
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/behat/behat_theme_boost_union_behat_smartmenus.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function i_create_menus_with_the_following_fields_to_these_values($menu,
["Appearance > Themes > Boost Union > Smart menus"]);
$this->execute("behat_general::i_click_on_in_the", [".action-list-items", "css_element", $menu, 'table_row']);
$this->execute("behat_general::i_click_on", ["Add new menu item", "button"]);
$this->execute("behat_general::click_link", ["Expand all"]);
$this->execute('behat_forms::i_set_the_following_fields_to_these_values', [$data]);
$this->execute("behat_general::i_click_on", ["Save changes", "button"]);
}
Expand Down
171 changes: 171 additions & 0 deletions tests/behat/theme_boost_union_menuitemsettings_application.feature
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,174 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" items pag
And I should see "Available courses" in the "smartmenus_item" "table"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And I should see "Test course.." in the ".primary-navigation" "css_element"

@javascript
Scenario: Smartmenuitem: Application - Show the menu item title as different type
Given I log in as "admin"
And I navigate to smartmenu "Quick Links" items
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 01 |
| Type | Heading |
And I should see "Demo item 01" in the "smartmenus_item" "table"
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 02 |
| Type | Static |
| Menu item URL | https://example.com |
And I should see "Demo item 02" in the "smartmenus_item" "table"
Then I follow "Dashboard"
And I should see menu "Quick Links" item "Demo item 01" in location "Main"
Then I reload the page
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
Then I click on "Demo item 01" "link" in the ".primary-navigation" "css_element"
Then I should see "Dashboard"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And I click on "Demo item 02" "link" in the ".primary-navigation" "css_element"
Then I should see "Example Domain"

@javascript
Scenario: Smartmenuitem: Application - Show the menu item in different order and multiple viewports
Given I log in as "admin"
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 01 |
| Type | Static |
| Menu item URL | https://example.com |
| desktop | 1 |
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 02 |
| Type | Static |
| Menu item URL | https://example.com |
| tablet | 1 |
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 03 |
| Type | Static |
| Menu item URL | https://example.com |
| mobile | 1 |
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And "Demo item 02" "text" should appear after "Demo item 01" "text"
And "Demo item 03" "text" should appear after "Demo item 02" "text"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I set the field "Order" to "3"
And I click on "Save changes" "button"
And I click on ".action-edit" "css_element" in the "Demo item 03" "table_row"
And I set the field "Order" to "1"
And I click on "Save changes" "button"
And "Demo item 02" "text" should appear after "Demo item 03" "text"
And "Demo item 01" "text" should appear after "Demo item 02" "text"
And I should not see menu "Quick Links" item "Demo item 01" in location "Menu"
And I should see menu "Demo item 02" in css "nav.menubar"
And I should see menu "Demo item 03" in css "nav.menubar"
Then I change window size to "980x290"
And I should see menu "Demo item 01" in css "nav.menubar"
And I should not see menu "Demo item 02" in css "nav.menubar"
And I should see menu "Demo item 03" in css "nav.menubar"
Then I change window size to "mobile"
And I should see menu "Demo item 01" in css "nav.menubar"
And I should see menu "Demo item 02" in css "nav.menubar"
And I should not see menu "Demo item 03" in css "nav.menubar"


@javascript
Scenario: Smartmenuitem: Application - Show the menu item in different styles
Given I log in as "admin"
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 01 |
| Type | Heading |
| Display options | Show title icon |
| Tooltip | Demo tooltip |
| cssclass | blockitem |
## Icon
And I should see "Demo item 01" in the "smartmenus_item" "table"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
Then I click on "input[name='iconsearch']" "css_element"
Then I click on ".fontawesome-picker .popover-body .fa-info-circle" "css_element"
And I click on "Save changes" "button"

And I should see menu "Quick Links" item "Demo item 01" in location "Main"
And ".icon.fa-info-circle" "css_element" should exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
Then I click on "input[name='iconsearch']" "css_element"
Then I click on ".fontawesome-picker .popover-body .fa-folder-o" "css_element"
And I click on "Save changes" "button"
And I should see menu "Quick Links" item "Demo item 01" in location "Main"
And ".icon.fa-folder-o" "css_element" should exist in the ".primary-navigation" "css_element"
And ".icon.fa-info-circle" "css_element" should not exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"

## Display options.
And I set the field "Display options" to "Hide title"
And I click on "Save changes" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And I should not see "Demo item 01" in the ".primary-navigation" "css_element"
And ".icon.fa-folder-o" "css_element" should exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I set the field "Display options" to "Hide title in mobile"
And I click on "Save changes" "button"
And I should see menu "Quick Links" item "Demo item 01" in location "Main"
Then I change window size to "mobile"
And I click on "Quick Links" "link" in the "nav.moremenu" "css_element"
And I should not see "Demo item 01" in the ".primary-navigation" "css_element"
Then I change window size to "large"
# Tooltip
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I set the field "Display options" to "Show title icon"
And I click on "Save changes" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And I hover ".primary-navigation a.dropdown-item" "css_element"
Then I should see "Demo tooltip"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I set the field "Tooltip" to ""
And I click on "Save changes" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And I hover ".primary-navigation a.dropdown-item" "css_element"
Then I should not see "Demo tooltip"
## Target
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I set the field "Type" to "Static"
Then I set the field "Menu item URL" to "https://example.com"
Then I set the field "Target" to "New tab"
And I click on "Save changes" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And the "target" attribute of "//div[contains(@class, 'primary-navigation')]//a[contains(normalize-space(.), 'Demo item 01')]" "xpath_element" should contain "_blank"
## CSS classes
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And ".blockitem" "css_element" should exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
Then I set the field "cssclass" to "block-info"
And I click on "Save changes" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
And ".blockitem" "css_element" should not exist in the ".primary-navigation" "css_element"
And ".block-info" "css_element" should exist in the ".primary-navigation" "css_element"

@javascript @_file_upload
Scenario: Smartmenuitem: Application - Show the menu item as a card with different appearance
Given I log in as "admin"
And I navigate to smartmenus
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I set the field "Types" to "Card"
And I click on "Save and return" "button"
And I set "Quick Links" items with the following fields to these values:
| Title | Demo item 01 |
| Type | Static |
| Menu item URL | https://example.com |
| Text position | Below image |
| Text color | #FFFEFF |
| Background color | #031FC3 |
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I expand all fieldsets
And I upload "theme/boost_union/tests/fixtures/backimg.jpg" file to "Image" filemanager
And I click on "Save changes" "button"
And I should see menu "Quick Links" item "Demo item 01" in location "Main"
Then the image at "//div[contains(@class, 'primary-navigation')]//img[contains(@src, 'pluginfile.php') and contains(@src, '/theme_boost_union/smartmenus_itemimage/')]" "xpath_element" should be identical to "theme/boost_union/tests/fixtures/backimg.jpg"
Then DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "background-color" "rgb(3, 31, 195)"
Then DOM element ".dropdown-menu.show .card-block .content-block a.dropdown-item" should have computed style "color" "rgb(255, 254, 255)"
Then ".dropdown-menu.show .card-block.card-text-below" "css_element" should exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Demo item 01" "table_row"
And I expand all fieldsets
Then I set the field "Text position" to "Top overlay"
Then I set the field "Background color" to "#50DFFB"
Then I set the field "Text color" to "#230017"
And I click on "Save changes" "button"
And I should see menu "Quick Links" item "Demo item 01" in location "Main"
Then DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "background-color" "rgba(80, 223, 251, 0.5)"
Then DOM element ".dropdown-menu.show .card-block .content-block a.dropdown-item" should have computed style "color" "rgb(35, 0, 23)"
Then ".dropdown-menu.show .card-block.card-text-overlay-top" "css_element" should exist in the ".primary-navigation" "css_element"
83 changes: 83 additions & 0 deletions tests/behat/theme_boost_union_menusettings_application.feature
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,86 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menu items" page
And I click on "Save and return" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
Then ".card-dropdown.card-form-fullwidth .dropdown-menu.show" "css_element" should exist in the ".primary-navigation" "css_element"

@javascript
Scenario: Smartmenu: Application - Displays the card menus container in different overflow behavior
Given I log in as "admin"
And I create menu with the following fields to these values:
| Title | Quick Links |
| Locations | Main |
| Type | Card |
| Overflow behavior | No wrap |
And I set "Quick Links" items with the following fields to these values:
| Title | Smartmenu Resource |
| Type | Static |
| URL | https://moodle.org |
And I click on "Smart menus" "link" in the "#page-navbar .breadcrumb" "css_element"
And ".dropdown.nav-item.card-dropdown" "css_element" should exist in the ".primary-navigation" "css_element"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
Then ".card-dropdown.card-overflow-no-wrap .dropdown-menu.show" "css_element" should exist in the ".primary-navigation" "css_element"
Then ".card-dropdown.card-overflow-wrap .dropdown-menu.show" "css_element" should not exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
And I expand all fieldsets
And I set the field "Overflow behavior" to "Wrap"
And I click on "Save and return" "button"
And I click on "Quick Links" "link" in the ".primary-navigation" "css_element"
Then ".card-dropdown.card-overflow-wrap .dropdown-menu.show" "css_element" should exist in the ".primary-navigation" "css_element"
Then ".card-dropdown.card-overflow-no-wrap .dropdown-menu.show" "css_element" should not exist in the ".primary-navigation" "css_element"

@javascript
Scenario: Smartmenu: Application - Check the Advanced settings.
Given I log in as "admin"
And I create menu with the following fields to these values:
| Title | Quick Links |
| Locations | Main, Menu, User, Bottom |
| Mode | Submenu |
| CSS classes | Context-block |
And I set "Quick Links" items with the following fields to these values:
| Title | Smartmenu Resource |
| Type | Heading |
And I click on "Smart menus" "link" in the "#page-navbar .breadcrumb" "css_element"
And I should see menu "Quick Links" in location "Main, Menu, User, Bottom"
# Check css class.
Then ".dropdown.nav-item.Context-block" "css_element" should exist in the ".primary-navigation" "css_element"
Then ".dropdown .dropdown-toggle" "css_element" should exist in the ".primary-navigation" "css_element"
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
Then I click on "Expand all" "link"
And I set the field "Mode" to "Inline"
And I click on "Save and return" "button"
And I should see menu "Smartmenu Resource" in location "Main, Menu, User, Bottom"
And I click on ".action-edit" "css_element" in the "Quick Links" "table_row"
Then I click on "Expand all" "link"
And I set the field "Mode" to "Submenu"
# More menu behavior
And I set the field "More menu behavior" to "Forced into more menu"
And I click on "Save and return" "button"
And I click on "More" "link" in the ".primary-navigation" "css_element"
Then I should see menu "Quick Links" in css ".primary-navigation .dropdownmoremenu"
And I create menu with the following fields to these values:
| Title | Test Quick Demo Links 01 |
| Locations | Main |
And I create menu with the following fields to these values:
| Title | Test Quick Demo Links 02 |
| Locations | Main |
And I create menu with the following fields to these values:
| Title | Test Quick Demo Links 03 |
| Locations | Main |
And I create menu with the following fields to these values:
| Title | Test Quick Demo Links 04 |
| Locations | Main |
And I create menu with the following fields to these values:
| Title | Test Quick Demo Links 05 |
| Locations | Main |
And I create menu with the following fields to these values:
| Title | Test Quick Demo Links 06 |
| Locations | Main |
Then I change the viewport size to "1900x495"
And I click on "More" "link" in the ".primary-navigation" "css_element"
Then I should see menu "Test Quick Demo Links 06" in css ".primary-navigation .dropdownmoremenu"
And I click on ".action-edit" "css_element" in the "Test Quick Demo Links 06" "table_row"
Then I click on "Expand all" "link"
And I set the field "More menu behavior" to "Forced out side of more menu"
And I click on "Save and return" "button"
And I should not see menu "Test Quick Demo Links 06" in css ".primary-navigation .dropdownmoremenu"
And I click on "More" "link" in the ".primary-navigation" "css_element"
Then I should see menu "Test Quick Demo Links 06" in css ".primary-navigation"
Binary file added tests/fixtures/backimg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e9acf75

Please sign in to comment.