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

FET-1481 - Fixing format function #796

Merged
merged 40 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e62ab07
started implementation of new duration text function based on date
Jul 31, 2024
8be72cb
changing additional formatduration functions to the new format functi…
Aug 1, 2024
8cbe958
fixing minor implementation and updating playwright tests as well as …
Aug 5, 2024
10ea3bb
fixing minor issues with duration
Aug 5, 2024
74e9bfa
Merge branch 'main' into fix/FET-1481
Aug 5, 2024
39fdf52
checking to make sure current time is valid
Aug 5, 2024
cd27950
fixing year calculation to be more accurate
Aug 5, 2024
3c569dc
removing unused constant
Aug 5, 2024
4252933
increase shard count
storywithoutend Aug 6, 2024
72100e5
fix e2e tests
storywithoutend Aug 6, 2024
e437cc0
revert adding shard to e2e tests
storywithoutend Aug 6, 2024
be85bd6
fix e2e tests
storywithoutend Aug 6, 2024
1c45c80
fix more tests
storywithoutend Aug 6, 2024
8582842
Update registerName.spec.ts
storywithoutend Aug 6, 2024
653b714
adding console log to e2e tests
storywithoutend Aug 6, 2024
96553a2
increase shards
storywithoutend Aug 6, 2024
ac07577
removing unused variables
Aug 7, 2024
bac9c55
Merge branch 'main' into fix/FET-1481
Aug 7, 2024
6dbbda3
test browser
storywithoutend Aug 7, 2024
6721810
more logs
storywithoutend Aug 7, 2024
c0df0e7
removing un-needed function and tests, simplified duration function a…
Aug 7, 2024
447f81b
modified registerName tests with dates to match the way dates are don…
Aug 7, 2024
bbcec4e
adding logic to set the right day if increased by months
Aug 7, 2024
5b06dcb
fixing month calculation
Aug 7, 2024
98255c4
fixing issue with getting last day of the new month
Aug 7, 2024
ad57458
being more general in the date duration
Aug 7, 2024
89d5a34
fixing minor bug with date calculation
Aug 7, 2024
2fa7768
increase shards
storywithoutend Aug 8, 2024
d6f5fbe
Update test.yaml
storywithoutend Aug 8, 2024
3f419a4
Update test.yaml
storywithoutend Aug 8, 2024
f674d5f
test adding even more shards
storywithoutend Aug 10, 2024
8744cca
move importName tests to front
storywithoutend Aug 10, 2024
3d33b68
removing console logs that was used to test out issue
Aug 12, 2024
06d2a2a
Merge pull request #800 from ensdomains/fix/FET-1481-tests
yeewiz Aug 13, 2024
72f305b
Merge branch 'main' into fix/FET-1481
Aug 13, 2024
b0f4796
Merge branch 'main' into fix/FET-1481
storywithoutend Aug 29, 2024
2b4ab85
clean up duration function
storywithoutend Sep 3, 2024
0e0e2e5
Merge branch 'main' into fix/FET-1481
storywithoutend Sep 3, 2024
bc5960b
sync dependencies
storywithoutend Sep 3, 2024
43b68f0
simplify e2e tests dealing with durationType date
storywithoutend Sep 3, 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
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
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
Loading
Loading