Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci]Improve then steps usages inside acceptance tests suite apiTags #39921

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improved then step to suite apiTags
  • Loading branch information
SagarGi committed Mar 25, 2022
commit 702643a760445f49ea733931d0f0c6af4c2c6768
25 changes: 13 additions & 12 deletions tests/acceptance/features/apiTags/assignTags.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@api @systemtags-app-required @files_sharing-app-required @issue-ocis-reva-51
Feature: Assign tags to file/folder
As a user
I want to assign tags to the file/folder
So that I can organize the files/folders easily

Expand All @@ -25,8 +26,8 @@ Feature: Assign tags to file/folder
Given the administrator has created a "normal" tag with name "MyFirstTag"
And the administrator has created a "normal" tag with name "MySecondTag"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" owned by user "Alice" using the WebDAV API
And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt"
When user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" owned by user "Alice" using the WebDAV API
Then the HTTP status code should be "404"
And file "/myFileToTag.txt" owned by user "Alice" should have the following tags
| name | type |
Expand All @@ -38,8 +39,8 @@ Feature: Assign tags to file/folder
And the administrator has created a "not user-assignable" tag with name "MySecondTag"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
And user "Alice" has shared file "/myFileToTag.txt" with user "Brian"
When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt"
When user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
Then the HTTP status code should be "403"
And file "/myFileToTag.txt" shared by user "Alice" should have the following tags
| name | type |
Expand Down Expand Up @@ -77,8 +78,8 @@ Feature: Assign tags to file/folder
And the administrator has created a "not user-visible" tag with name "MySecondTag"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
And user "Alice" has shared file "/myFileToTag.txt" with user "Brian"
When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt"
When user "Brian" adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
Then the HTTP status code should be "412"
And file "/myFileToTag.txt" shared by user "Alice" should have the following tags
| name | type |
Expand All @@ -92,8 +93,8 @@ Feature: Assign tags to file/folder
And the administrator has created a "static" tag with name "StaticTag" and groups "hash#group"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
And user "Alice" has shared file "/myFileToTag.txt" with user "Brian"
When user "Alice" adds tag "NormalTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Brian" adds tag "StaticTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Alice" has added tag "NormalTag" to file "/myFileToTag.txt"
When user "Brian" adds tag "StaticTag" to file "/myFileToTag.txt" using the WebDAV API
Then the HTTP status code should be "403"
And file "/myFileToTag.txt" shared by user "Alice" should have the following tags
| name | type |
Expand All @@ -105,8 +106,8 @@ Feature: Assign tags to file/folder
And the administrator has created a "not user-visible" tag with name "MySecondTag"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
And user "Alice" has shared file "/myFileToTag.txt" with the administrator
When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API
And the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt"
When the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
Then the HTTP status code should be "201"
And file "/myFileToTag.txt" should have the following tags for the administrator
| name | type |
Expand All @@ -122,8 +123,8 @@ Feature: Assign tags to file/folder
And the administrator has created a "not user-assignable" tag with name "MySecondTag"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
And user "Alice" has shared file "/myFileToTag.txt" with the administrator
When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API
And the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt"
When the administrator adds tag "MySecondTag" to file "/myFileToTag.txt" using the WebDAV API
Then the HTTP status code should be "201"
And file "/myFileToTag.txt" should have the following tags for the administrator
| name | type |
Expand Down
5 changes: 3 additions & 2 deletions tests/acceptance/features/apiTags/assignTagsGroup.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@api @systemtags-app-required @issue-ocis-reva-51
Feature: Title of your feature
I want to use this template for my feature file
Feature: Assign tag to groups
As a user
I should be able to assign tag to groups

Background:
Given user "Alice" has been created with default attributes and without skeleton files
Expand Down
22 changes: 11 additions & 11 deletions tests/acceptance/features/apiTags/createTags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,23 @@ Feature: Creation of tags


