Skip to content

Commit

Permalink
add delete subnames aftereach for mynames.spec
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Sep 2, 2024
1 parent c44e2a7 commit 1d001eb
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions e2e/specs/stateless/myNames.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { afterEach } from 'node:test'

import { expect, Locator, Page } from '@playwright/test'
import { createAccounts } from '@root/playwright/fixtures/accounts'
import {
testClient,
waitForTransaction,
Expand All @@ -7,11 +10,31 @@ import {
import { deleteSubnameFixture } from '@root/playwright/fixtures/makeName/generators/deleteSubname'
import { WrappedSubname } from '@root/playwright/fixtures/makeName/generators/generateWrappedSubname'
import { Address } from 'viem'
import { beforeAll } from 'vitest'
import { afterAll, beforeAll } from 'vitest'

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

import { test } from '../../../playwright'
import { Name } from '../../../playwright/fixtures/makeName'

// Set the tests as serial so that cleaning up data will not affect other tests
test.describe.configure({ mode: 'serial' })

let tempSubnames: string[] = []
test.afterEach(async () => {
console.log('Cleaning up temp subnames')
for (const subname of tempSubnames) {
console.log(`Deleting subname: ${subname}`)
// eslint-disable-next-line no-await-in-loop
await deleteSubname(walletClient, {
name: subname,
contract: 'nameWrapper',
account: createAccounts().getAddress('user3') as Address,
})
}
tempSubnames = []
})

test('myNames', async ({ page, login, makeName }) => {
await testClient.increaseTime({ seconds: 3 * 365 * 24 * 60 * 60 })
await testClient.mine({ blocks: 1 })
Expand Down Expand Up @@ -541,12 +564,18 @@ test('Should display all expiry data (30 same expiry, subnames)', async ({
},
]

await makeName(tempNames)
const names = await makeName(tempNames)

tempSubnames = names.flatMap((name, i) => {
const subnames = i === 0 ? temp : temp2
return subnames.map(({ label }) => `${label}.${name}`)
})

await page.goto('/')
await login.connect('user3')
await page.goto('/my/names')

await page.pause()
await page.waitForSelector('[data-testid="names-list"]')

const nameLinks = page.locator('[data-testid="names-list"] div div a')
Expand Down

0 comments on commit 1d001eb

Please sign in to comment.