Skip to content

Commit

Permalink
Merge branch 'main' into dentity-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Nov 7, 2024
2 parents 04f31f0 + 36e6041 commit ed86c8c
Show file tree
Hide file tree
Showing 97 changed files with 3,689 additions and 1,134 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
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
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
106 changes: 106 additions & 0 deletions e2e/specs/stateless/box.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { expect } from '@playwright/test'

import { setPrimaryName } from '@ensdomains/ensjs/wallet'

import { test } from '../../../playwright'
import { createAccounts } from '../../../playwright/fixtures/accounts'
import { walletClient } from '../../../playwright/fixtures/contracts/utils/addTestContracts'

test('should allow box registration with available name', async ({
page,
login,
time,
makePageObject,
consoleListener,
}) => {
const name = `box-registration-${Date.now()}.box`

await setPrimaryName(walletClient, {
name: '',
account: createAccounts().getAddress('user') as `0x${string}`,
})

const homePage = makePageObject('HomePage')

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

await time.sync(500)

await homePage.goto()
await login.connect()

await homePage.searchInput.fill(name)
await page.locator(`[data-testid="search-result-name"]`, { hasText: name }).waitFor()
await page.locator(`[data-testid="search-result-name"]`, { hasText: 'Available' }).waitFor()
await homePage.searchInput.press('Enter')

await test.step('should fire tracking event: search_selected_box', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)
await expect(consoleListener.getMessages().toString()).toMatch(
new RegExp(`search_selected_box.*?${name}`),
)
consoleListener.clearMessages()
})

await page.waitForURL(new RegExp(`/${name}/dotbox`))
await expect(page.locator(`text=${name}`).first()).toBeVisible()
await expect(page.locator('text=Available')).toBeVisible()
await expect(page.getByRole('button', { name: 'Register on my.box' })).toBeVisible()

const [newTab] = await Promise.all([
page.waitForEvent('popup'),
page.click('text=Register on my.box'),
])

await newTab.waitForLoadState()

await expect(newTab).toHaveURL(
`https://my.box/search?domain=${name.replace('.box', '')}&ref=ensdomains`,
)

await test.step('should fire tracking event: register_started_box', async () => {
await expect(consoleListener.getMessages()).toHaveLength(1)
await expect(consoleListener.getMessages().toString()).toContain('register_started_box')
consoleListener.clearMessages()
})
})

test('should not direct to the registration page if name is not available', async ({
page,
login,
makePageObject,
consoleListener,
}) => {
await setPrimaryName(walletClient, {
name: '',
account: createAccounts().getAddress('user') as `0x${string}`,
})

const name = 'google.box'

await consoleListener.initialize({
regex: /Event triggered on local development.*?search_selected_box/,
})

const homePage = makePageObject('HomePage')
await homePage.goto()
await login.connect()

await homePage.searchInput.fill(name)
await page.locator(`[data-testid="search-result-name"]`, { hasText: name }).waitFor()
await page.locator(`[data-testid="search-result-name"]`, { hasText: 'Registered' }).waitFor()
await homePage.searchInput.press('Enter')

await expect(page).toHaveURL('/')

await test.step('should not fire tracking event: search_selected_box', async () => {
await expect(consoleListener.getMessages()).toHaveLength(0)
})
})
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()
})
Loading

0 comments on commit ed86c8c

Please sign in to comment.