Skip to content

Commit

Permalink
adding test for refresh button
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajacharya2 committed Apr 24, 2024
1 parent a956484 commit 379c6c3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
15 changes: 14 additions & 1 deletion tests/behat/behat_repository_ocis.php
Original file line number Diff line number Diff line change
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 "([^"]*)" (has sent|sends) 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]);
}
}
31 changes: 30 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,32 @@ 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"
And user "admin" has uploaded a file inside space "Personal" with content "some content" to "testfile.txt"
And 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
Given "admin" has created the project space "ProjectMoodle"
And I should not see "ProjectMoodle"
When I refresh the file-picker
Then I should see "ProjectMoodle"
And I click on "ProjectMoodle" "link"
And user "admin" has uploaded a file inside space "ProjectMoodle" with content "some content" to "testfile.txt"
And 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 379c6c3

Please sign in to comment.