Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallets updates #107

Merged
merged 13 commits into from
Nov 27, 2023
1 change: 1 addition & 0 deletions packages/wallets/src/bitget/bitget.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonWalletConfig } from '../wallets.constants';

export const BITGET_COMMON_CONFIG: CommonWalletConfig = {
WALLET_NAME: 'bitget',
CONNECTED_WALLET_NAME: 'Bitget',
RPC_URL_PATTERN: '',
STORE_EXTENSION_ID: 'jiidiaalihmmhddjgbnbgdfflelocpak',
CONNECT_BUTTON_NAME: 'Bitget',
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/coin98/coin98.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonWalletConfig } from '../wallets.constants';

export const COIN98_COMMON_CONFIG: CommonWalletConfig = {
WALLET_NAME: 'coin98',
CONNECTED_WALLET_NAME: 'Coin98',
RPC_URL_PATTERN: 'https://mainnet.infura.io/v3/**',
STORE_EXTENSION_ID: 'aeachknmefphepccionboohckonoeemg',
CONNECT_BUTTON_NAME: 'Coin98',
Expand Down
8 changes: 5 additions & 3 deletions packages/wallets/src/coin98/coin98.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,32 @@
await test.step('Setup', async () => {
await this.navigate();
if (!this.page) throw "Page isn't ready";
const firstTime = await this.page.waitForSelector('text=Restore Wallet');
const firstTime = await this.page.waitForSelector('text=Get Started');

Check failure on line 29 in packages/wallets/src/coin98/coin98.page.ts

View workflow job for this annotation

GitHub Actions / Testing

../../test/widgets/solana.spec.ts:32:7 › Solana › Coin98 connect

1) ../../test/widgets/solana.spec.ts:32:7 › Solana › Coin98 connect ============================== page.waitForSelector: Timeout 120000ms exceeded. =========================== logs =========================== waiting for locator('text=Get Started') to be visible ============================================================ at ../../../packages/wallets/src/coin98/coin98.page.ts:29 27 | await this.navigate(); 28 | if (!this.page) throw "Page isn't ready"; > 29 | const firstTime = await this.page.waitForSelector('text=Get Started'); | ^ 30 | if (firstTime) await this.firstTimeSetup(network); 31 | }); 32 | } at /home/runner/work/wallets-testing-modules/wallets-testing-modules/packages/wallets/src/coin98/coin98.page.ts:29:41 at Coin98.setup (/home/runner/work/wallets-testing-modules/wallets-testing-modules/packages/wallets/src/coin98/coin98.page.ts:26:5) at BrowserService.setup (/home/runner/work/wallets-testing-modules/wallets-testing-modules/wallets-testing/browser/browser.service.ts:96:5) at /home/runner/work/wallets-testing-modules/wallets-testing-modules/wallets-testing/test/widgets/solana.spec.ts:33:5
if (firstTime) await this.firstTimeSetup(network);
});
}

