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