From 2d2b70bc0186b0ad57fe6a07e4d2e3e78c920f36 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 26 Jan 2022 23:15:48 +0100 Subject: [PATCH] MDL-72089 behat: Need to hover the cards to make the buttons visible Kudos to Chrome that detected this. The buttons are now not visible until you hover the course card. Hence, we have to do the same with extra behat step, to allow the following click to work. --- .../tests/behat/block_myoverview_dashboard.feature | 6 ++++++ .../tests/behat/block_myoverview_favourite.feature | 3 +++ .../tests/behat/block_myoverview_hidden.feature | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature b/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature index 75142568a0d..969ed5f2b93 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_dashboard.feature @@ -130,6 +130,7 @@ Feature: The my overview block allows users to easily access their courses Scenario: View favourite courses - w/ persistence Given I am on the "My courses" page logged in as "student1" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "All" "button" in the "Course overview" "block" @@ -200,6 +201,7 @@ Feature: The my overview block allows users to easily access their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "In progress" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I reload the page @@ -213,6 +215,7 @@ Feature: The my overview block allows users to easily access their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "Past" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element" And I reload the page @@ -226,6 +229,7 @@ Feature: The my overview block allows users to easily access their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "Future" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I reload the page @@ -239,6 +243,7 @@ Feature: The my overview block allows users to easily access their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "All" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I reload the page @@ -256,6 +261,7 @@ Feature: The my overview block allows users to easily access their courses And I click on "All" "button" in the "Course overview" "block" # We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (including archived)" element instead When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I reload the page diff --git a/blocks/myoverview/tests/behat/block_myoverview_favourite.feature b/blocks/myoverview/tests/behat/block_myoverview_favourite.feature index 71d140ea4ca..51d8f0207fd 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_favourite.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_favourite.feature @@ -25,6 +25,7 @@ Feature: The my overview block allows users to favourite their courses Scenario: Favourite a course on a course card Given I am on the "My courses" page logged in as "student1" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I reload the page @@ -35,6 +36,7 @@ Feature: The my overview block allows users to favourite their courses Scenario: Star a course and switch display to list Given I am on the "My courses" page logged in as "student1" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I reload the page @@ -48,6 +50,7 @@ Feature: The my overview block allows users to favourite their courses Scenario: Star a course and switch display to summary Given I am on the "My courses" page logged in as "student1" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element" And I reload the page diff --git a/blocks/myoverview/tests/behat/block_myoverview_hidden.feature b/blocks/myoverview/tests/behat/block_myoverview_hidden.feature index 45b29931b65..e27ef877174 100644 --- a/blocks/myoverview/tests/behat/block_myoverview_hidden.feature +++ b/blocks/myoverview/tests/behat/block_myoverview_hidden.feature @@ -27,6 +27,7 @@ Feature: The my overview block allows users to hide their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "All" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I reload the page @@ -36,8 +37,10 @@ Feature: The my overview block allows users to hide their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "All" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" When I reload the page @@ -53,10 +56,12 @@ Feature: The my overview block allows users to hide their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "All" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" When I click on "All" "button" in the "Course overview" "block" And I click on "Archived" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" When I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Unarchive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I reload the page @@ -68,13 +73,16 @@ Feature: The my overview block allows users to hide their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "All" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "All" "button" in the "Course overview" "block" And I click on "Archived" "link" in the "Course overview" "block" And I should see "Course 2" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Unarchive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" When I reload the page @@ -90,6 +98,7 @@ Feature: The my overview block allows users to hide their courses Given I am on the "My courses" page logged in as "student1" And I click on "All" "button" in the "Course overview" "block" When I click on "All" "link" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" Then I should not see "Course 2" in the "Course overview" "block" @@ -102,14 +111,17 @@ Feature: The my overview block allows users to hide their courses And I click on "All" "button" in the "Course overview" "block" # We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except hidden)" element instead When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Archive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" Then I should see "Course 2" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I should not see "Archive" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I should see "Unarchive" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on "Unarchive" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" Then I should see "Course 2" in the "Course overview" "block" + And I hover "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I should see "Archive" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element" And I should not see "Unarchive" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"