Skip to content

Commit

Permalink
MDL-76601 block_myoverview: Remove hover action before clicking on menu
Browse files Browse the repository at this point in the history
With the course card menu now always displayed, there's no need to hover
first before clicking on the menus on block_myoverview Behat tests.
  • Loading branch information
junpataleta committed Jan 4, 2023
1 parent 4662669 commit 9581a44
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ 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"
Expand Down Expand Up @@ -201,7 +200,6 @@ 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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I reload the page
Expand All @@ -215,7 +213,6 @@ 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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
And I reload the page
Expand All @@ -229,7 +226,6 @@ 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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I reload the page
Expand All @@ -243,7 +239,6 @@ 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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I reload the page
Expand All @@ -261,7 +256,6 @@ 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 removed from view)" 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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
And I reload the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ 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
Expand All @@ -36,7 +35,6 @@ 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 click on "Display drop-down menu" "button" in the "Course overview" "block"
Expand All @@ -48,7 +46,6 @@ 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 click on "Display drop-down menu" "button" in the "Course overview" "block"
Expand Down
32 changes: 10 additions & 22 deletions blocks/myoverview/tests/behat/block_myoverview_hidden.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ 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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I reload the page
Expand All @@ -36,33 +35,29 @@ Feature: The my overview block allows users to hide their courses
Scenario: Test hide toggle functionality w/ favorites
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 "All" "link" in the "Course overview" "block"
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 "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
When I reload the page
Then I should not see "Course 2" in the "Course overview" "block"
And I should not see "Course 2" in the "Course overview" "block"
And I click on "All" "button" in the "Course overview" "block"
And I click on "Starred" "link" in the "Course overview" "block"
Then I should not see "Course 2" in the "Course overview" "block"
And I click on "Starred" "button" in the "Course overview" "block"
And I click on "Removed from view" "link" in the "Course overview" "block"
Then I should see "Course 2" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"

Scenario: Test show toggle functionality
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 "All" "link" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I click on "Remove from view" "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 "All" "button" in the "Course overview" "block"
And I click on "Removed from view" "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 ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I click on "Restore to view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I reload the page
And I click on "Removed from view" "button" in the "Course overview" "block"
Expand All @@ -72,33 +67,29 @@ Feature: The my overview block allows users to hide their courses
Scenario: Test show toggle functionality w/ favorites
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 "All" "link" in the "Course overview" "block"
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 "Remove from view" "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 "Removed from view" "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 "Restore to view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
When I reload the page
Then I should not see "Course 2" in the "Course overview" "block"
And I click on "Removed from view" "button" in the "Course overview" "block"
And I click on "All" "link" in the "Course overview" "block"
Then I should see "Course 2" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"
And I click on "All" "button" in the "Course overview" "block"
And I click on "Starred" "link" in the "Course overview" "block"
Then I should see "Course 2" in the "Course overview" "block"
And I should see "Course 2" in the "Course overview" "block"

Scenario: Test a course is hidden directly with "All" 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 "Remove from view" "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"
Expand All @@ -111,17 +102,14 @@ 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 "Remove from view" "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 "Remove from view" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I should see "Restore to view" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I click on "Restore to view" "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 should see "Course 2" in the "Course overview" "block"
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I should see "Remove from view" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
And I should not see "Restore to view" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"

0 comments on commit 9581a44

Please sign in to comment.