From ce960892c03c9c52834ac42c0b0f3b345cb748a8 Mon Sep 17 00:00:00 2001
From: Kathrin Osswald <kathrin.osswald@uni-ulm.de>
Date: Thu, 3 Sep 2020 13:08:01 +0200
Subject: [PATCH] Fixed Behat issues after upgrading to 3.9.

---
 CHANGES.md                                    |  1 +
 ...oost_campus_course_layout_settings.feature |  2 +-
 ...oost_campus_footer_layout_settings.feature | 24 ++++++++++++-------
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index b41e08d..25c92dc 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Changes
 
 ### Unreleased
 
+* 2020-09-03 - Fixed Behat issues after upgrading to 3.9.
 * 2020-09-02 - Deleted own additional edit button for courses because upstream Boost reimplemented it.
                Many thanks to @christianwolters for providing this fix.
 * 2020-09-02 - Prepare compatibility for Moodle 3.9.
diff --git a/tests/behat/theme_boost_campus_course_layout_settings.feature b/tests/behat/theme_boost_campus_course_layout_settings.feature
index dd38653..4cf8a57 100644
--- a/tests/behat/theme_boost_campus_course_layout_settings.feature
+++ b/tests/behat/theme_boost_campus_course_layout_settings.feature
@@ -36,7 +36,7 @@ Feature: Configuring the theme_boost_campus plugin for the "Course Layout settin
       | section0title | no     | theme_boost_campus |
     When I log in as "teacher1"
     And I am on "Course 1" course homepage with editing mode on
-    Then "General" "text" in the "li#section-0" "css_element" should not be visible
+    Then "#section-0 h3.sectionname.accesshide" "css_element" should exist
     When I edit the section "0" and I fill the form with:
       | Custom                     | 1                           |
       | New value for Section name | This is the general section |
diff --git a/tests/behat/theme_boost_campus_footer_layout_settings.feature b/tests/behat/theme_boost_campus_footer_layout_settings.feature
index fe32e24..b7e47ea 100644
--- a/tests/behat/theme_boost_campus_footer_layout_settings.feature
+++ b/tests/behat/theme_boost_campus_footer_layout_settings.feature
@@ -221,14 +221,18 @@ Feature: Configuring the theme_boost_campus plugin for the "Footer Layout Settin
   #    | footerhideusertourslink | 1     | theme_boost_campus |
   Scenario: Enable "Hide link to reset the user tour"
     When I log in as "admin"
+    And I add a new user tour with:
+      | Name                | First tour    |
+      | Description         | My first tour |
+      | Apply to URL match  | /my/%         |
+      | Tour is enabled     | 1             |
+    And I add steps to the "First tour" tour:
+      | targettype                  | Title             | Content                                  |
+      | Display in middle of page   | Welcome           | Welcome to your personal learning space. |
     And I navigate to "Appearance > Boost Campus" in site administration
     And I click on "Footer Layout Settings" "link"
     And I set the field "s_theme_boost_campus_footerhideusertourslink" to "1"
     And I press "Save changes"
-    # As both provided user tours are disabled in the testing environment, we need to enable one
-    # (the Dashboard tour) first.
-    And I navigate to "Appearance > User tours" in site administration
-    And I click on "//td[@id='tours_r0_c3']//a[contains(concat(' ',normalize-space(@class),' '),'quickeditlink')]" "xpath_element"
     And I log out
     When I log in as "teacher1"
     Then I should not see "Reset user tour on this page" in the "page-footer" "region"
@@ -241,14 +245,18 @@ Feature: Configuring the theme_boost_campus plugin for the "Footer Layout Settin
   #    | footerhideusertourslink | 0     | theme_boost_campus |
   Scenario: Counter check: Disable "Hide link to reset the user tour"
     When I log in as "admin"
+    And I add a new user tour with:
+      | Name                | First tour    |
+      | Description         | My first tour |
+      | Apply to URL match  | /my/%         |
+      | Tour is enabled     | 1             |
+    And I add steps to the "First tour" tour:
+      | targettype                  | Title             | Content                                  |
+      | Display in middle of page   | Welcome           | Welcome to your personal learning space. |
     And I navigate to "Appearance > Boost Campus" in site administration
     And I click on "Footer Layout Settings" "link"
     And I set the field "s_theme_boost_campus_footerhideusertourslink" to "0"
     And I press "Save changes"
-    # As both provided user tours are disabled in the testing environment, we need to enable one
-    # (the Dashboard tour) first.
-    And I navigate to "Appearance > User tours" in site administration
-    And I click on "//td[@id='tours_r0_c3']//a[contains(concat(' ',normalize-space(@class),' '),'quickeditlink')]" "xpath_element"
     And I log out
     When I log in as "teacher1"
     Then I should see "Reset user tour on this page" in the "page-footer" "region"
-- 
GitLab