fix issue/10059
This commit is contained in:
@@ -513,17 +513,41 @@ class NotificationContext implements Context {
|
|||||||
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
$this->assertEmailContains($user, $expectedEmailBodyContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then user :user should have received the following email from user :sender ignoring whitespaces
|
||||||
|
*
|
||||||
|
* @param string $user
|
||||||
|
* @param string $sender
|
||||||
|
* @param PyStringNode $content
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function userShouldHaveReceivedTheFollowingEmailFromUserIgnoringWhitespaces(string $user, string $sender, PyStringNode $content):void {
|
||||||
|
$rawExpectedEmailBodyContent = \str_replace("\r\n", "\n", $content->getRaw());
|
||||||
|
$expectedEmailBodyContent = $this->featureContext->substituteInLineCodes(
|
||||||
|
$rawExpectedEmailBodyContent,
|
||||||
|
$sender
|
||||||
|
);
|
||||||
|
$this->assertEmailContains($user, $expectedEmailBodyContent, true);
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $expectedEmailBodyContent
|
* @param string $expectedEmailBodyContent
|
||||||
|
* @param bool $ignoreWhiteSpace
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function assertEmailContains(string $user, string $expectedEmailBodyContent):void {
|
public function assertEmailContains(string $user, string $expectedEmailBodyContent, $ignoreWhiteSpace = false):void {
|
||||||
$address = $this->featureContext->getEmailAddressForUser($user);
|
$address = $this->featureContext->getEmailAddressForUser($user);
|
||||||
$this->featureContext->pushEmailRecipientAsMailBox($address);
|
$this->featureContext->pushEmailRecipientAsMailBox($address);
|
||||||
$actualEmailBodyContent = EmailHelper::getBodyOfLastEmail($address, $this->featureContext->getStepLineRef());
|
$actualEmailBodyContent = EmailHelper::getBodyOfLastEmail($address, $this->featureContext->getStepLineRef());
|
||||||
|
if ($ignoreWhiteSpace) {
|
||||||
|
$expectedEmailBodyContent = preg_replace('/\s+/', '', $expectedEmailBodyContent);
|
||||||
|
$actualEmailBodyContent = preg_replace('/\s+/', '', $actualEmailBodyContent);
|
||||||
|
}
|
||||||
Assert::assertStringContainsString(
|
Assert::assertStringContainsString(
|
||||||
$expectedEmailBodyContent,
|
$expectedEmailBodyContent,
|
||||||
$actualEmailBodyContent,
|
$actualEmailBodyContent,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ use TestHelpers\WebDavHelper;
|
|||||||
*/
|
*/
|
||||||
class OcmContext implements Context {
|
class OcmContext implements Context {
|
||||||
private FeatureContext $featureContext;
|
private FeatureContext $featureContext;
|
||||||
|
private NotificationContext $notificationContext;
|
||||||
private string $invitationToken;
|
private string $invitationToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +53,18 @@ class OcmContext implements Context {
|
|||||||
$environment = $scope->getEnvironment();
|
$environment = $scope->getEnvironment();
|
||||||
// Get all the contexts you need in this context from here
|
// Get all the contexts you need in this context from here
|
||||||
$this->featureContext = $environment->getContext('FeatureContext');
|
$this->featureContext = $environment->getContext('FeatureContext');
|
||||||
|
$this->notificationContext = $environment->getContext('NotificationContext');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all the inbucket emails
|
||||||
|
*
|
||||||
|
* @AfterScenario @email
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function clearInbucketMessages():void {
|
||||||
|
$this->notificationContext->clearInbucketMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ default:
|
|||||||
- SettingsContext:
|
- SettingsContext:
|
||||||
- OcisConfigContext:
|
- OcisConfigContext:
|
||||||
- SharingNgContext:
|
- SharingNgContext:
|
||||||
|
- OcmContext:
|
||||||
|
|
||||||
apiAntivirus:
|
apiAntivirus:
|
||||||
paths:
|
paths:
|
||||||
|
|||||||
@@ -134,17 +134,17 @@ Feature: create invitation
|
|||||||
| @domain.com | 400 |
|
| @domain.com | 400 |
|
||||||
| user@domain..com | 400 |
|
| user@domain..com | 400 |
|
||||||
|
|
||||||
@email @skip
|
@email @issue-10059
|
||||||
Scenario: federated user gets an email notification if their email was specified when creating the federation share invitation
|
Scenario: federated user gets an email notification if their email was specified when creating the federation share invitation
|
||||||
Given using server "LOCAL"
|
Given using server "LOCAL"
|
||||||
When "Alice" has created the federation share invitation with email "brian@example.com" and description "a share invitation from Alice"
|
When "Alice" has created the federation share invitation with email "brian@example.com" and description "a share invitation from Alice"
|
||||||
And user "Brian" should have received the following email from user "Alice"
|
And user "Brian" should have received the following email from user "Alice" ignoring whitespaces
|
||||||
"""
|
"""
|
||||||
Hi,
|
Hi,
|
||||||
|
|
||||||
Alice Hansen (alice@example.org) wants to start sharing collaboration resources with you.
|
Alice Hansen (alice@example.org) wants to start sharing collaboration resources with you.
|
||||||
|
|
||||||
Please visit your federation provider and use the following details:
|
Please visit your federation settings and use the following details:
|
||||||
Token: %fed_invitation_token%
|
Token: %fed_invitation_token%
|
||||||
ProviderDomain: https://ocis-server:9200
|
ProviderDomain: https://ocis-server:9200
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user