Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated SignInOutRepeatedlyTest such that it verifies that the sessio… #198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ FString USequenceWallet::GetWalletAddress() const
return Addr;
}

FString USequenceWallet::GetSessionId() const
{
return this->Credentials.GetSessionWallet()->GetSessionId();
}


void USequenceWallet::GetIdToken(const FString& Nonce, const TSuccessCallback<FSeqIdTokenResponse_Data>&OnSuccess, const FFailureCallback& OnFailure) const
{
if (this->SequenceRPCManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ class SEQUENCEPLUGIN_API USequenceWallet : public UGameInstanceSubsystem
*/
FString GetWalletAddress() const;

/**
* Get the current/active session id associated with this wallet
* @return the current/active session id associated with this wallet
*/
FString GetSessionId() const;

/**
* Allows you to update the provider URL set for the SequenceWallet
* @param Url New provider Url you wish to use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ void USignInOutRepeatedlyTestHelper::OnAuthSuccess()
Repetitions++;
if (TOptional<USequenceWallet*> OptionalSequenceWallet = USequenceWallet::Get(); OptionalSequenceWallet.IsSet() && OptionalSequenceWallet.GetValue())
{

TSet<FString> UniqueSessionIds(SessionIds);
bool bAllSessionIdsUnique = UniqueSessionIds.Num() == SessionIds.Num();
if (!bAllSessionIdsUnique)
{
bTestComplete = true;
ParentTest->AddError(TEXT("Session Ids are not unique"));
return;
}

SessionIds.Add(OptionalSequenceWallet.GetValue()->GetSessionId());
OptionalSequenceWallet.GetValue()->SignOut();
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "CoreMinimal.h"
#include "Misc/AutomationTest.h"
#include "SequencePlugin/Public/SequenceAuthenticator.h"
#include "SequencePlugin/Public/Sequence/SequenceAPI.h"
#include "SignInOutRepeatedlyTest.generated.h"

class FSignInOutRepeatedlyTest;
Expand All @@ -29,8 +30,9 @@ class USignInOutRepeatedlyTestHelper : public UObject
USequenceAuthenticator* Authenticator = nullptr;
int32 Repetitions = 0;
static const int32 MaxRepetitions = 3;
TArray<FString> SessionIds;

void ConnectAsGuest();
};

DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FWaitForSignInOutCompletion, USignInOutRepeatedlyTestHelper*, TestHelper);
DEFINE_LATENT_AUTOMATION_COMMAND_ONE_PARAMETER(FWaitForSignInOutCompletion, USignInOutRepeatedlyTestHelper*, TestHelper);