Skip to content

Commit

Permalink
[QAA-262] Delegate E2E test: User should be able to select a validator (
Browse files Browse the repository at this point in the history
#8084)

test: ✅ Adding delegate tests - User should be able to select a validator

test: ⚡️ adding cli to delegate tests
  • Loading branch information
VicAlbr authored Oct 16, 2024
1 parent 63ec8f9 commit f436b72
Show file tree
Hide file tree
Showing 25 changed files with 184 additions and 14,802 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const AccountHeaderActions: AlgorandFamily["accountHeaderManageActions"] = ({
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const AccountHeaderActions = ({ account, parentAccount }: Props) => {
disabled: disableStakeButton,
label: t("account.stake"),
tooltip: disabledLabel,
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const ValidatorField = ({ account, delegation, onChangeValidator, selectedPoolId
<>
{showAll && <ValidatorSearchInput noMargin={true} search={searchQuery} onSearch={onSearch} />}
<ValidatorsFieldContainer>
<Box p={1}>
<Box p={1} data-testid="validator-list">
{(showAll && isSearching) || (!showAll && ledgerPoolsLoading) ? (
<Box flex={1} py={3} alignItems="center" justifyContent="center">
<BigSpinner size={35} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const ValidatorGroupsField = ({
<>
{showAll && <ValidatorSearchInput noMargin={true} search={search} onSearch={onSearch} />}
<S.ValidatorsFieldContainer>
<Box p={1}>
<Box p={1} data-testid="validator-list">
<ScrollLoadingList
data={showAll ? validatorGroups : [chosenValidatorGroup ?? validatorGroups[0]]}
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const AccountHeaderActions = ({ account, parentAccount, source }: Props) => {
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button-cosmos",
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const ValidatorField = ({ account, onChangeValidator, chosenVoteAccAddr }: Props
<>
{showAll && <ValidatorSearchInput noMargin={true} search={search} onSearch={onSearch} />}
<ValidatorsFieldContainer>
<Box p={1}>
<Box p={1} data-testid="validator-list">
<ScrollLoadingList
data={showAll ? validators : chosenValidator}
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const AccountHeaderManageActions = (props: {
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const ValidatorList = (props: Props) => {
{showAll && <ValidatorSearchInput noMargin={true} search={search} onSearch={onSearch} />}

<ValidatorsFieldContainer>
<Box p={1}>
<Box p={1} data-testid="validator-list">
<ScrollLoadingList
data={showAll ? providers : defaultValidator}
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const AccountHeaderActions = ({ account, parentAccount }: Props) => {
label: t("account.stake", {
currency: account?.currency?.name,
}),
accountActionsTestId: "stake-from-account-action-button",
accountActionsTestId: "stake-button",
},
];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const AccountHeaderActions: NearFamily["accountHeaderManageActions"] = ({
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ValidatorField = ({ account, onChangeValidator, chosenVoteAccAddr }: Props
<>
{showAll && <ValidatorSearchInput noMargin={true} search={search} onSearch={onSearch} />}
<ValidatorsFieldContainer>
<Box p={1}>
<Box p={1} data-testid="validator-list">
<ScrollLoadingList
data={
showAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const AccountHeaderManageActions = ({ account, parentAccount, source = "Account
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const AccountHeaderActions: SolanaFamily["accountHeaderManageActions"] = ({ acco
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ValidatorField = ({ account, onChangeValidator, chosenVoteAccAddr }: Props
<>
{showAll && <ValidatorSearchInput noMargin={true} search={search} onSearch={onSearch} />}
<ValidatorsFieldContainer>
<Box p={1}>
<Box p={1} data-testid="validator-list">
<ScrollLoadingList
data={showAll ? validators : [chosenValidator ?? validators[0]]}
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const AccountHeaderManageActions: TezosFamily["accountHeaderManageActions"] = ({
eventProperties: {
button: "stake",
},
accountActionsTestId: "stake-button",
},
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const AccountHeaderManageActions = ({
button: "stake",
},
onClick: () => stakeOnClick(),
accountActionsTestId: "stake-button",
},
];
};
Expand Down
30 changes: 30 additions & 0 deletions apps/ledger-live-desktop/tests/enum/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ export class Account {
Currency.SOL,
"Solana 2",
"6vSQTFcBoPfUKAdo8BQNJqqxU6UcBmd87HQoNSbgTMzH",
undefined,
1,
);

static readonly TRX_1 = new Account(
Expand Down Expand Up @@ -261,6 +263,8 @@ export class Account {
Currency.ATOM,
"Cosmos 2",
"cosmos12d854g9mut943gu5ncyhalapukttkddnvlxaq6",
undefined,
1,
);

static readonly XTZ_1 = new Account(
Expand Down Expand Up @@ -294,6 +298,16 @@ export class Account {
Currency.NEAR,
"NEAR 1",
"70b2982a31cfcffc773145d2143392612bb83a22926c912e2ce3ec0634f637e2",
undefined,
0,
);

static readonly NEAR_2 = new Account(
Currency.NEAR,
"NEAR 2",
"5effd8bfea3885b6f5f91256663e5af720b18761a96bd6592e210a23f950872c",
undefined,
1,
);

static readonly ETH_USDT_1 = new Account(
Expand Down Expand Up @@ -391,4 +405,20 @@ export class Account {
"Ethereum 2",
"0x43047a5023d55a8658fcb1c1cea468311adaa3ad",
);

static readonly MULTIVERS_X_1 = new Account(
Currency.MULTIVERS_X,
"MultiversX 1",
"erd1kp2psapk98pjtxr0n583qlq9zurwdwaqcvgh7l5hyj6hh839p5dq82cuw9",
undefined,
0,
);

static readonly OSMO_1 = new Account(
Currency.OSMO,
"Osmosis 1",
"osmo1w7v2v6v8z3r3d8x8h7yjv6w2k3c5w3z7w6v8v8",
undefined,
0,
);
}
35 changes: 35 additions & 0 deletions apps/ledger-live-desktop/tests/enum/AppInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class AppInfos {
public readonly receivePattern?: DeviceLabels[],
public readonly delegatePattern?: DeviceLabels[],
) {}

static readonly BITCOIN = new AppInfos(
"Bitcoin",
[
Expand All @@ -18,6 +19,7 @@ export class AppInfos {
],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly BITCOIN_TESTNET = new AppInfos(
"Bitcoin Test",
[
Expand All @@ -29,67 +31,80 @@ export class AppInfos {
],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly DOGECOIN = new AppInfos(
"Dogecoin",
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly ETHEREUM = new AppInfos(
"Ethereum",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly ETHEREUM_HOLESKY = new AppInfos(
"Ethereum Holesky",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly ETHEREUM_SEPOLIA = new AppInfos(
"Ethereum Sepolia",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly ETHEREUM_CLASSIC = new AppInfos(
"Ethereum Classic",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly SOLANA = new AppInfos(
"Solana",
[DeviceLabels.TRANSFER, DeviceLabels.RECIPIENT, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.PUBKEY, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.DELEGATE_FROM, DeviceLabels.DEPOSIT, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly POLKADOT = new AppInfos(
"Polkadot",
[DeviceLabels.DEST, DeviceLabels.AMOUNT, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
);

static readonly TRON = new AppInfos(
"Tron",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.SIGN, DeviceLabels.CANCEL],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.CANCEL],
);

static readonly RIPPLE = new AppInfos(
"Ripple",
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.SIGN, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly CARDANO = new AppInfos(
"Cardano",
[DeviceLabels.SEND, DeviceLabels.SEND_TO_ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.CONFIRM, DeviceLabels.REJECT],
);

static readonly STELLAR = new AppInfos(
"Stellar",
[DeviceLabels.SEND, DeviceLabels.DESTINATION, DeviceLabels.FINALIZE, DeviceLabels.CANCEL],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly BITCOIN_CASH = new AppInfos(
"Bitcoin Cash",
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly ALGORAND = new AppInfos(
"Algorand",
[
Expand All @@ -100,6 +115,7 @@ export class AppInfos {
],
[DeviceLabels.ADDRESS, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
);

static readonly COSMOS = new AppInfos(
"Cosmos",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.CAPS_APPROVE, DeviceLabels.CAPS_REJECT],
Expand All @@ -111,26 +127,31 @@ export class AppInfos {
DeviceLabels.CAPS_REJECT,
],
);

static readonly TEZOS = new AppInfos(
"Tezos",
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly POLYGON = new AppInfos(
"Polygon",
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly BINANCE_SMART_CHAIN = new AppInfos(
"Binance Smart Chain",
[DeviceLabels.AMOUNT, DeviceLabels.ADDRESS, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly TON = new AppInfos(
"Ton",
[DeviceLabels.AMOUNT, DeviceLabels.TO, DeviceLabels.APPROVE, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly NEAR = new AppInfos(
"Near",
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
Expand All @@ -146,7 +167,21 @@ export class AppInfos {
DeviceLabels.SIGN,
],
);

static readonly MULTIVERSE_X = new AppInfos(
"Multiverse X",
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly OSMOSIS = new AppInfos(
"Osmosis",
[DeviceLabels.AMOUNT, DeviceLabels.DESTINATION, DeviceLabels.ACCEPT, DeviceLabels.REJECT],
[DeviceLabels.ADDRESS, DeviceLabels.APPROVE, DeviceLabels.REJECT],
);

static readonly LS = new AppInfos("LedgerSync");

static readonly EXCHANGE = new AppInfos("Exchange", [
DeviceLabels.SEND,
DeviceLabels.GET,
Expand Down
2 changes: 2 additions & 0 deletions apps/ledger-live-desktop/tests/enum/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ export class Currency {
static readonly POL_DAI = new Currency("(PoS) Dai Stablecoin", "DAI", AppInfos.POLYGON);
static readonly POL_UNI = new Currency("Uniswap (PoS)", "UNI", AppInfos.POLYGON);
static readonly NEAR = new Currency("NEAR", "NEAR", AppInfos.NEAR);
static readonly MULTIVERS_X = new Currency("Multiverse X", "EGLD", AppInfos.MULTIVERSE_X);
static readonly OSMO = new Currency("Osmosis", "OSMO", AppInfos.OSMOSIS);
}
7 changes: 1 addition & 6 deletions apps/ledger-live-desktop/tests/page/account.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export class AccountPage extends AppPage {
private swapButton = this.page.getByTestId("swap-account-action-button");
private buyButton = this.page.getByTestId("buy-button");
private sellButton = this.page.getByTestId("sell-button");
private stakeButton = this.page.getByTestId("stake-from-account-action-button");
private stakeButtonCosmos = this.page.getByTestId("stake-button-cosmos");
private stakeButton = this.page.getByTestId("stake-button");
readonly stakeBanner = this.page.getByTestId("account-stake-banner");
private stakeBannerButton = this.page.getByTestId("account-stake-banner-button");
private receiveButton = this.page.getByRole("button", { name: "Receive", exact: true });
Expand Down Expand Up @@ -93,10 +92,6 @@ export class AccountPage extends AppPage {
await operationList.scrollIntoViewIfNeeded();
}

async startCosmosStakingFlow() {
await this.stakeButtonCosmos.click();
}

/**
* Delete account from account itself
*/
Expand Down
Loading

0 comments on commit f436b72

Please sign in to comment.