Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Extend create safe e2e test #1543

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ const DEFAULT_OWNER_ADDRESS = '0xC16Db0251654C0a72E91B190d81eAD367d2C6fED'
const OWNER_ADDRESS = '0xE297437d6b53890cbf004e401F3acc67c8b39665'

describe('Create Safe form', () => {
before(() => {
localStorage.setItem('SAFE_v2__lastWallet', JSON.stringify('E2E Wallet'))
})
it('should navigate to the form', () => {
//cy.connectE2EWallet()
cy.connectE2EWallet()

cy.visit('/welcome')

Expand All @@ -27,18 +24,40 @@ describe('Create Safe form', () => {

// Input a custom name
cy.get('input[name="name"]').type('Test safe name').should('have.value', 'Test safe name')
})

it('should allow changing the network', () => {
// Switch to a different network
cy.get('[data-cy="create-safe-select-network"]').click()
cy.contains('Ethereum').click()

// Network hint should be displayed
cy.contains('Change your wallet network').should('be.visible')
cy.contains('button', 'Next').should('be.disabled')

// Switch back to Görli
cy.get('[data-cy="create-safe-select-network"]').click()
cy.contains('li span', 'Görli').click()

cy.contains('button', 'Next').click()
})

it('should display a default owner and threshold', () => {
// Default owner
cy.get('input[name="owners.0.address"]').should('have.value', DEFAULT_OWNER_ADDRESS)
cy.get('input[name="owners.0.name"]').type('Test Owner Name').should('have.value', 'Test Owner Name')

// Default threshold
cy.get('input[name="threshold"]').should('have.value', 1)
})

it('should allow changing the owner name', () => {
cy.get('input[name="owners.0.name"]').type('Test Owner Name')
cy.contains('button', 'Back').click()
cy.contains('button', 'Next').click()
cy.get('input[name="owners.0.name"]').should('have.value', 'Test Owner Name')
})

it('should add a new owner and update threshold', () => {
// Add new owner
cy.contains('button', 'Add new owner').click()
cy.get('input[name="owners.1.address"]').should('exist')
Expand All @@ -47,14 +66,21 @@ describe('Create Safe form', () => {
// Update threshold
cy.get('input[name="threshold"]').parent().click()
cy.contains('li', '2').click()
})

it('should remove an owner and update threshold', () => {
// Remove owner
cy.get('button[aria-label="Remove owner"]').click()

// Threshold should change back to 1
cy.get('input[name="threshold"]').should('have.value', 1)

cy.contains('button', 'Next').click()
})

it('should display summary on review page', () => {
cy.contains('Test safe name')
cy.contains(OWNER_ADDRESS)
cy.contains(DEFAULT_OWNER_ADDRESS)
cy.contains('2 out of 2')
cy.contains('1 out of 1')
})
})
2 changes: 1 addition & 1 deletion src/components/new-safe/OwnerRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const OwnerRow = ({
>
{removable && (
<>
<IconButton onClick={() => remove?.(index)}>
<IconButton onClick={() => remove?.(index)} aria-label="Remove owner">
<SvgIcon component={DeleteIcon} inheritViewBox />
</IconButton>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/new-safe/create/steps/SetNameStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function SetNameStep({
/>
</Grid>
<Grid item>
<Box className={css.select}>
<Box className={css.select} data-cy="create-safe-select-network">
<NetworkSelector />
</Box>
</Grid>
Expand Down