@deeeed/metamask-harness 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/adapters/extension/live.sh +2 -2
- package/adapters/extension/wallet-fixture-state.cjs +57 -19
- package/adapters/shared/ensure-runner-deps.sh +64 -5
- package/bin/mm-harness +26 -8
- package/dist/adapters/extension/runtime.js +1 -10
- package/dist/adapters.js +5 -1
- package/dist/commands/run-engine.js +18 -13
- package/dist/commands/runtime-launch.js +7 -2
- package/dist/live-adapter-contract.js +4 -2
- package/dist/recipe-security.js +3 -6
- package/dist/run-recording.js +156 -39
- package/library/actions/extension/analytics/set_consent.mjs +165 -0
- package/library/actions/extension/platform/cdp.mjs +112 -14
- package/library/actions/mobile/analytics/set_consent.mjs +90 -0
- package/library/actions/shared/analytics/_adapter.mjs +24 -0
- package/library/actions/shared/analytics/assert_events.mjs +168 -0
- package/library/actions/shared/analytics/collector.mjs +505 -0
- package/library/actions/shared/analytics/consent.mjs +14 -0
- package/library/actions/shared/analytics/read_events.mjs +22 -0
- package/library/actions/shared/analytics/start_capture.mjs +24 -0
- package/library/manifests/extension.action-manifest.json +188 -1
- package/library/manifests/mobile.action-manifest.json +161 -0
- package/package.json +3 -3
|
@@ -2760,6 +2760,193 @@
|
|
|
2760
2760
|
"app-mutation",
|
|
2761
2761
|
"external-mutation"
|
|
2762
2762
|
]
|
|
2763
|
+
},
|
|
2764
|
+
"metamask.analytics.start_capture": {
|
|
2765
|
+
"description": "extension Start capturing MetaMetrics events at the Segment transport and return a cursor to bracket later reads.",
|
|
2766
|
+
"execution_capabilities": [
|
|
2767
|
+
"arbitrary-code"
|
|
2768
|
+
],
|
|
2769
|
+
"examples": [
|
|
2770
|
+
{
|
|
2771
|
+
"action": "metamask.analytics.start_capture",
|
|
2772
|
+
"intent": "Begin capturing analytics before driving the flow",
|
|
2773
|
+
"next": "done"
|
|
2774
|
+
}
|
|
2775
|
+
],
|
|
2776
|
+
"schema": {
|
|
2777
|
+
"type": "object",
|
|
2778
|
+
"properties": {
|
|
2779
|
+
"port": {
|
|
2780
|
+
"type": "integer",
|
|
2781
|
+
"description": "Collector port. Defaults to cdp_port + 1000, else 9090. The client build must point its Segment host here (extension SEGMENT_HOST, mobile SEGMENT_PROXY_URL)."
|
|
2782
|
+
},
|
|
2783
|
+
"cdp_port": {
|
|
2784
|
+
"type": "integer"
|
|
2785
|
+
}
|
|
2786
|
+
},
|
|
2787
|
+
"additionalProperties": false
|
|
2788
|
+
}
|
|
2789
|
+
},
|
|
2790
|
+
"metamask.analytics.read_events": {
|
|
2791
|
+
"description": "extension Read MetaMetrics events captured since a cursor, as [{ event, properties, ts }].",
|
|
2792
|
+
"execution_capabilities": [
|
|
2793
|
+
"host-read-export"
|
|
2794
|
+
],
|
|
2795
|
+
"examples": [
|
|
2796
|
+
{
|
|
2797
|
+
"action": "metamask.analytics.read_events",
|
|
2798
|
+
"since": 0,
|
|
2799
|
+
"intent": "Inspect which analytics events the flow emitted",
|
|
2800
|
+
"next": "done"
|
|
2801
|
+
}
|
|
2802
|
+
],
|
|
2803
|
+
"schema": {
|
|
2804
|
+
"type": "object",
|
|
2805
|
+
"properties": {
|
|
2806
|
+
"since": {
|
|
2807
|
+
"type": "number",
|
|
2808
|
+
"description": "Cursor (epoch ms) from start_capture. Omit to read everything captured."
|
|
2809
|
+
},
|
|
2810
|
+
"event": {
|
|
2811
|
+
"type": "string",
|
|
2812
|
+
"description": "Optional exact event-name filter."
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2815
|
+
"additionalProperties": false
|
|
2816
|
+
}
|
|
2817
|
+
},
|
|
2818
|
+
"metamask.analytics.assert_events": {
|
|
2819
|
+
"description": "extension Assert MetaMetrics event names, property values and counts. Counts are the point: an exact count catches a double emit that a presence check cannot.",
|
|
2820
|
+
"execution_capabilities": [
|
|
2821
|
+
"host-read-export"
|
|
2822
|
+
],
|
|
2823
|
+
"examples": [
|
|
2824
|
+
{
|
|
2825
|
+
"action": "metamask.analytics.assert_events",
|
|
2826
|
+
"expect": [
|
|
2827
|
+
{
|
|
2828
|
+
"event": "Perp Order Cancel Transaction",
|
|
2829
|
+
"count": 1
|
|
2830
|
+
}
|
|
2831
|
+
],
|
|
2832
|
+
"intent": "Assert the cancel event was emitted exactly once",
|
|
2833
|
+
"next": "done"
|
|
2834
|
+
}
|
|
2835
|
+
],
|
|
2836
|
+
"schema": {
|
|
2837
|
+
"type": "object",
|
|
2838
|
+
"properties": {
|
|
2839
|
+
"since": {
|
|
2840
|
+
"type": "number",
|
|
2841
|
+
"description": "Cursor from start_capture; brackets the assertion to this flow."
|
|
2842
|
+
},
|
|
2843
|
+
"exact": {
|
|
2844
|
+
"type": "boolean",
|
|
2845
|
+
"description": "When true, any captured event not named in expect is a failure."
|
|
2846
|
+
},
|
|
2847
|
+
"timeout_ms": {
|
|
2848
|
+
"type": "number",
|
|
2849
|
+
"description": "How long to wait for the lower bounds to be met. Default 15000."
|
|
2850
|
+
},
|
|
2851
|
+
"settle_ms": {
|
|
2852
|
+
"type": "number",
|
|
2853
|
+
"description": "Extra wait after the bounds are met, before judging. Default 1500. Required to catch a duplicate that arrives after the expected event."
|
|
2854
|
+
},
|
|
2855
|
+
"expect": {
|
|
2856
|
+
"type": "array",
|
|
2857
|
+
"items": {
|
|
2858
|
+
"type": "object",
|
|
2859
|
+
"properties": {
|
|
2860
|
+
"event": {
|
|
2861
|
+
"type": "string",
|
|
2862
|
+
"description": "Exact event name."
|
|
2863
|
+
},
|
|
2864
|
+
"count": {
|
|
2865
|
+
"type": "integer",
|
|
2866
|
+
"description": "Exact number of matching events. Mutually exclusive with min/max."
|
|
2867
|
+
},
|
|
2868
|
+
"min": {
|
|
2869
|
+
"type": "integer",
|
|
2870
|
+
"description": "Lower bound on matching events. Default 1."
|
|
2871
|
+
},
|
|
2872
|
+
"max": {
|
|
2873
|
+
"type": "integer",
|
|
2874
|
+
"description": "Upper bound on matching events."
|
|
2875
|
+
},
|
|
2876
|
+
"properties": {
|
|
2877
|
+
"type": "object",
|
|
2878
|
+
"description": "Subset match on event properties; only events matching all of them are counted."
|
|
2879
|
+
}
|
|
2880
|
+
},
|
|
2881
|
+
"required": [
|
|
2882
|
+
"event"
|
|
2883
|
+
],
|
|
2884
|
+
"additionalProperties": false
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
},
|
|
2888
|
+
"required": [
|
|
2889
|
+
"expect"
|
|
2890
|
+
],
|
|
2891
|
+
"additionalProperties": false
|
|
2892
|
+
}
|
|
2893
|
+
},
|
|
2894
|
+
"metamask.analytics.set_consent": {
|
|
2895
|
+
"description": "extension Set MetaMetrics consent flags so events actually reach the Segment transport. Wallet fixtures set neither, so capture yields nothing without this.",
|
|
2896
|
+
"execution_capabilities": [
|
|
2897
|
+
"app-mutation"
|
|
2898
|
+
],
|
|
2899
|
+
"examples": [
|
|
2900
|
+
{
|
|
2901
|
+
"action": "metamask.analytics.set_consent",
|
|
2902
|
+
"intent": "Opt in before capturing analytics",
|
|
2903
|
+
"next": "done"
|
|
2904
|
+
}
|
|
2905
|
+
],
|
|
2906
|
+
"schema": {
|
|
2907
|
+
"type": "object",
|
|
2908
|
+
"properties": {
|
|
2909
|
+
"participate": {
|
|
2910
|
+
"type": "boolean",
|
|
2911
|
+
"description": "MetaMetrics optedIn state. Default true."
|
|
2912
|
+
},
|
|
2913
|
+
"marketing": {
|
|
2914
|
+
"type": "boolean",
|
|
2915
|
+
"description": "dataCollectionForMarketing. Default true. Required for utm_* properties to survive."
|
|
2916
|
+
},
|
|
2917
|
+
"timeout_ms": {
|
|
2918
|
+
"type": "number",
|
|
2919
|
+
"description": "Maximum time to navigate to Settings and apply each consent toggle. Default 15000."
|
|
2920
|
+
}
|
|
2921
|
+
},
|
|
2922
|
+
"additionalProperties": false
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2926
|
+
"observers": [
|
|
2927
|
+
{
|
|
2928
|
+
"ref": "ui.screen",
|
|
2929
|
+
"default_for": [
|
|
2930
|
+
"ui.navigate",
|
|
2931
|
+
"ui.press",
|
|
2932
|
+
"ui.key_press",
|
|
2933
|
+
"ui.set_input",
|
|
2934
|
+
"ui.scroll",
|
|
2935
|
+
"ui.wait_for",
|
|
2936
|
+
"ui.screenshot"
|
|
2937
|
+
]
|
|
2938
|
+
},
|
|
2939
|
+
{
|
|
2940
|
+
"ref": "ui.visible",
|
|
2941
|
+
"default_for": [
|
|
2942
|
+
"ui.navigate",
|
|
2943
|
+
"ui.press",
|
|
2944
|
+
"ui.key_press",
|
|
2945
|
+
"ui.set_input",
|
|
2946
|
+
"ui.scroll",
|
|
2947
|
+
"ui.wait_for",
|
|
2948
|
+
"ui.screenshot"
|
|
2949
|
+
]
|
|
2763
2950
|
}
|
|
2764
|
-
|
|
2951
|
+
]
|
|
2765
2952
|
}
|
|
@@ -2882,6 +2882,167 @@
|
|
|
2882
2882
|
"app-mutation",
|
|
2883
2883
|
"external-mutation"
|
|
2884
2884
|
]
|
|
2885
|
+
},
|
|
2886
|
+
"metamask.analytics.start_capture": {
|
|
2887
|
+
"description": "mobile Start capturing MetaMetrics events at the Segment transport and return a cursor to bracket later reads.",
|
|
2888
|
+
"execution_capabilities": [
|
|
2889
|
+
"arbitrary-code"
|
|
2890
|
+
],
|
|
2891
|
+
"examples": [
|
|
2892
|
+
{
|
|
2893
|
+
"action": "metamask.analytics.start_capture",
|
|
2894
|
+
"intent": "Begin capturing analytics before driving the flow",
|
|
2895
|
+
"next": "done"
|
|
2896
|
+
}
|
|
2897
|
+
],
|
|
2898
|
+
"schema": {
|
|
2899
|
+
"type": "object",
|
|
2900
|
+
"properties": {
|
|
2901
|
+
"port": {
|
|
2902
|
+
"type": "integer",
|
|
2903
|
+
"description": "Collector port. Defaults to cdp_port + 1000, else 9090. The client build must point its Segment host here (extension SEGMENT_HOST, mobile SEGMENT_PROXY_URL)."
|
|
2904
|
+
},
|
|
2905
|
+
"cdp_port": {
|
|
2906
|
+
"type": "integer"
|
|
2907
|
+
}
|
|
2908
|
+
},
|
|
2909
|
+
"additionalProperties": false
|
|
2910
|
+
}
|
|
2911
|
+
},
|
|
2912
|
+
"metamask.analytics.read_events": {
|
|
2913
|
+
"description": "mobile Read MetaMetrics events captured since a cursor, as [{ event, properties, ts }].",
|
|
2914
|
+
"execution_capabilities": [
|
|
2915
|
+
"host-read-export"
|
|
2916
|
+
],
|
|
2917
|
+
"examples": [
|
|
2918
|
+
{
|
|
2919
|
+
"action": "metamask.analytics.read_events",
|
|
2920
|
+
"since": 0,
|
|
2921
|
+
"intent": "Inspect which analytics events the flow emitted",
|
|
2922
|
+
"next": "done"
|
|
2923
|
+
}
|
|
2924
|
+
],
|
|
2925
|
+
"schema": {
|
|
2926
|
+
"type": "object",
|
|
2927
|
+
"properties": {
|
|
2928
|
+
"since": {
|
|
2929
|
+
"type": "number",
|
|
2930
|
+
"description": "Cursor (epoch ms) from start_capture. Omit to read everything captured."
|
|
2931
|
+
},
|
|
2932
|
+
"event": {
|
|
2933
|
+
"type": "string",
|
|
2934
|
+
"description": "Optional exact event-name filter."
|
|
2935
|
+
}
|
|
2936
|
+
},
|
|
2937
|
+
"additionalProperties": false
|
|
2938
|
+
}
|
|
2939
|
+
},
|
|
2940
|
+
"metamask.analytics.assert_events": {
|
|
2941
|
+
"description": "mobile Assert MetaMetrics event names, property values and counts. Counts are the point: an exact count catches a double emit that a presence check cannot.",
|
|
2942
|
+
"execution_capabilities": [
|
|
2943
|
+
"host-read-export"
|
|
2944
|
+
],
|
|
2945
|
+
"examples": [
|
|
2946
|
+
{
|
|
2947
|
+
"action": "metamask.analytics.assert_events",
|
|
2948
|
+
"expect": [
|
|
2949
|
+
{
|
|
2950
|
+
"event": "Perp Order Cancel Transaction",
|
|
2951
|
+
"count": 1
|
|
2952
|
+
}
|
|
2953
|
+
],
|
|
2954
|
+
"intent": "Assert the cancel event was emitted exactly once",
|
|
2955
|
+
"next": "done"
|
|
2956
|
+
}
|
|
2957
|
+
],
|
|
2958
|
+
"schema": {
|
|
2959
|
+
"type": "object",
|
|
2960
|
+
"properties": {
|
|
2961
|
+
"since": {
|
|
2962
|
+
"type": "number",
|
|
2963
|
+
"description": "Cursor from start_capture; brackets the assertion to this flow."
|
|
2964
|
+
},
|
|
2965
|
+
"exact": {
|
|
2966
|
+
"type": "boolean",
|
|
2967
|
+
"description": "When true, any captured event not named in expect is a failure."
|
|
2968
|
+
},
|
|
2969
|
+
"timeout_ms": {
|
|
2970
|
+
"type": "number",
|
|
2971
|
+
"description": "How long to wait for the lower bounds to be met. Default 15000."
|
|
2972
|
+
},
|
|
2973
|
+
"settle_ms": {
|
|
2974
|
+
"type": "number",
|
|
2975
|
+
"description": "Extra wait after the bounds are met, before judging. Default 1500. Required to catch a duplicate that arrives after the expected event."
|
|
2976
|
+
},
|
|
2977
|
+
"expect": {
|
|
2978
|
+
"type": "array",
|
|
2979
|
+
"items": {
|
|
2980
|
+
"type": "object",
|
|
2981
|
+
"properties": {
|
|
2982
|
+
"event": {
|
|
2983
|
+
"type": "string",
|
|
2984
|
+
"description": "Exact event name."
|
|
2985
|
+
},
|
|
2986
|
+
"count": {
|
|
2987
|
+
"type": "integer",
|
|
2988
|
+
"description": "Exact number of matching events. Mutually exclusive with min/max."
|
|
2989
|
+
},
|
|
2990
|
+
"min": {
|
|
2991
|
+
"type": "integer",
|
|
2992
|
+
"description": "Lower bound on matching events. Default 1."
|
|
2993
|
+
},
|
|
2994
|
+
"max": {
|
|
2995
|
+
"type": "integer",
|
|
2996
|
+
"description": "Upper bound on matching events."
|
|
2997
|
+
},
|
|
2998
|
+
"properties": {
|
|
2999
|
+
"type": "object",
|
|
3000
|
+
"description": "Subset match on event properties; only events matching all of them are counted."
|
|
3001
|
+
}
|
|
3002
|
+
},
|
|
3003
|
+
"required": [
|
|
3004
|
+
"event"
|
|
3005
|
+
],
|
|
3006
|
+
"additionalProperties": false
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
},
|
|
3010
|
+
"required": [
|
|
3011
|
+
"expect"
|
|
3012
|
+
],
|
|
3013
|
+
"additionalProperties": false
|
|
3014
|
+
}
|
|
3015
|
+
},
|
|
3016
|
+
"metamask.analytics.set_consent": {
|
|
3017
|
+
"description": "mobile Set MetaMetrics consent flags through the Security & Privacy controls so events reach the Segment transport.",
|
|
3018
|
+
"execution_capabilities": [
|
|
3019
|
+
"app-mutation"
|
|
3020
|
+
],
|
|
3021
|
+
"examples": [
|
|
3022
|
+
{
|
|
3023
|
+
"action": "metamask.analytics.set_consent",
|
|
3024
|
+
"intent": "Opt in before capturing analytics",
|
|
3025
|
+
"next": "done"
|
|
3026
|
+
}
|
|
3027
|
+
],
|
|
3028
|
+
"schema": {
|
|
3029
|
+
"type": "object",
|
|
3030
|
+
"properties": {
|
|
3031
|
+
"participate": {
|
|
3032
|
+
"type": "boolean",
|
|
3033
|
+
"description": "MetaMetrics optedIn state. Default true."
|
|
3034
|
+
},
|
|
3035
|
+
"marketing": {
|
|
3036
|
+
"type": "boolean",
|
|
3037
|
+
"description": "dataCollectionForMarketing. Default true. Required for utm_* properties to survive."
|
|
3038
|
+
},
|
|
3039
|
+
"timeout_ms": {
|
|
3040
|
+
"type": "number",
|
|
3041
|
+
"description": "Maximum time to navigate to Settings, apply each consent toggle, and read back state. Default 15000."
|
|
3042
|
+
}
|
|
3043
|
+
},
|
|
3044
|
+
"additionalProperties": false
|
|
3045
|
+
}
|
|
2885
3046
|
}
|
|
2886
3047
|
}
|
|
2887
3048
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deeeed/metamask-harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mm-harness": "bin/mm-harness"
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@farmslot/agent-runtime": "^0.4.0",
|
|
23
23
|
"@farmslot/handoff": "^0.3.1",
|
|
24
|
-
"@farmslot/protocol": "^0.
|
|
25
|
-
"@farmslot/recipe-harness": "^0.10.
|
|
24
|
+
"@farmslot/protocol": "^0.14.0",
|
|
25
|
+
"@farmslot/recipe-harness": "^0.10.3",
|
|
26
26
|
"commander": "^12.0.0",
|
|
27
27
|
"es-module-lexer": "2.3.1",
|
|
28
28
|
"esbuild": "0.28.1",
|