Skip to content

Commit

Permalink
Merge branch 'main' into feat/FET-1611-track-users-through-dns-import…
Browse files Browse the repository at this point in the history
…ing-flow
  • Loading branch information
storywithoutend committed Oct 28, 2024
2 parents ee21c1d + 0332869 commit 27845ac
Show file tree
Hide file tree
Showing 61 changed files with 2,012 additions and 650 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/pages-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ jobs:
SITEMAP_GRAPH_KEY: ${{ secrets.SITEMAP_GRAPH_KEY }}

- name: Publish
uses: cloudflare/pages-action@v1
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ens-app-v3
directory: out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: '3'
wranglerVersion: 'v3.57.1'
command: pages deploy --project-name=ens-app-v3
secrets: |
GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Submit sitemap
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ have developed a design system in order to ensure consistent styling across the
Pages folder has basic route layout and basic react needed for rendering pages. These
files should be kept relatively simple

Components that pages consume are kept in the components folder. This folder has a strucutre
that mimicks the strucutre of the pages folder. If a component is only used on a specific page
Components that pages consume are kept in the components folder. This folder has a structure
that mimics the structure of the pages folder. If a component is only used on a specific page
then it goes into the corresponding folder in the components folder.

If a component is used across multiple pages and other components,
Expand Down Expand Up @@ -254,7 +254,7 @@ Once exited, you can commit the data to your branch. You do not need to run a se

#### Stateless vs Stateful

Our e2e tests are split into two categories, stateless and stateful. Stateless test use the development environment, are faster, and is the general recommended way to write integration tests. Occasionally, you may need to test a feature that requires an external api or service. In this case, you can use the stateful tests. These tests are slower,
Our e2e tests are split into two categories, stateless and stateful. Stateless test use the development environment, are faster, and is the general recommended way to write integration tests. Occasionally, you may need to test a feature that requires an external API or service. In this case, you can use the stateful tests. These tests are slower,

#### Running the tests

Expand Down
7 changes: 1 addition & 6 deletions e2e/specs/stateless/box.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,7 @@ test('should not direct to the registration page if name is not available', asyn
const name = 'google.box'

await consoleListener.initialize({
regex: new RegExp(
`Event triggered on local development.*?(${[
'search_selected_box',
'register_started_box',
].join('|')})`,
),
regex: /Event triggered on local development.*?search_selected_box/,
})

const homePage = makePageObject('HomePage')
Expand Down
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()
})
144 changes: 104 additions & 40 deletions e2e/specs/stateless/extendNames.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ test('should be able to register multiple names on the address page', async ({
subgraph,
makePageObject,
makeName,
time,
}) => {
// Generating names in not neccessary but we want to make sure that there are names to extend
await makeName([
Expand All @@ -39,7 +40,6 @@ test('should be able to register multiple names on the address page', async ({

await addresPage.goto(address)
await login.connect()
await page.pause()

await addresPage.selectToggle.click()

Expand All @@ -65,29 +65,44 @@ 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 page.pause()
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()

await expect(page.getByText('Your "Extend names" transaction was successful')).toBeVisible({
timeout: 10000,
})
await subgraph.sync()

// Should be able to remove this after useQuery is fixed. Using to force a refetch.
await time.increaseTime({ seconds: 15 })
await page.reload()
await page.waitForTimeout(3000)
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 expect(await addresPage.getTimestamp(name)).not.toBe(timestampDict[name])
await expect(await addresPage.getTimestamp(name)).toBe(timestampDict[name] + 31536000000 * 3)
}
Expand Down Expand Up @@ -117,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 @@ -130,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 @@ -199,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 @@ -258,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 @@ -269,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 @@ -490,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 @@ -573,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 @@ -619,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()
})
Loading

0 comments on commit 27845ac

Please sign in to comment.