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

[QAA-409][Speculos][Detox] Various fixes #8821

Closed
Closed
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
30 changes: 26 additions & 4 deletions .github/workflows/test-mobile-e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
allure-report-ios:
name: "Allure Reports Export on Server"
runs-on: [ledger-live-medium]
if: ${{ always() && (inputs.slack_notif || github.event_name == 'push') }}
if: ${{ !inputs.speculos_tests && (inputs.slack_notif || github.event_name == 'push') }}
needs: [detox-tests-ios]
outputs:
report-url: ${{ steps.upload.outputs.report-url }}
Expand Down Expand Up @@ -200,7 +200,9 @@ jobs:
AVD_RAM_SIZE: 4096M
AVD_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
outputs:
status: ${{ steps.detox.outcome }}
status_1: ${{ steps.set-output.outputs.status_1 }}
status_2: ${{ steps.set-output.outputs.status_2 }}
status_3: ${{ steps.set-output.outputs.status_3 }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -315,6 +317,10 @@ jobs:
with:
name: "android-test-artifacts-${{ matrix.shardIndex }}"
path: apps/ledger-live-mobile/artifacts/
- name: Set job output based on detox result
id: set-output
if: always()
run: echo "status_${{ matrix.shardIndex }}=${{ steps.detox.outcome }}" >> $GITHUB_OUTPUT

allure-report-android:
name: "Allure Reports Export on Server"
Expand All @@ -323,7 +329,7 @@ jobs:
outputs:
report-url: ${{ steps.upload.outputs.report-url }}
result: ${{ steps.summary.outputs.test_result }}
status: ${{ needs.detox-tests-android.outputs.status }}
finalStatus: ${{ steps.aggregate.outputs.finalStatus }}
needs: [detox-tests-android]
steps:
- name: checkout
Expand All @@ -344,6 +350,22 @@ jobs:
with:
allure-results-path: android-test-artifacts
platform: android
- name: Aggregate test results
id: aggregate
run: |
if [ "${{ env.SPECULOS_RUN }}" == "true" ]; then
statuses=("${{ needs.detox-tests-android.outputs.status_1 }}" "${{ needs.detox-tests-android.outputs.status_2 }}" "${{ needs.detox-tests-android.outputs.status_3 }}")
else
statuses=("${{ needs.detox-tests-android.outputs.status_1 }}")
fi
finalStatus="success"
for status in "${statuses[@]}"; do
if [ "$status" != "success" ]; then
finalStatus="failure"
break
fi
done
echo "finalStatus=$finalStatus" >> $GITHUB_OUTPUT

upload-to-xray:
name: "Upload to Xray"
Expand Down Expand Up @@ -409,7 +431,7 @@ jobs:
env:
IOS_STATUS: ${{ needs.allure-report-ios.outputs.status }}
IOS_REPORT_URL: ${{ needs.allure-report-ios.outputs.report-url }}
ANDROID_STATUS: ${{ needs.allure-report-android.outputs.status }}
ANDROID_STATUS: ${{ needs.allure-report-android.outputs.finalStatus }}
ANDROID_REPORT_URL: ${{ needs.allure-report-android.outputs.report-url }}
steps:
- name: format message
Expand Down
4 changes: 2 additions & 2 deletions apps/ledger-live-mobile/e2e/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export class Application {
public transfertMenu = new TransfertMenuDrawer();
public walletTabNavigator = new WalletTabNavigatorPage();

constructor() {
constructor(userdata?: string) {
if (!getEnv("MOCK")) {
// Create a temporary userdata file for Speculos tests
const originalUserdata = "skip-onboarding";
const originalUserdata = userdata || "skip-onboarding";
this.userdataSpeculos = `temp-userdata-${Date.now()}`;
this.userdataPath = getUserdataPath(this.userdataSpeculos);
const originalFilePath = getUserdataPath(originalUserdata);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Account } from "@ledgerhq/live-common/e2e/enum/Account";
import { Application } from "../../../page";

const app = new Application();
const app = new Application("EthAccountXrpAccountReadOnlyFalse");
const account = Account.ETH_1;

describe("Receive Flow", () => {
beforeAll(async () => {
app.userdataSpeculos = "EthAccountXrpAccountReadOnlyFalse";
await app.init({
speculosApp: account.currency.speculosApp,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"e2e:build": "pnpm detox build",
"e2e:ci": "zx ./scripts/e2e-ci.mjs",
"e2e:test": "export MOCK=1 && pnpm detox test",
"e2e:test:speculos": "export MOCK=0 && pnpm detox test --testMatch $(pwd)/e2e/specs/speculos/**/**/*.spec.ts --testTimeout=300000",
"e2e:test:speculos": "export MOCK=0 && pnpm detox test --testMatch \"$(pwd)/e2e/specs/speculos/**/*.spec.ts\" --testTimeout=300000",
"prebeta": "bundle install",
"debug:detox": "pnpm detox test -c ios.manual currencies.spec.ts",
"ios:staging": "ENVFILE=.env.ios.staging react-native run-ios --mode Staging",
Expand Down
42 changes: 40 additions & 2 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
diff --git a/local-cli/testCommand/TestRunnerCommand.js b/local-cli/testCommand/TestRunnerCommand.js
index afdc985d5a55396fbec0affd0927156348e656d0..1c71bce08e05768ec2f92245316154ecd0f3445f 100644
--- a/local-cli/testCommand/TestRunnerCommand.js
+++ b/local-cli/testCommand/TestRunnerCommand.js
@@ -35,6 +35,7 @@ class TestRunnerCommand {
this._startCommands = this._prepareStartCommands(commands, cliConfig);
this._envFwd = {};
this._terminating = false;
+ this._isRetry = false; // Track whether it's a retry

if (runnerConfig.forwardEnv) {
this._envFwd = this._buildEnvOverride(cliConfig, deviceConfig);
@@ -79,6 +80,7 @@ class TestRunnerCommand {
}

if (--runsLeft > 0) {
+ this._isRetry = true;
// @ts-ignore
detox.session.testSessionIndex++; // it is always the primary context, so we can update it

@@ -204,11 +206,16 @@ class TestRunnerCommand {
/* istanbul ignore next */
const { _: specs = [], '--': passthrough = [], $0, ...argv } = this._argv;
const { _: $0_, ...$0argv } = parser($0);
+
+ // Remove shard arguments for retries
+ const filteredArgv = this._isRetry
+ ? _.omit(argv, ['shard'])
+ : argv;

return [
...$0_,
...unparse($0argv),
- ...unparse(argv),
+ ...unparse(filteredArgv),
...unparse({ _: [...passthrough, ...specs] }),
].map(String);
}
diff --git a/src/devices/common/drivers/android/exec/ADB.js b/src/devices/common/drivers/android/exec/ADB.js
index 3600972facda80dd0b74d6aa6e425ecab1d205ba..0dd7a4b59cb0bc4d4189f32d819c244ea5f66ba1 100644
index 434b0d65c89f8086084c8714c98e446c9bf54c3a..3b83753d3a3bd5468b53c4b0555bd278e301dbab 100644
--- a/src/devices/common/drivers/android/exec/ADB.js
+++ b/src/devices/common/drivers/android/exec/ADB.js
@@ -8,7 +8,10 @@ const { escape } = require('../../../../../utils/pipeCommands');
Expand All @@ -14,7 +52,7 @@ index 3600972facda80dd0b74d6aa6e425ecab1d205ba..0dd7a4b59cb0bc4d4189f32d819c244e

class ADB {
constructor() {
@@ -109,7 +112,7 @@ class ADB {
@@ -113,7 +116,7 @@ class ADB {
const command = (apiLvl >= 23)
? `install -r -g -t ${apkPath}`
: `install -rg ${apkPath}`;
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading