Skip to content

Commit

Permalink
Merge branch 'new-dawn' into feat/lock
Browse files Browse the repository at this point in the history
  • Loading branch information
drptbl authored Sep 16, 2024
2 parents f32d57b + 29efce3 commit 7e389da
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 27 deletions.
5 changes: 4 additions & 1 deletion wallets/metamask/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ export default defineConfig({
async setupNodeEvents(on, config) {
return configureSynpress(on, config)
}
}
},

defaultCommandTimeout: 12_000,
taskTimeout: 15_000
})
7 changes: 7 additions & 0 deletions wallets/metamask/src/cypress/MetaMask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ export default class MetaMask {
}

async confirmTransactionAndWaitForMining() {
await waitFor(
() =>
this.metamaskExtensionPage.locator(TransactionPage.nftApproveAllConfirmationPopup.approveButton).isVisible(),
5_000,
false
)

return this.metamaskPlaywright
.confirmTransactionAndWaitForMining()
.then(() => {
Expand Down
2 changes: 2 additions & 0 deletions wallets/metamask/test/cypress/batchTransfer.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
before(() => {
cy.switchNetwork('Anvil')

cy.get('#deployERC1155Button').click()

cy.confirmTransaction().then(() => {
Expand Down
4 changes: 0 additions & 4 deletions wallets/metamask/test/cypress/confirmSignature.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
before(() => {
cy.switchNetwork('Anvil')
})

it('should confirm `personal_sign`', () => {
cy.get('#personalSign').click()

Expand Down
8 changes: 0 additions & 8 deletions wallets/metamask/test/cypress/confirmTransaction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ const connectDeployAndMintNft = () => {
})
}

before(() => {
cy.connectToAnvil().then(() => {
cy.get('#connectButton').click()

cy.connectToDapp()
})
})

describe('with default gas setting', () => {
it('should confirm contract deployment', () => {
cy.get('#tokenAddresses').should('be.empty')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
it('should confirm contract deployment and wait for mining', () => {
cy.get('#tokenAddresses').should('be.empty')
cy.get('#createToken').click()

cy.confirmTransactionAndWaitForMining().then(() => {
cy.get('#tokenAddresses').should('include', /^0x/)
})
})

it('should confirm legacy transaction and wait for mining', () => {
cy.get('#sendButton').click()

cy.confirmTransactionAndWaitForMining()
})

it('should confirm EIP-1559 transaction and wait for mining', () => {
cy.get('#sendEIP1559Button').click()

cy.confirmTransactionAndWaitForMining().then(() => {
cy.get('#tokenAddresses').should('include', /^0x/)
})
})

it('should work correctly when calling sequentially', () => {
cy.get('#sendEIP1559Button').click()
cy.confirmTransactionAndWaitForMining().then(() => {
cy.get('#sendEIP1559Button').click()
cy.confirmTransactionAndWaitForMining().then(() => {
cy.get('#tokenAddresses').should('include', /^0x/)
})
})
})
2 changes: 1 addition & 1 deletion wallets/metamask/test/cypress/connectToDapp.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ it('should connect account to the app', () => {
cy.get('#connectButton').click()
cy.connectToDapp()

cy.get('#accounts').should('contain', '0x')
cy.get('#accounts').should('include', /^0x/)
})
17 changes: 4 additions & 13 deletions wallets/metamask/test/cypress/rejectAddNetwork.cy.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
it('should reject new network request', () => {
cy.createAnvilNode({
chainId: 1338,
port: 8546
}).then(() => {
cy.get('#addEthereumChain').click()
cy.get('#addEthereumChain').click()

cy.rejectNewNetwork().then(() => {
cy.get('#chainId').should('have.text', '0x1')
cy.rejectNewNetwork().then(() => {
cy.get('#chainId').should('have.text', '0x7a69')

cy.emptyAnvilNode()
})
cy.emptyAnvilNode()
})
})

after(() => {
cy.switchNetwork('Ethereum Mainnet')
})

0 comments on commit 7e389da

Please sign in to comment.