Skip to content

Commit a23c6e3

Browse files
test(snaps): Disable device synchronization in all tests (#30087)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until this PR meets the canonical Definition of Ready For Review in `docs/readme/ready-for-review.md`. In short: the template must be materially complete (not just section titles present), all status checks must be currently passing, and the only expected follow-up commits must be reviewer-driven. --> ## **Description** Add an optional property `disableSynchronization` to `withFixtures` and use it for all Snaps tests. This saves a large chunk of time when running these E2Es (**over 40s for some tests**). ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Test-only changes that adjust Detox synchronization behavior across many E2E specs; main risk is increased flakiness or hidden timing issues in the Snaps smoke suite. > > **Overview** > Adds a new `withFixtures` option, `disableSynchronization`, and applies it to the Snaps smoke tests to run them with Detox synchronization turned off. > > `withFixtures` now explicitly enables or disables synchronization after (re)launch, and ad-hoc sync toggling in `BrowserView.navigateToURL` (and the iOS WebSocket workaround in `test-snap-network-access.spec.ts`) is removed in favor of the centralized flag. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4f29881. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 9e6acf5 commit a23c6e3

27 files changed

Lines changed: 76 additions & 8 deletions

tests/framework/fixtures/FixtureHelper.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ export async function withFixtures(
518518
useCommandQueueServer = false,
519519
analyticsExpectations,
520520
shouldPrefetchSwapTokens = true,
521+
disableSynchronization = false,
521522
} = options;
522523

523524
// Clean up any stale port forwarding from previous failed tests
@@ -649,6 +650,12 @@ export async function withFixtures(
649650
});
650651
}
651652

653+
if (disableSynchronization) {
654+
await device.disableSynchronization();
655+
} else {
656+
await device.enableSynchronization();
657+
}
658+
652659
// Dismiss dev screens if running locally (not in CI)
653660
if (process.env.CI !== 'true') {
654661
await dismissDevScreens();

tests/framework/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,5 @@ export interface WithFixturesOptions {
463463
useCommandQueueServer?: boolean;
464464
analyticsExpectations?: AnalyticsExpectations;
465465
shouldPrefetchSwapTokens?: boolean;
466+
disableSynchronization?: boolean;
466467
}

tests/page-objects/Browser/BrowserView.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ class Browser {
325325
url: string,
326326
options: { skipUrlEditorDismissal?: boolean } = {},
327327
): Promise<void> {
328-
await device.disableSynchronization(); // because animations makes typing into the browser slow
329328
await Gestures.typeText(this.urlInputBoxID, url, {
330329
hideKeyboard: true,
331330
elemDescription: 'URL input box',
@@ -350,7 +349,6 @@ class Browser {
350349
});
351350
}
352351
}
353-
await device.enableSynchronization(); // re-enabling synchronization
354352
}
355353

