Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ensdomains/ens-app-v3 into …
Browse files Browse the repository at this point in the history
…socket-optimize
  • Loading branch information
talentlessguy committed Nov 30, 2024
2 parents d72f7c0 + 3f4d56a commit 5dd7466
Show file tree
Hide file tree
Showing 50 changed files with 1,330 additions and 483 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pages-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Cloudflare Pages
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_INTERCOM_ID: re9q5yti
NEXT_PUBLIC_DRPC_KEY: ${{ github.ref == 'refs/heads/main' && AnmpasF2C0JBqeAEzxVO8aTteiMlrW4R75hpDonbV6cR || '' }}

on: [push]
jobs:
Expand Down
1 change: 0 additions & 1 deletion e2e/specs/stateful/address.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ test('should go to the address page', async ({ page, login }) => {
await page.goto('/')
await login.connect()

await page.pause()
await page
.getByPlaceholder('Search for a name')
.fill('0xFc5958B4B6F9a06D21E06429c8833f865577acf0')
Expand Down
113 changes: 111 additions & 2 deletions e2e/specs/stateless/_importName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,33 @@ import { expect } from '@playwright/test'

import { test } from '../../../playwright'

test('should allow claim (owned by user)', async ({ page, login, accounts, makePageObject }) => {
// When testing locally, reducers will be run twice because of strict mode
const strictModeEventCount = process.env.CI ? 1 : 2

test('should allow claim (owned by user)', async ({
page,
login,
accounts,
makePageObject,
consoleListener,
}) => {
console.log(strictModeEventCount)
const name = 'swagabc.xyz'
await consoleListener.initialize({
regex: new RegExp(
`Event triggered on local development.*?(${[
'search_selected_dns',
'dns_selected_import_type',
'dns_sec_enabled',
'dns_verified_ownership',
'dns_claim_started',
'dns_claimed',
'dns_approve_registrar_wallet_opened',
'dns_import_wallet_opened',
'dns_claim_wallet_opened',
].join('|')})`,
),
})

const homePage = makePageObject('HomePage')
const importPage = makePageObject('ImportPage')
Expand All @@ -14,7 +39,17 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP

// should redirect to registration page
await homePage.searchInput.fill(name)
await page.locator(`[data-testid="search-result-name"]`, { hasText: name }).waitFor()
await page.locator(`[data-testid="search-result-name"]`, { hasText: 'Not Imported' }).waitFor()
await homePage.searchInput.press('Enter')

await test.step('should fire DNS import tracking event: search_selected_dns', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)

await expect(consoleListener.getMessages().toString()).toContain('search_selected_dns')
consoleListener.clearMessages()
})

await expect(importPage.heading).toHaveText(`Claim ${name}`)

// no type should be checked yet
Expand All @@ -31,6 +66,15 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP
// should jump straight to transaction step
await expect(importPage.heading).toHaveText('Claim your domain')

await test.step('should fire DNS import tracking event: dns_selected_import_type', async () => {
await expect(consoleListener.getMessages()).toHaveLength(strictModeEventCount)

await expect(consoleListener.getMessages().toString()).toMatch(
new RegExp(`dns_selected_import_type.*?${name}`),
)
consoleListener.clearMessages()
})

// should show cost value above 0
await expect(importPage.getCost()).resolves.toBeGreaterThan(0)

Expand All @@ -39,10 +83,26 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP

await importPage.nextButton.click()

await test.step('should fire DNS import tracking event: dns_claim_started', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)

await expect(consoleListener.getMessages().toString()).toContain('dns_claim_started')
consoleListener.clearMessages()
})

// should be two steps: approve and claim
await expect(transactionModal.getStepCount()).resolves.toEqual(2)

await transactionModal.confirm()

await test.step('should fire DNS import tracking event: dns_approve_registrar_wallet_opened', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)
await expect(consoleListener.getMessages().toString()).toContain(
'dns_approve_registrar_wallet_opened',
)
consoleListener.clearMessages()
})

await transactionModal.complete()

// should save transaction status on refresh
Expand All @@ -59,6 +119,12 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP
await expect(page.getByText('Open Wallet')).toBeVisible()
await transactionModal.confirm()

await test.step('should fire DNS import tracking event: dns_claim_wallet_opened', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)
await expect(consoleListener.getMessages().toString()).toContain('dns_claim_wallet_opened')
consoleListener.clearMessages()
})

// should show complete step
await expect(page.getByText('Congratulations!')).toBeVisible()
await expect(page.getByText(`You are now the owner of ${name}`)).toBeVisible()
Expand All @@ -69,9 +135,24 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP
)
})

