Skip to content

Commit 870311c

Browse files
committed
test: ✅ add end to end tests for system metrics
1 parent b17b8d4 commit 870311c

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ x-common-environment: &common-environment
1818
MAZE_BUGSNAG_API_KEY:
1919
MAZE_APPIUM_BUGSNAG_API_KEY:
2020
MAZE_NO_FAIL_FAST:
21+
NATIVE_INTEGRATION:
22+
RCT_NEW_ARCH_ENABLED:
2123

2224
services:
2325
license-finder:
@@ -79,9 +81,7 @@ services:
7981
BITBAR_ACCESS_KEY:
8082
RN_VERSION:
8183
EXPO_VERSION:
82-
RCT_NEW_ARCH_ENABLED:
8384
REACT_NATIVE_NAVIGATION:
84-
NATIVE_INTEGRATION:
8585
MAZE_REPEATER_API_KEY: "${MAZE_REPEATER_API_KEY_RN:-}"
8686
MAZE_HUB_REPEATER_API_KEY: "${MAZE_HUB_REPEATER_API_KEY_RN:-}"
8787
ports:

test/react-native/features/fixtures/scenario-launcher/ios/ScenarioLauncher.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ - (instancetype)init
150150
config.autoInstrumentAppStarts = NO;
151151
config.autoInstrumentViewControllers = NO;
152152
config.autoInstrumentNetworkRequests = NO;
153-
config.autoInstrumentRendering = YES;
153+
config.enabledMetrics.cpu = YES;
154+
config.enabledMetrics.memory = YES;
155+
config.enabledMetrics.rendering = YES;
154156
config.internal.autoTriggerExportOnBatchSize = 1;
155157
config.internal.clearPersistenceOnStart = YES;
156158

test/react-native/features/steps/react-native-steps.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@
2121
end
2222
end
2323

24+
Then('the {string} span has {word} attribute named {string}') do |span_name, attribute_type, attribute|
25+
spans = spans_from_request_list(Maze::Server.list_for('traces'))
26+
found_spans = spans.find_all { |span| span['name'].eql?(span_name) }
27+
raise Test::Unit::AssertionFailedError.new "No spans were found with the name #{span_name}" if found_spans.empty?
28+
raise Test::Unit::AssertionFailedError.new "found #{found_spans.size} spans named #{span_name}, expected exactly one" unless found_spans.size == 1
29+
30+
attributes = found_spans.first['attributes']
31+
attribute = attributes.find { |a| a['key'] == attribute }
32+
33+
value = attribute&.dig 'value', "#{attribute_type}Value"
34+
35+
Maze.check.not_nil value
36+
end
37+
2438
When("I relaunch the app after shutdown") do
2539
max_attempts = 20
2640
attempts = 0

0 commit comments

Comments
 (0)