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 Oct 21, 2024
2 parents ed8b7e9 + 9442642 commit 5a123f1
Show file tree
Hide file tree
Showing 27 changed files with 868 additions and 320 deletions.
47 changes: 46 additions & 1 deletion e2e/specs/stateless/createSubname.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,19 @@ test('should allow creating a subname', async ({ page, makeName, login, makePage
await login.connect()

await subnamesPage.getAddSubnameButton.click()
await subnamesPage.getAddSubnameInput.type('test')
await subnamesPage.getAddSubnameInput.fill('test')
await subnamesPage.getSubmitSubnameButton.click()
await subnamesPage.addMoreToProfileButton.click()
await page.getByTestId('profile-record-option-name').click()
await page.getByTestId('add-profile-records-button').click()
await page.getByTestId('profile-record-input-input-name').fill('Test Name')
await subnamesPage.getSubmitSubnameProfileButton.click()

const transactionModal = makePageObject('TransactionModal')
await transactionModal.autoComplete()

const subname = `test.${name}`
await subnamesPage.goto(subname)

await expect(page).toHaveURL(new RegExp(`/${subname}`), { timeout: 15000 })
})
Expand Down Expand Up @@ -150,6 +156,7 @@ test('should allow creating a subnames if the user is the wrapped owner', async
await subnamesPage.getAddSubnameButton.click()
await subnamesPage.getAddSubnameInput.fill('test')
await subnamesPage.getSubmitSubnameButton.click()
await subnamesPage.getSubmitSubnameProfileButton.click()

const transactionModal = makePageObject('TransactionModal')
await transactionModal.autoComplete()
Expand Down Expand Up @@ -226,6 +233,7 @@ test('should allow creating an expired wrapped subname', async ({
await subnamesPage.getAddSubnameButton.click()
await subnamesPage.getAddSubnameInput.fill('test')
await subnamesPage.getSubmitSubnameButton.click()
await subnamesPage.getSubmitSubnameProfileButton.click()

await transactionModal.autoComplete()

Expand All @@ -234,6 +242,7 @@ test('should allow creating an expired wrapped subname', async ({
})

test('should allow creating an expired wrapped subname from the profile page', async ({
page,
makeName,
login,
makePageObject,
Expand Down Expand Up @@ -269,7 +278,43 @@ test('should allow creating an expired wrapped subname from the profile page', a

await profilePage.getRecreateButton.click()

await page.getByTestId('reclaim-profile-next').click()

await transactionModal.autoComplete()

await expect(profilePage.getRecreateButton).toHaveCount(0)
})

test('should allow skipping records when creating a subname', async ({
page,
makeName,
login,
makePageObject,
}) => {
test.slow()
const name = await makeName({
label: 'manager-only',
type: 'legacy',
owner: 'user',
manager: 'user',
})

const subnamesPage = makePageObject('SubnamesPage')

await subnamesPage.goto(name)
await login.connect()

await subnamesPage.getAddSubnameButton.click()
await subnamesPage.getAddSubnameInput.fill('test')
await subnamesPage.getSubmitSubnameButton.click()
expect(subnamesPage.addMoreToProfileButton).toBeVisible()
await page.getByTestId('create-subname-profile-next').click()

const transactionModal = makePageObject('TransactionModal')
await transactionModal.autoComplete()

const subname = `test.${name}`

await expect(page).toHaveURL(new RegExp(`/${subname}`), { timeout: 15000 })
await expect(page.getByTestId('profile-empty-banner')).toBeVisible()
})
135 changes: 96 additions & 39 deletions e2e/specs/stateless/extendNames.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,28 @@ test('should be able to register multiple names on the address page', async ({

// warning message
await expect(page.getByText('You do not own all these names')).toBeVisible()
await page.getByRole('button', { name: 'I understand' }).click()
await page.locator('button:has-text("I understand")').click()

// name list
await addresPage.extendNamesModalNextButton.click()
await page.waitForLoadState('networkidle')
await expect(page.getByText(`Extend ${extendableNameItems.length} Names`)).toBeVisible()
page.locator('button:has-text("Next")').waitFor({ state: 'visible' })
await page.locator('button:has-text("Next")').click()

// check the invoice details
await expect(page.getByText(`Extend ${extendableNameItems.length} Names`)).toBeVisible()
await page.waitForLoadState('networkidle')
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()

// increment and save
await page.getByTestId('plus-minus-control-plus').click()
await page.getByTestId('plus-minus-control-plus').click()
await page.getByTestId('extend-names-confirm').click()
await page.waitForLoadState('networkidle')
await expect(page.getByTestId('invoice-item-0-amount')).not.toBeEmpty()
await expect(page.getByTestId('invoice-item-1-amount')).not.toBeEmpty()
await expect(page.getByTestId('invoice-total')).not.toBeEmpty()

page.locator('button:has-text("Next")').waitFor({ state: 'visible' })
await page.locator('button:has-text("Next")').click()
await page.waitForLoadState('networkidle')

await transactionModal.autoComplete()

Expand All @@ -88,13 +97,12 @@ test('should be able to register multiple names on the address page', async ({

// Should be able to remove this after useQuery is fixed. Using to force a refetch.
await time.increaseTime({ seconds: 15 })
await page.pause()
await page.reload()
await page.waitForLoadState('networkidle')
for (const name of extendableNameItems) {
const label = name.replace('.eth', '')
await addresPage.search(label)
await expect(addresPage.getNameRow(name)).toBeVisible({ timeout: 5000 })
await page.pause()
await expect(await addresPage.getTimestamp(name)).not.toBe(timestampDict[name])
await expect(await addresPage.getTimestamp(name)).toBe(timestampDict[name] + 31536000000 * 3)
}
Expand Down Expand Up @@ -124,7 +132,7 @@ test('should be able to extend a single unwrapped name from profile', async ({

const extendNamesModal = makePageObject('ExtendNamesModal')
await test.step('should show warning message', async () => {
await expect(page.getByText('You do not own this name')).toBeVisible()
await expect(page.getByText(`You do not own ${name}`)).toBeVisible()
await page.getByRole('button', { name: 'I understand' }).click()
})

Expand All @@ -137,12 +145,6 @@ test('should be able to extend a single unwrapped name from profile', async ({
})
})

await test.step('should show the cost comparison data', async () => {
await expect(page.getByTestId('year-marker-0')).toContainText('2% gas')
await expect(page.getByTestId('year-marker-1')).toContainText('1% gas')
await expect(page.getByTestId('year-marker-2')).toContainText('1% gas')
})

await test.step('should work correctly with plus minus control', async () => {
await expect(extendNamesModal.getCounterMinusButton).toBeDisabled()
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0033')
Expand Down Expand Up @@ -206,12 +208,6 @@ test('should be able to extend a single unwrapped name in grace period from prof
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
})

await test.step('should show the cost comparison data', async () => {
await expect(page.getByTestId('year-marker-0')).toContainText('2% gas')
await expect(page.getByTestId('year-marker-1')).toContainText('1% gas')
await expect(page.getByTestId('year-marker-2')).toContainText('1% gas')
})

await test.step('should work correctly with plus minus control', async () => {
await expect(extendNamesModal.getCounterMinusButton).toBeDisabled()
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0033')
Expand Down Expand Up @@ -265,7 +261,7 @@ test('should be able to extend a single unwrapped name in grace period from prof
await profilePage.getExtendButton.click()

await test.step('should show warning message', async () => {
await expect(page.getByText('You do not own this name')).toBeVisible()
await expect(page.getByText(`You do not own ${name}`)).toBeVisible()
await page.getByRole('button', { name: 'I understand' }).click()
})

Expand All @@ -276,12 +272,6 @@ test('should be able to extend a single unwrapped name in grace period from prof
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
})

await test.step('should show the cost comparison data', async () => {
await expect(page.getByTestId('year-marker-0')).toContainText('2% gas')
await expect(page.getByTestId('year-marker-1')).toContainText('1% gas')
await expect(page.getByTestId('year-marker-2')).toContainText('1% gas')
})

await test.step('should work correctly with plus minus control', async () => {
await expect(extendNamesModal.getCounterMinusButton).toBeDisabled()
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0033')
Expand Down Expand Up @@ -497,12 +487,6 @@ test('should be able to extend a name in grace period by a month', async ({
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
})

await test.step('should show the cost comparison data', async () => {
await expect(page.getByTestId('year-marker-0')).toContainText('2% gas')
await expect(page.getByTestId('year-marker-1')).toContainText('1% gas')
await expect(page.getByTestId('year-marker-2')).toContainText('1% gas')
})

await test.step('should be able to pick by date', async () => {
const dateSelection = page.getByTestId('date-selection')
await expect(dateSelection).toHaveText('Pick by date')
Expand Down Expand Up @@ -580,12 +564,6 @@ test('should be able to extend a name in grace period by 1 day', async ({
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
})

await test.step('should show the cost comparison data', async () => {
await expect(page.getByTestId('year-marker-0')).toContainText('2% gas')
await expect(page.getByTestId('year-marker-1')).toContainText('1% gas')
await expect(page.getByTestId('year-marker-2')).toContainText('1% gas')
})

await test.step('should be able to pick by date', async () => {
const dateSelection = page.getByTestId('date-selection')
await expect(dateSelection).toHaveText('Pick by date')
Expand Down Expand Up @@ -626,3 +604,82 @@ test('should be able to extend a name in grace period by 1 day', async ({
await expect(comparativeTimestamp).toEqual(newTimestamp)
})
})

test('should be able to extend a single wrapped name using deep link', async ({
page,
login,
makePageObject,
makeName,
}) => {
const name = await makeName({
label: 'legacy',
type: 'wrapped',
owner: 'user2',
})

const profilePage = makePageObject('ProfilePage')
const transactionModal = makePageObject('TransactionModal')

const homePage = makePageObject('HomePage')
await homePage.goto()
await login.connect()
await page.goto(`/${name}?renew`)

const timestamp = await profilePage.getExpiryTimestamp()

const extendNamesModal = makePageObject('ExtendNamesModal')
await test.step('should show warning message', async () => {
await expect(page.getByText(`You do not own ${name}`)).toBeVisible()
await page.getByRole('button', { name: 'I understand' }).click()
})

await test.step('should show 1 year extension', async () => {
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible({
timeout: 30000,
})
})

await test.step('should be able to add more years', async () => {
await expect(extendNamesModal.getCounterMinusButton).toBeDisabled()
await extendNamesModal.getCounterPlusButton.click()
await expect(page.getByText('2 years extension', { exact: true })).toBeVisible({
timeout: 30000,
})
})

await test.step('should be able to reduce number of years', async () => {
await extendNamesModal.getCurrencyToggle.click({ force: true })
await extendNamesModal.getCounterMinusButton.click()
})

await test.step('should extend', async () => {
await extendNamesModal.getExtendButton.click()
await transactionModal.autoComplete()
const newTimestamp = await profilePage.getExpiryTimestamp()
expect(newTimestamp).toEqual(timestamp + 31536000000)
})
})

test('should not be able to extend a name which is not registered', async ({
page,
makePageObject,
login,
}) => {
const name = 'this-name-does-not-exist.eth'
const homePage = makePageObject('HomePage')
await homePage.goto()
await login.connect()
await page.goto(`/${name}?renew`)
await expect(page.getByRole('heading', { name: `Register ${name}` })).toBeVisible()
})

test('renew deep link should redirect to registration when not logged in', async ({
page,
makePageObject,
}) => {
const name = 'this-name-does-not-exist.eth'
const homePage = makePageObject('HomePage')
await homePage.goto()
await page.goto(`/${name}?renew`)
await expect(page.getByRole('heading', { name: `Register ${name}` })).toBeVisible()
})
8 changes: 1 addition & 7 deletions e2e/specs/stateless/ownership.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ test.describe('Extend name', () => {
await ownershipPage.extendButton.click()

await test.step('should show ownership warning', async () => {
await expect(page.getByText('You do not own this name')).toBeVisible()
await expect(page.getByText(`You do not own ${name}`)).toBeVisible()
await page.getByRole('button', { name: 'I understand' }).click()
})
await test.step('should show the correct price data', async () => {
Expand All @@ -1160,12 +1160,6 @@ test.describe('Extend name', () => {
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
})

await test.step('should show the cost comparison data', async () => {
await expect(page.getByTestId('year-marker-0')).toContainText('2% gas')
await expect(page.getByTestId('year-marker-1')).toContainText('1% gas')
await expect(page.getByTestId('year-marker-2')).toContainText('1% gas')
})

await test.step('should work correctly with plus minus control', async () => {
await expect(extendNamesModal.getCounterMinusButton).toBeDisabled()
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0033')
Expand Down
Loading

0 comments on commit 5a123f1

Please sign in to comment.