async firstTimeSetup(network: string) {
await test.step('First time setup', async () => {
if (!this.page) throw "Page isn't ready";
await this.page.click('text=Restore Wallet');
await this.page.click('text=Get Started');
await this.page.click('text=Ok');
await this.page.waitForSelector('input[type=password]');
const inputs = await this.page.locator('input[type=password]');
await inputs.nth(0).fill(this.config.PASSWORD);
await inputs.nth(1).fill(this.config.PASSWORD);
await this.page.click('button:has-text("Setup Password")');
await this.page.click('button:has-text("Ok")');
await this.page.click('button:has-text("Continue")');
await this.page.fill('[placeholder="Search"]', network);
await this.page.getByText(network, { exact: true }).click();
await this.page.click('button:has-text("Restore")');
await this.page.fill('input[name="name"]', 'test');
await this.page.fill(
'div[class="relative w-full"] >> div',
this.config.SECRET_PHRASE.trim(),
);
await this.page.locator('button:has-text("Restore")').nth(1).click();
await this.page.locator('button:has-text("Restore")').click();
await this.page.waitForSelector('text=Success!');
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/coinbase/coinbase.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonWalletConfig } from '../wallets.constants';

export const COINBASE_COMMON_CONFIG: CommonWalletConfig = {
WALLET_NAME: 'coinbase',
CONNECTED_WALLET_NAME: 'Coinbase',
RPC_URL_PATTERN: 'https://mainnet.infura.io/v3/**',
STORE_EXTENSION_ID: 'hnfanknocfeofbddgcijnmhnfnkdnaad',
CONNECT_BUTTON_NAME: 'Coinbase',
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/exodus/exodus.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonWalletConfig } from '../wallets.constants';

export const EXODUS_COMMON_CONFIG: CommonWalletConfig = {
WALLET_NAME: 'exodus',
CONNECTED_WALLET_NAME: 'Exodus',
RPC_URL_PATTERN: '',
STORE_EXTENSION_ID: 'aholpfdialjgjfhomihkjbmgjidlcdno',
CONNECT_BUTTON_NAME: 'Exodus',
Expand Down
3 changes: 0 additions & 3 deletions packages/wallets/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
export * from './wallet.page';
export * from './wallets.constants';
export * from './coin98';
export * from './mathwallet';
export * from './metamask';
export * from './trustwallet';
export * from './phantom';
export * from './coinbase';
export * from './taho';
export * from './exodus';
export * from './xdefi';
export * from './okx';
Expand Down
2 changes: 0 additions & 2 deletions packages/wallets/src/mathwallet/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/wallets/src/mathwallet/mathwallet.constants.ts

This file was deleted.

82 changes: 0 additions & 82 deletions packages/wallets/src/mathwallet/mathwallet.page.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/wallets/src/metamask/metamask.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonWalletConfig } from '../wallets.constants';

export const METAMASK_COMMON_CONFIG: CommonWalletConfig = {
WALLET_NAME: 'metamask',
CONNECTED_WALLET_NAME: 'MetaMask',
RPC_URL_PATTERN: 'https://mainnet.infura.io/v3/**',
STORE_EXTENSION_ID: 'nkbihfbeogaeaoehlefnkodbefgpgknn',
CONNECT_BUTTON_NAME: 'Metamask',
Expand Down
35 changes: 35 additions & 0 deletions packages/wallets/src/metamask/metamask.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class MetamaskPage implements WalletPage {
});
}

async goToActivity() {
await this.page.locator('button:has-text("Activity")').click();
}

async setup() {
await test.step('Setup', async () => {
// added explicit route to #onboarding due to unexpected first time route from /home.html to /onboarding - page is close
Expand Down Expand Up @@ -128,6 +132,7 @@ export class MetamaskPage implements WalletPage {
networkUrl: string,
chainId: number,
tokenSymbol: string,
blockExplorer = '',
) {
await test.step('Add network', async () => {
if (!this.page) throw "Page isn't ready";
Expand All @@ -153,6 +158,11 @@ export class MetamaskPage implements WalletPage {
".form-field :has-text('Currency symbol') >> input",
tokenSymbol,
);
if (blockExplorer != '')
await this.page.fill(
".form-field :has-text('Block explorer URL') >> input",
blockExplorer,
);
await this.page.click('text=Save');
await this.navigate();
});
Expand Down Expand Up @@ -195,6 +205,31 @@ export class MetamaskPage implements WalletPage {
});
}

async confirmAddTokenToWallet(confirmPage: Page) {
await test.step('Confirm add token to wallet', async () => {
await confirmPage.locator('button:has-text("Add token")').click();
});
}
async openLastTxInEthplorer(txIndex = 0) {
if (!this.page) throw "Page isn't ready";
await this.navigate();
await this.goToActivity();
await this.page.getByTestId('activity-list-item').nth(txIndex).click();
const [, etherscanPage] = await Promise.all([
await this.page.locator('text=View on block explorer').click(),
await this.page.context().waitForEvent('page', { timeout: 120000 }),
]);
return etherscanPage;
}

async getTokenBalance(tokenName: string) {
await this.navigate();
await this.page
.getByTestId('multichain-token-list-button')
.locator(`p:has-text(${tokenName})`)
.textContent();
}

async confirmTx(page: Page, setAggressiveGas?: boolean) {
await test.step('Confirm TX', async () => {
if (setAggressiveGas) {
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/okx/okx.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonWalletConfig } from '../wallets.constants';

export const OKX_COMMON_CONFIG: CommonWalletConfig = {
WALLET_NAME: 'okx',
CONNECTED_WALLET_NAME: 'OKX Wallet',
RPC_URL_PATTERN: '',
STORE_EXTENSION_ID: 'mcohilncbfahbmgdjkbpemcciiolgcge',
CONNECT_BUTTON_NAME: 'OKX Wallet',
Expand Down
2 changes: 0 additions & 2 deletions packages/wallets/src/phantom/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/wallets/src/phantom/phantom.constants.ts

This file was deleted.

117 changes: 0 additions & 117 deletions packages/wallets/src/phantom/phantom.page.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/wallets/src/taho/index.ts

This file was deleted.

Loading
Loading