Skip to content

Commit

Permalink
Merge branch 'dev' into consistent-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Jul 13, 2023
2 parents c6ca851 + 93b761e commit 7e3cbf3
Show file tree
Hide file tree
Showing 337 changed files with 8,263 additions and 6,918 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
BUCKET: s3://${{ secrets.AWS_REVIEW_BUCKET_NAME }}/walletweb/${{ steps.extract_branch.outputs.branch }}
run: bash ./scripts/github/s3_upload.sh

# Comnment
# Comment
- name: Post a deployment link in the PR
if: always() && github.event.number
uses: mshick/add-pr-comment@v2
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/create_safe.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Create Safe', () => {
cy.contains('button', 'Accept all').click()

// Ensure wallet is connected to correct chain via header
cy.contains('E2E Wallet @ Görli')
cy.contains('E2E Wallet @ Goerli')

cy.contains('Create new Safe').click()

Expand Down
18 changes: 5 additions & 13 deletions cypress/e2e/safe-apps/tx_modal.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { TEST_SAFE } from './constants'

const appUrl = 'https://safe-test-app.com'

describe('The transaction modal', () => {
before(() => {
beforeEach(() => {
cy.fixture('safe-app').then((html) => {
cy.intercept('GET', `${appUrl}/*`, html)
cy.intercept('GET', `*/manifest.json`, {
Expand All @@ -12,21 +10,15 @@ describe('The transaction modal', () => {
icons: [{ src: 'logo.svg', sizes: 'any', type: 'image/svg+xml' }],
})
})

cy.visitSafeApp(`${appUrl}/dummy`)

cy.findByText(/accept selection/i).click()
})

describe('When sending a transaction from an app', () => {
it('should show the transaction popup', { defaultCommandTimeout: 12000 }, () => {
cy.findByRole('dialog').within(() => {
cy.findByText(/sending from/i)

const testSafeParts = TEST_SAFE.split(':')
cy.visitSafeApp(`${appUrl}/dummy`)

cy.findByText(`${testSafeParts[0]}:`)
cy.findByText(testSafeParts[1])
cy.findByText(/accept selection/i).click()
cy.findByRole('dialog').within(() => {
cy.findByText(/Cypress Test App/i)
})
})
})
Expand Down
96 changes: 21 additions & 75 deletions cypress/e2e/smoke/create_tx.cy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const SAFE = 'gor:0x04f8b1EA3cBB315b87ced0E32deb5a43cC151a91'
const EOA = '0xE297437d6b53890cbf004e401F3acc67c8b39665'

// generate number between 0.00001 and 0.00020
let recommendedNonce
const sendValue = Math.floor(Math.random() * 20 + 1) / 100000
const sendValue = 0.00002
const currentNonce = 3

describe('Queue a transaction on 1/N', () => {
Expand All @@ -28,7 +26,7 @@ describe('Queue a transaction on 1/N', () => {
cy.contains('New transaction').click()

// Modal is open
cy.contains('h2', 'New transaction').should('be.visible')
cy.contains('h1', 'New transaction').should('be.visible')
cy.contains('Send tokens').click()

// Fill transaction data
Expand All @@ -50,67 +48,36 @@ describe('Queue a transaction on 1/N', () => {
.next()
.then((element) => {
const maxBalance = element.text().replace(' GOR', '').trim()
cy.wrap(element)
.parents('form')
.find('label')
.contains('Amount')
.next()
.find('input')
.should('have.value', maxBalance)
.clear()
.type(sendValue)
cy.get('input[name="amount"]').should('have.value', maxBalance)
})

cy.get('input[name="amount"]').clear().type(sendValue)

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

it('should create a queued transaction', () => {
// Wait for /estimations response
cy.intercept('POST', '/**/multisig-transactions/estimations').as('EstimationRequest')

cy.wait('@EstimationRequest')

// Alias for New transaction modal
cy.contains('h2', 'Review transaction').parents('div').as('modal')

// Estimation is loaded
cy.get('button[type="submit"]').should('not.be.disabled')

// Gets the recommended nonce
cy.contains('Signing the transaction with nonce').should(($div) => {
// get the number in the string
recommendedNonce = $div.text().match(/\d+$/)[0]
})
cy.contains('Native token transfer').should('be.visible')

// Changes nonce to next one
cy.contains('Signing the transaction with nonce').click()
cy.contains('button', 'Edit').click()
cy.get('label').contains('Safe Account transaction nonce').next().clear().type(currentNonce)
cy.contains('Confirm').click()

// Asserts the execute checkbox exists
cy.get('@modal').within(() => {
cy.get('input[type="checkbox"]')
.parent('span')
.should(($div) => {
// Turn the classList into a string
const classListString = Array.from($div[0].classList).join()
// Check if it contains the error class
expect(classListString).to.include('checked')
})
})
cy.get('input[name="nonce"]').clear().type(currentNonce, { force: true }).type('{enter}', { force: true })

// Execution
cy.contains('Yes, ').should('exist')
cy.contains('Estimated fee').should('exist')

// Asserting the sponsored info is present
cy.contains('Sponsored by').should('be.visible')
cy.contains('Execute').should('be.visible')

cy.get('span').contains('Estimated fee').next().should('have.css', 'text-decoration-line', 'line-through')
cy.contains('Transactions per hour')
cy.contains('5 of 5')

cy.contains('Estimated fee').click()
cy.contains('Edit').click()
cy.contains('Owner transaction (Execution)').parents('form').as('Paramsform')
cy.contains('Execution parameters').parents('form').as('Paramsform')

// Only gaslimit should be editable when the relayer is selected
const arrayNames = ['Wallet nonce', 'Max priority fee (Gwei)', 'Max fee (Gwei)']
Expand All @@ -125,37 +92,16 @@ describe('Queue a transaction on 1/N', () => {
.invoke('prop', 'value')
.should('equal', '300000')
cy.get('@Paramsform').find('[name="gasLimit"]').parent('div').find('[data-testid="RotateLeftIcon"]').click()
cy.contains('Confirm').click()

// Asserts the execute checkbox is uncheckable
cy.contains('Execute transaction').click()
cy.get('@modal').within(() => {
cy.get('input[type="checkbox"]')
.parent('span')
.should(($div) => {
// Turn the classList into a string
const classListString = Array.from($div[0].classList).join()
// Check if it contains the error class
expect(classListString).not.to.include('checked')
})
})

// If the checkbox is unchecked the relayer is not present
cy.get('@modal').should('not.contain', 'Sponsored by').and('not.contain', 'Transactions per hour')
cy.get('@Paramsform').submit()

cy.contains('Signing the transaction with nonce').should('exist')

// Changes back to recommended nonce
cy.contains('Signing the transaction with nonce').click()
cy.contains('Edit').click()
cy.get('button[aria-label="Reset to recommended nonce"]').click()

// Accepts the values
cy.contains('Confirm').click()
// Asserts the execute checkbox is uncheckable
cy.contains('No, only').click()

cy.get('@modal').within(() => {
cy.get('input[type="checkbox"]').should('not.exist')
})
cy.get('input[name="nonce"]')
.clear({ force: true })
.type(currentNonce + 10, { force: true })
.type('{enter}', { force: true })

cy.contains('Submit').click()
})
Expand All @@ -174,9 +120,9 @@ describe('Queue a transaction on 1/N', () => {
cy.contains('h3', 'Transaction details').should('be.visible')

// Queue label
cy.contains(`Queued - transaction with nonce ${currentNonce} needs to be executed first`).should('be.visible')
cy.contains(`needs to be executed first`).should('be.visible')

// Transaction summary
cy.contains(`${recommendedNonce}` + 'Send' + '-' + `${sendValue} GOR`).should('exist')
cy.contains('Send' + '-' + `${sendValue} GOR`).should('exist')
})
})
11 changes: 5 additions & 6 deletions cypress/e2e/smoke/nfts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,17 @@ describe('Assets > NFTs', () => {

// Modal appears
cy.contains('Send NFTs')
cy.contains('Sending 2 NFTs from')
cy.contains('Recipient address or ENS *')
cy.contains('Recipient address or ENS')
cy.contains('Selected NFTs')
cy.get('input[name="recipient"]').type('0x97d314157727D517A706B5D08507A1f9B44AaaE9')
cy.contains('button', 'Next').click()

// Review modal appears
cy.contains('Review NFT transaction')
cy.contains('Sending 2 NFTs from')
cy.contains('Send')
cy.contains('To')
cy.wait(1000)
cy.contains('Action 1')
cy.contains('Action 2')
cy.contains('1')
cy.contains('2')
cy.get('b:contains("safeTransferFrom")').should('have.length', 2)
cy.contains('button:not([disabled])', 'Submit')
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@emotion/server": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@mui/icons-material": "^5.8.4",
"@mui/material": "^5.11.10",
"@mui/material": "^5.13.5",
"@mui/x-date-pickers": "^5.0.12",
"@reduxjs/toolkit": "^1.9.5",
"@safe-global/safe-apps-sdk": "7.11.0",
Expand Down
3 changes: 3 additions & 0 deletions public/images/common/caret-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/common/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/images/common/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/common/minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/images/common/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/common/save-address.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/images/messages/created.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/images/messages/signed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/images/notifications/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions public/images/sidebar/assets.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7e3cbf3

Please sign in to comment.