Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
52484c4
fix: show wallet info in useWalletInfo hook for ethers and ethers5
ignaciosantise Feb 6, 2025
9342f16
chore: changeset
ignaciosantise Feb 6, 2025
aae1248
chore: export connector id and icon if defined
ignaciosantise Feb 10, 2025
e696bf8
chore: moved connector constants to common package
ignaciosantise Feb 10, 2025
d3a9604
fix: improved state array updates in connection and router controllers
ignaciosantise Feb 12, 2025
4202275
Merge pull request #314 from reown-com/fix/valtio-arrays
ignaciosantise Feb 17, 2025
1f80e20
chore: added extra connected wallet info params
ignaciosantise Feb 17, 2025
f83ab59
Merge pull request #312 from reown-com/fix/ethers-walletinfo
ignaciosantise Feb 18, 2025
cab165d
chore: send origin to blockchain api, added expo check for user agent
ignaciosantise Feb 20, 2025
19e17ef
chore: changeset
ignaciosantise Feb 20, 2025
f3f4f37
fix: load transactions only when needed
ignaciosantise Feb 20, 2025
b43f2ab
Merge pull request #315 from reown-com/chore/useragent
ignaciosantise Feb 20, 2025
54f37b6
chore: added tests
ignaciosantise Feb 21, 2025
342e438
chore: test code improvements
ignaciosantise Feb 21, 2025
728ec72
Merge pull request #316 from reown-com/fix/transaction-load
ignaciosantise Feb 21, 2025
2ca82f0
fix: showing loader and placeholder correctly on activity tab
ignaciosantise Feb 21, 2025
41423b6
Merge pull request #317 from reown-com/fix/ui-fixes
ignaciosantise Feb 21, 2025
855bd0c
chore: add dependabot file
ignaciosantise Feb 21, 2025
fe8fd98
chore: removed dependabot file
ignaciosantise Feb 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/empty-mangos-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-coinbase-ethers-react-native': patch
'@reown/appkit-coinbase-wagmi-react-native': patch
'@reown/appkit-scaffold-utils-react-native': patch
'@reown/appkit-auth-ethers-react-native': patch
'@reown/appkit-auth-wagmi-react-native': patch
'@reown/appkit-scaffold-react-native': patch
'@reown/appkit-ethers5-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-wagmi-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-siwe-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wallet-react-native': patch
---

fix: load transactions when needed
18 changes: 18 additions & 0 deletions .changeset/light-geese-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-ethers5-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-auth-ethers-react-native': patch
'@reown/appkit-auth-wagmi-react-native': patch
'@reown/appkit-coinbase-ethers-react-native': patch
'@reown/appkit-coinbase-wagmi-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-scaffold-react-native': patch
'@reown/appkit-scaffold-utils-react-native': patch
'@reown/appkit-siwe-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
'@reown/appkit-wallet-react-native': patch
---

fix: show wallet info in useWalletInfo hook for ethers and ethers5
18 changes: 18 additions & 0 deletions .changeset/purple-berries-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-core-react-native': patch
'@reown/appkit-auth-ethers-react-native': patch
'@reown/appkit-auth-wagmi-react-native': patch
'@reown/appkit-coinbase-ethers-react-native': patch
'@reown/appkit-coinbase-wagmi-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-ethers5-react-native': patch
'@reown/appkit-scaffold-react-native': patch
'@reown/appkit-scaffold-utils-react-native': patch
'@reown/appkit-siwe-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wagmi-react-native': patch
'@reown/appkit-wallet-react-native': patch
---

fix: improved state array updates in connection and router controllers
18 changes: 18 additions & 0 deletions .changeset/witty-melons-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-coinbase-ethers-react-native': patch
'@reown/appkit-coinbase-wagmi-react-native': patch
'@reown/appkit-scaffold-utils-react-native': patch
'@reown/appkit-auth-ethers-react-native': patch
'@reown/appkit-auth-wagmi-react-native': patch
'@reown/appkit-scaffold-react-native': patch
'@reown/appkit-ethers5-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-wagmi-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-siwe-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-wallet-react-native': patch
---

chore: send expo info in useragent
4 changes: 2 additions & 2 deletions .maestro/w3m-connect-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ appId: com.walletconnect.web3modal.rnclisdk
id: 'account-button'

- tapOn:
id: 'w3m-account-select-network'
id: 'button-network'

- tapOn:
text: 'Polygon'
Expand All @@ -68,7 +68,7 @@ appId: com.walletconnect.web3modal.rnclisdk
text: 'Polygon'

- tapOn:
id: 'disconnect-button'
id: 'button-disconnect'

- assertVisible:
id: 'connect-button'
18 changes: 17 additions & 1 deletion apps/native/tests/shared/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,20 @@ export const DEFAULT_SESSION_PARAMS: SessionParams = {
optAccounts: ['1', '2'],
accept: true
};
export const DEFAULT_CHAIN_NAME = process.env.DEFAULT_CHAIN_NAME || 'Ethereum';

