diff --git a/browser/ui/webui/brave_wallet/wallet_panel_ui_browsertest.cc b/browser/ui/webui/brave_wallet/wallet_panel_ui_browsertest.cc index aa66d181cd86..07a0bbb778e7 100644 --- a/browser/ui/webui/brave_wallet/wallet_panel_ui_browsertest.cc +++ b/browser/ui/webui/brave_wallet/wallet_panel_ui_browsertest.cc @@ -75,6 +75,10 @@ std::string NeonEVMNetworkChainName() { return NeonEVMNetwork() + " .chainName"; } +std::string DAppSettingsButton() { + return R"([data-test-id='dapp-settings-button'])"; +} + std::string NetworksButton() { return R"([data-test-id='select-network-button'])"; } @@ -108,11 +112,16 @@ bool WaitFor(content::WebContents* web_contents, const std::string& selector) { bool WaitAndClickElement(content::WebContents* web_contents, const std::string& selector) { - if (!WaitFor(web_contents, selector)) { - return false; + for (int i = 0; i < 10; ++i) { + if (!WaitFor(web_contents, selector)) { + return false; + } + auto result = EvalJs(web_contents, selector + ".click()"); + if (result.value.is_none() && result.error.empty()) { + return true; + } } - - return EvalJs(web_contents, selector + ".click()").value.is_none(); + return false; } } // namespace @@ -248,6 +257,9 @@ IN_PROC_BROWSER_TEST_F(WalletPanelUIBrowserTest, InitialUIRendered) { #endif IN_PROC_BROWSER_TEST_F(WalletPanelUIBrowserTest, MAYBE_HideNetworkInSettings) { ActivateWalletTab(); + // Wait and click on DApp settings button. + ASSERT_TRUE( + WaitAndClickElement(wallet(), QuerySelectorJS(DAppSettingsButton()))); // Wait and click on select network button. ASSERT_TRUE(WaitAndClickElement(wallet(), QuerySelectorJS(NetworksButton()))); @@ -266,6 +278,9 @@ IN_PROC_BROWSER_TEST_F(WalletPanelUIBrowserTest, MAYBE_HideNetworkInSettings) { ActivateWalletTab(); wallet()->GetController().Reload(content::ReloadType::NORMAL, true); + // Wait and click on DApp settings button. + ASSERT_TRUE( + WaitAndClickElement(wallet(), QuerySelectorJS(DAppSettingsButton()))); // Wait and click on select network button. ASSERT_TRUE(WaitAndClickElement(wallet(), QuerySelectorJS(NetworksButton()))); @@ -281,6 +296,9 @@ IN_PROC_BROWSER_TEST_F(WalletPanelUIBrowserTest, CustomNetworkInSettings) { CreateSettingsTab(); ActivateWalletTab(); + // Wait and click on DApp settings button. + ASSERT_TRUE( + WaitAndClickElement(wallet(), QuerySelectorJS(DAppSettingsButton()))); // Wait and click on select network button. ASSERT_TRUE(WaitAndClickElement(wallet(), QuerySelectorJS(NetworksButton()))); diff --git a/components/brave_wallet/common/features.cc b/components/brave_wallet/common/features.cc index b469cc4d6673..17fa043435c3 100644 --- a/components/brave_wallet/common/features.cc +++ b/components/brave_wallet/common/features.cc @@ -54,7 +54,7 @@ BASE_FEATURE(kBraveWalletNftPinningFeature, BASE_FEATURE(kBraveWalletPanelV2Feature, "BraveWalletPanelV2", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kBraveWalletBitcoinFeature, "BraveWalletBitcoin", diff --git a/components/brave_wallet_ui/components/extension/dapp-connection-settings/change-network-button.tsx b/components/brave_wallet_ui/components/extension/dapp-connection-settings/change-network-button.tsx index 7ec1d921ca81..f0e65dfdb1bb 100644 --- a/components/brave_wallet_ui/components/extension/dapp-connection-settings/change-network-button.tsx +++ b/components/brave_wallet_ui/components/extension/dapp-connection-settings/change-network-button.tsx @@ -26,7 +26,7 @@ import { // Styled Components import { NetworkButton, - NameText, + NetworkName, ActiveIndicator } from './dapp-connection-settings.style' import { @@ -55,6 +55,7 @@ export const ChangeNetworkButton = (props: Props) => { return ( { marginRight={8} size='big' /> - + {network.chainName} - + {selectedNetwork?.chainId === network.chainId && diff --git a/components/brave_wallet_ui/components/extension/dapp-connection-settings/dapp-connection-main.tsx b/components/brave_wallet_ui/components/extension/dapp-connection-settings/dapp-connection-main.tsx index 830b923ab0d1..fdb8f340d5c9 100644 --- a/components/brave_wallet_ui/components/extension/dapp-connection-settings/dapp-connection-main.tsx +++ b/components/brave_wallet_ui/components/extension/dapp-connection-settings/dapp-connection-main.tsx @@ -287,6 +287,7 @@ export const DAppConnectionMain = (props: Props) => { onSelectOption('networks')} + data-test-id='select-network-button' > { return ( <> setShowSettings(prev => !prev)} + onClick={() => setShowSettings(prev => !prev)} + data-test-id='dapp-settings-button' > { {showSettings && <> +