Skip to content

Commit

Permalink
Type to find networks instead of choose them by roles (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
portdeveloper authored Aug 29, 2024
1 parent cb79dc1 commit 170630b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/nextjs/cypress/e2e/contract_interaction.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down Expand Up @@ -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",
Expand Down
10 changes: 6 additions & 4 deletions packages/nextjs/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
Expand Down

0 comments on commit 170630b

Please sign in to comment.