export const TEST_CHAINS = {
POLYGON: 'Polygon',
ETHEREUM: 'Ethereum',
GNOSIS: 'Gnosis'
} as const;

export type SupportedChain = (typeof TEST_CHAINS)[keyof typeof TEST_CHAINS];

export const TIMEOUTS = {
ANIMATION: 300,
NETWORK_SWITCH: 500,
CONNECTION: 5000,
SESSION_PROPOSAL: 30000
} as const;

export const DEFAULT_CHAIN_NAME = process.env.DEFAULT_CHAIN_NAME || TEST_CHAINS.ETHEREUM;
1 change: 0 additions & 1 deletion apps/native/tests/shared/constants/timeouts.ts

This file was deleted.

109 changes: 27 additions & 82 deletions apps/native/tests/shared/pages/ModalPage.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Locator, Page } from '@playwright/test';
import { expect } from '@playwright/test';
import { BASE_URL, DEFAULT_SESSION_PARAMS } from '../constants';
import { BASE_URL, DEFAULT_SESSION_PARAMS, TIMEOUTS } from '../constants';
import { WalletValidator } from '../validators/WalletValidator';
import { WalletPage } from './WalletPage';
import { TimingRecords } from '../types';
import { SupportedChain, TimingRecords } from '../types';
import { ModalValidator } from '../validators/ModalValidator';

