Skip to content

Commit

Permalink
Merge pull request #41 from 0xsequence/Feature/WaaSIntegration_auth
Browse files Browse the repository at this point in the history
Feature/waas integration auth
  • Loading branch information
BellringerQuinn authored Dec 20, 2023
2 parents 65d5592 + 440b658 commit b8a15ce
Show file tree
Hide file tree
Showing 71 changed files with 1,479 additions and 167 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@

# Plugins

/[Aa]ssets/TextMesh Pro
/[Aa]ssets/TextMesh Pro/
/[Aa]ssets/Plugins.meta
/[Aa]ssets/TextMesh Pro.meta
/[Aa]ssets/Plugins/Android
/[Aa]ssets/Plugins/Android.meta
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
Expand Down
8 changes: 8 additions & 0 deletions Assets/Plugins/AWS.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/AWS/AWSSDK.CognitoIdentity.dll
Binary file not shown.
33 changes: 33 additions & 0 deletions Assets/Plugins/AWS/AWSSDK.CognitoIdentity.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/AWS/AWSSDK.Core.dll
Binary file not shown.
33 changes: 33 additions & 0 deletions Assets/Plugins/AWS/AWSSDK.Core.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
33 changes: 33 additions & 0 deletions Assets/Plugins/AWS/AWSSDK.KeyManagementService.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/AWS/AWSSDK.SecurityToken.dll
Binary file not shown.
33 changes: 33 additions & 0 deletions Assets/Plugins/AWS/AWSSDK.SecurityToken.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
33 changes: 33 additions & 0 deletions Assets/Plugins/AWS/Microsoft.Bcl.AsyncInterfaces.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Plugins/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<application>
<activity
android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sdk-powered-by-sequence"/>
</intent-filter>
</activity>
</application>
</manifest>
7 changes: 7 additions & 0 deletions Assets/Plugins/Android/AndroidManifest.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 42 additions & 5 deletions Assets/SequenceExamples/Scripts/Tests/LoginFlowUITests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections;
using Sequence.Authentication;
using Sequence.Demo;
using SequenceExamples.Scripts.Tests.Utils;
using TMPro;
using UnityEngine;
using UnityEngine.Assertions;
Expand All @@ -20,6 +22,8 @@ public class LoginFlowUITests : MonoBehaviour
private MultifactorAuthenticationPage _mfaPage;
private LoginSuccessPage _loginSuccessPage;
private WalletPanel _walletPanel;

private static readonly WaitForSeconds WaitForAnimationTime = new WaitForSeconds(UITestHarness.WaitForAnimationTime);

public void Setup(MonoBehaviour testMonobehaviour, SequenceSampleUI ui, LoginPanel loginPanel, ConnectPage connectPage, LoginPage loginPage,
MultifactorAuthenticationPage mfaPage, LoginSuccessPage loginSuccessPage, WalletPanel walletPanel)
Expand All @@ -32,18 +36,33 @@ public void Setup(MonoBehaviour testMonobehaviour, SequenceSampleUI ui, LoginPan
_mfaPage = mfaPage;
_loginSuccessPage = loginSuccessPage;
_walletPanel = walletPanel;

_loginPanel.SetupLoginHandler(new MockLogin());
}

public IEnumerator EndToEndTest()
public IEnumerator EndToEndEmailFlowTest()
{
// Run all tests in one single suite to save time running test suite (otherwise, we need to reload and tear down the scene for each test
InitialExpectationsTest();
yield return _testMonobehaviour.StartCoroutine(TransitionToMfaPageTest());
yield return _testMonobehaviour.StartCoroutine(TransitionToLoginSuccessPageTest());
yield return _testMonobehaviour.StartCoroutine(GoBackToMfaPageAndVerifyPageStateTest());
yield return _testMonobehaviour.StartCoroutine(GoBackToLoginPageAndVerifyPageStateTest());
yield return _testMonobehaviour.StartCoroutine(GoBackToLoginPageAndVerifyPageStateTest("validEmail@valid.com"));
yield return _testMonobehaviour.StartCoroutine(NavigateToLoginSuccessPageAndDismissTest());
}

public IEnumerator EndToEndSocialFlowTest()
{
// Run all tests in one single suite to save time running test suite (otherwise, we need to reload and tear down the scene for each test
InitialExpectationsTest();
foreach (string provider in new[] {"Google", "Discord", "Facebook", "Apple"})
{
yield return _testMonobehaviour.StartCoroutine(NavigateToLoginSuccessPageViaSocialLoginTest(provider));
yield return _testMonobehaviour.StartCoroutine(GoBackToLoginPageAndVerifyPageStateTest(""));
}

yield return _testMonobehaviour.StartCoroutine(NavigateToLoginSuccessPageViaSocialLoginAndDismissTest("Google"));
}

private void InitialExpectationsTest()
{
Expand Down Expand Up @@ -128,7 +147,21 @@ private IEnumerator TransitionToLoginSuccessPage(string code)

AssertWeAreOnLoginSuccessPage();
}

