Commit cb36c910 authored by Moody Salem's avatar Moody Salem

fix integration tests, update default list

parent 0a1459ee
describe('Swap', () => { describe('Swap', () => {
beforeEach(() => cy.visit('/swap')) beforeEach(() => {
cy.clearLocalStorage()
cy.visit('/swap')
})
it('list selection persists', () => { it('list selection persists', () => {
cy.get('#swap-currency-output .open-currency-select-button').click() cy.get('#swap-currency-output .open-currency-select-button').click()
cy.get('#select-default-uniswap-list .select-button').click() cy.get('#list-introduction-choose-a-list').click()
cy.get('#list-row-tokens-uniswap-eth .select-button').click()
cy.reload() cy.reload()
cy.get('#swap-currency-output .open-currency-select-button').click() cy.get('#swap-currency-output .open-currency-select-button').click()
cy.get('#select-default-uniswap-list').should('not.exist') cy.get('#list-introduction-choose-a-list').should('not.exist')
})
// for some reason local storage is not being properly cleared
it.skip('change list', () => {
cy.get('#swap-currency-output .open-currency-select-button').click()
cy.get('#list-introduction-choose-a-list').click()
cy.get('#list-row-tokens-uniswap-eth .select-button').click()
cy.get('#currency-search-selected-list-name').should('contain', 'Uniswap')
cy.get('#currency-search-change-list-button').click()
cy.get('#list-row-tokens-1inch-eth .select-button').click()
cy.get('#currency-search-selected-list-name').should('contain', '1inch')
}) })
}) })
...@@ -35,7 +35,8 @@ describe('Swap', () => { ...@@ -35,7 +35,8 @@ describe('Swap', () => {
it('can swap ETH for DAI', () => { it('can swap ETH for DAI', () => {
cy.get('#swap-currency-output .open-currency-select-button').click() cy.get('#swap-currency-output .open-currency-select-button').click()
cy.get('#select-default-uniswap-list .select-button').click() cy.get('#list-introduction-choose-a-list').click()
cy.get('#list-row-tokens-uniswap-eth .select-button').click()
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').should('be.visible') cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').should('be.visible')
cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').click({ force: true }) cy.get('.token-item-0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735').click({ force: true })
cy.get('#swap-currency-input .token-amount-input').should('be.visible') cy.get('#swap-currency-input .token-amount-input').should('be.visible')
......
...@@ -197,10 +197,14 @@ export function CurrencySearch({ ...@@ -197,10 +197,14 @@ export function CurrencySearch({
alt={`${selectedListInfo.current.name} list logo`} alt={`${selectedListInfo.current.name} list logo`}
/> />
) : null} ) : null}
<TYPE.main>{selectedListInfo.current.name}</TYPE.main> <TYPE.main id="currency-search-selected-list-name">{selectedListInfo.current.name}</TYPE.main>
</Row> </Row>
) : null} ) : null}
<LinkStyledButton style={{ fontWeight: 500, color: theme.text2, fontSize: 16 }} onClick={onChangeList}> <LinkStyledButton
style={{ fontWeight: 500, color: theme.text2, fontSize: 16 }}
onClick={onChangeList}
id="currency-search-change-list-button"
>
{selectedListInfo.current ? 'Change' : 'Select a list'} {selectedListInfo.current ? 'Change' : 'Select a list'}
</LinkStyledButton> </LinkStyledButton>
</RowBetween> </RowBetween>
......
...@@ -18,7 +18,9 @@ export default function ListIntroduction({ onSelectList }: { onSelectList: () => ...@@ -18,7 +18,9 @@ export default function ListIntroduction({ onSelectList }: { onSelectList: () =>
You can switch between lists of tokens, as well as add your own custom lists via IPFS, HTTPS and ENS.{' '} You can switch between lists of tokens, as well as add your own custom lists via IPFS, HTTPS and ENS.{' '}
<i>Start by choosing a list.</i> <i>Start by choosing a list.</i>
</Text> </Text>
<ButtonPrimary onClick={onSelectList}>Choose a list</ButtonPrimary> <ButtonPrimary onClick={onSelectList} id="list-introduction-choose-a-list">
Choose a list
</ButtonPrimary>
<OutlineCard style={{ marginBottom: '8px', padding: '1rem' }}> <OutlineCard style={{ marginBottom: '8px', padding: '1rem' }}>
<Text fontWeight={400} fontSize={14} style={{ textAlign: 'center' }}> <Text fontWeight={400} fontSize={14} style={{ textAlign: 'center' }}>
Token lists are an{' '} Token lists are an{' '}
......
...@@ -81,6 +81,10 @@ function ListOrigin({ listUrl }: { listUrl: string }) { ...@@ -81,6 +81,10 @@ function ListOrigin({ listUrl }: { listUrl: string }) {
return <>{ensName ?? host}</> return <>{ensName ?? host}</>
} }
function listUrlRowHTMLId(listUrl: string) {
return `list-row-${listUrl.replace(/\./g, '-')}`
}
const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; onBack: () => void }) { const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; onBack: () => void }) {
const listsByUrl = useSelector<AppState, AppState['lists']['byUrl']>(state => state.lists.byUrl) const listsByUrl = useSelector<AppState, AppState['lists']['byUrl']>(state => state.lists.byUrl)
const selectedListUrl = useSelectedListUrl() const selectedListUrl = useSelectedListUrl()
...@@ -143,7 +147,7 @@ const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; on ...@@ -143,7 +147,7 @@ const ListRow = memo(function ListRow({ listUrl, onBack }: { listUrl: string; on
if (!list) return null if (!list) return null
return ( return (
<Row key={listUrl} align="center" padding="16px"> <Row key={listUrl} align="center" padding="16px" id={listUrlRowHTMLId(listUrl)}>
{list.logoURI ? ( {list.logoURI ? (
<ListLogo style={{ marginRight: '1rem' }} logoURI={list.logoURI} alt={`${list.name} list logo`} /> <ListLogo style={{ marginRight: '1rem' }} logoURI={list.logoURI} alt={`${list.name} list logo`} />
) : ( ) : (
......
...@@ -2564,10 +2564,10 @@ ...@@ -2564,10 +2564,10 @@
semver "^7.3.2" semver "^7.3.2"
tsutils "^3.17.1" tsutils "^3.17.1"
"@uniswap/default-token-list@^1.3.0": "@uniswap/default-token-list@^1.3.1":
version "1.3.0" version "1.3.1"
resolved "https://registry.yarnpkg.com/@uniswap/default-token-list/-/default-token-list-1.3.0.tgz#fd40e14165b31ff098b031b58ce8ca5ab81b3247" resolved "https://registry.yarnpkg.com/@uniswap/default-token-list/-/default-token-list-1.3.1.tgz#e856aa8e7d4112fcb39229df3023af0da1727699"
integrity sha512-EsHVHVn7UgtxrhiM6tcBCXic56dTpl1WiKcIZhFyTFkA0vja7iZIJ3FYiYxT56g4hT0B9Lm7ZdBaPvEY3d1/eQ== integrity sha512-nLBSzWGxVlbKby6xtf3ph56NltMyHCk8ohFD97Wub7K0I66YyHKuhyV7NZq05unB8TEWWpYDcdghmgztSv6H8Q==
"@uniswap/lib@1.1.1": "@uniswap/lib@1.1.1":
version "1.1.1" version "1.1.1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment