Skip to content

Commit

Permalink
e2e: update confirm tag
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBigBoss committed Jul 21, 2024
1 parent 2a9727b commit 77fdeb6
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import debug from 'debug'
import { parseEther } from 'viem'
import { getAuthSessionFromContext } from './fixtures/auth'
import { test as checkoutTest, expect } from './fixtures/checkout'
import { pricing } from 'app/data/sendtags'
import { pricing, price } from 'app/data/sendtags'

let log: debug.Debugger

Expand Down Expand Up @@ -44,7 +44,9 @@ test('can visit checkout page', async ({ page, checkoutPage }) => {
})

test('can add a pending tag', async ({ checkoutPage }) => {
const tagName = `${faker.lorem.word()}_${test.info().parallelIndex}`
const tagName = `${faker.lorem.word({
length: { min: 1, max: 16 },
})}_${test.info().parallelIndex}`
await checkoutPage.addPendingTag(tagName)
await expect(checkoutPage.page.getByLabel(`Pending Sendtag ${tagName}`)).toBeVisible()
})
Expand All @@ -58,7 +60,7 @@ test('cannot add an invalid tag name', async ({ checkoutPage }) => {

test('can confirm a tag', async ({ checkoutPage, supabase, user: { profile: myProfile } }) => {
// test.setTimeout(60_000) // 60 seconds
const tagName = `012345_${test.info().parallelIndex}` // ensure price is .002 ETH
const tagName = faker.string.alphanumeric({ length: { min: 1, max: 20 } })
await checkoutPage.addPendingTag(tagName)
await expect(checkoutPage.page.getByLabel(`Pending Sendtag ${tagName}`)).toBeVisible()
await checkoutPage.confirmTags(expect)
Expand All @@ -74,20 +76,20 @@ test('can confirm a tag', async ({ checkoutPage, supabase, user: { profile: myPr
const { data, error: activityError } = await supabase
.from('activity_feed')
.select('*')
.eq('event_name', 'tag_receipts')
.eq('event_name', 'tag_receipt_usdc')
expect(activityError).toBeFalsy()
expect(data).toHaveLength(1)
expect((data?.[0]?.data as { tags: string[] })?.tags).toEqual([tagName])

const receiptEvent = {
event_name: 'tag_receipts',
event_name: 'tag_receipt_usdc',
from_user: {
id: myProfile.id,
send_id: myProfile.send_id,
},
data: {
tags: [tagName],
value: parseEther('0.002').toString(),
value: price(tagName.length).toString(),
},
}
await expect(supabase).toHaveEventInActivityFeed(receiptEvent)
Expand Down

0 comments on commit 77fdeb6

Please sign in to comment.