Skip to content
Draft
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
177 changes: 177 additions & 0 deletions .maestro/payment-request/payment-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
appId: to.bitkit.dev
name: payment request figma frames
tags:
- visual
---
- launchApp:
clearState: true
- runFlow: ../setup/onboard-new-wallet.yaml

# seed paykit contacts, incoming and outgoing requests (debug builds only)
- openLink: bitkit://dev-fixture/payment-request
- extendedWaitUntil:
visible:
id: "TotalBalance-primary"
timeout: 10000

# list (payments tab of the subscriptions screen)
- tapOn:
id: "HeaderMenu"
- tapOn:
id: "DrawerSubscriptions"
- extendedWaitUntil:
visible:
id: "SubscriptionsScreen"
timeout: 10000
- tapOn: "Payments"
- extendedWaitUntil:
visible: "Areem Holden"
timeout: 10000
- assertVisible: "Ben"
- assertVisible: "Anna Pleb"
- assertVisible: "Snacks at conference"
- assertVisible: "John Carvalho"
- assertVisible: "Steaks & Burgers"
- assertVisible:
id: "PaymentRequestCreate"
- takeScreenshot:
path: list-after

# recipient with contacts header, entered from the list
- tapOn:
id: "PaymentRequestCreate"
- extendedWaitUntil:
visible:
id: "PaymentRequestRecipientSearch"
timeout: 10000
- extendedWaitUntil:
visible: "Alex Stronghand"
timeout: 5000
- assertNotVisible:
id: "PaymentRequestContactsHeader"
- assertVisible: "Anna Pleb"
- assertVisible: "Areem Holden"
- assertVisible: "Craig Wrong"
- assertVisible: "John Carvalho"
- takeScreenshot:
path: recipient-after

# amount
- tapOn:
id: "PaymentRequestContactpubky1rsduhcxpw74snwyct86m38c63j3pq8x4ycqikxg64roik8yw5xg"
- extendedWaitUntil:
visible:
id: "PaymentRequestNumberPad"
timeout: 10000
- assertVisible:
id: "PaymentRequestAmountUnit"
- takeScreenshot:
path: amount-empty-after
- tapOn:
id: "N5"
- tapOn:
id: "N0"
- tapOn:
id: "N0"
- tapOn:
id: "N0"
- tapOn:
id: "N0"
- assertVisible: "50 000"
- takeScreenshot:
path: amount-filled-after
- repeat:
times: 5
commands:
- tapOn:
id: "NRemove"
- tapOn:
id: "N1"
- tapOn:
id: "N4"
- tapOn:
id: "N5"
- tapOn:
id: "N0"
- tapOn:
id: "N0"
- tapOn:
id: "PaymentRequestAmountContinue"

# details
- extendedWaitUntil:
visible:
id: "PaymentRequestNote"
timeout: 5000
- tapOn:
id: "PaymentRequestNote"
- inputText: "Snacks at conference"
- hideKeyboard
- assertVisible: ".*14 500"
- assertVisible: "Anna Pleb"
- assertVisible: "1 week"
- assertVisible:
id: "PaymentRequestSend"
- takeScreenshot:
path: details-after

# sent
- tapOn:
id: "PaymentRequestSend"
- extendedWaitUntil:
visible:
id: "PaymentRequestSentCheck"
timeout: 10000
- assertVisible: "Anna Pleb"
- assertVisible: "Snacks at conference"
- takeScreenshot:
path: sent-after
- tapOn: "OK"
- extendedWaitUntil:
notVisible:
id: "ReceiveScreen"
timeout: 5000
- runFlow:
when:
visible:
id: "SubscriptionsScreen"
commands:
- tapOn:
id: "NavigationBack"
- extendedWaitUntil:
visible:
id: "TotalBalance-primary"
timeout: 5000

# recipient without contacts header, entered from the invoice editor
- openLink: bitkit://screen/receive/edit-invoice
- extendedWaitUntil:
visible:
id: "PaymentRequestSendButton"
timeout: 10000
- tapOn:
id: "ReceiveNumberPadTextField"
- extendedWaitUntil:
visible:
id: "ReceiveNumberPad"
timeout: 5000
- tapOn:
id: "N1"
- tapOn:
id: "ReceiveNumberPadSubmit"
- extendedWaitUntil:
visible:
id: "PaymentRequestSendButton"
timeout: 5000
- tapOn:
id: "PaymentRequestSendButton"
- extendedWaitUntil:
visible:
id: "PaymentRequestContactsHeader"
timeout: 10000
- assertVisible: "Alex Stronghand"
- assertVisible: "Anna Pleb"
- assertVisible: "Craig Wrong"
- assertVisible: "John Carvalho"
- takeScreenshot:
path: recipient-invoice-after
17 changes: 17 additions & 0 deletions .maestro/setup/onboard-new-wallet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
appId: to.bitkit.dev
name: onboard new wallet
---
- extendedWaitUntil:
visible:
id: "Continue"
timeout: 30000
- tapOn:
id: "Continue"
- tapOn:
id: "SkipIntro"
- tapOn:
id: "NewWallet"
- extendedWaitUntil:
visible:
id: "TotalBalance-primary"
timeout: 180000
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class CreatePaymentRequestScreenTest {
initialDraft = draft,
contact = PubkyProfile.placeholder(target.publicKey),
isCreating = false,
onBack = {},
onEditAmount = {},
onSend = {},
)
Expand All @@ -60,6 +59,7 @@ class CreatePaymentRequestScreenTest {
composeTestRule.onNodeWithTag("PaymentRequestExpiryWeek").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestSend").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestNumberPad").assertDoesNotExist()
composeTestRule.onNodeWithText("AMOUNT").assertDoesNotExist()
}

