Skip to content
4 changes: 4 additions & 0 deletions test/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export const DEFAULT_SOLANA_ACCOUNT =
export const DEFAULT_FIXTURE_SOLANA_ACCOUNT =
'4tE76eixEgyJDrdykdWJR1XBkzUk4cLMvqjR2xVJUxer';

/* Default fixture SOLANA account UUID (from default-fixture.json) */
export const DEFAULT_FIXTURE_SOLANA_ACCOUNT_ID =
'688e01b8-3134-4ef4-80e6-8772bab38ef7';
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated

/* Solana Mainnet chain ID (genesis hash) */
export const SOLANA_MAINNET_CHAIN_ID = '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';

Expand Down
8 changes: 8 additions & 0 deletions test/e2e/fixtures/fixture-builder-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ class FixtureBuilderV2 {
});
}

withShowNativeTokenAsMainBalanceDisabled(): this {
return this.withPreferencesController({
preferences: {
showNativeTokenAsMainBalance: false,
},
});
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed because now I'm using FixtureBuilderV2 in a spec which was using this method from the legacy fixture builder

build() {
return this.fixture;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { strict as assert } from 'assert';
import { By } from 'selenium-webdriver';
import { largeDelayMs } from '../../../helpers';
import { largeDelayMs, withFixtures } from '../../../helpers';
import { SOLANA_MAINNET_SCOPE } from '../../../constants';
import FixtureBuilderV2 from '../../../fixtures/fixture-builder-v2';
import { loginWithBalanceValidation } from '../../../page-objects/flows/login.flow';
import { addAccount } from '../../../page-objects/flows/add-account.flow';
import TestDappMultichain from '../../../page-objects/pages/test-dapp-multichain';
import { DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS } from '../testHelpers';
import { withSolanaAccountSnap } from '../../../tests/solana/common-solana';

describe('Multichain API - Non EVM', function () {
const SOLANA_SCOPE = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use the one in the constants file

describe("Call `wallet_createSession` with both EVM and Solana scopes that match the user's enabled networks", function () {
it('should only select the specified scopes requested by the user', async function () {
await withSolanaAccountSnap(
await withFixtures(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use the default fixtures out of the box. No need to additional layer of abstraction withSolanaAccountSnap

{
...DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS,
fixtures: new FixtureBuilderV2().build(),
title: this.test?.fullTitle(),
},
async (driver, _, extensionId) => {
async ({ driver, extensionId }) => {
await loginWithBalanceValidation(driver);
const requestScopesToNetworkMap = {
'eip155:1': 'Ethereum',
[SOLANA_SCOPE]: 'Solana',
[SOLANA_MAINNET_SCOPE]: 'Solana',
};

const requestScopes = Object.keys(requestScopesToNetworkMap);
Expand Down Expand Up @@ -72,17 +76,20 @@ describe('Multichain API - Non EVM', function () {

describe('Connect wallet to the multichain dapp via `externally_connectable`, call `wallet_createSession` with Solana scope, without any accounts requested', function () {
it('should automatically select the current active Solana account', async function () {
await withSolanaAccountSnap(
await withFixtures(
{
...DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS,
fixtures: new FixtureBuilderV2().build(),
title: this.test?.fullTitle(),
numberOfAccounts: 2,

@seaona seaona Feb 24, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the withSolanaAccountSnap method, we accepted a param for creating another account if we wanted.
This is now removed, and we use a re-usable flow addAccount from the flow folder, and it's used whenever is needed in the spec (adding an account is not an exclusive solana flow, but a multichain default flow)

},
async (driver, _, extensionId) => {
async ({ driver, extensionId }) => {
await loginWithBalanceValidation(driver);
await addAccount({ driver, switchToAccount: 'Account 1' });

const testDapp = new TestDappMultichain(driver);
await testDapp.openTestDappPage();
await testDapp.connectExternallyConnectable(extensionId);
await testDapp.initCreateSessionScopes([SOLANA_SCOPE]);
await testDapp.initCreateSessionScopes([SOLANA_MAINNET_SCOPE]);

const editButtons = await driver.findElements('[data-testid="edit"]');
await editButtons[0].click();
Expand Down
34 changes: 21 additions & 13 deletions test/e2e/flask/multichain-api/non-evm/wallet_invokeMethod.spec.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
import { strict as assert } from 'assert';
import { isObject } from 'lodash';
import { WINDOW_TITLES } from '../../../constants';
import { SOLANA_MAINNET_SCOPE, WINDOW_TITLES } from '../../../constants';
import TestDappMultichain from '../../../page-objects/pages/test-dapp-multichain';
import { DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS } from '../testHelpers';
import { withSolanaAccountSnap } from '../../../tests/solana/common-solana';
import { buildSolanaTestSpecificMock } from '../../../tests/solana/common-solana';
import { withFixtures } from '../../../helpers';
import FixtureBuilderV2 from '../../../fixtures/fixture-builder-v2';
import { loginWithBalanceValidation } from '../../../page-objects/flows/login.flow';
import SnapTransactionConfirmation from '../../../page-objects/pages/confirmations/snap-transaction-confirmation';
import SnapSignInConfirmation from '../../../page-objects/pages/confirmations/snap-sign-in-confirmation';

describe('Multichain API - Non EVM', function () {
const SOLANA_SCOPE = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';
describe('Calling `wallet_invokeMethod`', function () {
describe('signIn method', function () {
it('Should match selected method to the expected confirmation UI', async function () {
await withSolanaAccountSnap(
await withFixtures(
{
...DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS,
fixtures: new FixtureBuilderV2().build(),
title: this.test?.fullTitle(),
},
async (driver, _, extensionId) => {
async ({ driver, extensionId }) => {
await loginWithBalanceValidation(driver);
const testDapp = new TestDappMultichain(driver);
await testDapp.openTestDappPage();
await testDapp.connectExternallyConnectable(extensionId);
await testDapp.initCreateSessionScopes([SOLANA_SCOPE]);
await testDapp.initCreateSessionScopes([SOLANA_MAINNET_SCOPE]);
await driver.clickElementAndWaitForWindowToClose({
text: 'Connect',
tag: 'button',
Expand All @@ -32,7 +36,7 @@ describe('Multichain API - Non EVM', function () {
);

await testDapp.invokeMethod({
scope: SOLANA_SCOPE,
scope: SOLANA_MAINNET_SCOPE,
method: 'signIn',
});

Expand All @@ -47,17 +51,21 @@ describe('Multichain API - Non EVM', function () {

describe('signAndSendTransaction method', function () {
it('Should match selected method to the expected confirmation UI', async function () {
await withSolanaAccountSnap(
await withFixtures(
{
...DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS,
fixtures: new FixtureBuilderV2().build(),
title: this.test?.fullTitle(),
mockGetTransactionSuccess: true,
testSpecificMock: buildSolanaTestSpecificMock({
mockGetTransactionSuccess: true,
}),
},
async (driver, _, extensionId) => {
async ({ driver, extensionId }) => {
await loginWithBalanceValidation(driver);
const testDapp = new TestDappMultichain(driver);
await testDapp.openTestDappPage();
await testDapp.connectExternallyConnectable(extensionId);
await testDapp.initCreateSessionScopes([SOLANA_SCOPE]);
await testDapp.initCreateSessionScopes([SOLANA_MAINNET_SCOPE]);
await driver.clickElementAndWaitForWindowToClose({
text: 'Connect',
tag: 'button',
Expand All @@ -70,7 +78,7 @@ describe('Multichain API - Non EVM', function () {
const invokeMethod = 'signAndSendTransaction';

await testDapp.invokeMethod({
scope: SOLANA_SCOPE,
scope: SOLANA_MAINNET_SCOPE,
method: invokeMethod,
});

Expand All @@ -86,7 +94,7 @@ describe('Multichain API - Non EVM', function () {
);

const transactionResult = await testDapp.getInvokeMethodResult({
scope: SOLANA_SCOPE,
scope: SOLANA_MAINNET_SCOPE,
method: invokeMethod,
});
const parsedTransactionResult = JSON.parse(transactionResult);
Expand Down
15 changes: 11 additions & 4 deletions test/e2e/flask/snaps/test-snap-protocol.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import { openTestSnapClickButtonAndInstall } from '../../page-objects/flows/install-test-snap.flow';
import { DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS } from '../multichain-api/testHelpers';
import { DAPP_ONE_URL, WINDOW_TITLES } from '../../constants';
import { withSolanaAccountSnap } from '../../tests/solana/common-solana';
import { buildSolanaTestSpecificMock } from '../../tests/solana/common-solana';
import { withFixtures } from '../../helpers';
import FixtureBuilder from '../../fixtures/fixture-builder';
import { loginWithBalanceValidation } from '../../page-objects/flows/login.flow';
import ConnectAccountConfirmation from '../../page-objects/pages/confirmations/connect-account-confirmation';
import TestDappMultichain from '../../page-objects/pages/test-dapp-multichain';

describe('Test Protocol Snaps', function () {
it('can call getBlockHeight exposed by Snap', async function () {
await withSolanaAccountSnap(
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
title: this.test?.fullTitle(),
withProtocolSnap: true,
...DEFAULT_MULTICHAIN_TEST_DAPP_FIXTURE_OPTIONS,
testSpecificMock: buildSolanaTestSpecificMock({
withProtocolSnap: true,
}),
},
async (driver, mockServer, extensionId) => {
async ({ driver, mockServer, extensionId }) => {
await loginWithBalanceValidation(driver);
const mockBlockHeight = 368556246;
await mockServer
.forPost('https://api.devnet.solana.com/')
Expand Down
Loading
Loading