356354
/**

tests/smoke/snaps/test-snap-background-events.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe(SmokeSnaps('Background Events Snap Tests'), () => {
1818
fixture: new FixtureBuilder().build(),
1919
restartDevice: true,
2020
skipReactNativeReload: true,
21+
disableSynchronization: true,
2122
},
2223
async () => {
2324
await loginToApp();
@@ -34,6 +35,7 @@ describe(SmokeSnaps('Background Events Snap Tests'), () => {
3435
{
3536
fixture: new FixtureBuilder().build(),
3637
skipReactNativeReload: true,
38+
disableSynchronization: true,
3739
},
3840
async () => {
3941
const futureDate = new Date(Date.now() + 5_000).toISOString();
@@ -57,6 +59,7 @@ describe(SmokeSnaps('Background Events Snap Tests'), () => {
5759
{
5860
fixture: new FixtureBuilder().build(),
5961
skipReactNativeReload: true,
62+
disableSynchronization: true,
6063
},
6164
async () => {
6265
await TestSnaps.fillMessage('backgroundEventDurationInput', 'PT5S');
@@ -78,6 +81,7 @@ describe(SmokeSnaps('Background Events Snap Tests'), () => {
7881
{
7982
fixture: new FixtureBuilder().build(),
8083
skipReactNativeReload: true,
84+
disableSynchronization: true,
8185
},
8286
async () => {
8387
// Intentionally scheduling an event for 1 hour into the future, so it
@@ -114,6 +118,7 @@ describe(SmokeSnaps('Background Events Snap Tests'), () => {
114118
{
115119
fixture: new FixtureBuilder().build(),
116120
skipReactNativeReload: true,
121+
disableSynchronization: true,
117122
},
118123
async () => {
119124
const pastDate = new Date(Date.now() - 5_000).toISOString();

tests/smoke/snaps/test-snap-bip-32.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
1515
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
1616
restartDevice: true,
1717
skipReactNativeReload: true,
18+
disableSynchronization: true,
1819
},
1920
async () => {
2021
await loginToApp();
@@ -31,6 +32,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
3132
{
3233
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
3334
skipReactNativeReload: true,
35+
disableSynchronization: true,
3436
},
3537
async () => {
3638
await TestSnaps.tapButton('getPublicKeyBip32Button');
@@ -47,6 +49,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
4749
{
4850
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
4951
skipReactNativeReload: true,
52+
disableSynchronization: true,
5053
},
5154
async () => {
5255
await TestSnaps.fillMessage('messageSecp256k1Input', 'foo bar');
@@ -66,6 +69,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
6669
{
6770
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
6871
skipReactNativeReload: true,
72+
disableSynchronization: true,
6973
},
7074
async () => {
7175
await TestSnaps.fillMessage('messageEd25519Input', 'foo bar');
@@ -85,6 +89,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
8589
{
8690
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
8791
skipReactNativeReload: true,
92+
disableSynchronization: true,
8893
},
8994
async () => {
9095
await TestSnaps.fillMessage('messageEd25519Bip32Input', 'foo bar');
@@ -104,6 +109,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
104109
{
105110
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
106111
skipReactNativeReload: true,
112+
disableSynchronization: true,
107113
},
108114
async () => {
109115
await TestSnaps.selectInDropdown('bip32EntropyDropDown', 'SRP 1');
@@ -124,6 +130,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
124130
{
125131
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
126132
skipReactNativeReload: true,
133+
disableSynchronization: true,
127134
},
128135
async () => {
129136
await TestSnaps.selectInDropdown('bip32EntropyDropDown', 'SRP 2');
@@ -144,6 +151,7 @@ describe(SmokeSnaps('BIP-32 Snap Tests'), () => {
144151
{
145152
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
146153
skipReactNativeReload: true,
154+
disableSynchronization: true,
147155
},
148156
async () => {
149157
await TestSnaps.selectInDropdown('bip32EntropyDropDown', 'Invalid');

tests/smoke/snaps/test-snap-bip-44.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe.skip(SmokeSnaps('BIP-44 Snap Tests'), () => {
1515
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
1616
restartDevice: true,
1717
skipReactNativeReload: true,
18+
disableSynchronization: true,
1819
},
1920
async () => {
2021
await loginToApp();
@@ -31,6 +32,7 @@ describe.skip(SmokeSnaps('BIP-44 Snap Tests'), () => {
3132
{
3233
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
3334
skipReactNativeReload: true,
35+
disableSynchronization: true,
3436
},
3537
async () => {
3638
await TestSnaps.tapButton('getPublicKeyBip44Button');
@@ -47,6 +49,7 @@ describe.skip(SmokeSnaps('BIP-44 Snap Tests'), () => {
4749
{
4850
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
4951
skipReactNativeReload: true,
52+
disableSynchronization: true,
5053
},
5154
async () => {
5255
await TestSnaps.fillMessage('messageBip44Input', '1234');
@@ -65,6 +68,7 @@ describe.skip(SmokeSnaps('BIP-44 Snap Tests'), () => {
6568
{
6669
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
6770
skipReactNativeReload: true,
71+
disableSynchronization: true,
6872
},
6973
async () => {
7074
await TestSnaps.selectInDropdown('bip44EntropyDropDown', 'SRP 1');
@@ -84,6 +88,7 @@ describe.skip(SmokeSnaps('BIP-44 Snap Tests'), () => {
8488
{
8589
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
8690
skipReactNativeReload: true,
91+
disableSynchronization: true,
8792
},
8893
async () => {
8994
await TestSnaps.selectInDropdown('bip44EntropyDropDown', 'SRP 2');
@@ -103,6 +108,7 @@ describe.skip(SmokeSnaps('BIP-44 Snap Tests'), () => {
103108
{
104109
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
105110
skipReactNativeReload: true,
111+
disableSynchronization: true,
106112
},
107113
async () => {
108114
await TestSnaps.selectInDropdown('bip44EntropyDropDown', 'Invalid');

tests/smoke/snaps/test-snap-client-status.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe(SmokeSnaps('Client Status Snap Tests'), () => {
1616
fixture: new FixtureBuilder().build(),
1717
restartDevice: true,
1818
skipReactNativeReload: true,
19+
disableSynchronization: true,
1920
},
2021
async () => {
2122
await loginToApp();
@@ -32,6 +33,7 @@ describe(SmokeSnaps('Client Status Snap Tests'), () => {
3233
{
3334
fixture: new FixtureBuilder().build(),
3435
skipReactNativeReload: true,
36+
disableSynchronization: true,
3537
},
3638
async () => {
3739
await TestSnaps.tapButton('sendClientStatusButton');

tests/smoke/snaps/test-snap-cronjob.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe(SmokeSnaps('Cronjob Snap Tests'), () => {
1515
fixture: new FixtureBuilder().build(),
1616
restartDevice: true,
1717
skipReactNativeReload: true,
18+
disableSynchronization: true,
1819
},
1920
async () => {
2021
await loginToApp();

tests/smoke/snaps/test-snap-dialog.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe(SmokeSnaps('Dialog Snap Tests'), () => {
1717
fixture: new FixtureBuilder().build(),
1818
restartDevice: true,
1919
skipReactNativeReload: true,
20+
disableSynchronization: true,
2021
},
2122
async () => {
2223
await loginToApp();
@@ -34,6 +35,7 @@ describe(SmokeSnaps('Dialog Snap Tests'), () => {
3435
{
3536
fixture: new FixtureBuilder().build(),
3637
skipReactNativeReload: true,
38+
disableSynchronization: true,
3739
},
3840
async () => {
3941
await TestSnaps.tapButton('sendAlertButton');
@@ -54,6 +56,7 @@ describe(SmokeSnaps('Dialog Snap Tests'), () => {
5456
{
5557
fixture: new FixtureBuilder().build(),
5658
skipReactNativeReload: true,
59+
disableSynchronization: true,
5760
},
5861
async () => {
5962
await TestSnaps.tapButton('sendConfirmationButton');
@@ -70,6 +73,7 @@ describe(SmokeSnaps('Dialog Snap Tests'), () => {
7073
{
7174
fixture: new FixtureBuilder().build(),
7275
skipReactNativeReload: true,
76+
disableSynchronization: true,
7377
},
7478
async () => {
7579
await TestSnaps.tapButton('sendConfirmationButton');
@@ -88,6 +92,7 @@ describe(SmokeSnaps('Dialog Snap Tests'), () => {
8892
{
8993
fixture: new FixtureBuilder().build(),
9094
skipReactNativeReload: true,
95+
disableSynchronization: true,
9196
},
9297
async () => {
9398
await TestSnaps.tapButton('sendCustomButton');

tests/smoke/snaps/test-snap-ethereum-provider.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe(SmokeSnaps('Ethereum Provider Snap Tests'), () => {
2121
fixture: new FixtureBuilder().withMultiSRPKeyringController().build(),
2222
restartDevice: true,
2323
skipReactNativeReload: true,
24+
disableSynchronization: true,
2425
testSpecificMock: async (mockServer: Mockttp) => {
2526
await setupRemoteFeatureFlagsMock(
2627
mockServer,

0 commit comments

Comments
 (0)