Skip to content

Commit ef8b801

Browse files
authored
feat: Add more features and tests to MF2 test app (#1514)
1 parent 499679f commit ef8b801

67 files changed

Lines changed: 2476 additions & 335 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/e2e.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ jobs:
129129
arch: x86_64
130130
profile: pixel_7
131131
avd-name: e2e
132+
disable-animations: false
132133
working-directory: apps/tester-federation-v2
133134
script: |
134135
adb shell settings put global hide_error_dialogs 1
136+
adb shell cmd uimode night no
135137
for i in 1 2 3; do adb shell "uiautomator dump /sdcard/d.xml >/dev/null && grep -q aerr_ /sdcard/d.xml" && { echo 'ANR dialog on screen, clearing it'; adb shell am force-stop com.google.android.apps.nexuslauncher; }; sleep 2; done
136138
adb reverse tcp:8081 tcp:8081
137139
adb reverse tcp:8082 tcp:8082
@@ -229,6 +231,7 @@ jobs:
229231
xcrun simctl create e2e "$SIM_DEVICE" "$RT"
230232
xcrun simctl boot e2e
231233
xcrun simctl bootstatus e2e -b
234+
xcrun simctl ui e2e appearance light
232235
233236
# pod install generates the Xcode project the workspace points at
234237
- name: Build iOS app

‎agent_context/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ works, and is kept in sync with the implementation as it evolves.
99
| Folder | Topic |
1010
| --- | --- |
1111
| [rspackv2-jul2026](./rspackv2-jul2026/design.md) | Dual Rspack 1.x/2.x support |
12+
| [e2e-oct2026](./e2e-oct2026/design.md) | e2e tests on an emulator, on CI |

‎agent_context/e2e-oct2026/design.md‎

Lines changed: 280 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
module.exports = {
22
presets: ['module:@react-native/babel-preset'],
3+
plugins: ['react-native-worklets/plugin'],
34
comments: true,
5+
overrides: [
6+
{
7+
// Regex instead of a relative string: babel resolves strings against the
8+
// launch cwd, and the rspack CLI launches from the repo root.
9+
test: /[\\/]src[\\/]host[\\/]/,
10+
plugins: [
11+
[
12+
'@babel/plugin-transform-react-jsx',
13+
{ runtime: 'automatic', importSource: 'nativewind' },
14+
],
15+
],
16+
},
17+
],
418
};
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import path from 'node:path';
2+
import * as Repack from '@callstack/repack';
3+
4+
const BITMAP_EXTENSIONS = Repack.getAssetExtensionsRegExp(
5+
Repack.ASSET_EXTENSIONS.filter((ext) => ext !== 'svg')
6+
);
7+
8+
export function buildHostAssetRules(context: string) {
9+
const localAssets = path.join(context, 'src/host/assets/localAssets');
10+
const inlineAssets = path.join(context, 'src/host/assets/inlineAssets');
11+
12+
return [
13+
{
14+
test: BITMAP_EXTENSIONS,
15+
exclude: [localAssets, inlineAssets],
16+
use: {
17+
loader: '@callstack/repack/assets-loader',
18+
options: { inline: true, maxInlineSize: 90 * 1024 },
19+
},
20+
},
21+
{
22+
test: /\.svg$/,
23+
use: [
24+
{
25+
loader: '@svgr/webpack',
26+
options: { native: true, dimensions: false },
27+
},
28+
],
29+
},
30+
{
31+
test: BITMAP_EXTENSIONS,
32+
include: [localAssets],
33+
use: '@callstack/repack/assets-loader',
34+
},
35+
{
36+
test: BITMAP_EXTENSIONS,
37+
include: [inlineAssets],
38+
use: {
39+
loader: '@callstack/repack/assets-loader',
40+
options: { inline: true },
41+
},
42+
},
43+
];
44+
}

‎apps/tester-federation-v2/configs/rspack.host-app.mts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as Repack from '@callstack/repack';
2+
import { NativeWindPlugin } from '@callstack/repack-plugin-nativewind';
3+
import { ReanimatedPlugin } from '@callstack/repack-plugin-reanimated';
24
import rspack from '@rspack/core';
35

6+
import { buildHostAssetRules } from './hostAssetRules.mts';
47
import { buildSharedSingletons } from './sharedSingletons.mts';
58

69
export default Repack.defineRspackConfig((env) => {
@@ -28,15 +31,19 @@ export default Repack.defineRspackConfig((env) => {
2831
},
2932
type: 'javascript/auto',
3033
},
31-
...Repack.getAssetTransformRules({
32-
inline: true,
33-
maxInlineSize: 90 * 1024,
34-
}),
34+
...buildHostAssetRules(context!),
3535
],
3636
},
3737
plugins: [
38+
new NativeWindPlugin({
39+
cssInteropOptions: { inlineRem: 16 },
40+
}),
3841
new Repack.RepackPlugin({
3942
extraChunks: [
43+
{
44+
include: /^host-async-local$/,
45+
type: 'local',
46+
},
4047
{
4148
include: /.*/,
4249
type: 'remote',
@@ -62,6 +69,7 @@ export default Repack.defineRspackConfig((env) => {
6269
process.env.WITH_PRELOAD === 'true' ||
6370
process.env.WITH_PRELOAD === '1',
6471
}),
72+
new ReanimatedPlugin({ unstable_disableTransform: true }),
6573
],
6674
};
6775
});

‎apps/tester-federation-v2/configs/webpack.host-app.mts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// @ts-check
22
import * as Repack from '@callstack/repack';
3+
import { NativeWindPlugin } from '@callstack/repack-plugin-nativewind';
4+
import { ReanimatedPlugin } from '@callstack/repack-plugin-reanimated';
35
import webpack from 'webpack';
46

7+
import { buildHostAssetRules } from './hostAssetRules.mts';
58
import { buildSharedSingletons } from './sharedSingletons.mts';
69

710
export default Repack.defineWebpackConfig((env) => {
@@ -25,21 +28,26 @@ export default Repack.defineWebpackConfig((env) => {
2528
use: '@callstack/repack/babel-swc-loader',
2629
type: 'javascript/auto',
2730
},
28-
...Repack.getAssetTransformRules(),
31+
...buildHostAssetRules(context!),
2932
],
3033
},
3134
plugins: [
32-
// @ts-expect-error
35+
new NativeWindPlugin({
36+
cssInteropOptions: { inlineRem: 16 },
37+
}),
3338
new Repack.RepackPlugin({
3439
extraChunks: [
40+
{
41+
include: /^host-async-local$/,
42+
type: 'local',
43+
},
3544
{
3645
include: /.*/,
3746
type: 'remote',
3847
outputPath: `build/host-app/${platform}/output-remote`,
3948
},
4049
],
4150
}),
42-
// @ts-expect-error
4351
new Repack.plugins.ModuleFederationPluginV2({
4452
name: 'HostApp',
4553
filename: 'HostApp.container.js.bundle',
@@ -58,6 +66,7 @@ export default Repack.defineWebpackConfig((env) => {
5866
process.env.WITH_PRELOAD === 'true' ||
5967
process.env.WITH_PRELOAD === '1',
6068
}),
69+
new ReanimatedPlugin({ unstable_disableTransform: true }),
6170
],
6271
};
6372
});

‎apps/tester-federation-v2/configs/webpack.mini-app.mts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export default Repack.defineWebpackConfig((env) => {
2828
],
2929
},
3030
plugins: [
31-
// @ts-expect-error
3231
new Repack.RepackPlugin({
3332
extraChunks: [
3433
{
@@ -38,7 +37,6 @@ export default Repack.defineWebpackConfig((env) => {
3837
},
3938
],
4039
}),
41-
// @ts-expect-error
4240
new Repack.plugins.ModuleFederationPluginV2({
4341
name: 'MiniApp',
4442
filename: 'MiniApp.container.js.bundle',
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { test } from '@e2e-dev/mobile';
2+
import { expect } from 'e2e';
3+
4+
test('Async chunk loads through ScriptManager and renders', async ({
5+
app,
6+
screen,
7+
}) => {
8+
await app.open();
9+
await expect(screen.getByTestId('home-screen')).toBeVisible({
10+
timeout: 30_000,
11+
});
12+
13+
const entry = screen.getByTestId('home-async-chunk-button');
14+
await screen.scrollUntilVisible(entry);
15+
await entry.tap();
16+
await expect(screen.getByTestId('async-chunk-screen')).toBeVisible();
17+
18+
await expect(screen.getByTestId('async-chunk-content')).toBeVisible();
19+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { test } from '@e2e-dev/mobile';
2+
import { expect } from 'e2e';
3+
4+
test('Gallery MiniApp loads and renders its own navigator', async ({
5+
app,
6+
screen,
7+
}) => {
8+
await app.open();
9+
await expect(screen.getByTestId('home-screen')).toBeVisible({
10+
timeout: 30_000,
11+
});
12+
13+
const entry = screen.getByTestId('home-gallery-button');
14+
await screen.scrollUntilVisible(entry);
15+
await entry.tap();
16+
17+
await expect(screen.getByTestId('miniapp-gallery')).toBeVisible({
18+
timeout: 45_000,
19+
});
20+
await expect(screen.getByText('Picture 1')).toBeVisible();
21+
});

0 commit comments

Comments
 (0)