From 170630b40f69a24a547497d06633e18e28e0e438 Mon Sep 17 00:00:00 2001 From: port <108868128+portdeveloper@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:51:53 +0300 Subject: [PATCH] Type to find networks instead of choose them by roles (#147) --- packages/nextjs/cypress/e2e/contract_interaction.cy.ts | 3 ++- packages/nextjs/cypress/support/commands.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/nextjs/cypress/e2e/contract_interaction.cy.ts b/packages/nextjs/cypress/e2e/contract_interaction.cy.ts index 12d07e4e..869a4de7 100644 --- a/packages/nextjs/cypress/e2e/contract_interaction.cy.ts +++ b/packages/nextjs/cypress/e2e/contract_interaction.cy.ts @@ -12,7 +12,6 @@ describe("Contract Interaction", () => { cy.loadContract("0xca808b3eada02d53073e129b25f74b31d8647ae0"); cy.url().should("include", "/0xca808b3eada02d53073e129b25f74b31d8647ae0/8453"); cy.contains("Implementation Address").should("be.visible"); - cy.wait(1000); // wait for: the method card to re-render cy.interactWithMethod("balanceOf", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"); }); @@ -42,6 +41,8 @@ describe("Contract Interaction", () => { it("should add Viction as a custom chain and interact with a contract by submitting an ABI manually", () => { cy.visit("http://localhost:3000"); + cy.selectNetwork("Add custom chain"); + cy.get("#add-custom-chain-modal").should("be.visible"); cy.addCustomChain({ id: "88", name: "Viction", diff --git a/packages/nextjs/cypress/support/commands.ts b/packages/nextjs/cypress/support/commands.ts index e33b9324..19b616aa 100644 --- a/packages/nextjs/cypress/support/commands.ts +++ b/packages/nextjs/cypress/support/commands.ts @@ -20,8 +20,12 @@ Cypress.Commands.add("loadContract", (address: string) => { }); Cypress.Commands.add("selectNetwork", (networkName: string) => { - cy.get("#react-select-container").click(); - cy.get('[role="option"]').contains(networkName).click(); + cy.get("#react-select-container") + .click() + .find("input") + .first() + .type(networkName, { force: true }) + .type("{enter}", { force: true }); }); Cypress.Commands.add("interactWithMethod", (methodName: string, inputValue: string) => { @@ -42,8 +46,6 @@ Cypress.Commands.add( rpcUrl: string; blockExplorer: string; }) => { - cy.get("#react-select-container").click(); - cy.get('[role="option"]').contains("Add custom chain").click(); cy.get("#add-custom-chain-modal").should("be.visible"); cy.get('input[name="id"]').type(chainDetails.id); cy.get('input[name="name"]').type(chainDetails.name);