Skip to content

Commit

Permalink
Merge branch 'MDL-70726-master' of https://github.com/NashTechOpenUni…
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Mar 10, 2021
2 parents 82b2488 + d0bea8a commit 90db228
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 29 deletions.
4 changes: 2 additions & 2 deletions admin/tool/uploaduser/tests/behat/upload_users.feature
Expand Up @@ -132,12 +132,12 @@ Feature: Upload users
# Boost check.
And I log in as "jonest"
And I am on "Maths" course homepage
And "Turn editing on" "button" should not exist
And "Calendar" "link" should be visible
And I log out
# Classic check.
And I log in as "reznor"
And I am on "Maths" course homepage
And "Turn editing on" "button" should exist
And "Calendar" "link" should not be visible

@javascript
Scenario: Upload users setting their user theme when allowuserthemes is false
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/usertours/tests/behat/tour_accessibility.feature
Expand Up @@ -76,10 +76,10 @@ Feature: Apply accessibility to a tour
And "input[tabindex],button[tabindex]" "css_element" should exist
When I click on "Next" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And "input[tabindex],button[tabindex]" "css_element" should not exist
And "input[tabindex]:not([tabindex='-1']),button[tabindex]:not([tabindex='-1'])" "css_element" should not exist
When I click on "Previous" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should exist
And "input[tabindex],button[tabindex]" "css_element" should exist
When I click on "End tour" "button"
Then "input[aria-describedby^='tour-step-tool_usertours'],button[aria-describedby^='tour-step-tool_usertours']" "css_element" should not exist
And "input[tabindex],button[tabindex]" "css_element" should not exist
And "input[tabindex]:not([tabindex='0']),button[tabindex]:not([tabindex='0'])" "css_element" should not exist
12 changes: 6 additions & 6 deletions badges/tests/behat/backpack.feature
Expand Up @@ -140,7 +140,7 @@ Feature: Backpack badges
And I click on "Delete" "button" in the "Delete site backpack" "dialogue"
Then I should see "The site backpack has been deleted."
And I should not see "https://dc.imsglobal.org"
And "Delete" "button" should not exist
And "Delete" "button" should not be visible

@javascript
Scenario: Move up and down site backpack
Expand All @@ -166,27 +166,27 @@ Feature: Backpack badges
And I set the field "backpackapiurl" to "http://backpackapiurl.cat"
And I set the field "backpackweburl" to "http://backpackweburl.cat"
And I set the field "apiversion" to "2.1"
Then "Include authentication details with the backpack" "checkbox" should not exist
Then "Include authentication details with the backpack" "checkbox" should not be visible
And I should not see "Badge issuer email address"
And I should not see "Badge issuer password"
And I set the field "apiversion" to "1"
And "Include authentication details with the backpack" "checkbox" should exist
And "Include authentication details with the backpack" "checkbox" should be visible
And I click on "includeauthdetails" "checkbox"
And I should see "Badge issuer email address"
And I should not see "Badge issuer password"
And I set the field "apiversion" to "2"
And "Include authentication details with the backpack" "checkbox" should exist
And "Include authentication details with the backpack" "checkbox" should be visible
And I should see "Badge issuer email address"
And I should see "Badge issuer password"
And I set the field "backpackemail" to "test@test.com"
And I set the field "password" to "123456"
And I press "Save changes"
And I click on "Edit" "link" in the "http://backpackweburl.cat" "table_row"
And "input[name=includeauthdetails][type=checkbox][value=1]" "css_element" should exist
And the field "Include authentication details with the backpack" matches value "1"
And I click on "includeauthdetails" "checkbox"
And I press "Save changes"
And I click on "Edit" "link" in the "http://backpackweburl.cat" "table_row"
And "input[name=includeauthdetails][type=checkbox][value=1]" "css_element" should not exist
And the field "Include authentication details with the backpack" matches value "0"
And I click on "includeauthdetails" "checkbox"
And I should not see "test@test.com"
And I log out
Expand Down
Expand Up @@ -44,4 +44,4 @@ Feature: Manage H5P content from the content bank
And I expand "Site pages" node
And I click on "Content bank" "link"
When I follow "filltheblanks.h5p"
Then "region-main-settings-menu" "region" should not exist
Then "Rename" "link" should not exist in the "region-main-settings-menu" "region"
Expand Up @@ -43,25 +43,25 @@ Feature: Replace H5P file from an existing content requires special capabilities

Scenario: Teacher cannot replace another user's H5P files
When I click on "admincontent" "link"
Then "region-main-settings-menu" "region" should not exist
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"

Scenario: Teacher cannot replace a content without having upload capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:upload | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
Then "region-main-settings-menu" "region" should not exist
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"

Scenario: Teacher cannot replace a content without having the H5P upload capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| contenttype/h5p:upload | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
Then "region-main-settings-menu" "region" should not exist
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"

