This repository has been archived by the owner on Feb 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
358 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
demoapp/src/androidTest/java/me/uport/sdk/demoapp/PersonalSignatureTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package me.uport.sdk.demoapp | ||
|
||
import android.app.Activity | ||
import android.app.Instrumentation | ||
import android.content.Intent | ||
import android.content.IntentFilter | ||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.espresso.Espresso.onView | ||
import android.support.test.espresso.action.ViewActions.click | ||
import android.support.test.espresso.assertion.ViewAssertions.matches | ||
import android.support.test.espresso.intent.Intents.intending | ||
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction | ||
import android.support.test.espresso.intent.rule.IntentsTestRule | ||
import android.support.test.espresso.matcher.ViewMatchers.withId | ||
import android.support.test.espresso.matcher.ViewMatchers.withText | ||
import me.uport.sdk.demoapp.request_flows.PersonalSignRequestActivity | ||
import me.uport.sdk.transport.RequestDispatchActivity | ||
import org.hamcrest.CoreMatchers.not | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class PersonalSignatureTest { | ||
|
||
@get:Rule | ||
val intentsTestRule = IntentsTestRule(PersonalSignRequestActivity::class.java) | ||
|
||
private var instrumentation: Instrumentation? = null | ||
private var monitor: Instrumentation.ActivityMonitor? = null | ||
private val filter: IntentFilter? = null | ||
|
||
@Before | ||
fun run_before_every_test() { | ||
instrumentation = InstrumentationRegistry.getInstrumentation() | ||
monitor = instrumentation?.addMonitor(filter, null, true) | ||
} | ||
|
||
@After | ||
fun run_after_every_test() { | ||
instrumentation?.removeMonitor(monitor) | ||
} | ||
|
||
@Before | ||
fun stub_intent() { | ||
// Mock the ActivityResult to be returned to PersonalSignRequestActivity in onActivityResult. | ||
val resultData = Intent() | ||
val redirectUri = "https://uport-project.github.io/uport-android-sdk/callbacks#personalSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NTI0ODczMjIsImV4cCI6MTU1MjU3MzcyMiwidHlwZSI6InBlcnNvbmFsU2lnblJlc3AiLCJkYXRhIjoiVGhpcyBpcyBhIG1lc3NhZ2UgSSBuZWVkIHlvdSB0byBzaWduIiwic2lnbmF0dXJlIjp7InYiOjI3LCJyIjoiMHgzYjExMmUxMzZiMDI3MDZiNzNjZjhjYjFmNDI0ZDBjZjg1NWExZTM5OTU0ZGM3OTJjZTllYzFmNDkwZmJlZjBiIiwicyI6IjB4N2U0YTViMWU4MWM4YjNjZjJkMTY1ODdjNTUwMjUyNmNjOTM3OWU4OWUwOWI2NTNlMWI2NWUzOThkYzg5MjBjNiJ9LCJpc3MiOiJkaWQ6ZXRocjoweDNmZjI1MTE3YzBlMTcwY2E1MzBiZDU4OTE4OTljMTgzOTQ0ZGI0MzEifQ.5FtBavglhq1aeMtTM644cY5d1ij-0QvlMMLMQhmwVpUtCKOJRBjj3psXrPPuEm28_ZqAV0ISTyH7a2w1osjyzgE" | ||
resultData.putExtra("redirect_uri", redirectUri) | ||
val response = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData) | ||
|
||
// This sets up what the ActivityResult to be returned whenever an intent with the below action is launched | ||
intending(hasAction(RequestDispatchActivity.ACTION_DISPATCH_REQUEST)).respondWith(response) | ||
} | ||
|
||
@Test | ||
fun data_successfully_signed_by_uport_account() { | ||
|
||
// User clicks on send request. | ||
onView(withId(R.id.send_request)).perform(click()) | ||
|
||
Thread.sleep(5000) | ||
|
||
// Response detail TextView will no longer be empty | ||
onView(withId(R.id.response_details)).check(matches(not(withText("")))) | ||
} | ||
} |
59 changes: 0 additions & 59 deletions
59
demoapp/src/androidTest/java/me/uport/sdk/demoapp/SelectiveDisclosureTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
demoapp/src/androidTest/java/me/uport/sdk/demoapp/TransactionRequestTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package me.uport.sdk.demoapp | ||
|
||
import android.app.Activity | ||
import android.app.Instrumentation | ||
import android.content.Intent | ||
import android.content.IntentFilter | ||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.espresso.Espresso.onView | ||
import android.support.test.espresso.action.ViewActions.click | ||
import android.support.test.espresso.assertion.ViewAssertions.matches | ||
import android.support.test.espresso.intent.Intents.intending | ||
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction | ||
import android.support.test.espresso.intent.rule.IntentsTestRule | ||
import android.support.test.espresso.matcher.ViewMatchers.withId | ||
import android.support.test.espresso.matcher.ViewMatchers.withText | ||
import me.uport.sdk.demoapp.request_flows.EthereumTransactionActivity | ||
import me.uport.sdk.transport.RequestDispatchActivity | ||
import org.hamcrest.CoreMatchers.not | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class TransactionRequestTest { | ||
|
||
@get:Rule | ||
val intentsTestRule = IntentsTestRule(EthereumTransactionActivity::class.java) | ||
|
||
private var instrumentation: Instrumentation? = null | ||
private var monitor: Instrumentation.ActivityMonitor? = null | ||
private val filter: IntentFilter? = null | ||
|
||
@Before | ||
fun run_before_every_test() { | ||
instrumentation = InstrumentationRegistry.getInstrumentation() | ||
monitor = instrumentation?.addMonitor(filter, null, true) | ||
} | ||
|
||
@After | ||
fun run_after_every_test() { | ||
instrumentation?.removeMonitor(monitor) | ||
} | ||
|
||
@Before | ||
fun stub_intent() { | ||
// Mock the ActivityResult to be returned to EthereumTransactionActivity in onActivityResult. | ||
val resultData = Intent() | ||
val redirectUri = "https://uport-project.github.io/uport-android-sdk/callbacks#tx=6146ccf6a66d994f7c363db875e31ca35581450a4bf6d3be6cc9ac79233a69d0" | ||
resultData.putExtra("redirect_uri", redirectUri) | ||
val response = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData) | ||
|
||
// This sets up what the ActivityResult to be returned whenever an intent with the below action is launched | ||
intending(hasAction(RequestDispatchActivity.ACTION_DISPATCH_REQUEST)).respondWith(response) | ||
} | ||
|
||
@Test | ||
fun transaction_request_successfully_approved_by_uport_account() { | ||
// User clicks on send request. | ||
onView(withId(R.id.send_request)).perform(click()) | ||
|
||
Thread.sleep(5000) | ||
|
||
// Response detail TextView will no longer be empty | ||
onView(withId(R.id.response_details)).check(matches(not(withText("")))) | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
demoapp/src/androidTest/java/me/uport/sdk/demoapp/TypedDataTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package me.uport.sdk.demoapp | ||
|
||
import android.app.Activity | ||
import android.app.Instrumentation | ||
import android.content.Intent | ||
import android.content.IntentFilter | ||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.espresso.Espresso.onView | ||
import android.support.test.espresso.action.ViewActions.click | ||
import android.support.test.espresso.assertion.ViewAssertions.matches | ||
import android.support.test.espresso.intent.Intents.intending | ||
import android.support.test.espresso.intent.matcher.IntentMatchers.hasAction | ||
import android.support.test.espresso.intent.rule.IntentsTestRule | ||
import android.support.test.espresso.matcher.ViewMatchers.withId | ||
import android.support.test.espresso.matcher.ViewMatchers.withText | ||
import me.uport.sdk.demoapp.request_flows.TypedDataRequestActivity | ||
import me.uport.sdk.transport.RequestDispatchActivity | ||
import org.hamcrest.CoreMatchers.not | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class TypedDataTests { | ||
|
||
@get:Rule | ||
val intentsTestRule = IntentsTestRule(TypedDataRequestActivity::class.java) | ||
|
||
private var instrumentation: Instrumentation? = null | ||
private var monitor: Instrumentation.ActivityMonitor? = null | ||
private val filter: IntentFilter? = null | ||
|
||
@Before | ||
fun run_before_every_test() { | ||
instrumentation = InstrumentationRegistry.getInstrumentation() | ||
monitor = instrumentation?.addMonitor(filter, null, true) | ||
} | ||
|
||
@After | ||
fun run_after_every_test() { | ||
instrumentation?.removeMonitor(monitor) | ||
} | ||
|
||
@Before | ||
fun stub_intent() { | ||
// Mock the ActivityResult to be returned to TypedDataRequestActivity in onActivityResult. | ||
val resultData = Intent() | ||
val redirectUri = "https://uport-project.github.io/uport-android-sdk/callbacks#typedDataSig=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NTI0ODk1NDEsImV4cCI6MTU1MjU3NTk0MSwidHlwZSI6ImVpcDcxMlJlc3AiLCJyZXF1ZXN0Ijp7In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NDAxZjdmMzQ1N2YxYzk1YjM5MzQ5NTBlZjI3M2JhNjY5MTY3MzNhZGNjYWIyMGEwYTA3YzUxIn0sImlzcyI6ImRpZDpldGhyOjB4M2ZmMjUxMTdjMGUxNzBjYTUzMGJkNTg5MTg5OWMxODM5NDRkYjQzMSJ9.kEwFlT-hQF0eAhv9uS0A_qmc13J0-w3nTjk6ZMbVWOhxGqp_4HKzfYKJuHyKsWJKq2NMzX2jVcvx7Thfqnrc7wE" | ||
resultData.putExtra("redirect_uri", redirectUri) | ||
val response = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData) | ||
|
||
// This sets up what the ActivityResult to be returned whenever an intent with the below action is launched | ||
intending(hasAction(RequestDispatchActivity.ACTION_DISPATCH_REQUEST)).respondWith(response) | ||
} | ||
|
||
@Test | ||
fun typed_data_successfully_signed_by_uport_account() { | ||
|
||
// User clicks on send request. | ||
onView(withId(R.id.send_request)).perform(click()) | ||
|
||
Thread.sleep(5000) | ||
|
||
// Response detail TextView will no longer be empty | ||
onView(withId(R.id.response_details)).check(matches(not(withText("")))) | ||
} | ||
} |
Oops, something went wrong.