-
Notifications
You must be signed in to change notification settings - Fork 24.9k
fix(test): fix RNTester iOS unit and integration tests #53848
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
Open
artus9033
wants to merge
40
commits into
facebook:main
Choose a base branch
from
artus9033:fix/rntester-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+333
−279
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
354432e
fix(test): fix integration tests js app problems due to ES exports
artus9033 b8a93db
fix(test): fix unit tests compilation errors
artus9033 3908718
fix(test): fix AccessibilityManagerTest failing because of handling l…
artus9033 80289f8
test: disable AccessibilityManagerTest due to T225745315
artus9033 7c8e4a9
docs: update unit and integration tests instructions
artus9033 3a0dcd9
test: enable RCTLoggingTests
artus9033 c9d42b2
chore: update Podfile
artus9033 a41e886
fix(test): mock dispatch_async in RCTBlobManagerTests
artus9033 970228c
fix(test): use color constants for RCTConvert_UIColorTests::testGener…
artus9033 d9db57d
fix(test): update baseline strings in RCTBundleURLProviderTests
artus9033 cd572ab
fix(test): use default xctestplan environment variable values in test…
artus9033 30a93fc
fix(test): do not skip RCTBundleURLProviderTests in unit tests
artus9033 b34c885
Merge branch 'main' into fix/rntester-tests
artus9033 4c51544
fix: typechecking in IntegrationTestsApp.js
artus9033 462b28b
chore: update Podfile.lock
artus9033 c9484f1
chore: re-enable debugger in RNTester unit and integration tests
artus9033 efe4c5c
chore: update Podfile
artus9033 640e672
chore: revert changes to Podfile.lock
artus9033 a400089
fix: use ES exports in IntegrationTests sources, properly destructure…
artus9033 a1ae130
ci: run iOS unit & integration tests on CI
artus9033 9888b70
fix(test): fix codegen_utils-test.rb using removed mock helper Codege…
artus9033 dc24ea8
fix(test): bad indentation in ruby tests
artus9033 a8f6150
fix(test): ruby test - updated baselines in codegen_utils-test
artus9033 c627b3e
fix(test): ruby test - updated baselines in jsengine-test
artus9033 d753226
fix: missing requires in new_architecture.rb
artus9033 63ae020
fix(test): ruby test - updated baselines in new_architecture-test
artus9033 f92b135
fix(test): ruby test - updated baselines in utils-test
artus9033 42eb4c3
refactor: comment in codegen_utils-test.rb
artus9033 075bf29
Merge branch 'main' into fix/rntester-tests
artus9033 fa18880
Merge branch 'main' into fix/rntester-tests
artus9033 5182a1b
fix(test): fix order of arguments passed to assert_equal in Ruby tests
artus9033 c02cc35
fix(ci): bump up the target device of iOS test runner to a present one
artus9033 85138c0
Merge branch 'main' into fix/rntester-tests
artus9033 d3cb26c
chore: temporarily disable throwIfOnLegacyArch in RCTBridge
artus9033 b2ff94e
Merge branch 'main' into fix/rntester-tests
artus9033 3b208c9
fix(ci): include RCTTest source files in CI compilation that utilizes…
artus9033 f4b1eb5
fix(ci): correct path to test results in test-ios-rntester
artus9033 8fd5bc2
fix: explicitly define NDEBUG in objc-test
artus9033 d180f10
Merge branch 'main' into fix/rntester-tests
artus9033 bf04df5
fix(ci): conflicts between test artifacts' names
artus9033 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,9 @@ inputs: | |
ruby-version: | ||
description: The version of ruby that must be used | ||
default: 2.6.10 | ||
run-unit-tests: | ||
description: whether unit tests should run or not. | ||
default: "false" | ||
run-unit-integration-tests: | ||
description: whether unit & integration tests should run or not. | ||
default: "true" | ||
hermes-tarball-artifacts-dir: | ||
description: The directory where the hermes tarball artifacts are stored | ||
default: /tmp/hermes/hermes-runtime-darwin | ||
|
@@ -46,7 +46,7 @@ runs: | |
with: | ||
ruby-version: ${{ inputs.ruby-version }} | ||
- name: Prepare IOS Tests | ||
if: ${{ inputs.run-unit-tests == 'true' }} | ||
if: ${{ inputs.run-unit-integration-tests == 'true' }} | ||
uses: ./.github/actions/prepare-ios-tests | ||
- name: Set HERMES_ENGINE_TARBALL_PATH envvar if Hermes tarball is present | ||
shell: bash | ||
|
@@ -134,33 +134,33 @@ runs: | |
echo "App found at $APP_PATH" | ||
echo "app-path=$APP_PATH" >> $GITHUB_ENV | ||
- name: "Run Tests: iOS Unit and Integration Tests" | ||
if: ${{ inputs.run-unit-tests == 'true' }} | ||
if: ${{ inputs.run-unit-integration-tests == 'true' }} | ||
shell: bash | ||
run: yarn test-ios | ||
|
||
- name: Zip Derived data folder | ||
if: ${{ inputs.run-unit-tests == 'true' }} | ||
if: ${{ inputs.run-unit-integration-tests == 'true' }} | ||
shell: bash | ||
run: | | ||
echo "zipping tests results" | ||
cd /Users/distiller/Library/Developer/Xcode | ||
cd /Users/runner/Library/Developer/Xcode | ||
XCRESULT_PATH=$(find . -name '*.xcresult') | ||
tar -zcvf xcresults.tar.gz $XCRESULT_PATH | ||
- name: Upload artifact | ||
uses: actions/[email protected] | ||
if: ${{ inputs.run-unit-tests == 'true' }} | ||
if: ${{ inputs.run-unit-integration-tests == 'true' }} | ||
with: | ||
name: xcresults | ||
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz | ||
name: xcresults-${{ inputs.flavor }}-${{ inputs.use-frameworks }}-Ruby${{ inputs.ruby-version }} | ||
path: /Users/runner/Library/Developer/Xcode/xcresults.tar.gz | ||
- name: Upload RNTester App | ||
if: ${{ inputs.use-frameworks == 'StaticLibraries' && inputs.ruby-version == '2.6.10' }} # This is needed to avoid conflicts with the artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: RNTesterApp-NewArch-${{ inputs.flavor }} | ||
path: ${{ env.app-path }} | ||
- name: Store test results | ||
if: ${{ inputs.run-unit-tests == 'true' }} | ||
if: ${{ inputs.run-unit-integration-tests == 'true' }} | ||
uses: actions/[email protected] | ||
with: | ||
name: test-results | ||
name: test-results-${{ inputs.flavor }}-${{ inputs.use-frameworks }}-Ruby${{ inputs.ruby-version }} | ||
path: ./reports/junit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ class CodegenUtilsTests < Test::Unit::TestCase | |
|
||
def setup | ||
CodegenUtils.set_react_codegen_discovery_done(false) | ||
CodegenUtils.set_react_codegen_podspec_generated(false) | ||
Pod::Config.reset() | ||
@base_path = "~/app/ios" | ||
Pathname.pwd!(@base_path) | ||
|
@@ -62,8 +61,8 @@ def testUseReactCodegenDiscovery_whenCodegenDisabled_doNothing | |
|
||
# Assert | ||
assert_false(CodegenUtils.react_codegen_discovery_done()) | ||
assert_equal(Pod::UI.collected_messages, []) | ||
assert_equal(Pod::UI.collected_warns, []) | ||
assert_equal([], Pod::UI.collected_messages) | ||
assert_equal([], Pod::UI.collected_warns) | ||
end | ||
|
||
def testUseReactCodegenDiscovery_whenDiscoveryDone_doNothing | ||
|
@@ -75,8 +74,8 @@ def testUseReactCodegenDiscovery_whenDiscoveryDone_doNothing | |
|
||
# Assert | ||
assert_true(CodegenUtils.react_codegen_discovery_done()) | ||
assert_equal(Pod::UI.collected_messages, ["Skipping use_react_native_codegen_discovery."]) | ||
assert_equal(Pod::UI.collected_warns, []) | ||
assert_equal(["Skipping use_react_native_codegen_discovery."], Pod::UI.collected_messages) | ||
assert_equal([], Pod::UI.collected_warns) | ||
end | ||
|
||
def testUseReactCodegenDiscovery_whenAppPathUndefined_abort | ||
|
@@ -89,16 +88,16 @@ def testUseReactCodegenDiscovery_whenAppPathUndefined_abort | |
|
||
# Assert | ||
assert_false(CodegenUtils.react_codegen_discovery_done()) | ||
assert_equal(Pod::UI.collected_messages, []) | ||
assert_equal(Pod::UI.collected_warns, [ | ||
assert_equal([], Pod::UI.collected_messages) | ||
assert_equal([ | ||
'Error: app_path is required for use_react_native_codegen_discovery.', | ||
'If you are calling use_react_native_codegen_discovery! in your Podfile, please remove the call and pass `app_path` and/or `config_file_dir` to `use_react_native!`.' | ||
]) | ||
], Pod::UI.collected_warns) | ||
end | ||
|
||
# ============================= # | ||
# =========================== # | ||
# Test - CleanUpCodegenFolder # | ||
# ============================= # | ||
# =========================== # | ||
|
||
def testCleanUpCodegenFolder_whenCleanupDone_doNothing | ||
# Arrange | ||
|
@@ -110,9 +109,9 @@ def testCleanUpCodegenFolder_whenCleanupDone_doNothing | |
CodegenUtils.clean_up_build_folder(rn_path, codegen_dir, dir_manager: DirMock, file_manager: FileMock) | ||
|
||
# Assert | ||
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0) | ||
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, []) | ||
assert_equal(CodegenUtils.cleanup_done(), true) | ||
assert_equal(0, FileUtils::FileUtilsStorage.rmrf_invocation_count) | ||
assert_equal([], FileUtils::FileUtilsStorage.rmrf_paths) | ||
assert_equal(true, CodegenUtils.cleanup_done()) | ||
end | ||
|
||
def testCleanUpCodegenFolder_whenFolderDoesNotExists_markAsCleanupDone | ||
|
@@ -125,10 +124,10 @@ def testCleanUpCodegenFolder_whenFolderDoesNotExists_markAsCleanupDone | |
CodegenUtils.clean_up_build_folder(rn_path, codegen_dir, dir_manager: DirMock, file_manager: FileMock) | ||
|
||
# Assert | ||
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0) | ||
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, []) | ||
assert_equal(DirMock.glob_invocation, []) | ||
assert_equal(CodegenUtils.cleanup_done(), true) | ||
assert_equal(0, FileUtils::FileUtilsStorage.rmrf_invocation_count) | ||
assert_equal([], FileUtils::FileUtilsStorage.rmrf_paths) | ||
assert_equal([], DirMock.glob_invocation) | ||
assert_equal(true, CodegenUtils.cleanup_done()) | ||
end | ||
|
||
def testCleanUpCodegenFolder_whenFolderExists_deleteItAndSetCleanupDone | ||
|
@@ -137,29 +136,33 @@ def testCleanUpCodegenFolder_whenFolderExists_deleteItAndSetCleanupDone | |
codegen_dir = "build/generated/ios" | ||
codegen_path = "#{@base_path}/#{codegen_dir}" | ||
globs = [ | ||
"/MyModuleSpecs/MyModule.h", | ||
"#{codegen_path}/MyModuleSpecs/MyModule.mm", | ||
"#{codegen_path}/react/components/MyComponent/ShadowNode.h", | ||
"#{codegen_path}/react/components/MyComponent/ShadowNode.mm", | ||
codegen_path | ||
] | ||
rn_path = '../node_modules/react-native' | ||
|
||
DirMock.mocked_existing_dirs(codegen_path) | ||
DirMock.mocked_existing_globs(globs, "#{codegen_path}/*") | ||
|
||
original_define_singleton_method = CodegenUtils.method(:assert_codegen_folder_is_empty) | ||
CodegenUtils.define_singleton_method(:assert_codegen_folder_is_empty) do |*args, **kwargs| | ||
# no-op | ||
end | ||
|
||
Comment on lines
+146
to
+150
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This mock was missing |
||
# Act | ||
CodegenUtils.clean_up_build_folder(rn_path, codegen_dir, dir_manager: DirMock, file_manager: FileMock) | ||
|
||
# Assert | ||
assert_equal(DirMock.exist_invocation_params, [codegen_path, codegen_path]) | ||
assert_equal(DirMock.glob_invocation, ["#{codegen_path}/*", "#{codegen_path}/*"]) | ||
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 3) | ||
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [ | ||
globs, | ||
assert_equal([codegen_path], DirMock.exist_invocation_params) | ||
assert_equal(3, FileUtils::FileUtilsStorage.rmrf_invocation_count) | ||
assert_equal([ | ||
*globs, | ||
"#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.h", | ||
"#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm", | ||
]) | ||
assert_equal(CodegenUtils.cleanup_done(), true) | ||
], FileUtils::FileUtilsStorage.rmrf_paths) | ||
assert_equal(true, CodegenUtils.cleanup_done()) | ||
ensure | ||
# Restore original method so other tests are not affected | ||
CodegenUtils.define_singleton_method(:assert_codegen_folder_is_empty, original_define_singleton_method) | ||
end | ||
|
||
# ===================================== # | ||
|
@@ -175,7 +178,7 @@ def test_assertCodegenFolderIsEmpty_whenItDoesNotExists_doesNotAbort | |
CodegenUtils.assert_codegen_folder_is_empty(codegen_path, dir_manager: DirMock) | ||
|
||
# Assert | ||
assert_equal(Pod::UI.collected_warns, []) | ||
assert_equal([], Pod::UI.collected_warns) | ||
end | ||
|
||
def test_assertCodegenFolderIsEmpty_whenItExistsAndIsEmpty_doesNotAbort | ||
|
@@ -189,7 +192,7 @@ def test_assertCodegenFolderIsEmpty_whenItExistsAndIsEmpty_doesNotAbort | |
CodegenUtils.assert_codegen_folder_is_empty(codegen_path, dir_manager: DirMock) | ||
|
||
# Assert | ||
assert_equal(Pod::UI.collected_warns, []) | ||
assert_equal([], Pod::UI.collected_warns) | ||
end | ||
|
||
def test_assertCodegenFolderIsEmpty_whenItIsNotEmpty_itAborts | ||
|
@@ -205,9 +208,9 @@ def test_assertCodegenFolderIsEmpty_whenItIsNotEmpty_itAborts | |
} | ||
|
||
# Assert | ||
assert_equal(Pod::UI.collected_warns, [ | ||
assert_equal([ | ||
"Unable to remove the content of ~/app/ios/./build/generated/ios folder. Please run rm -rf ~/app/ios/./build/generated/ios and try again." | ||
]) | ||
], Pod::UI.collected_warns) | ||
end | ||
|
||
private | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this baseline, these files apparently are no longer present anywhere