Scenario: Teacher cannot replace a content without having the manage own content capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:manageowncontent | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
Then "region-main-settings-menu" "region" should not exist
Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
2 changes: 1 addition & 1 deletion contentbank/tests/behat/delete_content.feature
Expand Up @@ -60,7 +60,7 @@ Feature: Delete H5P file from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "content2delete.h5p"
And I follow "content2delete.h5p"
Then ".header-actions-container" "css_element" should not exist
Then "Delete" "link" should not exist in the "region-main-settings-menu" "region"
And I click on "Content bank" "link"
And I click on "Upload" "link"
And I click on "Choose a file..." "button"
Expand Down
16 changes: 11 additions & 5 deletions contentbank/tests/behat/search_content.feature
Expand Up @@ -24,16 +24,18 @@ Feature: Search content in the content bank
And I expand "Site pages" node
And I click on "Content bank" "link"
And I should see "santjordi.h5p"
And "Clear search input" "button" should not exist
And "Clear search input" "button" should not be visible
And I should not see "items found"
When I set the field "Search" to "book"
Then "Clear search input" "button" should exist
# Waiting for the animation to show the button to finish.
And I wait "1" seconds
Then "Clear search input" "button" should be visible
And I should see "3 items found"
And I should see "SantJordi_book"
And I should see "mathsbook.h5p"
And I should see "historybook.h5p"
And I set the field "Search" to "sant"
And "Clear search input" "button" should exist
And "Clear search input" "button" should be visible
And I should see "5 items found"
And I set the field "Search" to "santjordi"
And I should see "4 items found"
Expand All @@ -42,10 +44,14 @@ Feature: Search content in the content bank
And I should see "SantJordi_book"
And I should see "Dragon_santjordi.h5p"
And I click on "Clear search input" "button"
And "Clear search input" "button" should not exist
# Waiting for the animation to hide the button to finish.
And I wait "1" seconds
And "Clear search input" "button" should not be visible
And I should not see "items found"
And I set the field "Search" to ".h5p"
And "Clear search input" "button" should exist
# Waiting for the animation to show the button to finish.
And I wait "1" seconds
And "Clear search input" "button" should be visible
And I should see "7 items found"
And I set the field "Search" to "friend"
And I should see "0 items found"
16 changes: 9 additions & 7 deletions course/tests/behat/activity_chooser.feature
Expand Up @@ -51,8 +51,8 @@ Feature: Display and choose from the available activities in course
And I should see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "help" "core_course > Activity chooser screen"
And I should see "Back" in the "help" "core_course > Activity chooser screen"
When I click on "Back" "button" in the "help" "core_course > Activity chooser screen"
Then "modules" "core_course > Activity chooser screen" should exist
And "help" "core_course > Activity chooser screen" should not exist
Then "modules" "core_course > Activity chooser screen" should be visible
And "help" "core_course > Activity chooser screen" should not be visible
And "Back" "button" should not exist in the "modules" "core_course > Activity chooser screen"
And I should not see "The assignment activity module enables a teacher to communicate tasks, collect work and provide grades and feedback." in the "Add an activity or resource" "dialogue"

Expand Down Expand Up @@ -123,32 +123,34 @@ Feature: Display and choose from the available activities in course
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
When I set the field "search" to ""
And I should not see "1 results found" in the "Add an activity or resource" "dialogue"
Then ".searchresultscontainer" "css_element" should not exist
Then ".searchresultscontainer" "css_element" should not be visible
And ".optionscontainer" "css_element" should exist

Scenario: Teacher can not see a "clear" button if a search query is not entered in the activity chooser search bar
When I click on "Add an activity or resource" "button" in the "Topic 1" "section"
Then "Clear search input" "button" should not exist
Then "Clear search input" "button" should not be visible

Scenario: Teacher can see a "clear" button after entering a search query in the activity chooser search bar
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
When I set the field "search" to "Search query"
Then "Clear search input" "button" should not exist
Then "Clear search input" "button" should not be visible

Scenario: Teacher can not see a "clear" button if the search query is removed in the activity chooser search bar
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
And I set the field "search" to "Search query"
And "Clear search input" "button" should exist
When I set the field "search" to ""
Then "Clear search input" "button" should not exist
# Waiting for the animation to hide the button to finish.
And I wait "1" seconds
Then "Clear search input" "button" should not be visible

Scenario: Teacher can instantly remove the search query from the activity search bar by clicking on the "clear" button
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
And I set the field "search" to "Search query"
And I should see "results found" in the "Add an activity or resource" "dialogue"
When I click on "Clear search input" "button"
Then I should not see "Search query"
And ".searchresultscontainer" "css_element" should not exist
And ".searchresultscontainer" "css_element" should not be visible
And ".optionscontainer" "css_element" should exist

Scenario: Teacher gets the base case for the Activity Chooser tab mode
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/behat/behat_general.php
Expand Up @@ -1000,7 +1000,7 @@ public function should_not_exist($element, $selectortype) {
// Using the spin method as we want a reduced timeout but there is no need for a 0.1 seconds interval
// because in the optimistic case we will timeout.
// If all goes good it will throw an ElementNotFoundExceptionn that we will catch.
return $this->find($selectortype, $element, $exception, false, behat_base::get_reduced_timeout());
$this->find($selectortype, $element, $exception, false, behat_base::get_reduced_timeout());
} catch (ElementNotFoundException $e) {
// We expect the element to not be found.
return;
Expand Down

0 comments on commit 90db228

Please sign in to comment.