export class ModalPage {
Expand Down Expand Up @@ -92,7 +92,7 @@ export class ModalPage {
await expect(accountBtn, 'Account button should be visible').toBeVisible();
await expect(accountBtn, 'Account button should be enabled').toBeEnabled();
await accountBtn.click();
const disconnectBtn = this.page.getByTestId('disconnect-button');
const disconnectBtn = this.page.getByTestId('button-disconnect');
await expect(disconnectBtn, 'Disconnect button should be visible').toBeVisible();
await expect(disconnectBtn, 'Disconnect button should be enabled').toBeEnabled();
await disconnectBtn.click();
Expand Down Expand Up @@ -125,20 +125,12 @@ export class ModalPage {
// await this.page.getByTestId('w3m-connecting-siwe-cancel').click();
// }

async switchNetwork(network: string) {
await this.openAccountModal();
await this.page.getByTestId('w3m-account-select-network').click();
async switchNetwork(network: SupportedChain) {
await this.page.getByTestId(`w3m-network-switch-${network}`).click();
// The state is chaing too fast and test runner doesn't wait the loading page. It's fastly checking the network selection button and detect that it's switched already.
await this.page.waitForTimeout(300);
// The state is changing too fast and test runner doesn't wait for the loading page
await this.page.waitForTimeout(TIMEOUTS.NETWORK_SWITCH);
}

// async clickWalletDeeplink() {
// await this.connectButton.click();
// await this.page.getByTestId('wallet-selector-react-wallet-v2').click();
// await this.page.getByTestId('tab-desktop').click();
// }

async openAccountModal() {
await this.page.getByTestId('account-button').click();
}
Expand All @@ -154,17 +146,9 @@ export class ModalPage {
async closeModal() {
await this.page.getByTestId('header-close')?.click?.();
// Wait for the modal fade out animation
await this.page.waitForTimeout(300);
await this.page.waitForTimeout(TIMEOUTS.ANIMATION);
}

// async switchNetworkWithNetworkButton(networkName: string) {
// const networkButton = this.page.getByTestId('wui-network-button');
// await networkButton.click();

// const networkToSwitchButton = this.page.getByTestId(`w3m-network-switch-${networkName}`);
// await networkToSwitchButton.click();
// }

async openAllWallets() {
const allWallets = this.page.getByTestId('all-wallets');
await expect(allWallets, 'All wallets should be visible').toBeVisible();
Expand All @@ -177,18 +161,6 @@ export class ModalPage {
await qrCodeButton.click();
}

// async clickAllWalletsListSearchItem(id: string) {
// const allWalletsListSearchItem = this.page.getByTestId(`wallet-search-item-${id}`);
// await expect(allWalletsListSearchItem).toBeVisible();
// await allWalletsListSearchItem.click();
// }

// async clickTabWebApp() {
// const tabWebApp = this.page.getByTestId('tab-webapp');
// await expect(tabWebApp).toBeVisible();
// await tabWebApp.click();
// }

async clickHookDisconnectButton() {
const disconnectHookButton = this.page.getByTestId('disconnect-hook-button');
await expect(disconnectHookButton).toBeVisible();
Expand Down Expand Up @@ -216,64 +188,37 @@ export class ModalPage {
return this.page.evaluate(() => navigator.clipboard.readText());
}

// async clickOpenWebApp() {
// let url = '';

// const openButton = this.page.getByTestId('w3m-connecting-widget-secondary-button');
// await expect(openButton).toBeVisible();
// await expect(openButton).toHaveText('Open');

// while (!url) {
// await openButton.click();
// await this.page.waitForTimeout(500);

// const pages = this.page.context().pages();

// // Check if more than 1 tab is open
// if (pages.length > 1) {
// const lastTab = pages[pages.length - 1];

// if (lastTab) {
// url = lastTab.url();
// break;
// }
// }
// }

// return url;
// }

async search(value: string) {
const searchInput = this.page.getByTestId('wui-input-text');
await expect(searchInput, 'Search input should be visible').toBeVisible();
await searchInput.click();
await searchInput.fill(value);
}

async openNetworks() {
await this.page.getByTestId('w3m-account-select-network').click();
async goToNetworks() {
await this.page.getByTestId('button-network').click();
await expect(this.page.getByText('Select network')).toBeVisible();
}

// async openProfileView() {
// await this.page.getByTestId('wui-profile-button').click();
// }

// async getAddress(): Promise<`0x${string}`> {
// const address = await this.page.getByTestId('w3m-address').textContent();
// expect(address, 'Address should be present').toBeTruthy();

// return address as `0x${string}`;
// }
async goToActivity() {
await this.page.getByTestId('button-activity').click();
}

// async getChainId(): Promise<number> {
// const chainId = await this.page.getByTestId('w3m-chain-id').textContent();
// expect(chainId, 'Chain ID should be present').toBeTruthy();
async goBack() {
await this.page.getByTestId('button-back').click();
}

// return Number(chainId);
// }
async expectLoaderVisible() {
await expect(
this.page.getByTestId('loading-spinner'),
'Loading spinner should be visible'
).toBeVisible();
}

// async switchNetworkWithHook() {
// await this.page.getByTestId('switch-network-hook-button').click();
// }
async expectLoaderHidden() {
await expect(
this.page.getByTestId('loading-spinner'),
'Loading spinner should be hidden'
).toBeHidden();
}
}
22 changes: 18 additions & 4 deletions apps/native/tests/shared/pages/WalletPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,23 @@ export class WalletPage {
await this.page.waitForLoadState();
const sessionsButton = this.page.getByTestId('sessions');
await sessionsButton.click();
const sessionCard = this.page.getByTestId(`session-card`);
await sessionCard.click();
const disconnectButton = this.page.getByText('Delete');
await disconnectButton.click();

// Try to disconnect all visible session cards
while (true) {
const sessionCards = this.page.getByTestId('session-card');
const count = await sessionCards.count();

if (count === 0) {
break;
}

// Click the first card and disconnect it
await sessionCards.first().click();
const disconnectButton = this.page.getByText('Delete');
await disconnectButton.click();

// Wait a bit for the disconnection to complete
await this.page.waitForTimeout(500);
}
}
}
4 changes: 4 additions & 0 deletions apps/native/tests/shared/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TEST_CHAINS } from '../constants';

export interface SessionParams {
reqAccounts: string[];
optAccounts: string[];
Expand All @@ -7,3 +9,5 @@ export interface SessionParams {
export type TimingRecords = { item: string; timeMs: number }[];

export type CaipNetworkId = `${string}:${string}`;

export type SupportedChain = (typeof TEST_CHAINS)[keyof typeof TEST_CHAINS];
6 changes: 3 additions & 3 deletions apps/native/tests/shared/utils/timeouts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { MAXIMUM_WAIT_CONNECTIONS } from '../constants/timeouts';
import { TIMEOUTS } from '../constants';

export function getMaximumWaitConnections(): number {
if (process.env.CI) {
return MAXIMUM_WAIT_CONNECTIONS;
return TIMEOUTS.SESSION_PROPOSAL;
}

return MAXIMUM_WAIT_CONNECTIONS * 2;
return TIMEOUTS.SESSION_PROPOSAL * 2;
}
17 changes: 1 addition & 16 deletions apps/native/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ export class ModalValidator {
await expect(address, 'Correct address should be present').toHaveText(expectedAddress);
}

// async expectNetwork(network: string) {
// const networkButton = this.page.getByTestId('w3m-account-select-network');
// await expect(networkButton, `Network button should contain text ${network}`).toHaveText(
// network,
// {
// timeout: 5000
// }
// );
// }

async expectAcceptedSign() {
await expect(this.page.getByText('Signature successful')).toBeVisible({
timeout: 30 * 1000
Expand All @@ -103,7 +93,7 @@ export class ModalValidator {
}

async expectSwitchedNetwork(network: string) {
const switchNetworkButton = this.page.getByTestId(`w3m-account-select-network-text`);
const switchNetworkButton = this.page.getByTestId(`account-select-network-text`);
await expect(switchNetworkButton).toContainText(network);
}

Expand Down Expand Up @@ -132,11 +122,6 @@ export class ModalValidator {
await expect(getAWalletView).toBeVisible();
}

// async expectHeaderText(text: string) {
// const headerText = this.page.getByTestId('header-text');
// await expect(headerText).toHaveText(text);
// }

async expectNetworksDisabled(name: string) {
const disabledNetworkButton = this.page.getByTestId(`w3m-network-switch-${name}`);
disabledNetworkButton.click();
Expand Down
Loading