Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Nov 22, 2024
1 parent 98151c5 commit 84dc70b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 68 deletions.
116 changes: 58 additions & 58 deletions packages/ui/cypress/tests/setIdentity.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { landingPageNetwork, landingPageUrl } from '../fixtures/landingData'
import { landingPageNetwork } from '../fixtures/landingData'
import { setIdentityMultisigs } from '../fixtures/setIdentity/setIdentityMultisigs'
import { setIdentitySignatories } from '../fixtures/setIdentity/setIdentitySignatories'
import { multisigPage } from '../support/page-objects/multisigPage'
import { sendTxModal } from '../support/page-objects/sendTxModal'
import { topMenuItems } from '../support/page-objects/topMenuItems'
import { waitForTxRequest } from '../utils/waitForTxRequests'
// import { waitForTxRequest } from '../utils/waitForTxRequests'

describe('Set an identity', () => {
// joystream network isn't supported any more.
Expand All @@ -25,69 +25,69 @@ describe('Set an identity', () => {
sendTxModal.selectionEasySetupSetIdentity().should('not.exist')
})

it.skip('Can set an identity from the options menu', () => {
const multisigSignatoryWithoutIdentity = setIdentitySignatories[1]
cy.setupAndVisit({
url: landingPageUrl,
extensionConnectionAllowed: true,
injectExtensionWithAccounts: [multisigSignatoryWithoutIdentity]
})
multisigPage.optionsMenuButton().click()
multisigPage.setIdentityMenuOption().should('be.visible').click()
sendTxModal.sendTxTitle().should('be.visible')
sendTxModal.setIdentitySection().should('be.visible')
// it.skip('Can set an identity from the options menu', () => {
// const multisigSignatoryWithoutIdentity = setIdentitySignatories[1]
// cy.setupAndVisit({
// url: landingPageUrl,
// extensionConnectionAllowed: true,
// injectExtensionWithAccounts: [multisigSignatoryWithoutIdentity]
// })
// multisigPage.optionsMenuButton().click()
// multisigPage.setIdentityMenuOption().should('be.visible').click()
// sendTxModal.sendTxTitle().should('be.visible')
// sendTxModal.setIdentitySection().should('be.visible')

// every field is empty to start with
sendTxModal.setIdentityFieldInput('display').should('have.value', '')
sendTxModal.setIdentityFieldInput('legal').should('have.value', '')
// // every field is empty to start with
// sendTxModal.setIdentityFieldInput('display').should('have.value', '')
// sendTxModal.setIdentityFieldInput('legal').should('have.value', '')

// typing into legal with empty display should show an error
sendTxModal.setIdentityField('legal').type('le')
sendTxModal.sendTxError().should('contain', 'Display name is required')
sendTxModal.setIdentityFieldElement('display', 'label').should('have.class', 'Mui-error')
sendTxModal.setIdentityFieldElement('display', 'div').should('have.class', 'Mui-error')
sendTxModal.buttonSend().should('be.disabled')
// // typing into legal with empty display should show an error
// sendTxModal.setIdentityField('legal').type('le')
// sendTxModal.sendTxError().should('contain', 'Display name is required')
// sendTxModal.setIdentityFieldElement('display', 'label').should('have.class', 'Mui-error')
// sendTxModal.setIdentityFieldElement('display', 'div').should('have.class', 'Mui-error')
// sendTxModal.buttonSend().should('be.disabled')

// typing into display should remove the error
sendTxModal.setIdentityField('display').type('diis')
sendTxModal.sendTxError().should('not.exist')
sendTxModal.setIdentityFieldElement('display', 'label').should('not.have.class', 'Mui-error')
sendTxModal.buttonSend().should('be.enabled')
// // typing into display should remove the error
// sendTxModal.setIdentityField('display').type('diis')
// sendTxModal.sendTxError().should('not.exist')
// sendTxModal.setIdentityFieldElement('display', 'label').should('not.have.class', 'Mui-error')
// sendTxModal.buttonSend().should('be.enabled')

// typing a too long field should show another error
sendTxModal.setIdentityField('legal').type('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
sendTxModal.sendTxError().should('contain', 'A field exceeds the 32 character limit')
sendTxModal.setIdentityFieldElement('legal', 'label').should('have.class', 'Mui-error')
sendTxModal.buttonSend().should('be.disabled')
// // typing a too long field should show another error
// sendTxModal.setIdentityField('legal').type('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
// sendTxModal.sendTxError().should('contain', 'A field exceeds the 32 character limit')
// sendTxModal.setIdentityFieldElement('legal', 'label').should('have.class', 'Mui-error')
// sendTxModal.buttonSend().should('be.disabled')

// too many bytes should show the From error
sendTxModal.setIdentityField('legal').type('{selectall}{del}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
sendTxModal.setIdentityFieldElement('legal', 'label').should('not.have.class', 'Mui-error')
sendTxModal.sendTxError().should('contain', `The "From" account doesn't have`)
sendTxModal.buttonSend().should('be.disabled')
// // too many bytes should show the From error
// sendTxModal.setIdentityField('legal').type('{selectall}{del}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
// sendTxModal.setIdentityFieldElement('legal', 'label').should('not.have.class', 'Mui-error')
// sendTxModal.sendTxError().should('contain', `The "From" account doesn't have`)
// sendTxModal.buttonSend().should('be.disabled')

// removing should remove the error
sendTxModal.setIdentityField('legal').type('{selectall}{del}leeg')
sendTxModal.sendTxError().should('not.exist')
sendTxModal.setIdentityFieldElement('legal', 'label').should('not.have.class', 'Mui-error')
sendTxModal.buttonSend().should('be.enabled')
// // removing should remove the error
// sendTxModal.setIdentityField('legal').type('{selectall}{del}leeg')
// sendTxModal.sendTxError().should('not.exist')
// sendTxModal.setIdentityFieldElement('legal', 'label').should('not.have.class', 'Mui-error')
// sendTxModal.buttonSend().should('be.enabled')

// verify the tx it sends
sendTxModal.buttonSend().click()
waitForTxRequest()
cy.getTxRequests().then((req) => {
const txRequests = Object.values(req)
cy.wrap(txRequests.length).should('eq', 1)
cy.wrap(txRequests[0].payload.address).should('eq', multisigSignatoryWithoutIdentity.address)
sendTxModal.buttonSend().should('not.exist')
sendTxModal.buttonSending().should('be.visible')
// expected https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-rpc.polkadot.io#/extrinsics/decode/0x1f0102000412ad770206045069201514711dc2456908b0af226442d475d12a5334e9c4513e001901000564696973056c6565670000000000000000
cy.wrap(txRequests[0].payload.method).should(
'eq',
'0x1f0102000412ad770206045069201514711dc2456908b0af226442d475d12a5334e9c4513e001901000564696973056c6565670000000000000000'
)
})
})
// // verify the tx it sends
// sendTxModal.buttonSend().click()
// waitForTxRequest()
// cy.getTxRequests().then((req) => {
// const txRequests = Object.values(req)
// cy.wrap(txRequests.length).should('eq', 1)
// cy.wrap(txRequests[0].payload.address).should('eq', multisigSignatoryWithoutIdentity.address)
// sendTxModal.buttonSend().should('not.exist')
// sendTxModal.buttonSending().should('be.visible')
// // expected https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-rpc.polkadot.io#/extrinsics/decode/0x1f0102000412ad770206045069201514711dc2456908b0af226442d475d12a5334e9c4513e001901000564696973056c6565670000000000000000
// cy.wrap(txRequests[0].payload.method).should(
// 'eq',
// '0x1f0102000412ad770206045069201514711dc2456908b0af226442d475d12a5334e9c4513e001901000564696973056c6565670000000000000000'
// )
// })
// })

// skipping since identity now needs to be handled with the associatedppl chain
it.skip('Can edit an identity from the new tx button', () => {
Expand Down
18 changes: 10 additions & 8 deletions packages/ui/src/components/library/Autocomplete.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { Autocomplete as AutocompleteMui, Box, Popper } from '@mui/material'
import {
AutocompleteFreeSoloValueMapping,
Autocomplete as AutocompleteMui,
Box,
FilterOptionsState,
Popper
} from '@mui/material'
import React from 'react'
import { styled } from '@mui/material/styles'
import {
AutocompleteInputChangeReason,
AutocompleteRenderInputParams,
AutocompleteRenderOptionState
AutocompleteRenderOptionState,
AutocompleteValue
} from '@mui/material/Autocomplete/Autocomplete'
import { HiOutlineChevronDown } from 'react-icons/hi2'
import {
AutocompleteFreeSoloValueMapping,
AutocompleteInputChangeReason,
AutocompleteValue,
FilterOptionsState
} from '@mui/base/useAutocomplete/useAutocomplete'
import { theme } from '../../styles/theme'

interface AutocompleteProps<T, Multiple, DisableClearable, FreeSolo> {
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/components/select/OptionMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface OptionMenuProps {
const OptionMenuItem = ({ keyValue, children, ...props }: OptionMenuProps) => (
<BoxStyled
key={keyValue}
component="li"
{...props}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ export const theme = createTheme({
red: 'firebrick'
}
}
} as ThemeOptions)
} as Omit<ThemeOptions, 'components'>)

0 comments on commit 84dc70b

Please sign in to comment.