Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track users through DNS importing flow #884

Merged
merged 21 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7b6b949
Track DNS import flow events
nhohb Sep 23, 2024
f91839e
Merge branch 'feat/FET-1177-add-registration-tracking-events' of gith…
nhohb Sep 23, 2024
3be3354
Add e2e test for DNS import flow
nhohb Sep 24, 2024
1dd642e
Add tracker DNS follow to event open wallet and verify offchain owner…
nhohb Sep 25, 2024
87b55b3
Fix e2e test failed on import_type_selected_dns event
nhohb Sep 25, 2024
d3d68ff
Change logic function complete off chain process and function verify …
nhohb Sep 25, 2024
112a529
Update message test, change name function start dns import and reduce…
nhohb Sep 25, 2024
98fc843
Update function name complete transaction DNS import and update type …
nhohb Sep 25, 2024
5218991
Merge branch 'feat/FET-1177-add-registration-tracking-events' of gith…
nhohb Sep 26, 2024
91267ad
Update console listener event DNS tracker follow
nhohb Sep 26, 2024
e197f27
Remove variable unused and change method match to contain
nhohb Sep 26, 2024
ee21c1d
Use a regular expression literal instead of the 'RegExp' for search_s…
nhohb Sep 26, 2024
27845ac
Merge branch 'main' into feat/FET-1611-track-users-through-dns-import…
storywithoutend Oct 28, 2024
767b9c5
refactor dns claim event tracking
storywithoutend Oct 29, 2024
83af07f
update onchain import e2e test
storywithoutend Oct 29, 2024
f5a2bcf
fix onchain not owner e2e test
storywithoutend Oct 29, 2024
96746a2
clean up console logs and page pauses
storywithoutend Oct 29, 2024
cedf2a5
Merge branch 'main' into feat/FET-1611-track-users-through-dns-import…
storywithoutend Oct 29, 2024
0006c4a
remove page pause
storywithoutend Oct 29, 2024
6ef12d7
fix build errors
storywithoutend Oct 29, 2024
5bdb6c5
Merge branch 'main' into feat/FET-1611-track-users-through-dns-import…
sugh01 Nov 24, 2024
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
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

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
18 changes: 7 additions & 11 deletions e2e/specs/stateless/ownership.2LD.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from '@playwright/test'
import { test } from '../../../playwright'

test.describe('Unwrapped 2LD - Owner and Manager', () => {
test('Send feature', async ({ page, login, accounts, makeName, makePageObject }) => {
test('Send feature', async ({ login, accounts, makeName, makePageObject }) => {
const name = await makeName({
label: 'owner-manager',
type: 'legacy',
Expand Down Expand Up @@ -48,7 +48,6 @@ test.describe('Unwrapped 2LD - Owner and Manager', () => {

await transactionModal.autoComplete()

await page.pause()
await expect(ownershipPage.roleRow(accounts.getAddress('user3'))).toContainText('owner', {
timeout: 15000,
})
Expand Down Expand Up @@ -368,7 +367,6 @@ test.describe('Unwrapped 2LD - Manager Only', () => {
await ownershipPage.goto(name)
await login.connect()

await page.pause()
expect(await ownershipPage.getExpiryTimestamp()).toBeGreaterThan(0)
await expect(ownershipPage.expiryPanelRegistrationDate).toHaveCount(1)
await expect(ownershipPage.expiryPanelGracePeriod).toHaveCount(1)
Expand Down Expand Up @@ -518,7 +516,7 @@ test.describe('Wrapped and Emancipated 2LD - Owner', () => {
})

test.describe('Grace Period Unwrapped 2LD', () => {
test('Send feature', async ({ page, login, makeName, makePageObject }) => {
test('Send feature', async ({ login, makeName, makePageObject }) => {
const name = await makeName({
label: 'grace-period-unwrapped',
type: 'legacy',
Expand All @@ -538,7 +536,6 @@ test.describe('Grace Period Unwrapped 2LD', () => {
await ownershipPage.goto(name)
await login.connect()

await page.pause()
await expect(ownershipPage.sendNameButton).toHaveCount(0)
})

Expand Down Expand Up @@ -567,7 +564,7 @@ test.describe('Grace Period Unwrapped 2LD', () => {
await expect(ownershipPage.syncManagerButton).toHaveCount(0)
})

test('Edit Roles', async ({ page, login, accounts, makeName, makePageObject }) => {
test('Edit Roles', async ({ login, accounts, makeName, makePageObject }) => {
const name = await makeName({
label: 'grace-period-unwrapped',
type: 'legacy',
Expand All @@ -580,7 +577,7 @@ test.describe('Grace Period Unwrapped 2LD', () => {

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

await ownershipPage.editRolesButton.click()

await expect(editRolesModal.roleCardChangeButton('owner')).toHaveCount(0)
Expand Down Expand Up @@ -630,7 +627,7 @@ test.describe('Grace Period Unwrapped 2LD', () => {
})

test.describe('Grace Period Wrapped 2LD', () => {
test('Send feature', async ({ page, login, makeName, makePageObject }) => {
test('Send feature', async ({ login, makeName, makePageObject }) => {
const name = await makeName({
label: 'grace-period-wrapped',
type: 'wrapped',
Expand All @@ -650,7 +647,6 @@ test.describe('Grace Period Wrapped 2LD', () => {
await ownershipPage.goto(name)
await login.connect()

await page.pause()
await expect(ownershipPage.sendNameButton).toHaveCount(0)
})

Expand Down Expand Up @@ -678,7 +674,7 @@ test.describe('Grace Period Wrapped 2LD', () => {
await expect(ownershipPage.syncManagerButton).toHaveCount(0)
})

test('Edit Roles', async ({ page, login, accounts, makeName, makePageObject }) => {
test('Edit Roles', async ({ login, accounts, makeName, makePageObject }) => {
const name = await makeName({
label: 'grace-period-wrapped',
type: 'wrapped',
Expand All @@ -691,7 +687,7 @@ test.describe('Grace Period Wrapped 2LD', () => {

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

await ownershipPage.editRolesButton.click()

await expect(editRolesModal.roleCardChangeButton('owner')).toHaveCount(0)
Expand Down
Loading
Loading