Skip to content

Commit

Permalink
Fix some small things which were overseen in the review of PR #501
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Feb 18, 2024
1 parent 42dfccc commit e3da3d0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 103 deletions.
1 change: 0 additions & 1 deletion tests/behat/behat_theme_boost_union_base_smartmenus.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_theme_boost_union_base_smartmenus extends behat_base {

/**
* Open the smart menu listing page.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
| Course full name | 2 | Test course.. | Test course word count |

@javascript
Scenario: Smartmenus: Menu items: Presentation - Display the menu item title in different type
Given I log in as "admin"
Scenario: Smartmenus: Menu items: Presentation - Display the menu item title in different types
When I log in as "admin"
And I navigate to smart menu "Quick links" items
And I set "Quick links" smart menu items with the following fields to these values:
| Title | External links |
Expand All @@ -120,51 +120,48 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
| Menu item URL | https://moodle.org |
And I should see "Resources" in the "smartmenus_items" "table"
And I should see smart menu "Quick links" item "External links" in location "Main, Menu, User, Bottom"
# Main menu test.
# Main menu.
And I click on "Quick links" "link" in the ".primary-navigation" "css_element"
And I should see "External links" in the ".primary-navigation .menu-item-heading" "css_element"
Then the "href" attribute of ".primary-navigation .menu-item-heading" "css_element" should contain "#"
Then I should see "External links" in the ".primary-navigation .menu-item-heading" "css_element"
And I should see "Resources" in the ".primary-navigation .menu-item-static" "css_element"
Then the "href" attribute of ".primary-navigation .menu-item-static" "css_element" should contain "https://moodle.org"
And the "href" attribute of ".primary-navigation .menu-item-heading" "css_element" should contain "#"
And the "href" attribute of ".primary-navigation .menu-item-static" "css_element" should contain "https://moodle.org"
# Menu bar.
And I click on "Quick links" "link" in the ".boost-union-menubar" "css_element"
And I should see "External links" in the ".boost-union-menubar .menu-item-heading" "css_element"
Then the "href" attribute of ".boost-union-menubar .menu-item-heading" "css_element" should contain "#"
Then I should see "External links" in the ".boost-union-menubar .menu-item-heading" "css_element"
And I should see "Resources" in the ".boost-union-menubar .menu-item-static" "css_element"
Then the "href" attribute of ".boost-union-menubar .menu-item-static" "css_element" should contain "https://moodle.org"
And the "href" attribute of ".boost-union-menubar .menu-item-heading" "css_element" should contain "#"
And the "href" attribute of ".boost-union-menubar .menu-item-static" "css_element" should contain "https://moodle.org"
# 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 "External links" in the "#usermenu-carousel .menu-item-heading" "css_element"
Then I should see "External links" in the "#usermenu-carousel .menu-item-heading" "css_element"
And I should see "Resources" in the "#usermenu-carousel .menu-item-static" "css_element"
And the "href" attribute of "//div[contains(@class, 'carousel-item')]//a[contains(@class, 'menu-item-heading')]" "xpath_element" should contain "#"
And the "href" attribute of "//div[contains(@class, 'carousel-item')]//a[contains(@class, 'menu-item-static')]" "xpath_element" should contain "https://moodle.org"
# Menu items in bottom menu.
Then I change the viewport size to "740x900"
And I change the viewport size to "740x900"
And I click on "Quick links" "link" in the ".bottom-navigation" "css_element"
And I should see "External links" in the ".bottom-navigation" "css_element"
Then I should see "External links" in the ".bottom-navigation .menu-item-heading" "css_element"
And I should see "Resources" in the ".bottom-navigation .menu-item-static" "css_element"
And the "href" attribute of "//div[@class='bottom-navigation']//a[contains(@class, 'menu-item-heading')]" "xpath_element" should contain "#"
And the "href" attribute of "//div[@class='bottom-navigation']//a[contains(@class, 'menu-item-static')]" "xpath_element" should contain "https://moodle.org"
Then I change the viewport size to "large"

@javascript
Scenario: Smartmenus: Menu items - Display the menu items in different order
Given I log in as "admin"
When I log in as "admin"
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Demo item 01 |
| Menu item type | Static |
| Menu item URL | https://example.com |
| desktop | 1 |
| Title | Demo item 01 |
| Menu item type | Static |
| Menu item URL | https://example.com |
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Demo item 02 |
| Menu item type | Static |
| Menu item URL | https://example.com |
| tablet | 1 |
| Title | Demo item 02 |
| Menu item type | Static |
| Menu item URL | https://example.com |
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Demo item 03 |
| Menu item type | Static |
| Menu item URL | https://example.com |
| mobile | 1 |
| Title | Demo item 03 |
| Menu item type | Static |
| Menu item URL | https://example.com |
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"
Expand All @@ -179,21 +176,21 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app

@javascript
Scenario Outline: Smartmenus: Menu items - Display the menu items in different viewports
Given I log in as "admin"
When I log in as "admin"
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://moodle.org |
| desktop | <hidedesktop> |
| tablet | <hidetablet> |
| mobile | <hidemobile> |
And I <desktopshouldornot> see smart menu "Quick links" item "Resources" in location "Menu, Main, User"
Then I change window size to "800x980"
And I <tabletshouldornot> see smart menu "Quick links" item "Resources" in location "User, Menu"
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://moodle.org |
| desktop | <hidedesktop> |
| tablet | <hidetablet> |
| mobile | <hidemobile> |
Then I <desktopshouldornot> see smart menu "Quick links" item "Resources" in location "Menu, Main, User"
And I change window size to "800x980"
Then I <tabletshouldornot> see smart menu "Quick links" item "Resources" in location "User, Menu"
And I click on "More" "link" in the ".primary-navigation" "css_element"
And I <tabletshouldornot> see smart menu "Quick links" item "Resources" in location "Main"
Then I change window size to "mobile"
And I <mobileshouldornot> see smart menu "Quick links" item "Resources" in location "Menu, User"
Then I <tabletshouldornot> see smart menu "Quick links" item "Resources" in location "Main"
And I change window size to "mobile"
Then I <mobileshouldornot> see smart menu "Quick links" item "Resources" in location "Menu, User"
And I <mobileshouldornot> see smart menu "Quick links" item "Resources" in location "Bottom"

Examples:
Expand All @@ -205,29 +202,28 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app

@javascript
Scenario Outline: Smartmenus: Menu items: Presentation - Display the menu items title with icon
Given I log in as "admin"
When I log in as "admin"
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Resources |
| Menu item type | Heading |
| Title presentation | <presentationtitle> |
| Title | Resources |
| Menu item type | Heading |
| Title presentation | <presentationtitle> |
And I should see "Resources" in the "smartmenus_items" "table"
And I click on ".action-edit" "css_element" in the "Resources" "table_row"
Then I click on "input[name='iconsearch']" "css_element"
Then I click on ".fa-info-circle" "css_element" in the ".fontawesome-picker .popover-body " "css_element"
And I click on "input[name='iconsearch']" "css_element"
And I click on ".fa-info-circle" "css_element" in the ".fontawesome-picker .popover-body " "css_element"
And I click on "Save changes" "button"
And I <desktopshouldornot> see smart menu "Quick links" item "Resources" in location "Main, Menu, User"
And ".fa-info-circle" "css_element" should exist in the ".primary-navigation .dropdown-item.menu-item-heading" "css_element"
Then ".fa-info-circle" "css_element" should exist in the ".primary-navigation .dropdown-item.menu-item-heading" "css_element"
And ".fa-info-circle" "css_element" should exist in the ".boost-union-menubar .dropdown-item" "css_element"
And ".fa-info-circle" "css_element" should exist in the "#usermenu-carousel .carousel-item.submenu .dropdown-item" "css_element"
Then I change window size to "mobile"
And I change window size to "mobile"
And I <mobiletitleshould> see smart menu "Quick links" item "Resources" in location "Menu, User"
And I click on "More" "button" in the ".bottom-navigation" "css_element"
And I click on "Quick links" "link" in the "#theme_boost-drawers-primary" "css_element"
And I <mobiletitleshould> see "Resources" in the "#theme_boost-drawers-primary" "css_element"
And ".fa-info-circle" "css_element" should exist in the ".primary-navigation .dropdown-item.menu-item-heading" "css_element"
Then ".fa-info-circle" "css_element" should exist in the ".primary-navigation .dropdown-item.menu-item-heading" "css_element"
And ".fa-info-circle" "css_element" should exist in the ".boost-union-menubar .dropdown-item" "css_element"
And ".fa-info-circle" "css_element" should exist in the "#usermenu-carousel .carousel-item.submenu .dropdown-item" "css_element"
Then I change window size to "large"

Examples:
| presentationtitle | desktopshouldornot | mobiletitleshould |
Expand All @@ -237,70 +233,70 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app

@javascript
Scenario: Smartmenus: Menu items: Presentation - Display the tooltip on hover over the menu items
Given I log in as "admin"
When I log in as "admin"
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://moodle.org |
| Tooltip | External links |
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://moodle.org |
| Tooltip | External links |
And I should see "Resources" in the "smartmenus_items" "table"
And I click on "Quick links" "link" in the ".primary-navigation" "css_element"
And I hover over the "Resources" "text" in the ".primary-navigation" "css_element"
Then I should see "External links" in the "body>.tooltip" "css_element"
Then I should see "External links" in the "body > .tooltip" "css_element"
And I click on ".action-edit" "css_element" in the "Resources" "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 over the "Resources" "link" in the ".primary-navigation" "css_element"
And "body>.tooltip" "css_element" should not exist
And "body > .tooltip" "css_element" should not exist

@javascript
Scenario: Smartmenus: Menu items: Presentation - Display the card type menu items title with different position and color
Given I log in as "admin"
When I log in as "admin"
And I navigate to smart menus
And I click on ".action-edit" "css_element" in the "Quick links" "table_row"
And I set the field "Presentation type" to "Card"
And I click on "Save and return" "button"
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://moodle.org |
| Card text position| Below image |
| Card text color | #FFFEFF |
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://moodle.org |
| Card text position | Below image |
| Card text color | #FFFEFF |
And I should see smart menu "Quick links" item "Resources" in location "Main"
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 ".dropdown-menu.show .card-block.card-text-below" "css_element" should exist in the ".primary-navigation" "css_element"
And ".dropdown-menu.show .card-block .content-block" "css_element" should appear after ".dropdown-menu.show .card-block .img-block" "css_element"
And I click on ".action-edit" "css_element" in the "Resources" "table_row"
And I expand all fieldsets
Then I set the field "Card text position" to "Top overlay"
Then I set the field "Card text color" to "#230017"
And I set the field "Card text position" to "Top overlay"
And I set the field "Card text color" to "#230017"
And I click on "Save changes" "button"
And I should see smart menu "Quick links" item "Resources" in location "Main"
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"
Then DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "position" "absolute"
And ".dropdown-menu.show .card-block.card-text-overlay-top" "css_element" should exist in the ".primary-navigation" "css_element"
And DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "position" "absolute"
And I click on ".action-edit" "css_element" in the "Resources" "table_row"
And I expand all fieldsets
Then I set the field "Card text position" to "Bottom overlay"
And I set the field "Card text position" to "Bottom overlay"
And I click on "Save changes" "button"
And I should see smart menu "Quick links" item "Resources" in location "Main"
Then ".dropdown-menu.show .card-block.card-text-overlay-bottom" "css_element" should exist in the ".primary-navigation" "css_element"
Then DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "position" "absolute"
Then DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "align-items" "flex-end"
And DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "position" "absolute"
And DOM element ".dropdown-menu.show .card-block .content-block" should have computed style "align-items" "flex-end"

@javascript @_file_upload
Scenario: Smartmenus: Menu items: Presentation - Display the card type menu item with background image and colors
Given I log in as "admin"
When I log in as "admin"
And I navigate to smart menus
And I click on ".action-edit" "css_element" in the "Quick links" "table_row"
And I set the field "Presentation type" to "Card"
And I click on "Save and return" "button"
And I set "Quick links" smart menu items with the following fields to these values:
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://example.com |
| Card background color | #031FC3 |
| Title | Resources |
| Menu item type | Static |
| Menu item URL | https://example.com |
| Card background color | #031FC3 |
And I should see smart menu "Quick links" item "Resources" in location "Main"
And I click on "Quick links" "link" in the ".primary-navigation" "css_element"
Then DOM element ".dropdown-menu .menu-item-static .content-block" should have computed style "background-color" "rgb(3, 31, 195)"
Expand All @@ -310,8 +306,8 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app
And I expand all fieldsets
And I upload "theme/boost_union/tests/fixtures/backimg.jpg" file to "Card image" filemanager
And I click on "Save changes" "button"
And I should see smart menu "Quick links" item "Resources" in location "Main, Menu"
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 I should see smart menu "Quick links" item "Resources" in location "Main, Menu"
And 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"

@javascript
Scenario: Smartmenu: Menu items: Presentation - Add a smart menu item with multilang tags
Expand Down
Loading

0 comments on commit e3da3d0

Please sign in to comment.