|
| 1 | +describe("Contract Interaction", () => { |
| 2 | + it("should load DAI contract and interact with its balanceOf method", () => { |
| 3 | + cy.visit("http://localhost:3000"); |
| 4 | + cy.loadContract("0x6B175474E89094C44Da98b954EedeAC495271d0F"); |
| 5 | + cy.url().should("include", "/0x6B175474E89094C44Da98b954EedeAC495271d0F/1"); |
| 6 | + cy.interactWithMethod("balanceOf", "0x6B175474E89094C44Da98b954EedeAC495271d0F"); |
| 7 | + }); |
| 8 | + |
| 9 | + it("should load proxy contract on Base and interact with its balanceOf method", () => { |
| 10 | + cy.visit("http://localhost:3000"); |
| 11 | + cy.selectNetwork("Base"); |
| 12 | + cy.loadContract("0xca808b3eada02d53073e129b25f74b31d8647ae0"); |
| 13 | + cy.url().should("include", "/0xca808b3eada02d53073e129b25f74b31d8647ae0/8453"); |
| 14 | + cy.contains("Implementation Address").should("be.visible"); |
| 15 | + cy.wait(1000); // wait for: the method card to re-render |
| 16 | + cy.interactWithMethod("balanceOf", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"); |
| 17 | + }); |
| 18 | + |
| 19 | + it("should load unverified contract on Sepolia and ADD changeOwner write method to the UI", () => { |
| 20 | + cy.wakeUpHeimdall(); |
| 21 | + cy.visit("http://localhost:3000"); |
| 22 | + cy.selectNetwork("Sepolia"); |
| 23 | + cy.get('input[placeholder="Contract address"]').type("0x759c0e9d7858566df8ab751026bedce462ff42df"); |
| 24 | + cy.get("button:visible").contains("Decompile (beta)", { timeout: 10000 }).click({ force: true }); |
| 25 | + cy.wait(2000); |
| 26 | + cy.url().should("include", "/0x759c0e9d7858566df8ab751026bedce462ff42df/11155111"); |
| 27 | + cy.contains("changeOwner").click(); |
| 28 | + }); |
| 29 | + |
| 30 | + it("should load a contract on BNB Smart Chain and interact with its balanceOf method", () => { |
| 31 | + cy.visit("http://localhost:3000"); |
| 32 | + cy.selectNetwork("Other chains"); |
| 33 | + cy.get("#see-other-chains-modal").should("be.visible"); |
| 34 | + cy.contains("BNB Smart Chain").click(); |
| 35 | + cy.get(".modal-content").should("not.exist"); |
| 36 | + cy.get("#react-select-container").should("contain", "BNB Smart Chain"); |
| 37 | + cy.loadContract("0x2170ed0880ac9a755fd29b2688956bd959f933f8"); |
| 38 | + cy.url().should("include", "/0x2170ed0880ac9a755fd29b2688956bd959f933f8/56"); |
| 39 | + cy.get(".loading-spinner", { timeout: 10000 }).should("not.exist"); |
| 40 | + cy.interactWithMethod("balanceOf", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"); |
| 41 | + }); |
| 42 | + |
| 43 | + it("should add Parex as a custom chain and interact with a contract by submitting an ABI manually", () => { |
| 44 | + cy.visit("http://localhost:3000"); |
| 45 | + cy.addCustomChain({ |
| 46 | + id: "322202", |
| 47 | + name: "Parex", |
| 48 | + nativeCurrencyName: "PAREX", |
| 49 | + nativeCurrencySymbol: "PAREX", |
| 50 | + nativeCurrencyDecimals: "18", |
| 51 | + rpcUrl: "https://mainnet-rpc.parex.network", |
| 52 | + blockExplorer: "https://scan.parex.network/", |
| 53 | + }); |
| 54 | + cy.get("#react-select-container").should("contain", "Parex"); |
| 55 | + cy.get('input[placeholder="Contract address"]').type("0x6058518142C6AD506530F5A62dCc58050bf6fC28"); |
| 56 | + cy.fixture("parex_abi").then(parexContractABI => { |
| 57 | + cy.importABI(JSON.stringify(parexContractABI)); |
| 58 | + }); |
| 59 | + cy.url().should("include", "/0x6058518142C6AD506530F5A62dCc58050bf6fC28/322202"); |
| 60 | + cy.get(".loading-spinner", { timeout: 10000 }).should("not.exist"); |
| 61 | + cy.interactWithMethod("getUserBalance", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"); |
| 62 | + }); |
| 63 | +}); |
0 commit comments