-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
Feature/waas integration auth
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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; | ||
|
@@ -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) | ||
|
@@ -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("[email protected]")); | ||
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() | ||
{ | ||
|
@@ -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"); | ||
|
@@ -187,7 +220,7 @@ private IEnumerator GoBackToMfaPageAndVerifyPageStateTest() | |
Assert.AreEqual("Enter the code sent to\n<b>[email protected]</b>", text.text); | ||
} | ||
|
||
private IEnumerator GoBackToLoginPageAndVerifyPageStateTest() | ||
private IEnumerator GoBackToLoginPageAndVerifyPageStateTest(string expectedEmail) | ||
{ | ||
GameObject backGameObject = GameObject.Find("BackButton"); | ||
Assert.IsNotNull(backGameObject); | ||
|
@@ -203,7 +236,7 @@ private IEnumerator GoBackToLoginPageAndVerifyPageStateTest() | |
Assert.IsNotNull(emailGameObject); | ||
TMP_InputField emailInputField = emailGameObject.GetComponent<TMP_InputField>(); | ||
Assert.IsNotNull(emailInputField); | ||
Assert.AreEqual("[email protected]", emailInputField.text); | ||
Assert.AreEqual(expectedEmail, emailInputField.text); | ||
|
||
backGameObject = GameObject.Find("BackButton"); | ||
Assert.IsNull(backGameObject); | ||
|
@@ -213,7 +246,11 @@ public IEnumerator NavigateToLoginSuccessPageAndDismissTest() | |
{ | ||
yield return _testMonobehaviour.StartCoroutine(TransitionToMfaPage("[email protected]")); | ||
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>(); | ||
|