From 239a903ac098d3987ab3e93d530a1127a64cb9af Mon Sep 17 00:00:00 2001 From: Prasanna LMSACE Date: Wed, 13 Dec 2023 10:37:44 +0530 Subject: [PATCH] Test: Tests for smart menu visibility restriction by date, solves #364 --- ..._smartmenusettings_menuitems_rules.feature | 36 +++++++++++++++++++ ...nion_smartmenusettings_menus_rules.feature | 35 ++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/tests/behat/theme_boost_union_smartmenusettings_menuitems_rules.feature b/tests/behat/theme_boost_union_smartmenusettings_menuitems_rules.feature index 07b619a61a3..e9e60a4477b 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menuitems_rules.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menuitems_rules.feature @@ -167,6 +167,42 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | English | should | should not | should not | | English, Deutsch | should | should not | should | + @javascript + Scenario Outline: Smartmenu: Menu items: Rules - Show smart menu item based on the custom date range + When I navigate to smart menus + And I should see "Quick links" in the "smartmenus" "table" + And I should see smart menu "Quick links" item "Resources" in location "Main, Menu, User, Bottom" + And I click on ".action-list-items" "css_element" in the "Quick links" "table_row" + And I click on ".action-edit" "css_element" in the "Resources" "table_row" + And I expand all fieldsets + And I set the following fields to these values: + | id_start_date_enabled | | + | id_end_date_enabled | | + | id_start_date_day | | + | id_start_date_month | | + | id_start_date_year | | + | id_end_date_day | | + | id_end_date_month | | + | id_end_date_year | | + And I click on "Save changes" "button" + And I see smart menu "Quick links" item "Resources" in location "Main, Menu, User, Bottom" + Then I log out + And I log in as "student1" + And I see smart menu "Quick links" item "Resources" in location "Main, Menu, User, Bottom" + And I log out + When I log in as "teacher" + And I see smart menu "Quick links" item "Resources" in location "Main, Menu, User, Bottom" + + Examples: + | startenabled |endenabled | start_day | start_month | start_year | end_day | end_month | end_year | menushouldorshouldnot | + | 1 | 1 | 1 | January | 2023 | 1 | January | 2050 | should | + | 1 | 1 | 1 | January | 2049 | 1 | January | 2050 | should not | + | 1 | 1 | 1 | January | 2023 | 1 | December | 2023 | should not | + | 1 | 0 | 1 | January | 2023 | 1 | 1 | 2023 | should | + | 1 | 0 | 1 | January | 2049 | 1 | 1 | 2023 | should not | + | 0 | 1 | 1 | January | 2023 | 1 | December | 2050 | should | + | 0 | 1 | 1 | January | 2023 | 1 | December | 2023 | should not | + @javascript Scenario Outline: Smartmenu: Menu items: Rules - Show smart menu item based on multiple conditions When I log in as "teacher" diff --git a/tests/behat/theme_boost_union_smartmenusettings_menus_rules.feature b/tests/behat/theme_boost_union_smartmenusettings_menus_rules.feature index e94b3224b79..381e818bff9 100644 --- a/tests/behat/theme_boost_union_smartmenusettings_menus_rules.feature +++ b/tests/behat/theme_boost_union_smartmenusettings_menus_rules.feature @@ -163,6 +163,41 @@ Feature: Configuring the theme_boost_union plugin on the "Smart menus" page, app | English | should | should not | should not | | English, Deutsch | should | should not | should | + @javascript + Scenario Outline: Smartmenu: Menus: Rules - Show the menus based on the custom date range + When I navigate to smart menus + And I should see "Quick links" in the "smartmenus" "table" + And I should see smart menu "Quick links" in location "Main, Menu, User, Bottom" + And I click on ".action-edit" "css_element" in the "Quick links" "table_row" + And I expand all fieldsets + And I set the following fields to these values: + | id_start_date_enabled | | + | id_end_date_enabled | | + | id_start_date_day | | + | id_start_date_month | | + | id_start_date_year | | + | id_end_date_day | | + | id_end_date_month | | + | id_end_date_year | | + And I click on "Save and return" "button" + And I see smart menu "Quick links" in location "Main" + Then I log out + And I log in as "student1" + And I see smart menu "Quick links" in location "Main, Menu, User, Bottom" + And I log out + When I log in as "teacher" + And I see smart menu "Quick links" in location "Main, Menu, User, Bottom" + + Examples: + | startenabled |endenabled | start_day | start_month | start_year | end_day | end_month | end_year | menushouldorshouldnot | + | 1 | 1 | 1 | January | 2023 | 1 | January | 2050 | should | + | 1 | 1 | 1 | January | 2049 | 1 | January | 2050 | should not | + | 1 | 1 | 1 | January | 2023 | 1 | December | 2023 | should not | + | 1 | 0 | 1 | January | 2023 | 1 | 1 | 2023 | should | + | 1 | 0 | 1 | January | 2049 | 1 | 1 | 2023 | should not | + | 0 | 1 | 1 | January | 2023 | 1 | December | 2050 | should | + | 0 | 1 | 1 | January | 2023 | 1 | December | 2023 | should not | + @javascript Scenario Outline: Smartmenu: Menus: Rules - Show smart menu based on multiple conditions Given I log in as "teacher"