Skip to content

Commit

Permalink
Update message test, change name function start dns import and reduce…
Browse files Browse the repository at this point in the history
… case tracker event in useEventTracker
  • Loading branch information
nhohb committed Sep 25, 2024
1 parent d3d68ff commit 112a529
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
16 changes: 8 additions & 8 deletions e2e/specs/stateless/_importName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP
await page.locator(`[data-testid="search-result-name"]`, { hasText: 'Not Imported' }).waitFor()
await homePage.searchInput.press('Enter')

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

await expect(consoleEvents[0]).toContain(
Expand All @@ -58,7 +58,7 @@ 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 tracking event: import_type_selected_dns', async () => {
await test.step('should fire DNS import tracking event: import_type_selected_dns', async () => {
await expect(consoleEvents).toHaveLength(1)

await expect(consoleEvents[0]).toContain(
Expand All @@ -79,7 +79,7 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP

await importPage.nextButton.click()

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

await expect(consoleEvents[0]).toContain(
Expand All @@ -93,7 +93,7 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP

await transactionModal.confirm()

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

await expect(consoleEvents[0]).toContain(
Expand All @@ -112,7 +112,7 @@ test('should allow claim (owned by user)', async ({ page, login, accounts, makeP
// should allow finalising
await importPage.nextButton.click()

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

await expect(consoleEvents[0]).toContain(
Expand All @@ -127,7 +127,7 @@ 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 tracking event: register_wallet_opened_dns', async () => {
await test.step('should fire DNS import tracking event: register_wallet_opened_dns', async () => {
await expect(consoleEvents).toHaveLength(1)

await expect(consoleEvents[0]).toContain(
Expand Down Expand Up @@ -163,7 +163,7 @@ test('should allow import (not owned by user)', async ({ page, login, makePageOb
await page.locator(`[data-testid="search-result-name"]`, { hasText: 'Not Imported' }).waitFor()
await homePage.searchInput.press('Enter')

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

await expect(consoleEvents[0]).toContain(
Expand All @@ -185,7 +185,7 @@ 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 tracking event: import_type_selected_dns', async () => {
await test.step('should fire DNS import tracking event: import_type_selected_dns', async () => {
await expect(consoleEvents).toHaveLength(1)

await expect(consoleEvents[0]).toContain(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const VerifyOnchainOwnership = ({
return tc(`error.${errorKey}`, { ns: 'dnssec' })
}, [tc, error, isLoading])

const handleDNSButtonClick = () => {
const handleStartDNSImport = () => {
dispatch({ name: 'increaseStep', selected })

trackEvent({
Expand Down Expand Up @@ -170,7 +170,7 @@ export const VerifyOnchainOwnership = ({
{isConnected ? (
<DnsImportActionButton
disabled={!dnsOwner || isLoading || isRefetching || isError}
onClick={handleDNSButtonClick}
onClick={handleStartDNSImport}
data-testid="import-next-button"
{...(dnsOwnerStatus === 'mismatching'
? {
Expand Down
19 changes: 5 additions & 14 deletions src/hooks/useEventTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export const useEventTracker = () => {
'register_started',
'register_started_box',
'register_wallet_opened',
'verify_ownership_started_dns',
'claim_domain_started_dns',
'commit_wallet_opened_dns',
'register_started_dns',
'register_wallet_opened_dns',
),
},
({ eventName }) => sendTrackEvent(eventName, chain),
Expand All @@ -100,20 +105,6 @@ export const useEventTracker = () => {
sendTrackEvent(eventName, chain, { name, importType })
},
)
.with(
{
eventName: P.union(
'verify_ownership_started_dns',
'claim_domain_started_dns',
'commit_wallet_opened_dns',
'register_started_dns',
'register_wallet_opened_dns',
),
},
({ eventName }) => {
sendTrackEvent(eventName, chain)
},
)
.exhaustive()
}

Expand Down

0 comments on commit 112a529

Please sign in to comment.