diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index 600be56..f40e612 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -502,9 +502,9 @@ export async function pasteIOSText(testId: string, text: string) { export async function typeText(testId: string, text: string) { const el = await elementById(testId); await el.waitForDisplayed(); - await sleep(500); // Allow time for the element to settle + await sleep(1000); // Allow time for the element to settle await el.clearValue(); - await sleep(500); // Allow time for the clear action to propagate + await sleep(1000); // Allow time for the clear action to propagate await el.setValue(text); } @@ -1241,9 +1241,8 @@ export type ToastId = | 'InsufficientSavingsToast' | 'ProfilePubkyCopiedToast' | 'ProfileUpdatedToast' - | 'ContactSavedToast' - | 'ContactUpdatedToast' | 'ContactDeletedToast' + | 'ContactUpdatedToast' | 'SendAmountExceededToast'; /** Wait for a toast by test id. Prefer `waitToDisappear` for iOS: success toasts live in a separate diff --git a/test/helpers/hardware-wallet.ts b/test/helpers/hardware-wallet.ts index 00efacb..f7339ba 100644 --- a/test/helpers/hardware-wallet.ts +++ b/test/helpers/hardware-wallet.ts @@ -150,7 +150,6 @@ export async function renameHardwareWalletFromSettings(currentLabel: string, new }); await expectHardwareWalletInSettings(newLabel, { visible: true }); await expectHardwareWalletInSettings(currentLabel, { visible: false }); - } export async function expectHardwareSuggestion({ visible }: { visible: boolean }) { @@ -333,4 +332,3 @@ async function dismissSpendingBalanceToastIfShown() { console.info('→ SpendingBalanceReadyToast not shown after hardware transfer.'); } } - diff --git a/test/helpers/profile.ts b/test/helpers/profile.ts index 977c154..ba91820 100644 --- a/test/helpers/profile.ts +++ b/test/helpers/profile.ts @@ -67,7 +67,7 @@ export async function cleanupProfile(label: string) { await deleteProfile(); console.info(`Cleaned up Pubky profile for ${label}`); } catch (error) { - console.warn(`Could not cleanup Pubky profile for ${label}:`, error); + console.error(`Could not cleanup Pubky profile for ${label}:`, error); } } @@ -151,12 +151,10 @@ export async function addContact({ pubky, save = true, firstContact = false, - waitToastToDisappear: waitToDisappear = driver.isIOS, }: { pubky: string; save?: boolean; firstContact?: boolean; - waitToastToDisappear?: boolean; }): Promise { await openContacts(); await sleep(500); @@ -186,8 +184,14 @@ export async function addContact({ await tap('AddContactAdd'); await elementById('AddContactSave').waitForDisplayed(); await tap('AddContactSave'); - await waitForToast('ContactSavedToast', { waitToDisappear }); - await elementById('ContactsAddButton').waitForDisplayed(); + // Landing on contact details screen + await elementById('ContactViewName').waitForDisplayed(); + await elementById('ContactPay').waitForDisplayed(); + await elementById('ContactActivity').waitForDisplayed(); + await elementById('ContactCopy').waitForDisplayed(); + await elementById('ContactShare').waitForDisplayed(); + await elementById('ContactDelete').waitForDisplayed(); + await elementById('ContactAddTag').waitForDisplayed(); } export async function verifyAddContactRoute( @@ -221,11 +225,6 @@ export async function verifyAddContactRoute( }); } -export async function discardAddContactRoute() { - await elementById('AddContactDiscard').waitForDisplayed(); - await tap('AddContactDiscard'); -} - /** Opens Contacts and waits for a row with test id `Contact_`. */ export async function verifyContactRowDisplayed(publicKey: string) { await openContacts(); diff --git a/test/specs/hardware-wallet.e2e.ts b/test/specs/hardware-wallet.e2e.ts index 5f285f3..26fd195 100644 --- a/test/specs/hardware-wallet.e2e.ts +++ b/test/specs/hardware-wallet.e2e.ts @@ -52,21 +52,24 @@ describe('@hardware_wallet - Hardware Wallet', () => { stopTrezorEmulator(); }); - ciIt('@hardware_wallet_1 - Can connect, rename, show, and remove a Trezor emulator wallet', async () => { - await expectHardwareSuggestion({ visible: true }); - await startHardwareWalletFlowFromSuggestion(); - await completeHardwareWalletFlow(walletLabel); - await expectHardwareSuggestion({ visible: false }); - await openHardwareWalletSettings(); - await expectHardwareWalletInSettings(walletLabel, { visible: true }); - await expectHardwareWalletOnHome(walletLabel, { visible: true }); - await openHardwareWalletSettings(); - await renameHardwareWalletFromSettings(walletLabel, renamedWalletLabel); - await expectHardwareWalletOnHome(renamedWalletLabel, { visible: true }); - await removeHardwareWalletFromSettings(renamedWalletLabel); - await expectHardwareWalletInSettings(renamedWalletLabel, { visible: false }); - await expectHardwareWalletOnHome(renamedWalletLabel, { visible: false }); - }); + ciIt( + '@hardware_wallet_1 - Can connect, rename, show, and remove a Trezor emulator wallet', + async () => { + await expectHardwareSuggestion({ visible: true }); + await startHardwareWalletFlowFromSuggestion(); + await completeHardwareWalletFlow(walletLabel); + await expectHardwareSuggestion({ visible: false }); + await openHardwareWalletSettings(); + await expectHardwareWalletInSettings(walletLabel, { visible: true }); + await expectHardwareWalletOnHome(walletLabel, { visible: true }); + await openHardwareWalletSettings(); + await renameHardwareWalletFromSettings(walletLabel, renamedWalletLabel); + await expectHardwareWalletOnHome(renamedWalletLabel, { visible: true }); + await removeHardwareWalletFromSettings(renamedWalletLabel); + await expectHardwareWalletInSettings(renamedWalletLabel, { visible: false }); + await expectHardwareWalletOnHome(renamedWalletLabel, { visible: false }); + } + ); ciIt('@hardware_wallet_2 - Can receive onchain funds to hardware wallet', async () => { const sats = 15_000; diff --git a/test/specs/paykit.e2e.ts b/test/specs/paykit.e2e.ts index d107acf..0190ab6 100644 --- a/test/specs/paykit.e2e.ts +++ b/test/specs/paykit.e2e.ts @@ -17,7 +17,6 @@ import { addContact, cleanupProfile, createProfile, - discardAddContactRoute, verifyAddContactRoute, verifyContactRowDisplayed, } from '../helpers/profile'; @@ -81,7 +80,7 @@ describe('@pubky @paykit - Public payments', () => { await verifyAddContactRoute(unsavedPaykitContact.pubky, { ableToPay: unsavedPaykitContact.ableToPay, }); - await discardAddContactRoute(); + await doNavigationClose(); await enterAddressViaScanPrompt(unsavedPaykitContact.pubky, { acceptCameraPermission: false, @@ -89,12 +88,11 @@ describe('@pubky @paykit - Public payments', () => { await verifyAddContactRoute(unsavedPaykitContact.pubky, { ableToPay: unsavedPaykitContact.ableToPay, }); - await discardAddContactRoute(); + await doNavigationClose(); await addContact({ pubky: savedPaykitContact.pubky, firstContact: true, - waitToastToDisappear: true, }); await verifyContactRowDisplayed(savedPaykitContact.pubky); await tap(`Contact_${savedPaykitContact.pubky}`); diff --git a/test/specs/pubky-profile.e2e.ts b/test/specs/pubky-profile.e2e.ts index 858d885..10e5160 100644 --- a/test/specs/pubky-profile.e2e.ts +++ b/test/specs/pubky-profile.e2e.ts @@ -24,7 +24,6 @@ import { cleanupProfile, deleteContact, deleteProfile, - discardAddContactRoute, openEditProfile, readPubkyFromProfileCopy, removeEditProfileLinkAt, @@ -199,7 +198,7 @@ describe('@pubky @pubky_profile - Pubky profile', () => { await verifyAddContactRoute(firstStagingContact.pubky, { ableToPay: firstStagingContact.ableToPay, }); - await discardAddContactRoute(); + await doNavigationClose(); // route unsaved pubky from QR scanner prompt await enterAddressViaScanPrompt(firstStagingContact.pubky, { @@ -208,7 +207,7 @@ describe('@pubky @pubky_profile - Pubky profile', () => { await verifyAddContactRoute(firstStagingContact.pubky, { ableToPay: firstStagingContact.ableToPay, }); - await discardAddContactRoute(); + await doNavigationClose(); // add valid contacts for (const [i, stagingContact] of STAGING_TEST_CONTACTS.entries()) { @@ -251,6 +250,7 @@ describe('@pubky @pubky_profile - Pubky profile', () => { try { // Wallet A: create and customize profile, then capture seed. + console.log('Wallet A: create and customize profile, then capture seed.'); const { pubky: pubkyA } = await createProfile({ name: 'Alice Wallet A' }); currentWallet = 'A'; await updateMyProfile(detailsA); @@ -258,6 +258,9 @@ describe('@pubky @pubky_profile - Pubky profile', () => { seedA = await getSeed(); // Wallet B: fresh install + onboarding, create profile, then add wallet A as contact. + console.log( + 'Wallet B: fresh install + onboarding, create profile, then add wallet A as contact.' + ); await reinstallApp(); currentWallet = null; await completeOnboarding(); @@ -278,10 +281,16 @@ describe('@pubky @pubky_profile - Pubky profile', () => { await updateContactProfile({ pubky: pubkyA, details: detailsAUpdated }); await verifyContactDetails({ pubky: pubkyA, details: detailsAUpdated }); - await cleanupProfile('@pubky_profile_4 wallet B'); - currentWallet = null; + // temp: turn on after fix + // https://github.com/synonymdev/bitkit-android/pull/1108 + // https://github.com/synonymdev/bitkit-ios/pull/640 + // await deleteProfile(); + // currentWallet = null; // Restore wallet A and verify wallet A profile is unchanged by wallet B contact edits. + console.log( + 'Wallet A: restore wallet A and verify wallet A profile is unchanged by wallet B contact edits.' + ); await restoreWallet(seedA); await enablePaykitUi(); currentWallet = 'A'; @@ -297,7 +306,7 @@ describe('@pubky @pubky_profile - Pubky profile', () => { await enablePaykitUi(); await cleanupProfile('@pubky_profile_4 wallet A'); } catch (error) { - console.warn('Could not restore and cleanup wallet A profile:', error); + console.error('Could not restore and cleanup wallet A profile:', error); } } }