Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Engine from '../../../core/Engine';
import { SOLANA_NEW_FEATURE_CONTENT_LEARN_MORE } from '../../../constants/urls';
import Routes from '../../../constants/navigation/Routes';
import { useNavigation } from '@react-navigation/native';
import { SolanaNewFeatureSheetSelectorsIDs } from '../../../../e2e/selectors/wallet/SolanaNewFeatureSheet.selectors';

const SolanaNewFeatureContent = () => {
const [isVisible, setIsVisible] = useState(false);
Expand Down Expand Up @@ -132,6 +133,7 @@ const SolanaNewFeatureContent = () => {
variant={ButtonVariants.Link}
label={strings('solana_new_feature_content.learn_more')}
onPress={onLearnMoreClicked}
testID={SolanaNewFeatureSheetSelectorsIDs.SOLANA_LEARN_MORE_BUTTON}
/>
<Button
variant={ButtonVariants.Primary}
Expand All @@ -144,13 +146,15 @@ const SolanaNewFeatureContent = () => {
hasExistingSolanaAccount ? viewSolanaAccount : createSolanaAccount
}
width={ButtonWidthTypes.Full}
testID={SolanaNewFeatureSheetSelectorsIDs.SOLANA_CREATE_ACCOUNT_BUTTON}
/>

<Button
variant={ButtonVariants.Link}
label={strings('solana_new_feature_content.not_now')}
onPress={handleClose}
style={styles.cancelButton}
testID={SolanaNewFeatureSheetSelectorsIDs.SOLANA_NOT_NOW_BUTTON}
/>
</View>
</BottomSheet>
Expand Down
28 changes: 23 additions & 5 deletions e2e/fixtures/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ class FixtureBuilder {
return this;
}

/**
* Ensures that the Solana feature modal is suppressed by adding the appropriate flag to asyncState.
* @returns {FixtureBuilder} - The FixtureBuilder instance for method chaining.
*/
ensureSolanaModalSuppressed() {
if (!this.fixture.asyncState) {
this.fixture.asyncState = {};
}
this.fixture.asyncState['@MetaMask:solanaFeatureModalShown'] = 'true';
return this;
}

/**
* Set the default fixture values.
* @returns {FixtureBuilder} - The FixtureBuilder instance for method chaining.
Expand Down Expand Up @@ -647,6 +659,7 @@ class FixtureBuilder {
'@MetaMask:onboardingWizard': 'explored',
'@MetaMask:UserTermsAcceptedv1.0': 'true',
'@MetaMask:WhatsNewAppVersionSeen': '7.24.3',
'@MetaMask:solanaFeatureModalShown': 'true',
},
};
return this;
Expand Down Expand Up @@ -758,7 +771,9 @@ class FixtureBuilder {
this.withPermissionController(
this.createPermissionControllerConfig(additionalPermissions),
);
return this;

// Ensure Solana feature modal is suppressed
return this.ensureSolanaModalSuppressed();
}

withRampsSelectedRegion(region = null) {
Expand Down Expand Up @@ -870,7 +885,8 @@ class FixtureBuilder {
// Update selectedNetworkClientId to the new network client ID
fixtures.NetworkController.selectedNetworkClientId = newNetworkClientId;

return this;
// Ensure Solana feature modal is suppressed
return this.ensureSolanaModalSuppressed();
}

withSepoliaNetwork() {
Expand Down Expand Up @@ -910,7 +926,8 @@ class FixtureBuilder {
// Update selectedNetworkClientId to the new network client ID
fixtures.NetworkController.selectedNetworkClientId = newNetworkClientId;

return this;
// Ensure Solana feature modal is suppressed
return this.ensureSolanaModalSuppressed();
}

withPopularNetworks() {
Expand Down Expand Up @@ -961,7 +978,8 @@ class FixtureBuilder {
networkConfigurationsByChainId,
};

return this;
// Ensure Solana feature modal is suppressed
return this.ensureSolanaModalSuppressed();
}

withPreferencesController(data) {
Expand All @@ -976,8 +994,8 @@ class FixtureBuilder {
merge(this.fixture.state.engine.backgroundState.KeyringController, {
keyrings: [
{
accounts: [DEFAULT_FIXTURE_ACCOUNT],
type: 'HD Key Tree',
accounts: ['0x37cc5ef6bfe753aeaf81f945efe88134b238face'],
},
{ type: 'QR Hardware Wallet Device', accounts: [] },
],
Expand Down
59 changes: 59 additions & 0 deletions e2e/pages/wallet/SolanaNewFeatureSheet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';

import { SolanaNewFeatureSheetSelectorsIDs } from '../../selectors/wallet/SolanaNewFeatureSheet.selectors';
import Gestures from '../../utils/Gestures';
import Assertions from '../../utils/Assertions';
import { WalletViewSelectorsIDs } from '../../selectors/wallet/WalletView.selectors';
import Matchers from '../../utils/Matchers';

class SolanaNewFeatureSheet {
// Sheet container
get sheetContainer() {
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_NEW_FEATURE_SHEET);
}

// Create Account button
get createAccountButton() {
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_CREATE_ACCOUNT_BUTTON);
}

get learnMoreButton() {
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_LEARN_MORE_BUTTON);
}

get notNowButton() {
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_NOT_NOW_BUTTON);
}

get addAccountButton() {
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_ADD_ACCOUNT_BUTTON_IN_SHEET);
}

get carouselLogo() {
return Matchers.getElementByID(WalletViewSelectorsIDs.CAROUSEL_SIXTH_SLIDE);
}

// Interaction methods
async tapCreateAccountButton() {
await Gestures.waitAndTap(this.createAccountButton);
}

async tapAddAccountButton() {
await Gestures.waitAndTap(this.addAccountButton);
}

async tapLearnMoreButton() {
await Gestures.waitAndTap(this.learnMoreButton);
}


async tapNotNowButton() {
await Gestures.waitAndTap(this.notNowButton);
}

async swipeWithCarouselLogo() {
await Gestures.swipe(this.learnMoreButton, 'down', 'fast');
}
}

export default new SolanaNewFeatureSheet();
16 changes: 16 additions & 0 deletions e2e/selectors/wallet/SolanaNewFeatureSheet.selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { SNAP_ACCOUNT_CUSTOM_NAME_ADD_ACCOUNT_BUTTON } from '../../../app/components/Approvals/SnapAccountCustomNameApproval/SnapAccountCustomNameApproval.constants';

export const SolanaNewFeatureSheetSelectorsIDs = {
SOLANA_NEW_FEATURE_SHEET: 'solana-new-feature-sheet',
SOLANA_CREATE_ACCOUNT_BUTTON: 'solana-create-account-button',
SOLANA_LEARN_MORE_BUTTON: 'solana-learn-more-button',
SOLANA_ADD_ACCOUNT_BUTTON_IN_SHEET: SNAP_ACCOUNT_CUSTOM_NAME_ADD_ACCOUNT_BUTTON,
SOLANA_NOT_NOW_BUTTON: 'solana-not-now-button',
SOLANA_CARASOULE_LOGO: 'carousel-sixth-slide',
};

export const SolanaNewFeatureSheetSelectorsText = {
TITLE: 'Solana is here!',
DESCRIPTION: 'Create, send, and receive Solana tokens in MetaMask',
CREATE_ACCOUNT_BUTTON: 'Create Solana Account',
};
10 changes: 10 additions & 0 deletions e2e/viewHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Assertions from './utils/Assertions';
import { CustomNetworks } from './resources/networks.e2e';
import ToastModal from './pages/wallet/ToastModal';
import TestDApp from './pages/Browser/TestDApp';
import SolanaNewFeatureSheet from './pages/wallet/SolanaNewFeatureSheet';

const LOCALHOST_URL = `http://localhost:${getGanachePort()}/`;
const validAccount = Accounts.getValidAccount();
Expand Down Expand Up @@ -68,6 +69,15 @@ have to have all these workarounds in the tests

console.log('The marketing toast is not visible');
}

// Handle Solana New feature sheet
try {
await SolanaNewFeatureSheet.swipeWithCarouselLogo();
} catch {
/* eslint-disable no-console */

console.log('The new Solana feature modal is not visible');
}
};

export const skipNotificationsDeviceSettings = async () => {
Expand Down
7 changes: 6 additions & 1 deletion metro.transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ const availableFeatures = new Set([
'solana',
]);

const mainFeatureSet = new Set(['preinstalled-snaps', 'multi-srp']);
const mainFeatureSet = new Set([
'preinstalled-snaps',
'keyring-snaps',
'multi-srp',
'solana',
]);
const betaFeatureSet = new Set([
'beta',
'preinstalled-snaps',
Expand Down
Loading