Commit c365a5ec authored by Moody Salem's avatar Moody Salem Committed by GitHub

Add some integration tests (#743)

parent ee92df15
describe('Landing Page', () => {
beforeEach(() => cy.visit('/'))
it('loads exchange page', () => {
cy.get('#exchangePage')
})
it('redirects to url /swap', () => {
cy.url().should('include', '/swap')
})
it('allows navigation to send', () => {
cy.get('#send-navLink').click()
cy.url().should('include', '/send')
})
it('allows navigation to pool', () => {
cy.get('#pool-navLink').click()
cy.url().should('include', '/pool')
})
})
describe('Pool', () => {
beforeEach(() => cy.visit('/pool'))
it('can search for a pool', () => {
cy.get('#join-pool-button').click()
cy.get('#token-search-input').type('DAI')
})
it.skip('can import a pool', () => {
cy.get('#join-pool-button').click()
cy.get('#import-pool-link').click() // blocked by the grid element in the search box
cy.url().should('include', '/find')
})
})
describe('Send', () => {
beforeEach(() => cy.visit('/send'))
it('can enter an amount into input', () => {
cy.get('#sending-no-swap-input').type('0.001')
})
})
describe('Homepage', () => { describe('Swap', () => {
beforeEach(() => cy.visit('/')) beforeEach(() => cy.visit('/swap'))
it('loads exchange page', () => {
cy.get('#exchangePage')
})
it('has url /swap', () => {
cy.url().should('include', '/swap')
})
it('can enter an amount into input', () => { it('can enter an amount into input', () => {
cy.get('#swapInputField').type('0.001') cy.get('#swapInputField').type('0.001')
}) })
......
...@@ -147,7 +147,7 @@ export default function AdvancedSettings({ ...@@ -147,7 +147,7 @@ export default function AdvancedSettings({
parseCustomInput(val) parseCustomInput(val)
setActiveIndex(SLIPPAGE_INDEX[4]) setActiveIndex(SLIPPAGE_INDEX[4])
}} }}
placeHolder="Custom" placeholder="Custom"
onClick={() => { onClick={() => {
setActiveIndex(SLIPPAGE_INDEX[4]) setActiveIndex(SLIPPAGE_INDEX[4])
if (slippageInput) { if (slippageInput) {
......
...@@ -997,7 +997,11 @@ function ExchangePage({ sendingInput = false, history, params }: ExchangePagePro ...@@ -997,7 +997,11 @@ function ExchangePage({ sendingInput = false, history, params }: ExchangePagePro
Max Max
</MaxButton> </MaxButton>
)} )}
<StyledNumerical value={formattedAmounts[Field.INPUT]} onUserInput={val => onUserInput(Field.INPUT, val)} /> <StyledNumerical
id="sending-no-swap-input"
value={formattedAmounts[Field.INPUT]}
onUserInput={val => onUserInput(Field.INPUT, val)}
/>
<CurrencyInputPanel <CurrencyInputPanel
field={Field.INPUT} field={Field.INPUT}
value={formattedAmounts[Field.INPUT]} value={formattedAmounts[Field.INPUT]}
......
...@@ -142,7 +142,12 @@ function NavigationTabs({ location: { pathname }, history }: RouteComponentProps ...@@ -142,7 +142,12 @@ function NavigationTabs({ location: { pathname }, history }: RouteComponentProps
) : ( ) : (
<Tabs> <Tabs>
{tabOrder.map(({ path, textKey, regex }) => ( {tabOrder.map(({ path, textKey, regex }) => (
<StyledNavLink key={path} to={path} isActive={(_, { pathname }) => !!pathname.match(regex)}> <StyledNavLink
id={`${textKey}-navLink`}
key={path}
to={path}
isActive={(_, { pathname }) => !!pathname.match(regex)}
>
{t(textKey)} {t(textKey)}
</StyledNavLink> </StyledNavLink>
))} ))}
......
...@@ -48,16 +48,15 @@ function escapeRegExp(string: string): string { ...@@ -48,16 +48,15 @@ function escapeRegExp(string: string): string {
export const Input = React.memo(function InnerInput({ export const Input = React.memo(function InnerInput({
value, value,
onUserInput, onUserInput,
placeHolder, placeholder,
...rest ...rest
}: { }: {
value: string | number value: string | number
onUserInput: (string) => void onUserInput: (string) => void
placeHolder?: string error?: boolean
fontSize?: string
align?: 'right' | 'left' align?: 'right' | 'left'
id?: string } & Omit<React.HTMLProps<HTMLInputElement>, 'ref' | 'onChange' | 'as'>) {
onClick?: () => void
}) {
const enforcer = (nextUserInput: string) => { const enforcer = (nextUserInput: string) => {
if (nextUserInput === '' || inputRegex.test(escapeRegExp(nextUserInput))) { if (nextUserInput === '' || inputRegex.test(escapeRegExp(nextUserInput))) {
onUserInput(nextUserInput) onUserInput(nextUserInput)
...@@ -78,7 +77,7 @@ export const Input = React.memo(function InnerInput({ ...@@ -78,7 +77,7 @@ export const Input = React.memo(function InnerInput({
autoCorrect="off" autoCorrect="off"
// text-specific options // text-specific options
type="text" type="text"
placeholder={placeHolder || '0.0'} placeholder={placeholder || '0.0'}
minLength={1} minLength={1}
maxLength={79} maxLength={79}
spellCheck="false" spellCheck="false"
......
...@@ -596,6 +596,7 @@ function SearchModal({ ...@@ -596,6 +596,7 @@ function SearchModal({
</RowBetween> </RowBetween>
<Input <Input
type={'text'} type={'text'}
id="token-search-input"
placeholder={t('tokenSearchPlaceholder')} placeholder={t('tokenSearchPlaceholder')}
value={searchQuery} value={searchQuery}
ref={inputRef} ref={inputRef}
......
...@@ -64,6 +64,7 @@ function Supply({ history }: RouteComponentProps) { ...@@ -64,6 +64,7 @@ function Supply({ history }: RouteComponentProps) {
return ( return (
<AutoColumn gap="lg" justify="center"> <AutoColumn gap="lg" justify="center">
<ButtonPrimary <ButtonPrimary
id="join-pool-button"
padding="16px" padding="16px"
onClick={() => { onClick={() => {
setShowPoolSearch(true) setShowPoolSearch(true)
...@@ -95,6 +96,7 @@ function Supply({ history }: RouteComponentProps) { ...@@ -95,6 +96,7 @@ function Supply({ history }: RouteComponentProps) {
<Text textAlign="center" style={{ padding: '.5rem 0 .5rem 0' }}> <Text textAlign="center" style={{ padding: '.5rem 0 .5rem 0' }}>
{filteredExchangeList?.length !== 0 ? `Don't see a pool you joined? ` : 'Already joined a pool? '}{' '} {filteredExchangeList?.length !== 0 ? `Don't see a pool you joined? ` : 'Already joined a pool? '}{' '}
<Link <Link
id="import-pool-link"
onClick={() => { onClick={() => {
history.push('/find') history.push('/find')
}} }}
......
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