Skip to content

Commit 357b63a

Browse files
committed
test: removed the flaky step
1 parent bc332e0 commit 357b63a

File tree

3 files changed

+19
-89
lines changed

3 files changed

+19
-89
lines changed

tests/acceptance/bootstrap/SettingsContext.php

+15-41
Original file line numberDiff line numberDiff line change
@@ -668,53 +668,27 @@ public function userSetsTheEmailSendingIntervalToUsingTheSettingsAPI(
668668
}
669669

670670
/**
671-
* @Given /^user "([^"]*)" has (disabled|enabled) notification for the following events:$/
671+
* @Given /^user "([^"]*)" has set the email sending interval to "([^"]*)" using the settings API$/
672672
*
673673
* @param string $user
674-
* @param string $enabledOrDisabled
675-
* @param TableNode $table
674+
* @param string $interval
676675
*
677676
* @return void
678-
* @throws GuzzleException|JsonException
679-
* @throws Exception
677+
* @throws Exception|GuzzleException
680678
*/
681-
public function userHasDisabledOrEnabledNotificationForFollowingEventUsingSettingsApi(
679+
public function userHasSetTheEmailSendingIntervalToUsingTheSettingsAPI(
682680
string $user,
683-
string $enabledOrDisabled,
684-
TableNode $table
681+
string $interval,
685682
): void {
686-
$settings = $table->getRowsHash();
687-
Assert::assertCount(1, $settings, "only 1 event should be provided");
688-
foreach ($settings as $event => $value) {
689-
$body = $this->getBodyForNotificationSetting($user, $event);
690-
if (str_contains($value, "mail")) {
691-
$body["value"]["collectionValue"]["values"][]
692-
= ["key" => "mail","boolValue" => $enabledOrDisabled === "enabled"];
693-
}
694-
if (str_contains($value, "in-app")) {
695-
$body["value"]["collectionValue"]["values"][]
696-
= ["key" => "in-app","boolValue" => $enabledOrDisabled === "enabled"];
697-
}
698-
if (str_contains($value, "instant")) {
699-
$body["value"]["stringValue"]
700-
= "instant";
701-
}
702-
if (str_contains($value, "daily")) {
703-
$body["value"]["stringValue"]
704-
= "daily";
705-
}
706-
if (str_contains($value, "weekly")) {
707-
$body["value"]["stringValue"]
708-
= "weekly";
709-
}
710-
$response = SettingsHelper::updateSettings(
711-
$this->featureContext->getBaseUrl(),
712-
$this->featureContext->getActualUsername($user),
713-
$this->featureContext->getPasswordForUser($user),
714-
json_encode($body),
715-
$this->featureContext->getStepLineRef(),
716-
);
717-
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
718-
}
683+
$body = $this->getBodyForNotificationSetting($user, "Email sending interval");
684+
$body["value"]["stringValue"] = $interval;
685+
$response = SettingsHelper::updateSettings(
686+
$this->featureContext->getBaseUrl(),
687+
$this->featureContext->getActualUsername($user),
688+
$this->featureContext->getPasswordForUser($user),
689+
json_encode($body),
690+
$this->featureContext->getStepLineRef(),
691+
);
692+
$this->featureContext->theHTTPStatusCodeShouldBe(201, "", $response);
719693
}
720694
}

tests/acceptance/bootstrap/SpacesContext.php

-39
Original file line numberDiff line numberDiff line change
@@ -4762,45 +4762,6 @@ public function userGetsTheDriveItemInSpace(string $user, string $file, string $
47624762
);
47634763
}
47644764

4765-
/**
4766-
* @Given user :user has expired the last share of resource :resource inside of the space :spaceName
4767-
*
4768-
* @param string $user
4769-
* @param string $resource
4770-
* @param string $spaceName
4771-
*
4772-
* @return void
4773-
* @throws GuzzleException|JsonException
4774-
*/
4775-
public function userHasExpiredTheLastShareOfResourceInsideOfTheSpace(
4776-
string $user,
4777-
string $resource,
4778-
string $spaceName
4779-
): void {
4780-
$dateTime = new DateTime('yesterday');
4781-
$rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP');
4782-
if ($this->featureContext->isUsingSharingNG()) {
4783-
$space = $this->getSpaceByName($user, $spaceName);
4784-
$itemId = $this->getResourceId($user, $spaceName, $resource);
4785-
$body['expirationDateTime'] = $rows['expireDate'];
4786-
$permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
4787-
$response = GraphHelper::updateShare(
4788-
$this->featureContext->getBaseUrl(),
4789-
$this->featureContext->getStepLineRef(),
4790-
$user,
4791-
$this->featureContext->getPasswordForUser($user),
4792-
$space["id"],
4793-
$itemId,
4794-
\json_encode($body),
4795-
$permissionID
4796-
);
4797-
} else {
4798-
$rows['permissions'] = (string)$this->featureContext->getLastCreatedUserGroupShare()->permissions;
4799-
$response = $this->updateSharedResource($user, $rows);
4800-
}
4801-
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
4802-
}
4803-
48044765
/**
48054766
* @Given /^user "([^"]*)" has updated the space "([^"]*)" with settings:$/
48064767
*

tests/acceptance/features/cliCommands/emailNotification.feature

+4-9
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ Feature: get email notification via CLI command
1010
| Brian |
1111
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
1212
And user "Alice" has created a space "share space" with the default quota using the Graph API
13-
And user "Alice" has created folder "FolderToShare"
1413
And user "Alice" has uploaded file with content "some data" to "lorem.txt"
1514

1615

17-
Scenario: get daily grouped email notification via CLI command
18-
Given user "Brian" has enabled notification for the following events:
19-
| Email sending interval | daily |
16+
Scenario: get daily grouped email notification
17+
Given user "Brian" has set the email sending interval to "daily" using the settings API
2018
And user "Alice" has sent the following resource share invitation:
2119
| resource | lorem.txt |
2220
| space | Personal |
@@ -31,7 +29,6 @@ Feature: get email notification via CLI command
3129
| shareType | user |
3230
| permissionsRole | Viewer |
3331
| expirationDateTime | 2042-01-01T23:59:59.000Z |
34-
And user "Alice" has expired the last share of resource "lorem.txt" inside of the space "Personal"
3532
And user "Alice" has sent the following space share invitation:
3633
| space | share space |
3734
| sharee | Brian |
@@ -82,9 +79,8 @@ Feature: get email notification via CLI command
8279
"""
8380

8481

85-
Scenario: get weekly grouped email notification via CLI command
86-
Given user "Brian" has enabled notification for the following events:
87-
| Email sending interval | weekly |
82+
Scenario: get weekly grouped email notification
83+
Given user "Brian" has set the email sending interval to "weekly" using the settings API
8884
And user "Alice" has sent the following resource share invitation:
8985
| resource | lorem.txt |
9086
| space | Personal |
@@ -99,7 +95,6 @@ Feature: get email notification via CLI command
9995
| shareType | user |
10096
| permissionsRole | Viewer |
10197
| expirationDateTime | 2042-01-01T23:59:59.000Z |
102-
And user "Alice" has expired the last share of resource "lorem.txt" inside of the space "Personal"
10398
And user "Alice" has sent the following space share invitation:
10499
| space | share space |
105100
| sharee | Brian |

0 commit comments

Comments
 (0)