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

DISABLE_TRANSACTION_BROADCAST logic moved to tests suites #8385

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 0 additions & 16 deletions .github/workflows/test-ui-e2e-only-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ on:
required: false
type: string
default: "B2CQA-2461"
enable_send_test:
description: Enable broadcast
required: false
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name != 'develop' && github.ref || github.run_id }}
Expand All @@ -61,7 +56,6 @@ jobs:
CI_OS: "ubuntu-latest"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
SPECULOS_IMAGE_TAG: ghcr.io/ledgerhq/speculos:0.11
ENABLE_BROADCAST_TEST: ${{ inputs.enable_send_test }}
runs-on: [ledger-live-4xlarge]
strategy:
fail-fast: false
Expand All @@ -73,16 +67,6 @@ jobs:
with:
ref: ${{ inputs.ref || github.sha }}

- name: Setup broadcast environment variables
id: set-env
run: |
day=$(date +%u)
if [ $day -eq 1 ] || "$ENABLE_BROADCAST_TEST" = "1" ; then
echo "ENABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
else
echo "DISABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
fi

- name: Setup caches
id: caches
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
Expand Down
3 changes: 1 addition & 2 deletions apps/ledger-live-desktop/tests/fixtures/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ export const test = base.extend<TestFixtures>({
FEATURE_FLAGS: JSON.stringify(featureFlags),
MANAGER_DEV_MODE: IS_NOT_MOCK ? true : undefined,
SPECULOS_API_PORT: IS_NOT_MOCK ? getEnv("SPECULOS_API_PORT")?.toString() : undefined,
DISABLE_TRANSACTION_BROADCAST:
process.env.ENABLE_TRANSACTION_BROADCAST == "1" || !IS_NOT_MOCK ? undefined : 1,
DISABLE_TRANSACTION_BROADCAST: !IS_NOT_MOCK ? undefined : 1,
},
env,
);
Expand Down
241 changes: 124 additions & 117 deletions apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";
import { commandCLI } from "tests/utils/cliUtils";
import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils";

const e2eDelegationAccounts = [
{
Expand Down Expand Up @@ -47,17 +48,120 @@
},
];

