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

Support/enable broadcast on demand v2 #8706

Merged
merged 8 commits into from
Dec 18, 2024
14 changes: 14 additions & 0 deletions .github/workflows/test-ui-e2e-only-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ on:
required: false
type: string
default: "B2CQA-2461"
enable_broadcast:
description: "Enable transaction broadcast"
required: false
type: boolean
default: false
build_type:
description: "Firebase env to target (pick js for release testing)"
required: false
Expand Down Expand Up @@ -113,6 +118,15 @@ jobs:
run: docker pull ${{ env.SPECULOS_IMAGE_TAG }}
shell: bash

- name: Set DISABLE_TRANSACTION_BROADCAST
id: set-broadcast
run: |
if [[ "${{ inputs.enable_broadcast }}" == "true" || ( "${{ github.event_name }}" == "schedule" && "${{ github.event.schedule.cron }}" == "0 5 * * 1" ) ]]; then
echo "DISABLE_TRANSACTION_BROADCAST=0" >> $GITHUB_ENV
else
echo "DISABLE_TRANSACTION_BROADCAST=1" >> $GITHUB_ENV
fi

- name: Run playwright tests [Linux => xvfb-run]
id: tests
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Delegate } from "../../models/Delegate";
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";
import { CLI } from "tests/utils/cliUtils";
import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils";
import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency";

const e2eDelegationAccounts = [
Expand Down Expand Up @@ -50,10 +49,6 @@ const validators = [
];

test.describe("Delegate flows", () => {
test.beforeAll(async () => {
process.env.DISABLE_TRANSACTION_BROADCAST =
new Date().getDay() === 1 && isRunningInScheduledWorkflow() ? "0" : "1";
});
for (const account of e2eDelegationAccounts) {
test.describe("Delegate", () => {
test.use({
Expand Down
17 changes: 12 additions & 5 deletions apps/ledger-live-desktop/tests/specs/speculos/nft.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import { CLI } from "tests/utils/cliUtils";
import invariant from "invariant";

test.describe("send NFT to ENS address", () => {
const transaction = new NFTTransaction(Account.ETH_1, Account.ETH_MC, Nft.PODIUM, Fee.SLOW);
const originalValue = process.env.DISABLE_TRANSACTION_BROADCAST;

test.beforeAll(async () => {
process.env.DISABLE_TRANSACTION_BROADCAST = "true";
});
test.afterAll(async () => {
delete process.env.DISABLE_TRANSACTION_BROADCAST;
process.env.DISABLE_TRANSACTION_BROADCAST = "1";
});
const transaction = new NFTTransaction(Account.ETH_1, Account.ETH_MC, Nft.PODIUM, Fee.SLOW);
test.use({
userdata: "skip-onboarding",
cliCommands: [
Expand Down Expand Up @@ -59,6 +58,14 @@ test.describe("send NFT to ENS address", () => {
await app.sendDrawer.expectNftInfos(transaction);
},
);

test.afterAll(() => {
if (originalValue !== undefined) {
process.env.DISABLE_TRANSACTION_BROADCAST = originalValue;
} else {
delete process.env.DISABLE_TRANSACTION_BROADCAST;
}
});
});

test.describe("The user can see his NFT floor price", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Transaction } from "../../models/Transaction";
import { addTmsLink, addBugLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";
import { CLI } from "tests/utils/cliUtils";
import { isRunningInScheduledWorkflow } from "tests/utils/githubUtils";
import { getEnv } from "@ledgerhq/live-env";

//Warning 🚨: XRP Tests may fail due to API HTTP 429 issue - Jira: LIVE-14237
Expand Down Expand Up @@ -215,10 +214,6 @@ const tokenTransactionInvalid = [
];

test.describe("Send flows", () => {
test.beforeAll(async () => {
process.env.DISABLE_TRANSACTION_BROADCAST =
new Date().getDay() === 1 && isRunningInScheduledWorkflow() ? "0" : "1";
});
//Warning 🚨: Test may fail due to the GetAppAndVersion issue - Jira: LIVE-12581 or insufficient funds

for (const transaction of transactionE2E) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ const swaps = [

for (const { swap, xrayTicket } of swaps) {
test.describe("Swap - Accepted (without tx broadcast)", () => {
const originalValue = process.env.DISABLE_TRANSACTION_BROADCAST;

test.beforeAll(async () => {
process.env.SWAP_DISABLE_APPS_INSTALL = "true";
process.env.SWAP_API_BASE = "https://swap-stg.ledger-test.com/v5";
Expand All @@ -203,7 +205,11 @@ for (const { swap, xrayTicket } of swaps) {
test.afterAll(async () => {
delete process.env.SWAP_DISABLE_APPS_INSTALL;
delete process.env.SWAP_API_BASE;
delete process.env.DISABLE_TRANSACTION_BROADCAST;
if (originalValue !== undefined) {
process.env.DISABLE_TRANSACTION_BROADCAST = originalValue;
} else {
delete process.env.DISABLE_TRANSACTION_BROADCAST;
}
});

test.use({
Expand Down
3 changes: 0 additions & 3 deletions apps/ledger-live-desktop/tests/utils/githubUtils.ts

This file was deleted.

Loading