Skip to content
Merged
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
13 changes: 7 additions & 6 deletions test/helpers/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,12 @@ export async function addContact({
pubky,
save = true,
firstContact = false,
waitToastToDisappear: waitToDisappear = driver.isIOS,
}: {
pubky: string;
save?: boolean;
firstContact?: boolean;
waitToastToDisappear?: boolean;
}): Promise<void> {
await openContacts();
await sleep(500);
Expand Down Expand Up @@ -184,7 +186,7 @@ export async function addContact({
await tap('AddContactAdd');
await elementById('AddContactSave').waitForDisplayed();
await tap('AddContactSave');
await waitForToast('ContactSavedToast', { waitToDisappear: driver.isIOS });
await waitForToast('ContactSavedToast', { waitToDisappear });
await elementById('ContactsAddButton').waitForDisplayed();
}

Expand Down Expand Up @@ -213,11 +215,10 @@ export async function verifyAddContactRoute(
}

await elementById('AddContactSave').waitForDisplayed();
await expect(
await elementById('AddContactPay')
.isDisplayed()
.catch(() => false)
).toBe(ableToPay);
await elementById('AddContactPay').waitForDisplayed({
reverse: !ableToPay,
timeoutMsg: `add contact ${publicKey}: expected AddContactPay ${ableToPay ? 'visible' : 'hidden'} (fixture ableToPay=${ableToPay})`,
});
}

export async function discardAddContactRoute() {
Expand Down
7 changes: 6 additions & 1 deletion test/specs/paykit.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async function switchToOnchainIfNeeded() {
}

async function payCurrentContactOnchain(amountSats: number) {
await sleep(1000);
await elementById('ContactPay').waitForDisplayed();
await tap('ContactPay');
await switchToOnchainIfNeeded();
Expand Down Expand Up @@ -88,7 +89,11 @@ describe('@pubky @paykit - Public payments', () => {
});
await discardAddContactRoute();

await addContact({ pubky: savedPaykitContact.pubky, firstContact: true });
await addContact({
pubky: savedPaykitContact.pubky,
firstContact: true,
waitToastToDisappear: true,
});
await verifyContactRowDisplayed(savedPaykitContact.pubky);
await tap(`Contact_${savedPaykitContact.pubky}`);

Expand Down