Skip to content
Open
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
43 changes: 43 additions & 0 deletions e2e/accept-a-payment.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { expect, test } from '@playwright/test'

test('accept a payment', async ({ page }) => {
test.setTimeout(120000)

// Set up virtual authenticator via CDP
const client = await page.context().newCDPSession(page)
await client.send('WebAuthn.enable')
const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})

await page.goto('/guide/payments/accept-a-payment')

// Step 1: Sign up with passkey
const signUpButton = page.getByRole('button', { name: 'Sign up' }).first()
await expect(signUpButton).toBeVisible({ timeout: 90000 })
// Wait for page to fully initialize
await page.waitForTimeout(1000)
await signUpButton.click()

await expect(page.getByRole('button', { name: 'Sign out' }).first()).toBeVisible({
timeout: 60000,
})

// Step 2: Add funds (this is the last step - balance updates confirm receipt)
const addFundsButton = page.getByRole('button', { name: 'Add funds' }).first()
await expect(addFundsButton).toBeVisible()
await addFundsButton.click()

await expect(page.getByRole('button', { name: 'Add more funds' }).first()).toBeVisible({
timeout: 90000,
})

// Clean up
await client.send('WebAuthn.removeVirtualAuthenticator', { authenticatorId })
})
82 changes: 82 additions & 0 deletions e2e/managing-fee-liquidity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { expect, test } from '@playwright/test'

test('manage fee liquidity', async ({ page }) => {
test.setTimeout(240000)

// Set up virtual authenticator via CDP
const client = await page.context().newCDPSession(page)
await client.send('WebAuthn.enable')
const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})

await page.goto('/guide/stablecoin-dex/managing-fee-liquidity')

// Step 1: Sign up with passkey
const signUpButton = page.getByRole('button', { name: 'Sign up' }).first()
await expect(signUpButton).toBeVisible({ timeout: 90000 })
// Wait for page to fully initialize
await page.waitForTimeout(1000)
await signUpButton.click()

await expect(page.getByRole('button', { name: 'Sign out' }).first()).toBeVisible({
timeout: 60000,
})

// Step 2: Add funds
const addFundsButton = page.getByRole('button', { name: 'Add funds' }).first()
await expect(addFundsButton).toBeVisible()
await addFundsButton.click()

await expect(page.getByRole('button', { name: 'Add more funds' }).first()).toBeVisible({
timeout: 90000,
})

// Step 3: Create or load token
const nameInput = page.getByLabel('Token name').first()
await expect(nameInput).toBeVisible()
await nameInput.fill('FeeLiquidityUSD')

const symbolInput = page.getByLabel('Token symbol').first()
await expect(symbolInput).toBeVisible()
await symbolInput.fill('FEELIQ')

const deployButton = page.getByRole('button', { name: 'Deploy' }).first()
await expect(deployButton).toBeVisible()
await deployButton.click()

await expect(page.getByRole('link', { name: 'View receipt' }).first()).toBeVisible({
timeout: 90000,
})

// Step 4: Add liquidity (mint)
const addLiquidityButton = page.getByRole('button', { name: 'Add Liquidity' }).first()
await expect(addLiquidityButton).toBeVisible()
await addLiquidityButton.click()

await expect(page.getByRole('link', { name: 'View receipt' }).nth(1)).toBeVisible({
timeout: 90000,
})

// Step 5: Check pool (no action needed, pool info should be visible after adding liquidity)
// The pool data is displayed inline; just wait a moment for it to update
await page.waitForTimeout(2000)

// Step 6: Burn liquidity
const burnLiquidityButton = page.getByRole('button', { name: 'Burn Liquidity' }).first()
await expect(burnLiquidityButton).toBeVisible({ timeout: 30000 })
await burnLiquidityButton.click()

await expect(page.getByRole('link', { name: 'View receipt' }).nth(2)).toBeVisible({
timeout: 90000,
})

// Clean up
await client.send('WebAuthn.removeVirtualAuthenticator', { authenticatorId })
})
53 changes: 53 additions & 0 deletions e2e/pay-fees-in-any-stablecoin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect, test } from '@playwright/test'

test('pay fees in any stablecoin', async ({ page }) => {
test.setTimeout(120000)

// Set up virtual authenticator via CDP
const client = await page.context().newCDPSession(page)
await client.send('WebAuthn.enable')
const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})

await page.goto('/guide/payments/pay-fees-in-any-stablecoin')

// Step 1: Sign up with passkey
const signUpButton = page.getByRole('button', { name: 'Sign up' }).first()
await expect(signUpButton).toBeVisible({ timeout: 90000 })
// Wait for page to fully initialize
await page.waitForTimeout(1000)
await signUpButton.click()

await expect(page.getByRole('button', { name: 'Sign out' }).first()).toBeVisible({
timeout: 60000,
})

// Step 2: Add funds
const addFundsButton = page.getByRole('button', { name: 'Add funds' }).first()
await expect(addFundsButton).toBeVisible()
await addFundsButton.click()

await expect(page.getByRole('button', { name: 'Add more funds' }).first()).toBeVisible({
timeout: 90000,
})

// Step 3: Pay with fee token
const enterDetailsButton = page.getByRole('button', { name: 'Enter details' }).first()
await expect(enterDetailsButton).toBeVisible()
await enterDetailsButton.click()

const sendButton = page.getByRole('button', { name: 'Send' }).first()
await sendButton.click()

await expect(page.getByRole('link', { name: 'View receipt' })).toBeVisible({ timeout: 90000 })

