-
-
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
- Loading branch information
Showing
7 changed files
with
221 additions
and
15 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
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
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,27 @@ | ||
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")); | ||
}); | ||
}); |
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,38 @@ | ||
before(() => { | ||
cy.connectToAnvil() | ||
cy.getNetwork().should('eq', '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', '0x5FbDB2315678afecb367f032d93F642f64180aa3') | ||
|
||
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') | ||
}) | ||
}) |