Skip to content

Commit

Permalink
Merge pull request #909 from ensdomains/fix-e2e-multi-name-extension-bug
Browse files Browse the repository at this point in the history
fix extend name bugs
  • Loading branch information
sugh01 authored Nov 8, 2024
2 parents 36e6041 + 3c486bc commit 0478c78
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 131 deletions.
33 changes: 16 additions & 17 deletions e2e/specs/stateless/extendNames.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { daysToSeconds } from '@app/utils/time'

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

test('should be able to extend multiple names on the address page', async ({
test('should be able to extend multiple names (including names in grace preiod) on the address page', async ({
page,
accounts,
login,
Expand All @@ -26,11 +26,13 @@ test('should be able to extend multiple names on the address page', async ({
label: 'extend-legacy',
type: 'legacy',
owner: 'user2',
duration: -24 * 60 * 60,
},
{
label: 'wrapped',
type: 'wrapped',
owner: 'user2',
duration: -24 * 60 * 60,
},
])

Expand Down Expand Up @@ -65,31 +67,28 @@ test('should be able to extend multiple names on the address page', async ({

// warning message
await expect(page.getByText('You do not own all these names')).toBeVisible()
await page.locator('button:has-text("I understand")').click()
await page.getByTestId('extend-names-confirm').click()

// name list
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")').waitFor({ state: 'visible' })
await page.locator('button:has-text("Next")').click()

// check the invoice details
await page.waitForLoadState('networkidle')
await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
// increment and save
// TODO: Reimplement when date duration bug is fixed
// await expect(page.getByText('1 year extension', { exact: true })).toBeVisible()
await expect(page.getByTestId('plus-minus-control-label')).toHaveText('1 year')
await page.getByTestId('plus-minus-control-plus').click()
await expect(page.getByTestId('plus-minus-control-label')).toHaveText('2 years')
await page.getByTestId('plus-minus-control-plus').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 expect(page.getByTestId('plus-minus-control-label')).toHaveText('3 years')
await expect(page.getByTestId('invoice-item-0-amount')).not.toHaveText('0.0000 ETH')
await expect(page.getByTestId('invoice-item-1-amount')).not.toHaveText('0.0000 ETH')
await expect(page.getByTestId('invoice-total')).not.toHaveText('0.0000 ETH')

await page.getByTestId('extend-names-confirm').click()
await expect(transactionModal.transactionModal).toBeVisible({ timeout: 10000 })
await transactionModal.autoComplete()
await page.waitForLoadState('networkidle')

await expect(page.getByText('Your "Extend names" transaction was successful')).toBeVisible({
timeout: 10000,
Expand Down Expand Up @@ -374,7 +373,7 @@ test('should be able to extend a name by a month', async ({
await test.step('should show the correct price data', async () => {
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0003')
await expect(extendNamesModal.getInvoiceTransactionFee).toContainText('0.0001')
await expect(extendNamesModal.getInvoiceTotal).toContainText('0.0004')
await expect(extendNamesModal.getInvoiceTotal).toContainText(/0\.000[3|4]/)
await expect(page.getByText(/1 month .* extension/)).toBeVisible()
})

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/test-helpers": "^0.5.16",
"@playwright/test": "^1.48.0",
"@playwright/test": "^1.48.2",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
Expand Down
Loading

0 comments on commit 0478c78

Please sign in to comment.