diff --git a/.github/workflows/ci-e2e.yml b/.github/workflows/ci-e2e.yml index b126777135..611189a6ab 100644 --- a/.github/workflows/ci-e2e.yml +++ b/.github/workflows/ci-e2e.yml @@ -37,7 +37,7 @@ jobs: - run: .github/workflows/ci/wait-for http://localhost:3001/_actuator/probes/liveness -t 240 - run: .github/workflows/ci/wait-for http://localhost:3002/_actuator/probes/liveness -t 240 - - run: .github/workflows/ci/wait-for http://localhost:19551/ping -t 240 + - run: .github/workflows/ci/wait-for http://localhost:19550/ping -t 240 - uses: cypress-io/github-action@d79d2d530a66e641eb4a5f227e13bc985c60b964 # v4.2.2 with: diff --git a/docker-compose.yml b/docker-compose.yml index 4e67e86d7d..9264159771 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: ports: - "19553:80" - "19552:8080" - # - "19551:8082" + - "19550:8082" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/ActionButtons.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/ActionButtons.tsx index 062ff6b3e8..18823667a7 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/ActionButtons.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/ActionButtons.tsx @@ -195,7 +195,7 @@ export function ActionButtons(): JSX.Element { { navigateToTokenSelectionScreen(TokenListType.From); }} diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/__snapshots__/DFIBalanceCard.test.tsx.snap b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/__snapshots__/DFIBalanceCard.test.tsx.snap index 33b44c5be0..c919fa7d50 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/__snapshots__/DFIBalanceCard.test.tsx.snap +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/__snapshots__/DFIBalanceCard.test.tsx.snap @@ -207,7 +207,7 @@ exports[`DFI Balance Card should match snapshot 1`] = ` } testID="total_dfi_label_name" > - DeFiChain + DeFiChain diff --git a/mobile-app/app/screens/AppNavigator/screens/Settings/SettingsScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Settings/SettingsScreen.tsx index d3567afda6..87ad57a70b 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Settings/SettingsScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Settings/SettingsScreen.tsx @@ -365,6 +365,7 @@ function NavigateItemRow({ light={tailwind("text-mono-light-v2-700")} dark={tailwind("text-mono-dark-v2-700")} style={tailwind("font-normal-v2 text-sm mr-1")} + testID={`${testID}_value`} > {translate("screens/Settings", value)} diff --git a/mobile-app/cypress/e2e/functional/transferDomain/addresses.spec.ts b/mobile-app/cypress/e2e/functional/transferDomain/addresses.spec.ts index 5923c9991e..a89a0cabfc 100644 --- a/mobile-app/cypress/e2e/functional/transferDomain/addresses.spec.ts +++ b/mobile-app/cypress/e2e/functional/transferDomain/addresses.spec.ts @@ -5,27 +5,28 @@ context("Portfolio - Send - Address Book", () => { "0x2DeC425BF3c289C9B7452aD54E2F9877F21e0316", ]; - function validateMatchAddress(address: string, label: string): void { - cy.getByTestID("address_input").contains(address); - if (label === labels[0]) { - cy.getByTestID("address_input_footer").contains(label); - } else { - cy.getByTestID("address_input_footer_evm").contains(label); - } + // Addresses that shows up under the 'Your address' tab in address book + function populateYourAddresses(): void { + // Create new wallet address - only available if there is DFI UTXO + cy.getByTestID("bottom_tab_portfolio").click(); + cy.getByTestID("wallet_address").should("exist").click(); + cy.getByTestID("create_new_address").should("exist").click(); // Generate Address 2 wallet address + + // Go back to previous Address 1 + cy.getByTestID("wallet_address").should("exist").click(); + cy.getByTestID("address_row_0").click(); + cy.getByTestID("wallet_address").should("have.text", "Address 1"); } // Whitelisted addresses function populateAddressBook(hasExistingAddress?: boolean): void { + cy.getByTestID("bottom_tab_portfolio").click(); cy.getByTestID("action_button_group").should("exist"); cy.getByTestID("send_balance_button").click().wait(3000); cy.getByTestID("select_DFI").click().wait(3000); cy.getByTestID("address_book_button").click(); cy.wrap(labels).each((_v, index: number) => { - if (index === 0) { - cy.getByTestID("button_add_address").click(); - } else { - cy.getByTestID("add_new_address").click(); - } + cy.getByTestID("add_new_address").click(); if (hasExistingAddress) { // Reselect DVM address type @@ -45,43 +46,16 @@ context("Portfolio - Send - Address Book", () => { cy.getByTestID("address_book_address_input_error").should("not.exist"); cy.getByTestID("save_address_label").click().wait(1000); cy.getByTestID("pin_authorize").type("000000").wait(2000); - validateMatchAddress(addresses[index], labels[index]); cy.wait(1000); - cy.getByTestID("address_input_clear_button").click(); - cy.getByTestID("address_book_button").click(); cy.getByTestID(`address_row_label_${index}_WHITELISTED`).contains( labels[index], ); cy.getByTestID(`address_row_text_${index}_WHITELISTED`).contains( addresses[index], ); - // cy.getByTestID('address_book_address_input').clear().type(addresses[index]).blur() }); } - function verifyWhitelistedAddressRowItems(index: number) { - cy.getByTestID(`address_row_label_${index}_WHITELISTED`).should( - "have.text", - labels[index], - ); - cy.getByTestID(`address_row_text_${index}_WHITELISTED`).should( - "have.text", - addresses[index], - ); - cy.getByTestID(`address_row_${index}_WHITELISTED_caret`).should("exist"); - - // dvm address - if (index === 0) { - cy.getByTestID(`address_row_label_${index}_WHITELISTED_EVM_tag`).should( - "not.exist", - ); - // evm address - } else { - cy.getByTestID(`address_row_label_${index}_WHITELISTED_EVM_tag`).should( - "exist", - ); - } - } function verifyYourAddressRowItems(index: number) { // Generated wallet label cy.getByTestID(`address_row_label_${index}_YOUR_ADDRESS`).should( @@ -95,14 +69,12 @@ context("Portfolio - Send - Address Book", () => { cy.getByTestID(`address_row_text_${index}_YOUR_ADDRESS_EVM`).should( "exist", ); - - // caret - cy.getByTestID(`address_row_${index}_YOUR_ADDRESS_caret`).should("exist"); } // Send DFI tokens dvm -> evm function topUpDfiInEvmDomain() { cy.getByTestID("bottom_tab_portfolio").click(); + cy.getByTestID("action_button_group").should("exist"); cy.getByTestID("send_balance_button").click(); cy.getByTestID("select_DFI").click(); cy.getByTestID("25%_amount_button").click(); @@ -114,41 +86,71 @@ context("Portfolio - Send - Address Book", () => { // Send confirmation screen cy.getByTestID("button_confirm_send").click(); cy.getByTestID("pin_authorize").type("000000").wait(4000); + cy.getByTestID("oceanInterface_close").click(); // Close ocean interface popup } describe("Whitelisted and Your Addresses tab", () => { before(() => { cy.createEmptyWallet(true); cy.sendDFItoWallet().sendDFITokentoWallet().wait(4000); - cy.getByTestID("bottom_tab_portfolio").click(); - topUpDfiInEvmDomain(); - cy.getByTestID("oceanInterface_close").click(); // Close ocean interface popup - populateYourAddresses(); // Generate new wallet Address 2 + populateAddressBook(); // Add whitelist addresses }); + it("(dvm) Whitelisted - should not display evm tag for dvm addresses", () => { - populateAddressBook(); // Add whitelist addresses - verifyWhitelistedAddressRowItems(0); + cy.getByTestID("bottom_tab_portfolio").click(); + cy.getByTestID("header_settings").click(); + cy.getByTestID("address_book_title").click(); + cy.getByTestID("address_row_label_0_WHITELISTED").should( + "have.text", + labels[0], + ); + cy.getByTestID("address_row_text_0_WHITELISTED").should( + "have.text", + addresses[0], + ); + cy.getByTestID("address_row_0_WHITELISTED_caret").should("exist"); + + cy.getByTestID("address_row_label_0_WHITELISTED_EVM_tag").should( + "not.exist", + ); }); + it("(dvm) Whitelisted - should display evm tag for evm addresses", () => { - verifyWhitelistedAddressRowItems(1); + cy.getByTestID("address_row_label_1_WHITELISTED").should( + "have.text", + labels[1], + ); + cy.getByTestID("address_row_text_1_WHITELISTED").should( + "have.text", + addresses[1], + ); + cy.getByTestID("address_row_1_WHITELISTED_caret").should("exist"); + cy.getByTestID("address_row_label_1_WHITELISTED_EVM_tag").should("exist"); }); + it("(dvm) Your Addresses - should display not evm tag for dvm addresses", () => { + cy.getByTestID("bottom_tab_portfolio").click(); + cy.getByTestID("header_settings").click(); + cy.getByTestID("address_book_title").click(); cy.getByTestID("address_button_group_YOUR_ADDRESS").click(); verifyYourAddressRowItems(0); }); + it("(dvm) Your Addresses - should display evm tag for evm addresses", () => { verifyYourAddressRowItems(1); - cy.getByTestID("bottom_tab_portfolio").click(); }); // Switch to evm domain it("(evm) Whitelisted - should disable evm addresses in evm domain", () => { // Go back to portfolio page to switch domain + cy.getByTestID("bottom_tab_portfolio").click(); cy.getByTestID("domain_switch").click(); - - goToAddressBook(); + cy.getByTestID("action_button_group").should("exist"); + cy.getByTestID("send_balance_button").click().wait(3000); + cy.getByTestID("select_DFI").click().wait(3000); + cy.getByTestID("address_book_button").click(); cy.getByTestID("address_row_0_WHITELISTED").should( "have.attr", @@ -157,6 +159,7 @@ context("Portfolio - Send - Address Book", () => { ); cy.getByTestID("address_row_1_WHITELISTED").should("not.be.disabled"); }); + // Switch to your address tab it("(evm) Your Address - should disable evm addresses in evm domain", () => { cy.getByTestID("address_button_group_YOUR_ADDRESS").click(); @@ -165,25 +168,6 @@ context("Portfolio - Send - Address Book", () => { }); }); -// Addresses that shows up under the 'Your address' tab in address book -function populateYourAddresses(): void { - // Create new wallet address - only available if there is DFI UTXO - cy.getByTestID("bottom_tab_portfolio").click(); - cy.getByTestID("wallet_address").click(); - cy.getByTestID("create_new_address").should("exist").click(); // Generate Address 2 wallet address - - // Go back to previous Address 1 - cy.getByTestID("wallet_address").click(); - cy.getByTestID("address_row_0").click(); - cy.getByTestID("wallet_address").should("have.text", "Address 1"); -} -function goToAddressBook() { - cy.getByTestID("action_button_group").should("exist"); - cy.getByTestID("send_balance_button").click().wait(3000); - cy.getByTestID("select_EvmDFI").click().wait(3000); - cy.getByTestID("address_book_button").click(); -} - // Check if evm address is disabled in evm domain for generated Address 1 and 2 cards function verifyYourAddressItemEvm() { cy.wrap([0, 1]).each((index: number) => { @@ -209,10 +193,12 @@ context("Portfolio", () => { describe("Wallet label (& address book bottom sheet)", () => { it('should display generated address label "Address 1" as first wallet label', () => { - cy.getByTestID("wallet_address").should("have.text", "Address 1"); + cy.getByTestID("wallet_address") + .should("exist") + .should("have.text", "Address 1"); }); it("should display new wallet label after modifying wallet label", () => { - cy.getByTestID("wallet_address").click(); + cy.getByTestID("wallet_address").should("exist").click(); // Go to edit address book bottom sheet cy.getByTestID("address_edit_icon_address_row_0").click(); @@ -234,7 +220,7 @@ context("Portfolio", () => { // Generate new wallet address it("should display generated Address 2 label as second wallet label", () => { cy.getByTestID("bottom_tab_portfolio").click(); - cy.getByTestID("wallet_address").click(); + cy.getByTestID("wallet_address").should("exist").click(); cy.getByTestID("create_new_address").should("exist").click(); // Generate Address 2 wallet address cy.getByTestID("wallet_address").should("have.text", "Address 2"); diff --git a/mobile-app/cypress/e2e/functional/wallet/dex/swap/swap_tabs_dropdowns.spec.ts b/mobile-app/cypress/e2e/functional/wallet/dex/swap/swap_tabs_dropdowns.spec.ts index fb1ae7ab85..224cf82bda 100644 --- a/mobile-app/cypress/e2e/functional/wallet/dex/swap/swap_tabs_dropdowns.spec.ts +++ b/mobile-app/cypress/e2e/functional/wallet/dex/swap/swap_tabs_dropdowns.spec.ts @@ -97,12 +97,12 @@ context("Wallet - DEX - disabled pool pairs", () => { cy.getByTestID("dex_action_button_composite_swap_button_26").should( "have.css", "opacity", // using opacity to check enable - "1" + "1", ); // status: true cy.getByTestID("dex_action_button_composite_swap_button_28").should( "have.css", "opacity", // using opacity to check disable - "0.3" + "0.3", ); // status: false }); }); @@ -134,7 +134,8 @@ context("Wallet - DEX - Instant/Future Swap - tabs and dropdowns", () => { }); it("should be able to choose tokens to swap", () => { - cy.getByTestID("composite_swap").click(); + cy.wait(1000); + cy.getByTestID("composite_swap").should("exist").click(); cy.wait(5000); cy.getByTestID("token_select_button_FROM").click(); cy.getByTestID("select_DFI").click().wait(2000); @@ -146,18 +147,18 @@ context("Wallet - DEX - Instant/Future Swap - tabs and dropdowns", () => { cy.getByTestID("switch_button").click(); cy.getByTestID("token_select_button_FROM_display_symbol").should( "have.text", - "dTU10" + "dTU10", ); cy.getByTestID("token_select_button_TO_display_symbol").should( "have.text", - "DFI" + "DFI", ); }); it("should be able to disable future swap tab if tokenA and tokenB is not a valid future swap pair", () => { cy.getByTestID("swap_tabs_FUTURE_SWAP").should( "have.attr", - "aria-disabled" + "aria-disabled", ); /* Only DUSD <-> Loan tokens are allowed in future swap */ @@ -167,7 +168,7 @@ context("Wallet - DEX - Instant/Future Swap - tabs and dropdowns", () => { cy.getByTestID("select_dTU10").click(); cy.getByTestID("swap_tabs_FUTURE_SWAP").should( "not.have.attr", - "aria-disabled" + "aria-disabled", ); }); @@ -175,11 +176,11 @@ context("Wallet - DEX - Instant/Future Swap - tabs and dropdowns", () => { cy.getByTestID("swap_tabs_FUTURE_SWAP").click(); cy.getByTestID("token_select_button_FROM_display_symbol").should( "have.text", - "DUSD" + "DUSD", ); cy.getByTestID("token_select_button_TO_display_symbol").should( "have.text", - "dTU10" + "dTU10", ); }); diff --git a/mobile-app/cypress/e2e/functional/wallet/portfolio/sendConfirmation.spec.ts b/mobile-app/cypress/e2e/functional/wallet/portfolio/sendConfirmation.spec.ts index d032af62a9..e9a5f36111 100644 --- a/mobile-app/cypress/e2e/functional/wallet/portfolio/sendConfirmation.spec.ts +++ b/mobile-app/cypress/e2e/functional/wallet/portfolio/sendConfirmation.spec.ts @@ -20,14 +20,14 @@ context("Wallet - Send Preview/Confirmation", () => { .invoke("text") .should((t) => expect(t).equal("1.23400000")); cy.getByTestID("wallet_address").should("exist"); - cy.getByTestID("summary_to_value").should( + cy.getByTestID("address_input_footer").should( "have.text", - "bcrt1q8rfsfny80jx78cmk4rsa069e2ckp6rn83u6ut9" + "bcrt1q8rfsfny80jx78cmk4rsa069e2ckp6rn83u6ut9", ); cy.getByTestID("transaction_fee_label").should( "have.text", - "Transaction fee" + "Transaction fee", ); cy.getByTestID("transaction_fee_value").contains("DFI"); @@ -35,7 +35,7 @@ context("Wallet - Send Preview/Confirmation", () => { cy.getByTestID("text_amount").contains("1.23400000 dBTC"); cy.getByTestID("text_amount_rhsUsdAmount").should( "have.text", - "$12,340.00" + "$12,340.00", ); cy.getByTestID("button_confirm_send").should("not.have.attr", "disabled"); }); diff --git a/mobile-app/cypress/e2e/functional/wallet/settings/serviceProvider.spec.ts b/mobile-app/cypress/e2e/functional/wallet/settings/serviceProvider.spec.ts index 53aeb7267a..6a4a7ccdcd 100644 --- a/mobile-app/cypress/e2e/functional/wallet/settings/serviceProvider.spec.ts +++ b/mobile-app/cypress/e2e/functional/wallet/settings/serviceProvider.spec.ts @@ -53,53 +53,53 @@ defichainUrlEnvs.forEach((defichainUrlEnv) => { cy.getByTestID("header_network_name") .first() .contains(defichainUrlEnv); - cy.getByTestID("setting_navigate_service_provider").contains( + cy.getByTestID("setting_navigate_service_provider_value").contains( "Default", ); cy.url().should("include", "app/Settings", () => { - expect(localStorage.getItem("WALLET.SERVICE_PROVIDER_URL")).to.eq( - url.default, - ); + expect( + localStorage.getItem("WALLET.SERVICE_PROVIDER_URL.DVM"), + ).to.eq(url.default); }); }); }); it(`should have default service provider url on ${defichainUrlEnv}`, () => { cy.getByTestID("setting_navigate_service_provider").click(); - cy.getByTestID("dvm_endpoint_url_input").should( + cy.getByTestID("DVM_endpoint_url_input").should( "have.value", url.default, ); }); it(`input should be locked and not editable on ${defichainUrlEnv}`, () => { - cy.getByTestID("dvm_endpoint_url_input").should( + cy.getByTestID("DVM_endpoint_url_input").should( "have.attr", "readonly", ); }); it(`can unlock to change service provider endpoint on ${defichainUrlEnv}`, () => { - cy.getByTestID("dvm_edit_service_provider").click(); + cy.getByTestID("DVM_edit_service_provider").click(); cy.getByTestID("reset_button").should("exist"); - cy.getByTestID("dvm_endpoint_url_input").should( + cy.getByTestID("DVM_endpoint_url_input").should( "not.have.attr", "readonly", ); + cy.getByTestID("DVM_endpoint_url_input").should("have.value", ""); cy.getByTestID("button_submit").should("have.attr", "aria-disabled"); }); it(`should type invalid custom provider URL on ${defichainUrlEnv}`, () => { - cy.getByTestID("dvm_endpoint_url_input").should("have.value", ""); - cy.getByTestID("dvm_endpoint_url_input").type( + cy.getByTestID("DVM_endpoint_url_input").type( "http://invalidcustomURL.com", ); - cy.getByTestID("dvm_endpoint_url_input_error").contains("Invalid URL"); + cy.getByTestID("DVM_endpoint_url_input_error").contains("Invalid URL"); cy.getByTestID("button_submit").should("have.attr", "aria-disabled"); }); it(`should submit valid custom service provider on ${defichainUrlEnv}`, () => { - cy.getByTestID("dvm_endpoint_url_input").clear().type(url.custom); + cy.getByTestID("DVM_endpoint_url_input").clear().type(url.custom); cy.getByTestID("button_submit").should( "not.have.attr", "aria-disabled", @@ -107,8 +107,8 @@ defichainUrlEnvs.forEach((defichainUrlEnv) => { cy.getByTestID("button_submit").click().wait(3000); cy.getByTestID("pin_authorize").type("000000", { delay: 3000 }); cy.wait(5000); - cy.url().should("include", "app/portfolio"); cy.getByTestID("bottom_tab_portfolio").click(); + cy.url().should("include", "app/portfolio"); cy.wait(4000); cy.getByTestID("header_settings").click().wait(1000); cy.wait(4000); @@ -127,7 +127,7 @@ defichainUrlEnvs.forEach((defichainUrlEnv) => { cy.getByTestID("bottom_tab_portfolio").click(); cy.getByTestID("header_settings").click(); cy.getByTestID("setting_navigate_service_provider").click(); - cy.getByTestID("dvm_edit_service_provider").click(); + cy.getByTestID("DVM_edit_service_provider").click(); cy.getByTestID("reset_button").should("exist").click().wait(3000); cy.getByTestID("pin_authorize").type("000000", { delay: 3000 }); cy.wait(5000);