From e3da3d0aafd946a14825c0438a59fd41137e6202 Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Fri, 16 Feb 2024 22:29:16 +0100 Subject: [PATCH] Fix some small things which were overseen in the review of PR #501 --- ...ehat_theme_boost_union_base_smartmenus.php | 1 - ...enusettings_menuitems_presentation.feature | 150 +++++++++--------- ...artmenusettings_menus_presentation.feature | 46 +++--- 3 files changed, 94 insertions(+), 103 deletions(-) diff --git a/tests/behat/behat_theme_boost_union_base_smartmenus.php b/tests/behat/behat_theme_boost_union_base_smartmenus.php index 69489151764..32a2d81cd05 100644 --- a/tests/behat/behat_theme_boost_union_base_smartmenus.php +++ b/tests/behat/behat_theme_boost_union_base_smartmenus.php @@ -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. * diff --git a/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature b/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature index febb50b1435..b7b74c856e2 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menuitems_presentation.feature @@ -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 | @@ -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" @@ -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 | | - | tablet | | - | mobile | | - And I see smart menu "Quick links" item "Resources" in location "Menu, Main, User" - Then I change window size to "800x980" - And I see smart menu "Quick links" item "Resources" in location "User, Menu" + | Title | Resources | + | Menu item type | Static | + | Menu item URL | https://moodle.org | + | desktop | | + | tablet | | + | mobile | | + Then I see smart menu "Quick links" item "Resources" in location "Menu, Main, User" + And I change window size to "800x980" + Then I 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 see smart menu "Quick links" item "Resources" in location "Main" - Then I change window size to "mobile" - And I see smart menu "Quick links" item "Resources" in location "Menu, User" + Then I see smart menu "Quick links" item "Resources" in location "Main" + And I change window size to "mobile" + Then I see smart menu "Quick links" item "Resources" in location "Menu, User" And I see smart menu "Quick links" item "Resources" in location "Bottom" Examples: @@ -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 | | + | Title | Resources | + | Menu item type | Heading | + | Title presentation | | 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 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 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 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 | @@ -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)" @@ -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 diff --git a/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature b/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature index f36f0431ee5..76a956310e2 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menus_presentation.feature @@ -122,38 +122,34 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app Then DOM element ".card-dropdown .dropdown-menu.show img" should have computed style "height" "" Examples: - | cardsize | height | - | Tiny (50px) | 50px | - | Small (100px) | 100px | - | Medium (150px) | 150px | - | Large (200px) | 200px | + | cardsize | height | + | Tiny (50px) | 50px | + | Small (100px) | 100px | + | Medium (150px) | 150px | + | Large (200px) | 200px | @javascript - Scenario: Smartmenu: Menus: Presentation - Displays the card menu container in various overflow behaviors - Given I log in as "admin" + Scenario Outline: Smartmenu: Menus: Presentation - Displays the card menu container in various overflow behaviors + When I log in as "admin" And I create smart menu with the following fields to these values: - | Title | Quick Links | - | Menu location(s) | Main navigation | - | Presentation type | Card | - | Card overflow behavior | No wrap | + | Title | Quick Links | + | Menu location(s) | Main navigation | + | Presentation type | Card | + | Card overflow behavior | | And I set "Quick Links" smart menu items with the following fields to these values: - | Title | Smartmenu Resource | - | Menu item type | Static | - | Menu item URL | https://moodle.org | + | Title | Smartmenu Resource | + | Menu item type | Static | + | Menu item 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" - And ".card-dropdown.card-overflow-wrap .dropdown-menu.show" "css_element" should not exist in the ".primary-navigation" "css_element" - Then DOM element ".primary-navigation .card-dropdown .dropdown-menu.show" should have computed style "flex-wrap" "nowrap" + Then ".card-dropdown.card-overflow-no-wrap .dropdown-menu.show" "css_element" exist in the ".primary-navigation" "css_element" + And ".card-dropdown.card-overflow-wrap .dropdown-menu.show" "css_element" 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 "Card 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" - And ".card-dropdown.card-overflow-wrap .dropdown-menu.show" "css_element" should exist in the ".primary-navigation" "css_element" - And ".card-dropdown.card-overflow-no-wrap .dropdown-menu.show" "css_element" should not exist in the ".primary-navigation" "css_element" + Examples: + | overflow | nowrapshouldornot | wrapshouldornot | flexshouldornot | + | No wrap | should | should not | should | + | Wrap | should not | should | should not | @javascript Scenario Outline: Smartmenu: Menus: Presentation - Display the smart menu and its menu items as card withs different aspect ratios @@ -210,7 +206,7 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app @javascript Scenario: Smartmenu: Menus: Presentation - Display the menus inside and outside more menu - Given I log in as "admin" + When I log in as "admin" And I create smart menu with the following fields to these values: | Title | Quick links | | Menu location(s) | Main, Menu |