513 lines
21 KiB
C++
513 lines
21 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "tests/config.h"
|
|
#if defined(US_SDK_LIGHT_MOBILE)
|
|
#error This file shall not be part of the solution
|
|
#endif
|
|
#include "tests/fixture/authenticationFixture.h"
|
|
#include <ubiservices/core/types/typesId/storeOfferId.h>
|
|
#include <ubiservices/platformHelper.h>
|
|
#include <ubiservices/services/entity/entityClient.h>
|
|
#include <ubiservices/services/entity/entityCreation.h>
|
|
#include <ubiservices/services/friend/friendClient.h>
|
|
#include <ubiservices/services/friend/friendInfoClub.h>
|
|
#include <ubiservices/services/http/request/httpRequest.h>
|
|
#include <ubiservices/services/profile/profileClient.h>
|
|
#include <ubiservices/services/secondaryStore/offerSpace.h>
|
|
#include <ubiservices/services/secondaryStore/secondaryStoreClient.h>
|
|
#include <ubiservices/services/user/userClient.h>
|
|
#include <usCommon/authenticationHelper.h>
|
|
#if defined(US_TARGET_XONE)
|
|
#include <eh.h>
|
|
#include <ppltasks.h>
|
|
#elif defined(US_TARGET_PS4)
|
|
#include <../private/ubiservices/core/debug/systemChecker.h>
|
|
#include <web_browser_dialog.h>
|
|
#include <np_toolkit2.h>
|
|
#elif defined(US_TARGET_KILI)
|
|
#include <../private/ubiservices/core/debug/systemChecker.h>
|
|
#include <web_browser_dialog.h>
|
|
#endif
|
|
|
|
|
|
namespace US_NS {;
|
|
US_DEFINE_TEST(TestManualConsole);
|
|
|
|
typedef AuthenticationFixture<1> MANUAL_CONSOLE;
|
|
typedef AuthenticationFixture<1, false> MANUAL_CONSOLE_NO_LOGIN;
|
|
|
|
namespace TestManualConsole_BF
|
|
{
|
|
UserInfoCreation fillUserInfoCreation(const char* nameOnPlatform, const char* password = "a1234567")
|
|
{
|
|
UserInfoCreation userInfo;
|
|
|
|
userInfo.m_nameOnPlatform = nameOnPlatform;
|
|
|
|
userInfo.m_password = password;
|
|
userInfo.m_isPasswordGenerationRequested = userInfo.m_password.isEmpty();
|
|
userInfo.m_email = userInfo.m_nameOnPlatform + "@ubisoft.com";
|
|
userInfo.m_dateOfBirth = Date(1982, 2, 20);
|
|
userInfo.m_firstName = userInfo.m_nameOnPlatform;
|
|
userInfo.m_lastName = "ManualTest";
|
|
userInfo.m_gender = UserGender::Male;
|
|
|
|
return userInfo;
|
|
}
|
|
}
|
|
|
|
#if defined(US_ENABLE_UPLAY_LOGIN)
|
|
/// @important This test must be run with a non-linked account
|
|
#if defined(US_TARGET_OSX) || defined(US_TARGET_WINDOWS) || defined(US_TARGET_LINUX) || defined(US_TARGET_GGP)
|
|
TEST_F(MANUAL_CONSOLE_NO_LOGIN, DISABLED_HELPER_CreateUSerWithAutoGeneratedPassword)
|
|
#else
|
|
TEST_F(MANUAL_CONSOLE, DISABLED_HELPER_CreateUSerWithAutoGeneratedPassword)
|
|
#endif
|
|
{
|
|
UserClient& userClient = getFacade().getUserClient();
|
|
// Change this email to run the scenario.
|
|
// The email must change before each execution
|
|
// (the test attempts to create a non-existent user profile).
|
|
const UserInfoCreation userInfo = TestManualConsole_BF::fillUserInfoCreation("UbiSvcManAGP08", ""); // AGP : Auto Generated Password
|
|
EXPECT_TRUE(userInfo.m_password.isEmpty());
|
|
|
|
LegalOptInsKey key;
|
|
{
|
|
const AsyncResult<LegalOptIns> result = userClient.requestUserLegalOptIns("CA", "EN");
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(result));
|
|
key = result.getResult().m_key;
|
|
}
|
|
|
|
{
|
|
const AsyncResult<Vector<UserInfoError> > result = userClient.validateUserCreationData(userInfo, key);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(result));
|
|
ASSERT_EQ(0u, result.getResult().size());
|
|
}
|
|
|
|
{
|
|
const AsyncResult<Empty> result = userClient.createUser(userInfo, key);
|
|
#if defined(US_TARGET_OSX) || defined(US_TARGET_WINDOWS) || defined(US_TARGET_LINUX) || defined(US_TARGET_GGP)
|
|
// On PC and OSX, the login cannot be processed since the password is unknown
|
|
ASSERT_TRUE(AsyncHelper::waitFailure(result, Errors::USERS_UNABLE_TO_RENEW_CREDENTIALS));
|
|
#else
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(result));
|
|
#endif
|
|
}
|
|
|
|
#if !defined(US_TARGET_OSX) && !defined(US_TARGET_WINDOWS) && !defined(US_TARGET_LINUX) && !defined(US_TARGET_GGP)
|
|
// Just a test to check that operations needing to be logged in are actually working
|
|
{
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(getFacade().getFriendClient().requestFriends(FriendClient::ClubWithConsoleInfo)));
|
|
}
|
|
#endif
|
|
}
|
|
#endif // defined(US_ENABLE_UPLAY_LOGIN) || defined(US_TARGET_SWITCH)
|
|
|
|
// No point of running this on PC since the Club profile is used on that platform (no link needed)
|
|
#if !defined(US_TARGET_WINDOWS) && defined(US_ENABLE_UPLAY_LOGIN)
|
|
/// Links the current platform online player to the specified Club account.
|
|
/// @important This test must be run with a non-linked account
|
|
TEST_F(MANUAL_CONSOLE, DISABLED_HELPER_LinkUser)
|
|
{
|
|
ASSERT_FALSE(getFacade().getAuthenticationClient().getSessionInfo().hasUserAccountLinked());
|
|
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(getFacade().getUserClient().linkCurrentProfile("ubiSvcManCsl008@ubisoft.com", "a1234567")));
|
|
|
|
EXPECT_TRUE(getFacade().getAuthenticationClient().getSessionInfo().getUserId().isValid());
|
|
}
|
|
#endif
|
|
|
|
/// Invites the "test accounts"
|
|
TEST_F(MANUAL_CONSOLE, DISABLED_HELPER_SetupFriendship)
|
|
{
|
|
const Vector<String> invitedUsersNames =
|
|
{
|
|
"ussdk001",
|
|
"ussdk002",
|
|
"ussdk003",
|
|
"ussdk006"
|
|
};
|
|
|
|
ASSERT_TRUE(getFacade().getAuthenticationClient().getSessionInfo().hasUserAccountLinked());
|
|
|
|
const auto& resultUplayProfiles = getFacade().getProfileClient().requestUplayProfiles(invitedUsersNames);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(resultUplayProfiles));
|
|
|
|
const auto& profilesReceived = resultUplayProfiles.getResult();
|
|
ASSERT_EQ(invitedUsersNames.size(), profilesReceived.size());
|
|
|
|
for(const auto& profile : profilesReceived)
|
|
{
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(getFacade().getFriendClient().sendFriendsClubInvite({ profile.second.m_profileId })));
|
|
}
|
|
}
|
|
|
|
/// Invites the "test accounts"
|
|
TEST_F(MANUAL_CONSOLE, DISABLED_HELPER_SetupFriendshipBatch)
|
|
{
|
|
ASSERT_TRUE(getFacade().getAuthenticationClient().getSessionInfo().hasUserAccountLinked());
|
|
|
|
for(uint32 i = 1; i <= 128; ++i)
|
|
{
|
|
const String nameOnPlatform = String::formatText("%s%03i", String(_T("UbiSvc")).getUtf8(), i);
|
|
//const String email = userInfo.m_nameOnPlatform + _T("@ubisoft.com");
|
|
|
|
Vector<String> usernames;
|
|
usernames.push_back(nameOnPlatform);
|
|
|
|
const AsyncResult<Map<String, ProfileInfo> > result = getFacade().getProfileClient().requestUplayProfiles(usernames);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(result));
|
|
|
|
const Map<String, ProfileInfo>& profiles = result.getResult();
|
|
ASSERT_EQ(1u, profiles.size()); // Friend count
|
|
|
|
for(Map<String, ProfileInfo>::const_iterator it = profiles.begin(), end = profiles.end(); it != end; ++it)
|
|
{
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(getFacade().getFriendClient().sendFriendsClubInvite({ it->second.m_profileId })));
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Setup the inventory needed for running tests (for new test accounts only) on space Ubiservices SDK Generic PC
|
|
TEST_F(MANUAL_CONSOLE, DISABLED_HELPER_SetupSecondaryStoreInventoryUbiservicesSdkGenericPC)
|
|
{
|
|
const SpaceId spaceId(US_TEST_NS::SPACE_ID_US_SDK_GENERIC_PC);
|
|
|
|
const StoreOfferId offerId("6c716bd5-d871-406a-b0be-05b2491f0281"); // special offer containing all items needed
|
|
|
|
// needed items:
|
|
const StoreItemId scopeId("1147ff3f-647c-4747-8aab-ea085371d4b3");
|
|
const uint32 scopeQuantity(1u);
|
|
|
|
const StoreItemId silencerId("58002a45-ec20-4851-992c-7308ee86bccc");
|
|
const uint32 silencerQuantity(1u);
|
|
|
|
const StoreItemId gunId("7265f22e-7f02-42d8-9d0b-467ec874a5ba");
|
|
const uint32 gunQuantity(1u);
|
|
|
|
const StoreItemId grenadeId("43a35801-7100-4656-99c0-f145c256e7b0");
|
|
const uint32 grenadeQuantity(28u);
|
|
|
|
const StoreItemId currency1Id("1dc2387a-8249-4fd1-877e-cc5b6ba50c8c");
|
|
const uint32 currency1Quantity(1000000000u);
|
|
|
|
// checks the inventory is currently empty
|
|
auto& secondaryStoreClient = getFacade().getSecondaryStoreClient();
|
|
const auto& firstInventoryResult = secondaryStoreClient.requestInventoryAll(ProfileId(), spaceId);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(firstInventoryResult));
|
|
ASSERT_TRUE(firstInventoryResult.getResult().empty());
|
|
|
|
// applies the special offer
|
|
auto offersResult = secondaryStoreClient.requestOffersSpace({ offerId }, spaceId);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(offersResult));
|
|
ASSERT_EQ(1u, offersResult.getResult().size());
|
|
const auto& offerSpace = offersResult.getResult().front();
|
|
|
|
const auto& transactionResult = secondaryStoreClient.applyOffer(offerSpace, ProfileId(), spaceId);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(transactionResult));
|
|
|
|
// checks the inventory is now filled as expected
|
|
const auto& secondInventoryResult = secondaryStoreClient.requestInventoryAll(ProfileId(), spaceId);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(secondInventoryResult));
|
|
|
|
bool scopeIsPresent = false;
|
|
bool silencerIsPresent = false;
|
|
bool gunIsPresent = false;
|
|
bool grenadeIsPresent = false;
|
|
bool currency1IsPresent = false;
|
|
bool unexpectedItemIsPresent = false;
|
|
|
|
for (const auto& inventoryElement : secondInventoryResult.getResult())
|
|
{
|
|
if (inventoryElement.m_itemId == scopeId && inventoryElement.m_quantity == scopeQuantity)
|
|
{
|
|
scopeIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == silencerId && inventoryElement.m_quantity == silencerQuantity)
|
|
{
|
|
silencerIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == gunId && inventoryElement.m_quantity == gunQuantity)
|
|
{
|
|
gunIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == grenadeId && inventoryElement.m_quantity == grenadeQuantity)
|
|
{
|
|
grenadeIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == currency1Id && inventoryElement.m_quantity == currency1Quantity)
|
|
{
|
|
currency1IsPresent = true;
|
|
}
|
|
else
|
|
{
|
|
unexpectedItemIsPresent = true;
|
|
}
|
|
}
|
|
|
|
EXPECT_TRUE(scopeIsPresent);
|
|
EXPECT_TRUE(silencerIsPresent);
|
|
EXPECT_TRUE(gunIsPresent);
|
|
EXPECT_TRUE(grenadeIsPresent);
|
|
EXPECT_TRUE(currency1IsPresent);
|
|
EXPECT_FALSE(unexpectedItemIsPresent);
|
|
}
|
|
|
|
/// Setup the inventory needed for running tests (for new test accounts only) on space Ubiservices SDK PC
|
|
TEST_F(MANUAL_CONSOLE, DISABLED_HELPER_SetupSecondaryStoreInventoryUbiservicesSdkPC)
|
|
{
|
|
const SpaceId spaceId(US_TEST_NS::SPACE_ID_US_SDK_PC);
|
|
|
|
const StoreOfferId offerId("dd3a7226-ca49-4ad2-ac71-77c1bb184702"); // special offer containing all items needed
|
|
|
|
// needed items:
|
|
const StoreItemId ninjaStarId("2521c8ed-f6c8-48b4-bdde-e36cd941fb93");
|
|
const uint32 ninjaStarQuantity(1806u);
|
|
|
|
const StoreItemId ubiservicesCoinsId("97da4640-0398-480e-801d-f932da9d8554");
|
|
const uint32 ubiservicesCoinsQuantity(2u);
|
|
|
|
const StoreItemId camouflageClothesId("923e2841-31ff-487d-9e7e-6c4e6277cede");
|
|
const uint32 camouflageClothesQuantity(3u);
|
|
|
|
const StoreItemId swordId("12a7725b-aa3a-4fdb-92d7-fe918415891e");
|
|
const uint32 swordQuantity(2u);
|
|
|
|
// checks the inventory is currently empty
|
|
auto& secondaryStoreClient = getFacade().getSecondaryStoreClient();
|
|
const auto& firstInventoryResult = secondaryStoreClient.requestInventoryAll(ProfileId(), spaceId);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(firstInventoryResult));
|
|
ASSERT_TRUE(firstInventoryResult.getResult().empty());
|
|
|
|
// applies the special offer
|
|
const auto& offersResult = secondaryStoreClient.requestOffersSpace({ offerId }, spaceId);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(offersResult));
|
|
ASSERT_EQ(1u, offersResult.getResult().size());
|
|
const auto& offerSpace = offersResult.getResult().front();
|
|
|
|
const auto& transactionResult = secondaryStoreClient.applyOffer(offerSpace, ProfileId(), spaceId);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(transactionResult));
|
|
|
|
// checks the inventory is now filled as expected
|
|
auto secondInventoryResult = secondaryStoreClient.requestInventoryAll(ProfileId(), spaceId);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(secondInventoryResult));
|
|
|
|
bool ninjaStarIsPresent = false;
|
|
bool ubiservicesCoinsIsPresent = false;
|
|
bool camouflageClothesIsPresent = false;
|
|
bool swordIsPresent = false;
|
|
bool unexpectedItemIsPresent = false;
|
|
|
|
for (const auto& inventoryElement : secondInventoryResult.getResult())
|
|
{
|
|
if (inventoryElement.m_itemId == ninjaStarId && inventoryElement.m_quantity == ninjaStarQuantity)
|
|
{
|
|
ninjaStarIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == ubiservicesCoinsId && inventoryElement.m_quantity == ubiservicesCoinsQuantity)
|
|
{
|
|
ubiservicesCoinsIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == camouflageClothesId && inventoryElement.m_quantity == camouflageClothesQuantity)
|
|
{
|
|
camouflageClothesIsPresent = true;
|
|
}
|
|
else if (inventoryElement.m_itemId == swordId && inventoryElement.m_quantity == swordQuantity)
|
|
{
|
|
swordIsPresent = true;
|
|
}
|
|
else
|
|
{
|
|
unexpectedItemIsPresent = true;
|
|
}
|
|
}
|
|
|
|
EXPECT_TRUE(ninjaStarIsPresent);
|
|
EXPECT_TRUE(ubiservicesCoinsIsPresent);
|
|
EXPECT_TRUE(camouflageClothesIsPresent);
|
|
EXPECT_TRUE(swordIsPresent);
|
|
EXPECT_FALSE(unexpectedItemIsPresent);
|
|
}
|
|
|
|
|
|
|
|
#if defined(US_TARGET_WINDOWS)
|
|
/// Accepts the friendships invites for the test accounts.
|
|
/// @important This test is solely intended to run on Win32 target only!
|
|
TEST_F(MANUAL_CONSOLE_NO_LOGIN, DISABLED_HELPER_Win32SetupAcceptFriendships)
|
|
{
|
|
const String invitedUsersEmails[] =
|
|
{
|
|
"ussdk001@ubisoft.com",
|
|
"ussdk002@ubisoft.com",
|
|
"ussdk003@ubisoft.com",
|
|
"ussdk006@ubisoft.com"
|
|
};
|
|
const String password = "a1234567";
|
|
|
|
for(auto& invitedUserEmail : invitedUsersEmails)
|
|
{
|
|
Facade facade; // Create a facade for each email since a facade is used for only one account (even with a logout)
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.createSession(PlayerCredentials(invitedUserEmail, password), {}, {})));
|
|
|
|
auto& friendClient = facade.getFriendClient();
|
|
const auto& resultClubInvites = friendClient.requestFriendsClubInvites();
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(resultClubInvites));
|
|
|
|
const auto& pendingInvitations = resultClubInvites.getResult();
|
|
|
|
for(const auto& pendingInvitation : pendingInvitations)
|
|
{
|
|
const auto* infoClub = pendingInvitation.getInfoClub();
|
|
if(infoClub != NULL && infoClub->m_profileInfo.m_nameOnPlatform != "ussdk010") // friend invites from ussdk010 shall be kept pending
|
|
{
|
|
PRINT_STREAM("Accepting friendship from " << infoClub->m_profileInfo.m_nameOnPlatform);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(friendClient.acceptFriendClubInvite(infoClub->m_profileInfo.m_profileId)));
|
|
}
|
|
}
|
|
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.deleteSession()));
|
|
}
|
|
}
|
|
#endif // US_TARGET_WINDOWS
|
|
|
|
|
|
#if defined(US_TARGET_WINDOWS)
|
|
/// Accepts the friendships invites for the test accounts.
|
|
/// @important This test is solely intended to run on Win32 target only!
|
|
TEST_F(MANUAL_CONSOLE_NO_LOGIN, DISABLED_HELPER_Win32SetupAcceptFriendshipsBatch)
|
|
{
|
|
for(uint32 i = 1; i < 128; ++i) // Accounts to process
|
|
{
|
|
const String nameOnPlatform = String::formatText("%s%03i", String(_T("UbiSvc")).getUtf8(), i);
|
|
const String email = nameOnPlatform + _T("@ubisoft.com");
|
|
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(getFacade().createSession(PlayerCredentials(email, "a1234567"), {}, {})));
|
|
|
|
const AsyncResult<Vector<FriendInfo> > result1 = getFacade().getFriendClient().requestFriendsClubInvites();
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(result1));
|
|
|
|
const Vector<FriendInfo>& pending = result1.getResult();
|
|
for(Vector<FriendInfo>::const_iterator it = pending.begin(), end = pending.end(); it != end; ++it)
|
|
{
|
|
const FriendInfoClub* info = it->getInfoClub();
|
|
if(info != NULL)
|
|
{
|
|
PRINT_STREAM("Accepting friendship from " << info->m_profileInfo.m_nameOnPlatform);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(getFacade().getFriendClient().acceptFriendClubInvite(info->m_profileInfo.m_profileId)));
|
|
}
|
|
}
|
|
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(getFacade().deleteSession()));
|
|
}
|
|
}
|
|
#endif // US_TARGET_WINDOWS
|
|
|
|
|
|
#if defined(US_TARGET_WINDOWS)
|
|
/// Remove the friendships for the test accounts.
|
|
/// Note : This test remove the friendship only in one way. To remove completely the friendship run the tests from both accounts
|
|
/// @important This test is solely intended to run on Win32 target only!
|
|
TEST_F(MANUAL_CONSOLE_NO_LOGIN, DISABLED_HELPER_Win32RemoveFriendships)
|
|
{
|
|
const String emails[] =
|
|
{
|
|
"ussdk001@ubisoft.com"
|
|
};
|
|
|
|
Vector<String> usernamesFriendsToRemove;
|
|
usernamesFriendsToRemove.push_back("ussdk010");
|
|
|
|
for (uint32 i = 0; i < sizeof(emails) / sizeof(emails[0]); ++i)
|
|
{
|
|
Facade facade; // Create a facade for each email as a facade is used for only one account (even with a logout)
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.createSession(PlayerCredentials(emails[i], "a1234567"), {}, {})));
|
|
|
|
const AsyncResult<Map<String, ProfileInfo> > result = facade.getProfileClient().requestUplayProfiles(usernamesFriendsToRemove);
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(result));
|
|
ASSERT_EQ(usernamesFriendsToRemove.size(), result.getResult().size()) << "Could find profile for usernamesToRemove";
|
|
|
|
const Map<String, ProfileInfo>& profiles = result.getResult();
|
|
for (Map<String, ProfileInfo>::const_iterator it = profiles.begin(), end = profiles.end(); it != end; ++it)
|
|
{
|
|
const ProfileInfo info = it->second;
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(facade.getFriendClient().removeFriendClub(info.m_profileId)));
|
|
}
|
|
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.deleteSession()));
|
|
}
|
|
}
|
|
#endif // US_TARGET_WINDOWS
|
|
|
|
|
|
#if defined(US_TARGET_WINDOWS)
|
|
/// Send the invitations that shall remain pending
|
|
/// @important This test is solely intended to run on Win32 target only!
|
|
TEST_F(MANUAL_CONSOLE_NO_LOGIN, DISABLED_HELPER_Win32SetupPendingFriendship)
|
|
{
|
|
// replace here with your new test user nameOnPlatform:
|
|
const String receiverName = "ustest002";
|
|
|
|
// this is not supposed to be changed:
|
|
const String senderEmail = "ussdk010@ubisoft.com";
|
|
const String password = "a1234567";
|
|
|
|
Facade facade;
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.createSession(PlayerCredentials(senderEmail, password), {}, {})));
|
|
|
|
const auto& resultProfiles = facade.getProfileClient().requestUplayProfiles({ receiverName });
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(resultProfiles));
|
|
|
|
const auto& profilesReceived = resultProfiles.getResult();
|
|
ASSERT_EQ(1u, profilesReceived.size());
|
|
const auto& profileInfo = *profilesReceived.begin();
|
|
ASSERT_EQ(receiverName, profileInfo.first);
|
|
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(facade.getFriendClient().sendFriendsClubInvite({ profileInfo.second.m_profileId })));
|
|
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.deleteSession()));
|
|
}
|
|
#endif // US_TARGET_WINDOWS
|
|
|
|
|
|
#if defined(US_TARGET_WINDOWS)
|
|
// Test to automatize the creation of a new Uplay test account.
|
|
TEST_F(MANUAL_CONSOLE_NO_LOGIN, DISABLED_HELPER_Win32CreateNewUplayTestAccount)
|
|
{
|
|
// Change this with your new user's name:
|
|
const String newUserName = "ustest002";
|
|
|
|
// Not supposed to be changed:
|
|
const String userUsedToLogin = "ussdk001";
|
|
const String emailSuffix = "@ubisoft.com";
|
|
const String password = "a1234567";
|
|
|
|
Facade facade;
|
|
ASSERT_TRUE(AsyncHelper::waitSuccess(facade.createSession(PlayerCredentials(userUsedToLogin + emailSuffix, password), {}, {})));
|
|
|
|
// checking that the user doesn't already exist
|
|
{
|
|
const auto& resultProfile = facade.getProfileClient().requestUplayProfiles({ newUserName });
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(resultProfile));
|
|
const auto& profiles = resultProfile.getResult();
|
|
ASSERT_TRUE(profiles.empty());
|
|
}
|
|
|
|
// creating the user
|
|
const auto& resultCreation = PlatformHelper::createUplayAccountForDevelopment(newUserName, emailSuffix, password);
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(resultCreation));
|
|
|
|
// checking the user has been added
|
|
{
|
|
const auto resultProfile = facade.getProfileClient().requestUplayProfiles({ newUserName });
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(resultProfile));
|
|
const auto& profiles = resultProfile.getResult();
|
|
EXPECT_EQ(1u, profiles.size());
|
|
}
|
|
|
|
EXPECT_TRUE(AsyncHelper::waitSuccess(facade.deleteSession()));
|
|
}
|
|
#endif // US_TARGET_WINDOWS
|
|
|
|
};
|