From 5d42d8ee0fa693228cf80e6caa31578557a0d0e2 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Thu, 28 Nov 2024 15:54:56 +0545 Subject: [PATCH] test: remove duplicate steps --- .../acceptance/bootstrap/SharingNgContext.php | 30 ------------------- .../shareInvitations.feature | 24 +++++---------- 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 8d49ba395..1889e8a3a 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -1138,36 +1138,6 @@ class SharingNgContext implements Context { ); } - /** - * @Then /^for user "([^"]*)" the space Shares should (not|)\s?contain these (files|entries):$/ - * - * @param string $user - * @param string $shouldOrNot - * @param TableNode $table - * - * @return void - * @throws Exception - */ - public function forUserTheSpaceSharesShouldContainTheseEntries(string $user, string $shouldOrNot, TableNode $table): void { - $should = $shouldOrNot !== 'not'; - $rows = $table->getRows(); - $response = GraphHelper::getSharesSharedWithMe( - $this->featureContext->getBaseUrl(), - $this->featureContext->getStepLineRef(), - $user, - $this->featureContext->getPasswordForUser($user) - ); - $contents = \json_decode($response->getBody()->getContents(), true); - - $fileFound = empty(array_diff(array_map(fn ($row) => trim($row[0], '/'), $rows), array_column($contents['value'], 'name'))); - - $assertMessage = $should - ? "Response does not contain the entry." - : "Response does contain the entry but should not."; - - Assert::assertSame($should, $fileFound, $assertMessage); - } - /** * @Given user :user has disabled sync of last shared resource * diff --git a/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature b/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature index 7c6379e52..6cd16962b 100644 --- a/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNgShareInvitation/shareInvitations.feature @@ -22,8 +22,7 @@ Feature: Send a sharing invitations | shareType | user | | permissionsRole | | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | | + And user "Brian" should have a share "" shared by user "Alice" And the JSON data of the response should match """ { @@ -112,8 +111,7 @@ Feature: Send a sharing invitations | shareType | group | | permissionsRole | | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | | + And user "Brian" should have a share "" shared by user "Alice" And for user "Carol" the space Shares should contain these entries: | | And the JSON data of the response should match @@ -1994,8 +1992,7 @@ Feature: Send a sharing invitations | shareType | user | | permissionsRole | | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | | + And user "Brian" should have a share "" shared by user "Alice" And the JSON data of the response should match """ { @@ -2082,8 +2079,7 @@ Feature: Send a sharing invitations | shareType | group | | permissionsRole | | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | | + And user "Brian" should have a share "" shared by user "Alice" And for user "Carol" the space Shares should contain these entries: | | And the JSON data of the response should match @@ -3119,8 +3115,7 @@ Feature: Send a sharing invitations | shareType | user | | permissionsRole | Viewer | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | textfile.txt | + And user "Brian" should have a share "" shared by user "Alice" When user "Alice" sends the following resource share invitation using the Graph API: | resource | textfile.txt | | space | Personal | @@ -3145,8 +3140,7 @@ Feature: Send a sharing invitations | shareType | group | | permissionsRole | Viewer | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | textfile.txt | + And user "Brian" should have a share "textfile.txt" shared by user "Alice" Scenario: share a file to user and group having same name (Project space) @@ -3166,8 +3160,7 @@ Feature: Send a sharing invitations | shareType | user | | permissionsRole | Viewer | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | textfile.txt | + And user "Brian" should have a share "textfile.txt" shared by user "Alice" When user "Alice" sends the following resource share invitation using the Graph API: | resource | textfile.txt | | space | NewSpace | @@ -3195,5 +3188,4 @@ Feature: Send a sharing invitations | shareType | group | | permissionsRole | Viewer | Then the HTTP status code should be "200" - And for user "Brian" the space Shares should contain these entries: - | textfile.txt | + And user "Brian" should have a share "textfile.txt" shared by user "Alice"