Skip to content

Commit

Permalink
Merge branch 'main' into fet-1613
Browse files Browse the repository at this point in the history
  • Loading branch information
sugh01 authored Sep 22, 2024
2 parents 4db64b0 + 3ab9ce5 commit ee5b490
Show file tree
Hide file tree
Showing 52 changed files with 1,388 additions and 517 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/knip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
steps:
- uses: actions/checkout@v3

Expand Down
1 change: 0 additions & 1 deletion deploy/00_deploy_multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { existsSync, mkdirSync } from 'fs'
import { readFile, writeFile } from 'fs/promises'
import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import fetch from 'node-fetch-commonjs'
import { resolve } from 'path'

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
Expand Down
File renamed without changes.
83 changes: 46 additions & 37 deletions e2e/specs/stateless/extendNames.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/* eslint-disable no-await-in-loop */
import { expect } from '@playwright/test'

import { dateToDateInput, roundDurationWithDay, secondsToDateInput } from '@app/utils/date'
import {
dateToDateInput,
roundDurationWithDay,
secondsFromDateDiff,
secondsToDateInput,
} from '@app/utils/date'
import { daysToSeconds } from '@app/utils/time'

import { test } from '../../../playwright'
Expand Down Expand Up @@ -353,14 +358,14 @@ test('should be able to extend a name by a month', async ({
})

await test.step('should set and render a date properly', async () => {
const expiryTime = (await profilePage.getExpiryTimestamp()) / 1000
const expiryTimestamp = await profilePage.getExpiryTimestamp()
const expiryTime = expiryTimestamp / 1000
const calendar = page.getByTestId('calendar')
const monthLater = await page.evaluate(
(ts) => {
return new Date(ts)
},
(expiryTime + daysToSeconds(31)) * 1000,
)
const monthLater = await page.evaluate((ts) => {
const expiryDate = new Date(ts)
expiryDate.setMonth(expiryDate.getMonth() + 1)
return expiryDate
}, expiryTimestamp)

await calendar.fill(dateToDateInput(monthLater))
await expect(page.getByTestId('calendar-date')).toHaveValue(
Expand All @@ -372,7 +377,7 @@ test('should be able to extend a name by a month', async ({
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0003')
await expect(extendNamesModal.getInvoiceTransactionFee).toContainText('0.0001')
await expect(extendNamesModal.getInvoiceTotal).toContainText('0.0004')
await expect(page.getByText('1 month extension', { exact: true })).toBeVisible()
await expect(page.getByText(/1 month .* extension/)).toBeVisible()
})

await test.step('should extend', async () => {
Expand All @@ -381,7 +386,9 @@ test('should be able to extend a name by a month', async ({
await transactionModal.autoComplete()

const newTimestamp = await profilePage.getExpiryTimestamp()
const comparativeTimestamp = timestamp + daysToSeconds(31) * 1000
const comparativeTimestamp =
timestamp +
secondsFromDateDiff({ startDate: new Date(timestamp), additionalMonths: 1 }) * 1000
await expect(comparativeTimestamp).toEqual(newTimestamp)
})
})
Expand Down Expand Up @@ -416,18 +423,18 @@ test('should be able to extend a name by a day', async ({
})

await test.step('should set and render a date properly', async () => {
const expiryTime = (await profilePage.getExpiryTimestamp()) / 1000
const expiryTimestamp = await profilePage.getExpiryTimestamp()
const expiryTime = expiryTimestamp / 1000
const calendar = page.getByTestId('calendar')
const monthLater = await page.evaluate(
(ts) => {
return new Date(ts)
},
(expiryTime + daysToSeconds(1)) * 1000,
)
const dayLater = await page.evaluate((ts) => {
const expiryDate = new Date(ts)
expiryDate.setDate(expiryDate.getDate() + 1)
return expiryDate
}, expiryTimestamp)

await calendar.fill(dateToDateInput(monthLater))
await calendar.fill(dateToDateInput(dayLater))
await expect(page.getByTestId('calendar-date')).toHaveValue(
secondsToDateInput(expiryTime + roundDurationWithDay(monthLater, expiryTime)),
secondsToDateInput(expiryTime + roundDurationWithDay(dayLater, expiryTime)),
)
})

Expand Down Expand Up @@ -497,14 +504,14 @@ test('should be able to extend a name in grace period by a month', async ({
})

await test.step('should set and render a date properly', async () => {
const expiryTime = (await profilePage.getExpiryTimestamp()) / 1000
const expiryTimestamp = await profilePage.getExpiryTimestamp()
const expiryTime = expiryTimestamp / 1000
const calendar = page.getByTestId('calendar')
const monthLater = await page.evaluate(
(ts) => {
return new Date(ts)
},
(expiryTime + daysToSeconds(31)) * 1000,
)
const monthLater = await page.evaluate((ts) => {
const expiryDate = new Date(ts)
expiryDate.setMonth(expiryDate.getMonth() + 1)
return expiryDate
}, expiryTimestamp)

await calendar.fill(dateToDateInput(monthLater))
await expect(page.getByTestId('calendar-date')).toHaveValue(
Expand All @@ -516,7 +523,7 @@ test('should be able to extend a name in grace period by a month', async ({
await expect(extendNamesModal.getInvoiceExtensionFee).toContainText('0.0003')
await expect(extendNamesModal.getInvoiceTransactionFee).toContainText('0.0001')
await expect(extendNamesModal.getInvoiceTotal).toContainText('0.0004')
await expect(page.getByText('1 month extension', { exact: true })).toBeVisible()
await expect(page.getByText(/1 month .* extension/)).toBeVisible()
})

await test.step('should extend', async () => {
Expand All @@ -525,7 +532,9 @@ test('should be able to extend a name in grace period by a month', async ({
await transactionModal.autoComplete()

const newTimestamp = await profilePage.getExpiryTimestamp()
const comparativeTimestamp = timestamp + daysToSeconds(31) * 1000
const comparativeTimestamp =
timestamp +
secondsFromDateDiff({ startDate: new Date(timestamp), additionalMonths: 1 }) * 1000
await expect(comparativeTimestamp).toEqual(newTimestamp)
})
})
Expand Down Expand Up @@ -578,18 +587,18 @@ test('should be able to extend a name in grace period by 1 day', async ({
})

await test.step('should set and render a date properly', async () => {
const expiryTime = (await profilePage.getExpiryTimestamp()) / 1000
const expiryTimestamp = await profilePage.getExpiryTimestamp()
const expiryTime = expiryTimestamp / 1000
const calendar = page.getByTestId('calendar')
const monthLater = await page.evaluate(
(ts) => {
return new Date(ts)
},
(expiryTime + daysToSeconds(1)) * 1000,
)
const dayLater = await page.evaluate((ts) => {
const expiryDate = new Date(ts)
expiryDate.setDate(expiryDate.getDate() + 1)
return expiryDate
}, expiryTimestamp)

await calendar.fill(dateToDateInput(monthLater))
await calendar.fill(dateToDateInput(dayLater))
await expect(page.getByTestId('calendar-date')).toHaveValue(
secondsToDateInput(expiryTime + roundDurationWithDay(monthLater, expiryTime)),
secondsToDateInput(expiryTime + roundDurationWithDay(dayLater, expiryTime)),
)
})

Expand Down
30 changes: 30 additions & 0 deletions e2e/specs/stateless/profileEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,36 @@ test.describe('profile', () => {
await expect(profilePage.record('text', 'email')).toHaveText('[email protected]')
await expect(profilePage.contentHash()).toContainText('ipfs://bafybeic...')
})

test('should redirect to profile tab if tab specified in query string does not exist', async ({
page,
login,
makeName,
makePageObject,
}) => {
const name = await makeName({
label: 'profile',
type: 'legacy',
records: await makeRecords(),
})

const profilePage = makePageObject('ProfilePage')

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

await page.goto(`/${name}?tab=customTab`)

await expect(page).toHaveURL(`/${name}`)

await page.pause()
await expect(profilePage.record('text', 'description')).toHaveText('Hello2')
await expect(profilePage.record('text', 'url')).toHaveText('twitter.com')
await expect(profilePage.record('address', 'btc')).toHaveText('bc1qj...pwa6n')
await expect(profilePage.record('address', 'etcLegacy')).toHaveText('etcLegacy0x3C4...293BC')
await expect(profilePage.record('text', 'email')).toHaveText('[email protected]')
await expect(profilePage.contentHash()).toContainText('ipfs://bafybeic...')
})
})

test.describe('migrations', () => {
Expand Down
Loading

0 comments on commit ee5b490

Please sign in to comment.