for (const account of e2eDelegationAccounts) {
test.describe("Delegate", () => {
test.describe("Delegate flows", () => {
test.beforeAll(async () => {
process.env.ENABLE_TRANSACTION_BROADCAST =
new Date().getDay() === 1 && isRunningInScheduledWorkflow() ? "true" : "false";
bharamboure-ledger marked this conversation as resolved.
Show resolved Hide resolved
});
for (const account of e2eDelegationAccounts) {
test.describe("Delegate", () => {
test.use({
userdata: "skip-onboarding",
speculosApp: account.delegate.account.currency.speculosApp,
cliCommands: [
{
command: commandCLI.liveData,
args: {
currency: account.delegate.account.currency.ticker,
index: account.delegate.account.index,
add: true,
appjson: "",
},
},
],
});

test(
`[${account.delegate.account.currency.name}] Delegate`,
{
annotation: {
type: "TMS",
description: account.xrayTicket,
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(account.delegate.account.accountName);

await app.account.clickBannerCTA();

Check failure on line 87 in apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu) (1, 3)

[speculos_tests] β€Ί specs/speculos/delegate.spec.ts:74:11 β€Ί Delegate flows β€Ί Delegate β€Ί [Solana] Delegate

6) [speculos_tests] β€Ί specs/speculos/delegate.spec.ts:74:11 β€Ί Delegate flows β€Ί Delegate β€Ί [Solana] Delegate β€Ί Click Stake button on banner TimeoutError: locator.scrollIntoViewIfNeeded: Timeout 120000ms exceeded. Call log: - waiting for getByTestId('account-stake-banner-button') 85 | await app.accounts.navigateToAccountByName(account.delegate.account.accountName); 86 | > 87 | await app.account.clickBannerCTA(); | ^ 88 | await app.delegate.verifyProvider(account.delegate.provider); 89 | 90 | await app.delegate.continueDelegate(); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts:87:29
await app.delegate.verifyProvider(account.delegate.provider);

await app.delegate.continueDelegate();
await app.delegate.fillAmount(account.delegate.amount);
await app.modal.countinueSendAmount();

await app.speculos.signDelegationTransaction(account.delegate);
await app.delegate.clickViewDetailsButton();

await app.drawer.waitForDrawerToBeVisible();
await app.delegateDrawer.transactionTypeIsVisible();
await app.delegateDrawer.providerIsVisible(account.delegate);
await app.delegateDrawer.amountValueIsVisible();
await app.drawer.close();

await app.layout.syncAccounts();
await app.account.clickOnLastOperation();
await app.delegateDrawer.expectDelegationInfos(account.delegate);
},
);
});
}

for (const validator of validators) {
test.describe("Select a validator", () => {
test.use({
userdata: "skip-onboarding",
speculosApp: validator.delegate.account.currency.speculosApp,
cliCommands: [
{
command: commandCLI.liveData,
args: {
currency: validator.delegate.account.currency.ticker,
index: validator.delegate.account.index,
add: true,
appjson: "",
},
},
],
});

test(
`[${validator.delegate.account.currency.name}] - Select validator`,
{
annotation: {
type: "TMS",
description: validator.xrayTicket,
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(validator.delegate.account.accountName);

await app.account.startStakingFlowFromMainStakeButton();
await app.modal.continue();

await app.delegate.verifyProvider(validator.delegate.provider);
await app.delegate.openSearchProviderModal();
await app.delegate.checkValidatorListIsVisible();
await app.delegate.selectProvider(1);

Check failure on line 148 in apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu) (1, 3)

[speculos_tests] β€Ί specs/speculos/delegate.spec.ts:129:11 β€Ί Delegate flows β€Ί Select a validator β€Ί [Multiverse X] - Select validator

8) [speculos_tests] β€Ί specs/speculos/delegate.spec.ts:129:11 β€Ί Delegate flows β€Ί Select a validator β€Ί [Multiverse X] - Select validator β€Ί check selected provider is different from the previous one Error: expect(received).toContain(expected) // indexOf Expected substring: "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqq78llllsm0hnpx" Received string: "Ledger by Figment" 146 | await app.delegate.openSearchProviderModal(); 147 | await app.delegate.checkValidatorListIsVisible(); > 148 | await app.delegate.selectProvider(1); | ^ 149 | }, 150 | ); 151 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts:148:30
},
);
});
}

test.describe("Staking flow from different entry point", () => {
const delegateAccount = new Delegate(Account.ATOM_1, "0.001", "Ledger");
test.use({
userdata: "skip-onboarding",
speculosApp: account.delegate.account.currency.speculosApp,
speculosApp: delegateAccount.account.currency.speculosApp,
cliCommands: [
{
command: commandCLI.liveData,
args: {
currency: account.delegate.account.currency.ticker,
index: account.delegate.account.index,
currency: delegateAccount.account.currency.ticker,
index: delegateAccount.account.index,
add: true,
appjson: "",
},
Expand All @@ -66,142 +170,45 @@
});

test(
`[${account.delegate.account.currency.name}] Delegate`,
"Staking flow from portfolio entry point",
{
annotation: {
type: "TMS",
description: account.xrayTicket,
description: "B2CQA-2769",
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(account.delegate.account.accountName);
await app.layout.goToPortfolio();
await app.portfolio.startStakeFlow();

await app.account.clickBannerCTA();
await app.delegate.verifyProvider(account.delegate.provider);
await app.assetDrawer.selectAsset(delegateAccount.account.currency);
await app.assetDrawer.selectAccountByIndex(delegateAccount.account);

await app.delegate.verifyProvider(delegateAccount.provider);
await app.delegate.continueDelegate();
await app.delegate.fillAmount(account.delegate.amount);
await app.modal.countinueSendAmount();

await app.speculos.signDelegationTransaction(account.delegate);
await app.delegate.clickViewDetailsButton();

await app.drawer.waitForDrawerToBeVisible();
await app.delegateDrawer.transactionTypeIsVisible();
await app.delegateDrawer.providerIsVisible(account.delegate);
await app.delegateDrawer.amountValueIsVisible();
await app.drawer.close();

await app.layout.syncAccounts();
await app.account.clickOnLastOperation();
await app.delegateDrawer.expectDelegationInfos(account.delegate);
},
);
});
}

for (const validator of validators) {
test.describe("Select a validator", () => {
test.use({
userdata: "skip-onboarding",
speculosApp: validator.delegate.account.currency.speculosApp,
cliCommands: [
{
command: commandCLI.liveData,
args: {
currency: validator.delegate.account.currency.ticker,
index: validator.delegate.account.index,
add: true,
appjson: "",
},
},
],
});

test(
`[${validator.delegate.account.currency.name}] - Select validator`,
"Staking flow from market entry point",
{
annotation: {
type: "TMS",
description: validator.xrayTicket,
description: "B2CQA-2771",
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(validator.delegate.account.accountName);
await app.layout.goToMarket();
await app.market.search(delegateAccount.account.currency.name);
await app.market.stakeButtonClick(delegateAccount.account.currency.ticker);

await app.account.startStakingFlowFromMainStakeButton();
await app.modal.continue();
await app.assetDrawer.selectAccountByIndex(delegateAccount.account);

await app.delegate.verifyProvider(validator.delegate.provider);
await app.delegate.openSearchProviderModal();
await app.delegate.checkValidatorListIsVisible();
await app.delegate.selectProvider(1);
await app.delegate.verifyProvider(delegateAccount.provider);
await app.delegate.continueDelegate();
},
);
});
}

test.describe("Staking flow from different entry point", () => {
const delegateAccount = new Delegate(Account.ATOM_1, "0.001", "Ledger");
test.use({
userdata: "skip-onboarding",
speculosApp: delegateAccount.account.currency.speculosApp,
cliCommands: [
{
command: commandCLI.liveData,
args: {
currency: delegateAccount.account.currency.ticker,
index: delegateAccount.account.index,
add: true,
appjson: "",
},
},
],
});

test(
"Staking flow from portfolio entry point",
{
annotation: {
type: "TMS",
description: "B2CQA-2769",
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
await app.layout.goToPortfolio();
await app.portfolio.startStakeFlow();

await app.assetDrawer.selectAsset(delegateAccount.account.currency);
await app.assetDrawer.selectAccountByIndex(delegateAccount.account);

await app.delegate.verifyProvider(delegateAccount.provider);
await app.delegate.continueDelegate();
},
);

test(
"Staking flow from market entry point",
{
annotation: {
type: "TMS",
description: "B2CQA-2771",
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));
await app.layout.goToMarket();
await app.market.search(delegateAccount.account.currency.name);
await app.market.stakeButtonClick(delegateAccount.account.currency.ticker);

await app.assetDrawer.selectAccountByIndex(delegateAccount.account);

await app.delegate.verifyProvider(delegateAccount.provider);
await app.delegate.continueDelegate();
},
);
});
Loading
Loading