Skip to content

Commit

Permalink
Merge pull request #106 from owncloud/test-refresh-button
Browse files Browse the repository at this point in the history
adding test for refresh button
  • Loading branch information
individual-it authored Apr 24, 2024
2 parents a956484 + f3e0927 commit e0d61a9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
19 changes: 16 additions & 3 deletions tests/behat/behat_repository_ocis.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function i_log_in_to_ocis(string $user) {

/**
* Upload a file to oCIS
* @Given user :user has uploaded a file inside space :space with content :content to :file
* @Given /^user "([^"]*)" (?:uploads|has uploaded) a file inside space "([^"]*)" with content "([^"]*)" to "([^"]*)"$/
*
* @param string $user
* @param string $space
Expand Down Expand Up @@ -279,7 +279,7 @@ public function get_visibility_setting_selector(string $drive): string {

/**
* Create a project space
* @Given :user has created the project space :space
* @Given /^"([^"]*)" (?:creates|has created) the project space "([^"]*)"$/
*
* @param string $user
* @param string $space
Expand Down Expand Up @@ -346,7 +346,7 @@ public function user_has_been_created_with_default_attributes(string $user) {

/**
* Send a share invitation
* @Given user :user has sent the following share invitation:
* @Given /^user "([^"]*)" (?:sends|has sent) the following share invitation:$/
* @param string $user
* @param TableNode $table
*
Expand All @@ -366,4 +366,17 @@ public function user_has_sent_the_following_share_invitation(string $user, Table
. json_decode($response['body'], true)['error']['message']);
}
}

/**
* Check if refreshing file picker shows the latest changes of oCIS server
* @Then I should see :arg1 after refreshing the file-picker
*
* @param string $text
* @return void
*/
public function i_should_see_after_refreshing_the_file_picker(string $text) {
$refreshbutton = $this->get_selected_node('css_element', '.fp-tb-refresh.enabled');
$refreshbutton->click();
$this->execute('behat_general::assert_page_contains_text', [$text]);
}
}
29 changes: 28 additions & 1 deletion tests/behat/uploadFileToMoodle.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: upload the resource in oCIS to moodle
And I log in to ocis as "admin"

Scenario: upload a file from the personal drive of ocis to moodle
And user "admin" has uploaded a file inside space "Personal" with content "some content" to "/testfile.txt"
Given user "admin" has uploaded a file inside space "Personal" with content "some content" to "/testfile.txt"
When I click on "//*[@class='fp-filename-field']/p[text()='Personal']" "xpath_element"
And I click on "//*[@class='fp-filename-field']/p[text()='testfile.txt']" "xpath_element"
And I click on "Select this file" "button"
Expand All @@ -43,3 +43,30 @@ Feature: upload the resource in oCIS to moodle
And I click on "//*[@class='fp-filename-field']/p[text()='testfile.txt']" "xpath_element"
And I click on "Select this file" "button"
Then I should see "testfile.txt"

Scenario: click refresh button to get latest resource on Personal drive
Given I click on "Personal" "link"
When user "admin" uploads a file inside space "Personal" with content "some content" to "testfile.txt"
Then I should not see "testfile.txt"
But I should see "testfile.txt" after refreshing the file-picker

Scenario: click refresh button to get latest resource on Project drive
When "admin" creates the project space "ProjectMoodle"
Then I should not see "ProjectMoodle"
But I should see "ProjectMoodle" after refreshing the file-picker
When I click on "ProjectMoodle" "link"
And user "admin" uploads a file inside space "ProjectMoodle" with content "some content" to "testfile.txt"
Then I should not see "testfile.txt"
But I should see "testfile.txt" after refreshing the file-picker

Scenario: click refresh button to get latest resource of Share drive
Given I click on "Shares" "link"
And user "Brian" has been created with default attributes
And user "Brian" has uploaded a file inside space "Personal" with content "some content" to "/testfile.txt"
When user "Brian" sends the following share invitation:
| resource | testfile.txt |
| space | Personal |
| sharee | Admin |
| shareType | user |
Then I should not see "testfile.txt"
But I should see "testfile.txt" after refreshing the file-picker

0 comments on commit e0d61a9

Please sign in to comment.