Skip to content

Commit

Permalink
Merge branch 'dev' into feat/wrapped-subname-tags
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB committed Feb 15, 2023
2 parents 1c73298 + c888f48 commit e08e23b
Show file tree
Hide file tree
Showing 19 changed files with 693 additions and 432 deletions.
76 changes: 72 additions & 4 deletions e2e/specs/stateless/05_permissions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,23 @@ describe('Permissions', () => {
cy.visit('/sub.wrapped.eth')
cy.findByTestId('permissions-tab').click()
cy.findByTestId('banner-parent-not-locked').click()
cy.url().should('contain', '/wrapped.eth').should('contain', 'tab=permissions')
})

it('should allow owner to revoke permissions', () => {
cy.visit('/wrapped.eth')

// Create subname button should be visible
cy.findByTestId('subnames-tab').click()
cy.findByTestId('add-subname-action').should('be.visible')

// Edit resolver and send button should be disabled
cy.findByTestId('more-tab').click()
cy.findByTestId('send-name-button').should('be.visible')
cy.findByTestId('edit-resolver-button').should('be.visible')

// Parent Status
cy.findByTestId('permissions-tab').click()
cy.findByTestId('owner-can-change-permissions').should('be.visible')

// Permissions
Expand Down Expand Up @@ -47,9 +60,40 @@ describe('Permissions', () => {
cy.findByTestId('burned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('burned-CANNOT_SET_TTL').should('be.visible')

// Create subname button should be disabled
cy.findByTestId('subnames-tab').click()
cy.findByTestId('add-subname-disabled-button').should('be.visible')

// Edit resolver and send button should be disabled
cy.findByTestId('more-tab').click()
cy.findByTestId('send-name-disabled-button').should('be.visible')
cy.findByTestId('set-resolver-disabled-button').should('be.visible')
})

it('should show correct buttons for managing subname', () => {
acceptMetamaskAccess(2)
cy.visit('/sub.wrapped.eth')
// Parent owner settings
cy.findByTestId('profile-action-Delete subname').should('be.visible')
cy.findByTestId('subnames-tab').click()
cy.findByTestId('add-subname-action').should('not.exist')
cy.findByTestId('more-tab').click()
cy.findByTestId('send-name-button').should('be.visible')
cy.findByTestId('edit-resolver-button').should('not.exist')
// Name owner settings
acceptMetamaskAccess(1)
cy.visit('/sub.wrapped.eth')
cy.findByTestId('profile-tab').click()
cy.findByTestId('profile-action-Delete subname').should('be.visible')
cy.findByTestId('subnames-tab').click()
cy.findByTestId('add-subname-action').should('be.visible')
cy.findByTestId('more-tab').click()
cy.findByTestId('send-name-button').should('be.visible')
cy.findByTestId('edit-resolver-button').should('be.visible')
})

it('should allow parent owner to extend expiry', () => {
acceptMetamaskAccess(2)
cy.visit('/sub.wrapped.eth')
cy.findByTestId('permissions-tab').click()

Expand Down Expand Up @@ -93,6 +137,7 @@ describe('Permissions', () => {
})

it('should allow parent owner to burn pcc', () => {
acceptMetamaskAccess(2)
cy.visit('/sub.wrapped.eth')
cy.findByTestId('permissions-tab').click()

Expand Down Expand Up @@ -156,7 +201,7 @@ describe('Permissions', () => {

cy.findByTestId('button-revoke-permissions').click()
cy.findByTestId('permissions-next-button').click()
const fuses = ['CANNOT_CREATE_SUBDOMAIN', 'CANNOT_TRANSFER']
const fuses = ['CANNOT_CREATE_SUBDOMAIN', 'CANNOT_TRANSFER', 'CANNOT_SET_RESOLVER']
for (const fuse of fuses) {
cy.findByTestId(`checkbox-${fuse}`).click()
}
Expand All @@ -175,12 +220,13 @@ describe('Permissions', () => {
cy.findByTestId('burned-CANNOT_UNWRAP').should('be.visible')
cy.findByTestId('burned-CANNOT_CREATE_SUBDOMAIN').should('be.visible')
cy.findByTestId('burned-CANNOT_TRANSFER').should('be.visible')
cy.findByTestId('unburned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('burned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('unburned-CANNOT_SET_TTL').should('be.visible')

})

it('should allow name owner to revoke change fuses', () => {
acceptMetamaskAccess(1)
cy.visit('/sub.wrapped.eth')
cy.findByTestId('permissions-tab').click()

Expand All @@ -193,7 +239,7 @@ describe('Permissions', () => {
cy.findByTestId('burned-CANNOT_UNWRAP').should('be.visible')
cy.findByTestId('burned-CANNOT_CREATE_SUBDOMAIN').should('be.visible')
cy.findByTestId('burned-CANNOT_TRANSFER').should('be.visible')
cy.findByTestId('unburned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('burned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('unburned-CANNOT_SET_TTL').should('be.visible')

cy.findByTestId('button-revoke-change-fuses').click()
Expand All @@ -216,7 +262,7 @@ describe('Permissions', () => {
cy.findByTestId('burned-CANNOT_UNWRAP').should('be.visible')
cy.findByTestId('burned-CANNOT_CREATE_SUBDOMAIN').should('be.visible')
cy.findByTestId('burned-CANNOT_TRANSFER').should('be.visible')
cy.findByTestId('unburned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('burned-CANNOT_SET_RESOLVER').should('be.visible')
cy.findByTestId('unburned-CANNOT_SET_TTL').should('be.visible')

// Button should disappear
Expand All @@ -226,4 +272,26 @@ describe('Permissions', () => {
cy.findByTestId('button-revoke-permissions-disabled').should('be.visible')
})

it('should show correct buttons for managing subname', () => {
acceptMetamaskAccess(2)
cy.visit('/sub.wrapped.eth')
// Parent owner settings
cy.findByTestId('profile-action-Delete subname').should('not.exist')
cy.findByTestId('subnames-tab').click()
cy.findByTestId('add-subname-action').should('not.exist')
cy.findByTestId('more-tab').click()
cy.findByTestId('send-name-button').should('not.exist')
cy.findByTestId('edit-resolver-button').should('not.exist')
// Name owner settings
acceptMetamaskAccess(1)
cy.visit('/sub.wrapped.eth')
cy.findByTestId('profile-tab').click()
cy.findByTestId('delete-subname-disabled-button').should('be.visible')
cy.findByTestId('subnames-tab').click()
cy.findByTestId('add-subname-disabled-button').should('be.visible')
cy.findByTestId('more-tab').click()
cy.findByTestId('send-name-disabled-button').should('be.visible')
cy.findByTestId('set-resolver-disabled-button').should('be.visible')
})

})
6 changes: 3 additions & 3 deletions e2e/specs/stateless/11_sendFlow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('Send Flow', () => {
acceptMetamaskAccess(2)
cy.visit('/test.wrapped.eth')
cy.findByTestId('more-tab').click()
cy.findByTestId('button-send-ownership').click()
cy.findByTestId('send-name-button').click()
cy.findByText('Make manager').should('be.visible')
cy.findByTestId('dogfood').type('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266')
cy.findByText('Next').click()
Expand Down Expand Up @@ -165,14 +165,14 @@ describe('Send Flow', () => {
acceptMetamaskAccess(2)
cy.visit('/legacy.wrapped.eth')
cy.findByTestId('more-tab').click()
cy.findByTestId('button-send-ownership').should('not.exist')
cy.findByTestId('send-name-button').should('not.exist')
})

it('should allow name owner to transfer', () => {
acceptMetamaskAccess(1)
cy.visit('/legacy.wrapped.eth')
cy.findByTestId('more-tab').click()
cy.findByTestId('button-send-ownership').click()
cy.findByTestId('send-name-button').click()
cy.findByText('Make owner').should('be.visible')
cy.findByTestId('dogfood').type('0x70997970C51812dc3A010C7d01b50e0d17dc79C8')
cy.findByText('Next').click()
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@ensdomains/ens-validation": "^0.1.0",
"@ensdomains/ensjs": "3.0.0-alpha.47",
"@ensdomains/eth-ens-namehash": "^2.0.15",
"@ensdomains/thorin": "0.6.25-alpha-2",
"@ensdomains/thorin": "0.6.28",
"@ethersproject/abi": "^5.6.4",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
Expand Down Expand Up @@ -114,7 +114,6 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^3.14.1",
"@cloudflare/wrangler": "^1.19.12",
"@deploysentinel/cypress-debugger": "^0.5.5",
"@ensdomains/buffer": "^0.1.0",
"@ensdomains/ens-test-env": "^0.3.7",
Expand Down Expand Up @@ -193,7 +192,7 @@
"typescript": "^4.8.2",
"typescript-styled-plugin": "^0.18.2",
"wait-on": "^6.0.1",
"wrangler": "^2.0.27",
"wrangler": "0.0.0-ff35b9d1",
"yalc": "^1.0.0-pre.53"
},
"pnpm": {
Expand Down
Loading

0 comments on commit e08e23b

Please sign in to comment.