test('should allow import (not owned by user)', async ({ page, login, makePageObject }) => {
test('should allow import (not owned by user)', async ({
page,
login,
makePageObject,
consoleListener,
}) => {
const name = 'taytems.xyz'

await consoleListener.initialize({
regex: new RegExp(
`Event triggered on local development.*?(${[
'search_selected_dns',
'dns_selected_import_type',
'dns_verified_ownership',
].join('|')})`,
),
})

const homePage = makePageObject('HomePage')
const importPage = makePageObject('ImportPage')
const transactionModal = makePageObject('TransactionModal')
Expand All @@ -81,7 +162,19 @@ test('should allow import (not owned by user)', async ({ page, login, makePageOb

// should redirect to registration page
await homePage.searchInput.fill(name)
await page.locator(`[data-testid="search-result-name"]`, { hasText: name }).waitFor()
await page.locator(`[data-testid="search-result-name"]`, { hasText: 'Not Imported' }).waitFor()
await homePage.searchInput.press('Enter')

await test.step('should fire DNS import tracking event: search_selected_dns', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)

await expect(consoleListener.getMessages().toString()).toMatch(
new RegExp(`search_selected_dns.*?${name}`),
)
consoleListener.clearMessages()
})

await expect(importPage.heading).toHaveText(`Claim ${name}`)

// no type should be checked yet
Expand All @@ -95,6 +188,15 @@ test('should allow import (not owned by user)', async ({ page, login, makePageOb
await expect(importPage.nextButton).toBeEnabled({ timeout: 15000 })
await importPage.nextButton.click()

await test.step('should fire DNS import tracking event: dns_selected_import_type', async () => {
await expect(consoleListener.getMessages()).toHaveLength(strictModeEventCount)

await expect(consoleListener.getMessages().toString()).toMatch(
new RegExp(`dns_selected_import_type.*?${name}`),
)
consoleListener.clearMessages()
})

// should show verify ownership step with error message
await expect(importPage.heading).toHaveText('Verify Ownership')
await expect(
Expand All @@ -107,6 +209,13 @@ test('should allow import (not owned by user)', async ({ page, login, makePageOb

await importPage.nextButton.click()

await test.step('should fire DNS import tracking event: dns_verified_ownership', async () => {
await expect(consoleListener.getMessages()).toHaveLength(strictModeEventCount)

await expect(consoleListener.getMessages().toString()).toContain('dns_verified_ownership')
consoleListener.clearMessages()
})

// should go to transaction step
await expect(importPage.heading).toHaveText('Import this domain')

Expand Down
5 changes: 2 additions & 3 deletions e2e/specs/stateless/advancedEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ test('should maintain state and when returning from transaction modal when addin

await recordsPage.goto(name)
await login.connect()
await page.pause()

// Validate records
await expect(recordsPage.getRecordValue('text', 'name')).toHaveText('Bob')
Expand Down Expand Up @@ -257,7 +256,7 @@ test('should maintain state and when returning from transaction modal when addin
await transactionModal.autoComplete()

// Validate change in records
await page.pause()

await expect(recordsPage.getRecordValue('text', 'name')).toHaveText('Nick')
await expect(recordsPage.getRecordValue('text', 'another text')).toHaveText('another record')
await expect(recordsPage.getRecordValue('address', 'bnb')).toHaveText(
Expand All @@ -266,7 +265,7 @@ test('should maintain state and when returning from transaction modal when addin
await expect(recordsPage.getRecordValue('address', 'eth')).toHaveText(
'0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
)
await page.pause()

await expect(recordsPage.getRecordValue('contentHash')).toHaveText(
'bzz://e40101fa011b20d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162'.toLowerCase(),
)
Expand Down
1 change: 0 additions & 1 deletion e2e/specs/stateless/deleteSubname.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ test.describe('unwrapped', () => {

await profilePage.goto(subname)
await login.connect()
await page.pause()

// Manager button should exist
await expect(page.getByTestId('owner-profile-button-name.manager')).toBeVisible()
Expand Down
5 changes: 0 additions & 5 deletions e2e/specs/stateless/extendNames.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ test('should be able to extend a single unwrapped name in grace period from prof

const timestamp = await profilePage.getExpiryTimestamp()

await page.pause()
await profilePage.getExtendButton.click()

const extendNamesModal = makePageObject('ExtendNamesModal')
Expand Down Expand Up @@ -343,7 +342,6 @@ test('should be able to extend a name by a month', async ({
await profilePage.goto(name)
await login.connect()

await page.pause()
const timestamp = await profilePage.getExpiryTimestamp()
await profilePage.getExtendButton.click()

Expand Down Expand Up @@ -408,7 +406,6 @@ test('should be able to extend a name by a day', async ({
await profilePage.goto(name)
await login.connect()

await page.pause()
const timestamp = await profilePage.getExpiryTimestamp()
await profilePage.getExtendButton.click()

Expand Down Expand Up @@ -475,7 +472,6 @@ test('should be able to extend a name in grace period by a month', async ({

const timestamp = await profilePage.getExpiryTimestamp()

await page.pause()
await profilePage.getExtendButton.click()

const extendNamesModal = makePageObject('ExtendNamesModal')
Expand Down Expand Up @@ -552,7 +548,6 @@ test('should be able to extend a name in grace period by 1 day', async ({

const timestamp = await profilePage.getExpiryTimestamp()

await page.pause()
await profilePage.getExtendButton.click()

const extendNamesModal = makePageObject('ExtendNamesModal')
Expand Down
Loading

0 comments on commit 5dd7466

Please sign in to comment.