-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: Test cases for network management and new tokens deployment (#…
…1193) * feat: Test cases for network management and new tokens deployment * fix: cypress tests befores and afters * fix: Network type imports
- Loading branch information
Showing
13 changed files
with
263 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 2 additions & 12 deletions
14
wallets/metamask/src/playwright/pages/HomePage/actions/addNetwork.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { z } from 'zod' | ||
|
||
export const NetworkValidation = z.object({ | ||
name: z.string(), | ||
rpcUrl: z.string(), | ||
chainId: z.number(), | ||
symbol: z.string(), | ||
blockExplorerUrl: z.string().optional() | ||
}) | ||
|
||
export type Network = z.infer<typeof NetworkValidation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
it('should add network and close network added popup', () => { | ||
cy.createAnvilNode().then(({ rpcUrl, chainId }) => { | ||
const network = { | ||
name: 'Anvil', | ||
rpcUrl, | ||
chainId, | ||
symbol: 'ETH', | ||
blockExplorerUrl: 'https://etherscan.io/' | ||
} | ||
|
||
cy.addNetwork(network).then(() => cy.getNetwork().should('eq', 'Anvil')) | ||
}) | ||
}) | ||
|
||
it('should add network without block explorer', () => { | ||
cy.createAnvilNode().then(({ rpcUrl, chainId }) => { | ||
const network = { | ||
name: 'Anvil2', | ||
rpcUrl, | ||
chainId, | ||
symbol: 'ETH', | ||
blockExplorerUrl: undefined | ||
} | ||
|
||
cy.addNetwork(network).then(() => cy.getNetwork().should('eq', 'Anvil2')) | ||
}) | ||
}) | ||
|
||
after(() => { | ||
cy.switchNetwork('Anvil', true) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
before(() => { | ||
cy.getNetwork().then((network) => { | ||
console.log(network) | ||
if (network !== 'Anvil') { | ||
cy.switchNetwork('Anvil') | ||
} | ||
}) | ||
|
||
cy.get('#connectButton').click() | ||
|
||
cy.connectToDapp() | ||
}) | ||
|
||
it('should add new token to MetaMask', () => { | ||
cy.get('#createToken').click() | ||
|
||
// wait for the blockchain - todo: replace with an event handler | ||
cy.wait(5000) | ||
|
||
cy.deployToken().then(() => { | ||
// wait for the blockchain - todo: replace with an event handler | ||
cy.wait(5000) | ||
|
||
cy.get('#tokenAddresses').should('have.text', '0x7ef8E99980Da5bcEDcF7C10f41E55f759F6A174B') | ||
|
||
cy.get('#watchAssets').click() | ||
|
||
cy.addNewToken() | ||
}) | ||
}) | ||
|
||
it('should add new token using EIP747', () => { | ||
cy.get('#eip747ContractAddress').type('0x5FbDB2315678afecb367f032d93F642f64180aa3') | ||
cy.get('#eip747Symbol').type('TST') | ||
cy.get('#eip747Decimals').type('4') | ||
|
||
cy.get('#eip747WatchButton').click() | ||
|
||
cy.addNewToken().then(() => { | ||
cy.get('#eip747Status').should('have.text', 'NFT added successfully') | ||
}) | ||
}) |
Oops, something went wrong.