1
1
require 'rexml/document'
2
2
require 'securerandom'
3
3
4
- fixtures = Dir [ "#{ __dir__ } /../fixtures/rn0_*" ] . map { |dir | File . basename ( dir ) } . sort
5
4
current_fixture = ENV [ 'RN_VERSION' ]
6
5
fixture_dir = "#{ __dir__ } /../../../react-native-cli/features/fixtures/generated/"
6
+ generate_fixture_script = "#{ __dir__ } /../../../../scripts/generate-react-native-cli-fixture.js"
7
7
8
8
# if RCT_NEW_ARCH_ENABLED is set add new-arch/ to the fixture_dir
9
9
if ENV [ 'RCT_NEW_ARCH_ENABLED' ] == 'true' || ENV [ 'RCT_NEW_ARCH_ENABLED' ] == '1'
16
16
step ( "I run the service '#{ current_fixture } ' interactively" )
17
17
end
18
18
19
- def find_cli_helper_script
20
- # Handle both Dockerized and local Maze Runner executions
21
- script = 'generate-react-native-cli-fixture.js'
22
- possible_locations = %W[
23
- #{ __dir__ } /../../../../scripts/#{ script }
24
- ]
25
- path = possible_locations . find { |path | File . exist? ( path ) }
26
- if path . nil?
27
- raise <<~ERROR
28
- The React Native CLI helper script was not found in any of the expected locations:
29
- - #{ possible_locations . join ( "\n -" ) }
30
- ERROR
31
- end
32
- path
33
- end
34
-
35
19
When ( 'I build the Android app' ) do
36
- script_path = find_cli_helper_script
37
- $logger. info `node #{ script_path } `
20
+ $logger. info `node #{ generate_fixture_script } `
38
21
39
22
# Change directory to fixture_dir
40
23
Dir . chdir ( fixture_dir ) do
@@ -43,8 +26,7 @@ def find_cli_helper_script
43
26
end
44
27
45
28
When ( 'I build the iOS app' ) do
46
- script_path = find_cli_helper_script
47
- $logger. info `node #{ script_path } `
29
+ $logger. info `node #{ generate_fixture_script } `
48
30
49
31
# Change directory to fixture_dir
50
32
Dir . chdir ( fixture_dir ) do
@@ -57,6 +39,16 @@ def find_cli_helper_script
57
39
$logger. info `node -e 'require("#{ script_path } ").buildIPA("#{ fixture_dir } ")'`
58
40
end
59
41
42
+ When ( 'the APK file exists' ) do
43
+ apk_path = "#{ fixture_dir } /reactnative.apk"
44
+ Maze . check . true ( File . exist? ( apk_path ) )
45
+ end
46
+
47
+ When ( 'the IPA file exists' ) do
48
+ ipa_path = "#{ fixture_dir } /output/reactnative.ipa"
49
+ Maze . check . true ( File . exist? ( ipa_path ) )
50
+ end
51
+
60
52
def parse_package_json
61
53
stdout_lines = Maze ::Runner . interactive_session . stdout_lines
62
54
length_before = stdout_lines . length
0 commit comments