Scenario: Creating tags in lowercase and uppercase should work
When the administrator creates a "normal" tag with name "UppercaseTag" using the WebDAV API
Then the HTTP status code should be "201"
When the administrator creates a "normal" tag with name "lowercasetag" using the WebDAV API
Then the HTTP status code should be "201"
When the administrator creates the following tags using the WebDAV API
| name | type |
| UppercaseTag | normal |
| lowercasetag | normal |
Then the HTTP status code of responses on all endpoints should be "201"
And the following tags should exist for the administrator
| name | type |
| UppercaseTag | normal |
| lowercasetag | normal |


Scenario: Creating tags with the same name in lowercase and uppercase should work
When the administrator creates a "normal" tag with name "testtag" using the WebDAV API
Then the HTTP status code should be "201"
When the administrator creates a "normal" tag with name "Testtag" using the WebDAV API
Then the HTTP status code should be "201"
When the administrator creates a "normal" tag with name "TESTTAG" using the WebDAV API
Then the HTTP status code should be "201"
When the administrator creates the following tags using the WebDAV API
| name | type |
| testtag | normal |
| Testtag | normal |
| TESTTAG | normal |
Then the HTTP status code of responses on all endpoints should be "201"
And the following tags should exist for the administrator
| name | type |
| testtag | normal |
Expand Down
30 changes: 20 additions & 10 deletions tests/acceptance/features/apiTags/editTags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Editing the tags
Scenario Outline: Renaming a normal tag as regular user should work
Given the administrator has created a "normal" tag with name "<tag_name>"
When user "Alice" edits the tag with name "<tag_name>" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "207"
And the following tags should exist for the administrator
| name | type |
| AnotherTagName | normal |
Examples:
Expand All @@ -23,31 +24,35 @@ Feature: Editing the tags
Scenario: Renaming a not user-assignable tag as regular user should fail
Given the administrator has created a "not user-assignable" tag with name "JustARegularTagName"
When user "Alice" edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "403"
And the following tags should exist for the administrator
| name | type |
| JustARegularTagName | not user-assignable |

@skipOnOcV10.6 @skipOnOcV10.7
Scenario: Renaming a static tag as regular user should fail
Given the administrator has created a "static" tag with name "StaticTagName"
When user "Alice" edits the tag with name "StaticTagName" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "403"
And the following tags should exist for the administrator
| name | type |
| StaticTagName | static |

@skipOnOcV10.6 @skipOnOcV10.7
Scenario: Renaming a not user-visible tag as regular user should fail
Given the administrator has created a "not user-visible" tag with name "JustARegularTagName"
When user "Alice" edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "404"
And the following tags should exist for the administrator
| name | type |
| JustARegularTagName | not user-visible |

@skipOnOcV10.6 @skipOnOcV10.7
Scenario: Renaming a not user-assignable tag as administrator should work
Given the administrator has created a "not user-assignable" tag with name "JustARegularTagName"
When the administrator edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "207"
And the following tags should exist for the administrator
| name | type |
| AnotherTagName | not user-assignable |
And tag "JustARegularTagName" should not exist for the administrator
Expand All @@ -56,7 +61,8 @@ Feature: Editing the tags
Scenario: Renaming a not user-visible tag as administrator should work
Given the administrator has created a "not user-visible" tag with name "JustARegularTagName"
When the administrator edits the tag with name "JustARegularTagName" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "207"
And the following tags should exist for the administrator
| name | type |
| AnotherTagName | not user-visible |
And tag "JustARegularTagName" should not exist for the administrator
Expand All @@ -65,7 +71,8 @@ Feature: Editing the tags
Scenario: Renaming a static tag as administrator should work
Given the administrator has created a "static" tag with name "StaticTagName"
When the administrator edits the tag with name "StaticTagName" and sets its name to "AnotherTagName" using the WebDAV API
Then the following tags should exist for the administrator
Then the HTTP status code should be "207"
And the following tags should exist for the administrator
| name | type |
| AnotherTagName | static |
And tag "StaticTagName" should not exist for the administrator
Expand All @@ -74,16 +81,19 @@ Feature: Editing the tags
Scenario: Editing tag groups as admin should work
Given the administrator has created a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2"
When the administrator edits the tag with name "TagWithGroups" and sets its groups to "group1|group3" using the WebDAV API
Then the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group3"
Then the HTTP status code should be "207"
And the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group3"