// Clean up
await client.send('WebAuthn.removeVirtualAuthenticator', { authenticatorId })
})
65 changes: 65 additions & 0 deletions e2e/send-parallel-transactions.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { expect, test } from '@playwright/test'

test('send parallel transactions', async ({ page }) => {
test.setTimeout(120000)

// Set up virtual authenticator via CDP
const client = await page.context().newCDPSession(page)
await client.send('WebAuthn.enable')
const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})

await page.goto('/guide/payments/send-parallel-transactions')

// Step 1: Sign up with passkey
const signUpButton = page.getByRole('button', { name: 'Sign up' }).first()
await expect(signUpButton).toBeVisible({ timeout: 90000 })

// Wait a moment for the page to fully initialize
await page.waitForTimeout(1000)

await signUpButton.click()

// Wait for sign out button (indicates successful sign up)
await expect(page.getByRole('button', { name: 'Sign out' }).first()).toBeVisible({
timeout: 30000,
})

// Step 2: Add funds
const addFundsButton = page.getByRole('button', { name: 'Add funds' }).first()
await expect(addFundsButton).toBeVisible()
await addFundsButton.click()

// Wait for "Add more funds" button (indicates funds were added)
await expect(page.getByRole('button', { name: 'Add more funds' }).first()).toBeVisible({
timeout: 90000,
})

// Step 3: Send parallel payments
const enterDetailsButton = page.getByRole('button', { name: 'Enter details' }).first()
await expect(enterDetailsButton).toBeVisible()
await enterDetailsButton.click()

// Click send both payments
const sendBothButton = page.getByRole('button', { name: 'Send both payments' })
await expect(sendBothButton).toBeVisible()
await sendBothButton.click()

// Wait for both transaction receipt links
await expect(page.getByRole('link', { name: 'View receipt' }).first()).toBeVisible({
timeout: 90000,
})
await expect(page.getByRole('link', { name: 'View receipt' }).nth(1)).toBeVisible({
timeout: 90000,
})

// Clean up
await client.send('WebAuthn.removeVirtualAuthenticator', { authenticatorId })
})
53 changes: 53 additions & 0 deletions e2e/sponsor-user-fees.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect, test } from '@playwright/test'

test('sponsor user fees', async ({ page }) => {
test.setTimeout(120000)

// Set up virtual authenticator via CDP
const client = await page.context().newCDPSession(page)
await client.send('WebAuthn.enable')
const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})

await page.goto('/guide/payments/sponsor-user-fees')

// Step 1: Sign up with passkey
const signUpButton = page.getByRole('button', { name: 'Sign up' }).first()
await expect(signUpButton).toBeVisible({ timeout: 90000 })
// Wait for page to fully initialize
await page.waitForTimeout(1000)
await signUpButton.click()

await expect(page.getByRole('button', { name: 'Sign out' }).first()).toBeVisible({
timeout: 60000,
})

// Step 2: Add funds
const addFundsButton = page.getByRole('button', { name: 'Add funds' }).first()
await expect(addFundsButton).toBeVisible()
await addFundsButton.click()

await expect(page.getByRole('button', { name: 'Add more funds' }).first()).toBeVisible({
timeout: 90000,
})

// Step 3: Send sponsored payment
const enterDetailsButton = page.getByRole('button', { name: 'Enter details' }).first()
await expect(enterDetailsButton).toBeVisible()
await enterDetailsButton.click()

const sendButton = page.getByRole('button', { name: 'Send' }).first()
await sendButton.click()

await expect(page.getByRole('link', { name: 'View receipt' })).toBeVisible({ timeout: 90000 })

// Clean up
await client.send('WebAuthn.removeVirtualAuthenticator', { authenticatorId })
})
53 changes: 53 additions & 0 deletions e2e/transfer-memos.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect, test } from '@playwright/test'

test('transfer with memo', async ({ page }) => {
test.setTimeout(120000)

// Set up virtual authenticator via CDP
const client = await page.context().newCDPSession(page)
await client.send('WebAuthn.enable')
const { authenticatorId } = await client.send('WebAuthn.addVirtualAuthenticator', {
options: {
protocol: 'ctap2',
transport: 'internal',
hasResidentKey: true,
hasUserVerification: true,
isUserVerified: true,
},
})

await page.goto('/guide/payments/transfer-memos')

// Step 1: Sign up with passkey
const signUpButton = page.getByRole('button', { name: 'Sign up' }).first()
await expect(signUpButton).toBeVisible({ timeout: 90000 })
// Wait for page to fully initialize
await page.waitForTimeout(1000)
await signUpButton.click()

await expect(page.getByRole('button', { name: 'Sign out' }).first()).toBeVisible({
timeout: 60000,
})

// Step 2: Add funds
const addFundsButton = page.getByRole('button', { name: 'Add funds' }).first()
await expect(addFundsButton).toBeVisible()
await addFundsButton.click()

await expect(page.getByRole('button', { name: 'Add more funds' }).first()).toBeVisible({
timeout: 90000,
})

// Step 3: Send payment with memo
const enterDetailsButton = page.getByRole('button', { name: 'Enter details' }).first()
await expect(enterDetailsButton).toBeVisible()
await enterDetailsButton.click()

const sendButton = page.getByRole('button', { name: 'Send' }).first()
await sendButton.click()

await expect(page.getByRole('link', { name: 'View receipt' })).toBeVisible({ timeout: 90000 })

// Clean up
await client.send('WebAuthn.removeVirtualAuthenticator', { authenticatorId })
})
Loading