-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dentity-integration
- Loading branch information
Showing
97 changed files
with
3,689 additions
and
1,134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.