private IEnumerator NavigateToLoginSuccessPageViaSocialLoginAndDismissTest(string providerName)
{
yield return NavigateToLoginSuccessPageViaSocialLoginTest(providerName);
yield return DismissTest();
}

private IEnumerator NavigateToLoginSuccessPageViaSocialLoginTest(string providerName)
{
TestExtensions.ClickButtonWithName(_loginPage.transform, $"{providerName}SignInButton");
yield return WaitForAnimationTime;

AssertWeAreOnLoginSuccessPage();
}

private TMP_InputField FetchMfaCodeFieldAndAssertAssumptions()
{
GameObject MfaCodeGameObject = GameObject.Find("MFACodeField");
Expand Down Expand Up @@ -187,7 +220,7 @@ private IEnumerator GoBackToMfaPageAndVerifyPageStateTest()
Assert.AreEqual("Enter the code sent to\n<b>validEmail@valid.com</b>", text.text);
}

private IEnumerator GoBackToLoginPageAndVerifyPageStateTest()
private IEnumerator GoBackToLoginPageAndVerifyPageStateTest(string expectedEmail)
{
GameObject backGameObject = GameObject.Find("BackButton");
Assert.IsNotNull(backGameObject);
Expand All @@ -203,7 +236,7 @@ private IEnumerator GoBackToLoginPageAndVerifyPageStateTest()
Assert.IsNotNull(emailGameObject);
TMP_InputField emailInputField = emailGameObject.GetComponent<TMP_InputField>();
Assert.IsNotNull(emailInputField);
Assert.AreEqual("validEmail@valid.com", emailInputField.text);
Assert.AreEqual(expectedEmail, emailInputField.text);

backGameObject = GameObject.Find("BackButton");
Assert.IsNull(backGameObject);
Expand All @@ -213,7 +246,11 @@ public IEnumerator NavigateToLoginSuccessPageAndDismissTest()
{
yield return _testMonobehaviour.StartCoroutine(TransitionToMfaPage("newValidEmail@valid.com"));
yield return _testMonobehaviour.StartCoroutine(TransitionToLoginSuccessPage("0987654321"));

yield return _testMonobehaviour.StartCoroutine(DismissTest());
}

private IEnumerator DismissTest()
{
GameObject dismissGameObject = GameObject.Find("DismissButton");
Assert.IsNotNull(dismissGameObject);
Button dismissButton = dismissGameObject.GetComponent<Button>();
Expand Down
4 changes: 0 additions & 4 deletions Assets/SequenceExamples/Scripts/Tests/SearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,12 @@ public IEnumerator ToggleViewAllPageTest()

Assert.IsFalse(collectionToggle.isOn);
Assert.IsTrue(tokenToggle.isOn);
AssertAllDisplayedSearchablesAreOfTypeT<TokenElement>(elementLayoutGroup);

collectionToggle.OnPointerClick(new PointerEventData(EventSystem.current));
yield return new WaitForSeconds(UITestHarness.WaitForAnimationTime); // Allow UI to update

Assert.IsTrue(collectionToggle.isOn);
Assert.IsFalse(tokenToggle.isOn);
AssertAllDisplayedSearchablesAreOfTypeT<SearchableCollection>(elementLayoutGroup);

yield return _testMonoBehaviour.StartCoroutine(HitUIBackButton());
yield return _testMonoBehaviour.StartCoroutine(NavigateToViewAllTokensPageTest());
Expand All @@ -391,14 +389,12 @@ public IEnumerator ToggleViewAllPageTest()

Assert.IsTrue(collectionToggle.isOn);
Assert.IsFalse(tokenToggle.isOn);
AssertAllDisplayedSearchablesAreOfTypeT<SearchableCollection>(elementLayoutGroup);

tokenToggle.OnPointerClick(new PointerEventData(EventSystem.current));
yield return new WaitForSeconds(UITestHarness.WaitForAnimationTime); // Allow UI to update

Assert.IsFalse(collectionToggle.isOn);
Assert.IsTrue(tokenToggle.isOn);
AssertAllDisplayedSearchablesAreOfTypeT<TokenElement>(elementLayoutGroup);

yield return _testMonoBehaviour.StartCoroutine(HitUIBackButton());
yield return _testMonoBehaviour.StartCoroutine(NavigateToViewAllCollectionsPageTest());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"GUID:27619889b8ba8c24980f49ee34dbb44a",
"GUID:0acc523941302664db1f4e527237feb3",
"GUID:6055be8ebefd69e48b49212b09b47b2f",
"GUID:f7fd4ba36aabd1d499450c174865e70b"
"GUID:f7fd4ba36aabd1d499450c174865e70b",
"GUID:f78a27d6a73d94c4baf04337e0add4dc"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
Loading

0 comments on commit b8a15ce

Please sign in to comment.