@Test
Expand Down Expand Up @@ -117,6 +117,7 @@ class CreatePaymentRequestScreenTest {
composeTestRule.onNodeWithTag("PaymentRequestContact${target.publicKey}").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestRecipientSearch").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestRecipientPaste", useUnmergedTree = true).assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestContactsHeader").assertDoesNotExist()
composeTestRule.onNodeWithTag("PaymentRequestSend").assertDoesNotExist()
composeTestRule.onNodeWithTag("PaymentRequestContact${target.publicKey}").performClick()
assertEquals(target, selectedTarget)
Expand All @@ -127,6 +128,43 @@ class CreatePaymentRequestScreenTest {
composeTestRule.onNodeWithText("No matching saved contact with a private connection.").assertIsDisplayed()
}

@Test
fun recipientFromInvoiceShowsContactsHeader() {
composeTestRule.setContent {
AppThemeSurface {
PaymentRequestRecipientContent(
targets = persistentListOf(target),
contacts = persistentListOf(PubkyProfile.placeholder(target.publicKey)),
onBack = {},
onPaste = { target.publicKey },
onSelected = {},
showContactsHeader = true,
)
}
}

composeTestRule.onNodeWithTag("PaymentRequestContactsHeader").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestContact${target.publicKey}").assertIsDisplayed()
}

@Test
fun detailsFromInvoiceShowsAmountLabelInsteadOfFiat() {
composeTestRule.setContent {
AppThemeSurface {
PaymentRequestDetailsContent(
initialDraft = draft,
contact = PubkyProfile.placeholder(target.publicKey),
isCreating = false,
onEditAmount = {},
onSend = {},
fromInvoiceEditor = true,
)
}
}

composeTestRule.onNodeWithText("AMOUNT").assertIsDisplayed()
}

@Test
fun sentShowsSuccessSurface() {
val contact = PubkyProfile.forDisplay(target.publicKey, "Anna", imageUrl = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,34 @@ class PaymentRequestsScreenTest {
composeTestRule.onNodeWithText("Weekly coffee").assertIsDisplayed()
}

@Test
fun listShowsIncomingSectionWithPayAndDismiss() {
val incoming = request(id = "incoming")

composeTestRule.setContent {
PaymentRequestsTestSurface {
PaymentRequestsContent(
requests = persistentListOf(incoming),
pending = persistentListOf(incoming),
contacts = persistentListOf(),
subscriptions = persistentListOf(),
dismissingRequestIds = persistentSetOf(),
canRequestPayment = true,
onBack = {},
onRequestPayment = {},
onPay = {},
onDismiss = { Result.success(Unit) },
onDetails = {},
)
}
}

composeTestRule.onNodeWithText("INCOMING").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestRowincoming").assertIsDisplayed()
composeTestRule.onNodeWithText("Pay").assertIsDisplayed()
composeTestRule.onNodeWithText("Dismiss").assertIsDisplayed()
}

@Test
fun historyGroupsCompletedRequestsAndKeepsActiveOutgoingRequests() {
val now = Clock.System.now()
Expand Down Expand Up @@ -151,8 +179,10 @@ class PaymentRequestsScreenTest {

composeTestRule.onNodeWithTag("PaymentRequestRowaccepted").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestRowoutgoing").assertIsDisplayed()
composeTestRule.onNodeWithText("Waiting for", substring = true).assertIsDisplayed()
composeTestRule.onNodeWithText("PAYMENT REQUESTS").assertIsDisplayed()
composeTestRule.onNodeWithText("Dinner").assertIsDisplayed()
composeTestRule.onNodeWithText("INCOMING").assertDoesNotExist()
composeTestRule.onNodeWithText("OUTGOING").assertIsDisplayed()
composeTestRule.onNodeWithText("pending").assertIsDisplayed()
composeTestRule.onNodeWithText("TODAY").assertIsDisplayed()
composeTestRule.onNodeWithTag("PaymentRequestCreate").assertIsDisplayed()
}
Expand Down
Loading
Loading