diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml index c6b59983a1..99b2a3472f 100644 --- a/.github/workflows/build/action.yml +++ b/.github/workflows/build/action.yml @@ -10,6 +10,10 @@ inputs: description: 'Production build flag' required: false + e2e_mnemonic: + description: 'Mnemonic for the E2E tests' + required: false + runs: using: 'composite' steps: @@ -30,3 +34,4 @@ runs: NEXT_PUBLIC_TENDERLY_PROJECT_NAME: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_PROJECT_NAME }} NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_TENDERLY_SIMULATE_ENDPOINT_URL }} NEXT_PUBLIC_WC_BRIDGE: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_WC_BRIDGE }} + NEXT_PUBLIC_CYPRESS_MNEMONIC: ${{ inputs.e2e_mnemonic }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e05f34acab..9ac7334dfd 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -24,6 +24,7 @@ jobs: - uses: ./.github/workflows/build with: secrets: ${{ toJSON(secrets) }} + e2e_mnemonic: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }} - name: Serve run: yarn serve & @@ -36,4 +37,3 @@ jobs: config: baseUrl=http://localhost:8080 env: CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - CYPRESS_MNEMONIC: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }} diff --git a/.github/workflows/safe-apps-e2e.yml b/.github/workflows/safe-apps-e2e.yml index 7132b67665..c4806f5933 100644 --- a/.github/workflows/safe-apps-e2e.yml +++ b/.github/workflows/safe-apps-e2e.yml @@ -25,6 +25,7 @@ jobs: - uses: ./.github/workflows/build with: secrets: ${{ toJSON(secrets) }} + e2e_mnemonic: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }} - name: Serve run: yarn serve & @@ -38,4 +39,3 @@ jobs: env: CYPRESS_PROJECT_ID: okn21k CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_SAFE_APPS_RECORD_KEY }} - CYPRESS_MNEMONIC: ${{ secrets.NEXT_PUBLIC_CYPRESS_MNEMONIC }} diff --git a/cypress.config.js b/cypress.config.js index c9b4ca0c65..99f648738f 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -4,10 +4,6 @@ export default defineConfig({ projectId: 'exhdra', trashAssetsBeforeRuns: true, - env: { - CYPRESS_MNEMONIC: process.env.CYPRESS_MNEMONIC, - }, - retries: { runMode: 2, openMode: 0, diff --git a/cypress/e2e/create_safe.cy.js b/cypress/e2e/create_safe.cy.js index 6af277060d..cf0d83f4b7 100644 --- a/cypress/e2e/create_safe.cy.js +++ b/cypress/e2e/create_safe.cy.js @@ -8,24 +8,16 @@ describe('Create Safe', () => { cy.contains('button', 'Accept all').click() // Ensure wallet is connected to correct chain via header - cy.contains('E2E Wallet @ Rinkeby') + cy.contains('E2E Wallet @ Görli') cy.contains('Create new Safe').click() - // Connect wallet & select network - cy.contains('Continue').click() - // Name cy.wait(1000) // Wait for form default values to populate - cy.contains('button', 'Continue').click() + cy.contains('button', 'Next').click() // Owners and confirmations cy.wait(1000) // Wait for form default values to populate - cy.contains('button', 'Continue').click() - - // Review - cy.wait(1000) // Not sure why without this ends with "Transaction underpriced" - cy.contains('button', 'Create').click() - cy.contains('Your Safe was successfully created!', { timeout: 60000 }) + cy.contains('button', 'Next').click() }) }) diff --git a/cypress/e2e/smoke/create_safe_form.cy.js b/cypress/e2e/smoke/create_safe_form.cy.js new file mode 100644 index 0000000000..650abe49dc --- /dev/null +++ b/cypress/e2e/smoke/create_safe_form.cy.js @@ -0,0 +1,60 @@ +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.visit('/welcome') + + // Close cookie banner + cy.contains('button', 'Accept all').click() + + // Ensure wallet is connected to correct chain via header + cy.contains('E2E Wallet @ Görli') + + cy.contains('Create new Safe').click() + }) + + it('should allow setting a name', () => { + // Name input should have a placeholder ending in 'goerli-safe' + cy.get('input[name="name"]') + .should('have.attr', 'placeholder') + .should('match', /g(ö|oe)rli-safe/) + + // Input a custom name + cy.get('input[name="name"]').type('Test safe name').should('have.value', 'Test safe name') + + 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) + + // Add new owner + cy.contains('button', 'Add new owner').click() + cy.get('input[name="owners.1.address"]').should('exist') + cy.get('input[name="owners.1.address"]').type(OWNER_ADDRESS) + + // Update threshold + cy.get('input[name="threshold"]').parent().click() + cy.contains('li', '2').click() + + 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') + }) +})