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 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
5 changes: 5 additions & 0 deletions .changeset/hot-cameras-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": minor
---

broadcasting on e2e tests only on scheduled workflows on Monday
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 { Delegate } from "../../models/Delegate";
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 @@ const validators = [
},
];

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() ? "1" : "0";
});
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();
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);
},
);
});
}

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 @@ for (const account of e2eDelegationAccounts) {
});

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