Skip to content

Commit 2670680

Browse files
portdevelopercarletex
authored andcommitted
Type to find networks instead of choose them by roles (#147)
1 parent e835f28 commit 2670680

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/nextjs/cypress/e2e/contract_interaction.cy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ describe("Contract Interaction", () => {
1212
cy.loadContract("0xca808b3eada02d53073e129b25f74b31d8647ae0");
1313
cy.url().should("include", "/0xca808b3eada02d53073e129b25f74b31d8647ae0/8453");
1414
cy.contains("Implementation Address").should("be.visible");
15-
cy.wait(1000); // wait for: the method card to re-render
1615
cy.interactWithMethod("balanceOf", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
1716
});
1817

@@ -42,6 +41,8 @@ describe("Contract Interaction", () => {
4241

4342
it("should add Viction as a custom chain and interact with a contract by submitting an ABI manually", () => {
4443
cy.visit("http://localhost:3000");
44+
cy.selectNetwork("Add custom chain");
45+
cy.get("#add-custom-chain-modal").should("be.visible");
4546
cy.addCustomChain({
4647
id: "88",
4748
name: "Viction",

packages/nextjs/cypress/support/commands.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ Cypress.Commands.add("loadContract", (address: string) => {
2020
});
2121

2222
Cypress.Commands.add("selectNetwork", (networkName: string) => {
23-
cy.get("#react-select-container").click();
24-
cy.get('[role="option"]').contains(networkName).click();
23+
cy.get("#react-select-container")
24+
.click()
25+
.find("input")
26+
.first()
27+
.type(networkName, { force: true })
28+
.type("{enter}", { force: true });
2529
});
2630

2731
Cypress.Commands.add("interactWithMethod", (methodName: string, inputValue: string) => {
@@ -42,8 +46,6 @@ Cypress.Commands.add(
4246
rpcUrl: string;
4347
blockExplorer: string;
4448
}) => {
45-
cy.get("#react-select-container").click();
46-
cy.get('[role="option"]').contains("Add custom chain").click();
4749
cy.get("#add-custom-chain-modal").should("be.visible");
4850
cy.get('input[name="id"]').type(chainDetails.id);
4951
cy.get('input[name="name"]').type(chainDetails.name);

0 commit comments

Comments
 (0)