Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51310
Changelog: [internal]
Just a bit of separation between these and Fantom own tests.
Reviewed By: lenaic
Differential Revision: D74717487
fbshipit-source-id: f9d8667c823fcda7b1f3222803367c6b15d9309d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51259
Changelog: [internal]
We recently added `Playground-itest` as a quick way to test things with Fantom without committing them.
This does the same for benchmarks, so we can quickly answer questions like:
> is `key in obj` faster than `obj[key]`?
Without having to create a new benchmark manually.
Reviewed By: yungsters
Differential Revision: D74578297
fbshipit-source-id: d86604d459f15652d0c2e1ad16a99d011a1324ca
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51220
Changelog: [internal]
Just a playground file to do quick tests in the Fantom environment.
For example, I just used it to know if Hermes supports `AggregateError`, which does:
```
it('...', () => {
console.log('AggregateError', global.AggregateError);
});
```
{F1977824992}
Reviewed By: lenaic
Differential Revision: D74474870
fbshipit-source-id: cbe8a287738b09afe336ae479cc3105d1474e58b
Summary:
Flag was removed in {D74196673}, this cleans up the dynamic flag.
bypass-github-export-checks
Changelog: [internal]
Reviewed By: jackpope
Differential Revision: D74493584
fbshipit-source-id: 6ade542b7e1bd9c4367b7dbef4d2f1ec2d79d0df
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51210
Changelog: [internal]
This adds a safety mechanism to Fantom tests to prevent LogBox from swallowing errors.
Now we validate that LogBox isn't installed when running tasks, so we can properly fix error reporting in tests.
Reviewed By: rshest
Differential Revision: D74464749
fbshipit-source-id: ef5e814b14aedbc681a4c7f9f8f60f454b239b6d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51211
Changelog: [internal]
This modifies the setup for Fantom so:
1. We don't inject "InitializeCore" by default.
2. We define a default environment setup module for Fantom with good defaults (LogBox, etc. disabled).
We also migrate all existing tests to use the new module.
The goal of this is to prevent LogBox from being used in tests so we can properly fix error propagation in the work loop (so they're not intercepted by it).
Reviewed By: rshest
Differential Revision: D69003812
fbshipit-source-id: 00353b5055e3700943a08ea67f698d49e068555b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51208
Changelog: [internal]
Adding a few more test cases to make sure error handling is fixed considering these use cases.
Reviewed By: rshest
Differential Revision: D74459974
fbshipit-source-id: 9a5865a9a09dd64535b4d38307db6c30f213b45f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51088
Creates `ShadowNodeReferenceCounter`, a module with utilities for writing Fantom tests that make assertions about the reference count for a `ShadowNode` object.
Changelog:
[Internal]
Reviewed By: lunaleaps
Differential Revision: D74131710
fbshipit-source-id: a949a402ee52f40445ce99c712540e80c8a05065
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50988
Changelog: [internal]
This fixes a potential bug where we coalesce unique events with non-unique ones of the same type and target.
Not marked as a bug fix in the changelog because this wouldn't happen in practice, as we always dispatch events of a given type the same way (all unique or all non-unique).
Reviewed By: sammy-SC, javache
Differential Revision: D73849222
fbshipit-source-id: 6f387d63b3a68dccc81c110287d42e15e31c181e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50986
Changelog: [internal]
This just exposes some enum values and methods that we forgot to expose in a few interfaces.
Reviewed By: javache
Differential Revision: D73849221
fbshipit-source-id: 19014d53216e67c77b0c31e5ade8f86de071b001
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50957
Changelog: [internal]
Now we can use the higher level API for event dispatching in this test.
Reviewed By: javache
Differential Revision: D73663626
fbshipit-source-id: 961af26f62128f093c71ad14f457ac8544348415
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50938
Changelog: [internal]
No more `maybeNode`s. Using ref objects makes the tests cleaner and the JSX easier to read than injecting lambdas.
This speaks for itself:
* 617 lines added
* 1393 lines removed
{F1977434870}
Reviewed By: lenaic
Differential Revision: D73659018
fbshipit-source-id: d1c23e6457bb1d351ce02b9f6fa8778b06ee0e55
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50899
changelog: [internal]
making things clearer in the docs for Fantom.
Reviewed By: rubennorte
Differential Revision: D73580305
fbshipit-source-id: 0e5edaa3baf57fc54f7a0c454fe4d2fa81627f66
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50760
Changelog: [internal]
This updates all Excalidraw SVG diagrams in the repository to use the latest format exported by Excalidraw after the fix in https://github.com/excalidraw/excalidraw/pull/9386.
I basically opened every image in Excalidraw and re-exported it.
Reviewed By: lenaic
Differential Revision: D73107703
fbshipit-source-id: 4432e952f9e6ee29f59ef8a9ff05479552744a31
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50699
Changelog: [internal]
Just changing the template to include emojis in the top level titles to make it easier to scan the doc
Reviewed By: lenaic
Differential Revision: D72961870
fbshipit-source-id: 64c45e7ac769c38af06ea318cdb581a04e230f90
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50665
Changelog: [internal]
Just a stylistic change of the link back to the documentation home.
It also changes the link in the template to make sure it's incorrect so people are forced to edit it when creating new docs.
Reviewed By: lenaic
Differential Revision: D72866823
fbshipit-source-id: fa7be286f996049b3f06e2defa5a8c486d63091b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50663
Changelog: [internal]
Adds additional documentation about pragmas and feature flags for Fantom.
Changes the diagram to mention that feature flags are passed to the Fantom CLI.
Reviewed By: andrewdacenko
Differential Revision: D72865960
fbshipit-source-id: abfd167279195495064f3c4dbdcaff92dd865bcf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50660
Changelog: [internal]
This is just a simpler way to test for changes in scroll position.
Reviewed By: andrewdacenko
Differential Revision: D72860138
fbshipit-source-id: a92d430399255a278f5c3c72005a5288d28310ab
Summary:
Changing these object arguments to `$ReadOnly` permits passing in values that are `$ReadOnly` (e.g. `payload` argument to `enqueueNativeEvent`).
Changelog:
[Internal]
Reviewed By: lyahdav
Differential Revision: D72474879
fbshipit-source-id: 27341131724f4f572b78563975774a5b20dee8f8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50260
Changelog: [internal]
Created new directory `react-native/src/private/__tests__/utilities` and moved `ensureInstance` and `isUnreachable` to it.
Reviewed By: yungsters
Differential Revision: D71826787
fbshipit-source-id: 50a50a54ab928c9060282a9f2256ad97dd856ba4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50258
Changelog: [internal]
Minor reordering of tests in `Fantom-itest`, fix of describe block for `enqueueScrollEvent` and fix incorrect usage of `enqueueScrollEvent` instead of `scrollTo` in `scrollTo` tests.
Reviewed By: yungsters
Differential Revision: D71820977
fbshipit-source-id: 07637e2d18cde96c78c83285ba28201260e42f3c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50257
Changelog: [internal]
## Context
We have some tests that make sure certain objects are deallocated/released at the right times, but those are generally hard to get right. The main reason is that WeakRefs semantics are tied to the tasks and microtasks in JS, but we handle them both inside and outside the Event Loop in Fantom tests.
This leads to some surprising behavior where things we expect to have been deallocated weren't because of some innocent looking code.
## Changes
This introduces a safety mechanism in Fantom to enforce that WeakRefs are always dereferenced inside the Event Loop, by patching the method in `WeakRef` and checking if we're in the Event Loop using Fantom APIs.
It also updates the existing test using WeakRefs to fix the new errors thrown by this patch, and to serve as a "good example" on how to use WeakRefs to do memory testing.
Reviewed By: yungsters
Differential Revision: D71815397
fbshipit-source-id: 8faab1898d9112ec365b41867179abb8b251e337
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50035
changelog: [internal]
to make it easier to write JSDocs, let's export functions directly from index.js instead of using proxy object.
Reviewed By: rubennorte
Differential Revision: D71200977
fbshipit-source-id: 0b53c0d3f73577c19253537b9e884459a4920643
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50033
changelog: [internal]
All public APIs should be covered with tests, this diff adds tests for Fantom.scheduleTask.
Reviewed By: rubennorte
Differential Revision: D71195921
fbshipit-source-id: dc7f0f889b9633b1e641dc8887fd506bc4753fe5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50011
changelog: [internal]
Majority of time, you want to simply scroll. This diff introduces a convenience method Fantom.scrollTo.
Previously, you would have to write:
```
Fantom.runOnUIThread(() => {
Fantom.enqueueScrollEvent(element, {
x: 0,
y: 60,
});
});
Fantom.runWorkLoop();
```
Now, you can just do:
```
Fantom.scrollTo(element, {
x: 0,
y: 60,
});
```
Reviewed By: rubennorte
Differential Revision: D71113680
fbshipit-source-id: aed49a2f12be8ab30be549235cc7a2b3e35faadb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50009
changelog: [internal]
rename method `scrollTo` to `enqueueOnScrollEvent` to make it obvious that event is only enqueued and not executed.
Reviewed By: rubennorte
Differential Revision: D71027761
fbshipit-source-id: 8a22babc2f5e86196c0b0af75ab65d539048dc72
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49990
Changelog: [internal]
This cleans up the flag and makes the Document API essentially part of the DOM APIs flag, after we've verified this is stable in a production experiment.
Reviewed By: sammy-SC
Differential Revision: D68772174
fbshipit-source-id: 3b3d0c4369a648faab3dc7caed8eec2c95fa05b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49912
Changelog: [internal]
This migrates all Fantom tests to use package-relative imports from `react-native` instead of relative paths.
Note that a lot of the current deep imports (e.g.: `import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement'`) will not be necessary when we release those APIs as public.
Reviewed By: sammy-SC
Differential Revision: D70779722
fbshipit-source-id: f0d28e00ca9881dc2a3cd151b75327b26711277e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49693
Allow setting the ReactNativeInternalFeatureFlags from a Fantom test using the `fantom_internal_flags` pragma.
Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D70242739
fbshipit-source-id: 17a69edbd58b93f8b8060192b9881e62febf9635
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49691
Changelog: [internal]
This adds a new getter for `document` in the `Root` class in Fantom tests to easily access the document instance for the root.
This isn't very useful at the moment, but will be very useful when we introduce `document.getElementById`, so we can access arbitrary nodes very easily.
Reviewed By: javache
Differential Revision: D69307130
fbshipit-source-id: 2650bc03e143ee9f0b29d0f284a2f9079ab9f765
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49690
Changelog: [internal]
We're shipping this soon and most tests already using DOM APIs to make assertions, so it's easier if we just "ship" in tests.
Reviewed By: javache, sammy-SC
Differential Revision: D69307129
fbshipit-source-id: 75d0be013703cff7bc2bad5cd16c26bc6471e547
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49526
Changelog: [Internal]
Introduce a binary tester for Fantom that will be used in runner when ready so OSS can run integration tests.
Here:
- Add BUCK target
- Add CMake target
Reviewed By: cortinico
Differential Revision: D69800975
fbshipit-source-id: 57e135e2a1cbfb88e0141ddc7859b9a29365ee1f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49463
We've started accumulating mode-files in many different directories, group them all under xplat/mode/react-native for consistency
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69658995
fbshipit-source-id: 70c842d24886b9b0ef8432d105ca64cac68078db
Summary:
Fantom was disabling Metro hierarchical lookup in all cases when `JS_DIR` is set. The intention is that `node_modules` folders other than the configured `JS_DIR/public/node_modules` are not used.
However, this leads to incorrect resolution where a transitive dependency is not hoisted. If the origin of the resolution is already inside `node_modules`, we must perform a hierarchical lookup to avoid picking up just whichever version happens to be hoisted to `node_modules` root.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D69303559
fbshipit-source-id: 12068fb0bebb8c2f81b64c23b952a623cb6fd792
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49251
Changelog: [internal]
Components like `AppContainer` require passing the rootTag as a prop, but we don't have access to it from Fantom unless we render something in the root and access it via the RootTagContext. This exposes the rootTag of the Root as a method so we can use it in initial render too.
Reviewed By: javache
Differential Revision: D69301571
fbshipit-source-id: 429fb56d937d3dffeb3c17a70d136ba4925ece8e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49254
Changelog: [internal]
This is just a convenience method to do:
```
Fantom.dispatchNativeEvent(node, 'click');
```
Instead of:
```
runOnUIThread(() => {
enqueueNativeEvent(node, 'click');
});
runWorkLoop();
```
Which is too verbose and people rarely need this level of granularity in tests.
Note that, in Fabric, we have methods called `dispatchEvent` that don't match 1:1 with this API. In that case, `dispatchEvent` is more aligned with Fantom's `enqueueNativeEvent`.
Reviewed By: javache
Differential Revision: D69302382
fbshipit-source-id: 6f71a5ace11c81f551df2c2837881dbc6f48e7ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49253
Changelog: [internal]
Renaming this low level method as `enqueue` is more accurate in this case than `dispatch`, which is misleading because it actually doesn't dispatch it to JS.
We should also rename this in Fabric, but that's a larger and breaking change, so just making the change in Fantom for now. This is a trade-off between convenience/ergonomics of the testing API vs. alignment with the internal nomenclature. In this case we favor the first.
Reviewed By: javache
Differential Revision: D69302383
fbshipit-source-id: 7e163920ace709503367bf68baab5e9f2bf8ae3f