Add Behat tests for social group - refs #8089

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 4996a294b0
commit aabd8a29ef
  1. 43
      tests/features/bootstrap/FeatureContext.php
  2. 21
      tests/features/socialGroup.feature

@ -188,4 +188,47 @@ class FeatureContext extends MinkContext
new Given('the "language" field should contain "' . $argument . '"')
);
}
/**
* @Given /^I am logged as "([^"]*)"$/
*/
public function iAmLoggedAs($username)
{
return [
new Given('I am on "/index.php?logout=logout"'),
new Given('I am on homepage'),
new Given('I fill in "login" with "' . $username . '"'),
new Given('I fill in "password" with "' . $username . '"'),
new Given('I press "submitAuth"')
];
}
/**
* @Given /^I have a friend$/
*/
public function iHaveAFriend()
{
$adminId = 1;
$friendId = 11;
$friendUsername = 'fbaggins';
$sendInvitationURL = '/main/inc/ajax/message.ajax.php?' . http_build_query([
'a' => 'send_invitation',
'user_id' => $friendId,
'content' => 'Add me'
]);
$acceptInvitationURL = '/main/inc/ajax/social.ajax.php?' . http_build_query([
'a' => 'add_friend',
'friend_id' => $adminId,
'is_my_friend' => 'friend'
]);
return array(
new Given('I am a platform administrator'),
new Given('I am on "' . $sendInvitationURL . '"'),
new Given('I am logged as "' . $friendUsername . '"'),
new Given('I am on "' . $acceptInvitationURL . '"'),
new Given('I am a platform administrator')
);
}
}

@ -0,0 +1,21 @@
Feature: Social Group
In order to use the Social Network
As an administrator
I need to be able to create a social group, invite users and post a message
Scenario: Create a social group
Given I am a platform administrator
And I am on "/main/social/group_add.php"
When I fill in the following:
| name | Behat Test Group |
| description | This is a group created by Behat |
And I press "submit"
Then I should see "Group added"
Scenario: Invite a friend to group
Given I am a platform administrator
And I have a friend
And I am on "/main/social/group_invitation.php?id=1"
When I fill in "invitation[]" with "11"
And I press "submit"
Then I should see "Invitation sent"
Loading…
Cancel
Save