@skipOnOcV10.6 @skipOnOcV10.7
Scenario: Editing static tag groups as admin should work
Given the administrator has created a "static" tag with name "StaticTagWithGroups" and groups "group1|group2"
When the administrator edits the tag with name "StaticTagWithGroups" and sets its groups to "group1|group3" using the WebDAV API
Then the "static" tag with name "StaticTagWithGroups" should have the groups "group1|group3"
Then the HTTP status code should be "207"
And the "static" tag with name "StaticTagWithGroups" should have the groups "group1|group3"

@skipOnOcV10.6 @skipOnOcV10.7
Scenario: Editing tag groups as regular user should fail
Given the administrator has created a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2"
When user "Alice" edits the tag with name "TagWithGroups" and sets its groups to "group1|group3" using the WebDAV API
Then the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group2"
Then the HTTP status code should be "403"
And the "not user-assignable" tag with name "TagWithGroups" should have the groups "group1|group2"
12 changes: 5 additions & 7 deletions tests/acceptance/features/apiTags/retreiveTags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ Feature: tags
Scenario: Getting tags only works with access to the file
Given the administrator has created a "normal" tag with name "MyFirstTag"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/myFileToTag.txt"
When user "Alice" adds tag "MyFirstTag" to file "/myFileToTag.txt" using the WebDAV API
Then file "/myFileToTag.txt" should have the following tags for user "Alice"
| name | type |
| MyFirstTag | normal |
And the HTTP status when user "Brian" requests tags for file "/myFileToTag.txt" owned by user "Alice" should be "404"
When user "Alice" gets the following properties of file "/myFileToTag.txt" using the WebDAV API
And user "Alice" has added tag "MyFirstTag" to file "/myFileToTag.txt"
When user "Brian" requests tags for file "/myFileToTag.txt" owned by user "Alice" using the WebDAV API
And user "Alice" gets the following properties of file "/myFileToTag.txt" using the WebDAV API
| propertyName |
| oc:tags |
Then the single response should contain a property "oc:tags" with value ""
Then the HTTP status code of responses on all endpoints should be "404"
And the single response should contain a property "oc:tags" with value ""

@files_sharing-app-required
Scenario: Static tags should be available while accessing the file if it is assigned to file
Expand Down
39 changes: 39 additions & 0 deletions tests/acceptance/features/bootstrap/TagsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,26 @@ public function theAdministratorCreatesATagWithName(string $type, string $name):
);
}

/**
* @When the administrator creates the following tags using the WebDAV API
*
* @param TableNode $table
*
* @return void
* @throws Exception
*/
public function theAdministratorCreatesFollowingTags(TableNode $table):void {
$this->featureContext->emptyLastHTTPStatusCodesArray();
$this->featureContext->verifyTableNodeColumns($table, ['name', 'type']);
foreach ($table->getHash() as $row) {
$this->createTagWithNameAsAdmin(
$row['type'],
$row['name']
);
$this->featureContext->pushToLastStatusCodesArrays();
}
}

/**
* @When /^the administrator creates a "([^"]*)" tag with name "([^"]*)" sending (true-false-strings|numbers) in the request using the WebDAV API$/
*
Expand Down Expand Up @@ -1517,6 +1537,25 @@ public function theHttpStatusWhenUserRequestsTagsForEntryOwnedByShouldBe(
);
}

/**
* @When /^user "([^"]*)" requests tags for (?:file|folder|entry) "([^"]*)" (?:shared|owned) by user "([^"]*)" using the WebDAV API$/
*
* @param string $user
* @param string $fileName
* @param string $sharingUser
*
* @return void
* @throws Exception
*/
public function whenUserRequestsTagsForEntryOwnedByAnotherUser(
string $user,
string $fileName,
string $sharingUser
):void {
$this->requestTagsForFile($user, $fileName, $sharingUser);
$this->featureContext->pushToLastStatusCodesArrays();
}

/**
* @Then /^(?:file|folder|entry) "([^"]*)" (?:shared|owned) by the (administrator|user) should have the following tags$/
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function userGetsPropertiesOfFolder(
$properties
)
);
$this->featureContext->pushToLastStatusCodesArrays();
}

/**
Expand Down