Skip to content

Commit

Permalink
MDL-82373 contentbank: Pause in Behat before interacting with h5p
Browse files Browse the repository at this point in the history
It seems that the loading of the h5p content upsets other interactions
with the page in Firefox as it loads. Unfortunately I haven't found a
reliable way to handle this with pendingJS yet.

This is the poor man's fix and we should find a better solution.
  • Loading branch information
andrewnicols committed Jul 17, 2024
1 parent 9251a72 commit 0b364ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
35 changes: 14 additions & 21 deletions contentbank/tests/behat/delete_content.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@ Feature: Delete H5P file from the content bank
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
And I am on site homepage
And I turn editing mode on
And the following config values are set as admin:
| unaddableblocks | | theme_boost|
And I add the "Navigation" block if not present
And I configure the "Navigation" block
And I set the following fields to these values:
| Page contexts | Display throughout the entire site |
And I press "Save changes"
And I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I am on the "Content bank" page
And I click on "Upload" "link"
And I click on "Choose a file..." "button"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
Expand All @@ -32,14 +22,16 @@ Feature: Delete H5P file from the content bank
And I click on "Save changes" "button"

Scenario: Admins can delete content from the content bank
Given I click on "More" "button"
Given I wait "2" seconds
And I click on "More" "button"
And I should see "Delete"
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
And I click on "Delete" "link"
And I should see "Are you sure you want to delete the content 'content2delete.h5p'"
And I should not see "The content will only be deleted from the content bank"
And I click on "Cancel" "button" in the "Delete content" "dialogue"
Then I should see "content2delete.h5p"
And I click on "More" "button"
And I wait "2" seconds
And I click on "More" "button"
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
And I click on "Delete" "button" in the "Delete content" "dialogue"
And I wait until the page is ready
Expand All @@ -61,20 +53,21 @@ Feature: Delete H5P file from the content bank
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/find-the-words.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
When I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
When I am on the "Content bank" page
And I should see "content2delete.h5p"
And I follow "content2delete.h5p"
And I wait "2" seconds
And I click on "More" "button"
Then I should not see "Delete"
And I click on "Content bank" "link"
And I am on the "Content bank" page
And I click on "Upload" "link"
And I click on "Choose a file..." "button"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
And I click on "find-the-words.h5p" "link"
And I click on "Select this file" "button"
And I click on "Save changes" "button"
And I click on "More" "button"
And I wait "2" seconds
And I click on "More" "button"
And I should see "Delete"

Scenario: The number of times a content is used is displayed before removing it
Expand All @@ -86,10 +79,10 @@ Feature: Delete H5P file from the content bank
And I click on "Link to the file" "radio"
And I click on "Select this file" "button"
And I click on "Save changes" "button"
When I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I am on the "Content bank" page
And I follow "content2delete.h5p"
And I click on "More" "button"
And I wait "2" seconds
And I click on "More" "button"
And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
Then I should see "Are you sure you want to delete the content 'content2delete.h5p'"
And I should see "The content will only be deleted from the content bank"
Expand Down
3 changes: 3 additions & 0 deletions lib/tests/behat/behat_navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ protected function resolve_core_page_url(string $name): moodle_url {
case 'Admin notifications':
return new moodle_url('/admin/');

case 'Content bank':
return new moodle_url('/contentbank/');

case 'My private files':
return new moodle_url('/user/files.php');

Expand Down

0 comments on commit 0b364ed

Please sign in to comment.