Skip to content

Commit cb3cc9e

Browse files
yash-builderYash Wadhia
and
Yash Wadhia
authored
feat[RN]: [ENG-8062] Added React-Native SDK test for RN New Architecture (Fabric) (#3885)
## Description Updated the end-to-end test cases to align with the new Expo React Native architecture (Fabric) __JIRA__ https://builder-io.atlassian.net/browse/ENG-8062 --------- Co-authored-by: Yash Wadhia <[email protected]>
1 parent 5562cc1 commit cb3cc9e

Some content is hidden

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

77 files changed

+3442
-182
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ jobs:
6161
[
6262
'svelte',
6363
'sveltekit',
64-
'react-native',
64+
'react-native-74',
65+
'react-native-76-fabric',
6566
'solid',
6667
'solid-start',
6768
'qwik-city',
@@ -132,7 +133,7 @@ jobs:
132133
'svelte',
133134
'sveltekit',
134135
'solid',
135-
'react-native',
136+
'react-native-74',
136137
'hydrogen',
137138
]
138139

.github/workflows/issue-close-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
stale-issue-label: 'bot-close'
2222
only-labels: 'bot-close'
2323
days-before-stale: -1
24-
days-before-close: 0
24+
days-before-close: 0

.github/workflows/lint-and-commit.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
---
32
name: Auto lint & commit 🤖
43

@@ -9,9 +8,9 @@ on:
98
env:
109
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
1110

12-
permissions:
11+
permissions:
1312
contents: write
14-
13+
1514
jobs:
1615
auto-lint-and-commit:
1716
name: Auto lint & commit 🤖
@@ -41,7 +40,7 @@ jobs:
4140
- name: Run eslint
4241
run: yarn workspace @builder.io/sdks lint
4342

44-
- name: "Import GPG key"
43+
- name: 'Import GPG key'
4544
id: import-gpg
4645
uses: crazy-max/ghaction-import-gpg@v6
4746
with:
@@ -54,16 +53,14 @@ jobs:
5453
id: auto-commit-action
5554
with:
5655
commit_message: Apply linting changes
57-
commit_author: "${{ steps.import-gpg.outputs.name }} <${{ steps.import-gpg.outputs.email }}>"
56+
commit_author: '${{ steps.import-gpg.outputs.name }} <${{ steps.import-gpg.outputs.email }}>'
5857
commit_user_name: ${{ steps.import-gpg.outputs.name }}
5958
commit_user_email: ${{ steps.import-gpg.outputs.email }}
60-
61-
62-
- name: "Run if changes have been detected"
59+
60+
- name: 'Run if changes have been detected'
6361
if: steps.auto-commit-action.outputs.changes_detected == 'true'
6462
run: echo "Committed linting changes."
65-
66-
- name: "Run if no changes have been detected"
63+
64+
- name: 'Run if no changes have been detected'
6765
if: steps.auto-commit-action.outputs.changes_detected == 'false'
6866
run: echo "No linting changes to commit."
69-

.github/workflows/react-native-sdk-test-remote.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
cache-install-state: true
3535

3636
- name: Build and test
37-
run: yarn workspace @e2e/react-native test:ios-remote
37+
run: yarn workspace @e2e/react-native-74 test:ios-remote
38+
env:
39+
EXPO_TOKEN: ${{ secrets.EXPO_ACCESS_TOKEN }}
40+
41+
- name: Build and test RN Fabric
42+
run: yarn workspace @e2e/react-native-76-fabric test:ios-remote
3843
env:
3944
EXPO_TOKEN: ${{ secrets.EXPO_ACCESS_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ Pods/
3838
.nx-cache
3939
.nx/workspace-data
4040

41-
!packages/sdks/e2e/react-native/.eas/build/*
41+
!packages/sdks/e2e/react-native-74/.eas/build/*

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<img alt="Animation of Builder.io Visual Editor" src="https://github.com/user-attachments/assets/6972696e-bfb5-4c6d-b987-ea6a07816655" >
2727
</p>
2828

29-
3029
## How the Builder.io platform works
3130

3231
Builder connects to your existing site or app and allows you to visually generate code (using your existing components) from either Figma designs or our drag and drop editor, and then export that code or publish those updates via our [SDKs](https://www.builder.io/c/docs/developers).
@@ -37,13 +36,10 @@ Read about [how Builder works](https://www.builder.io/c/docs/how-builder-works-t
3736
<img alt="How it works" src="https://github.com/user-attachments/assets/7ef9ca00-22f2-49b7-9b29-1df1eb7daba7" />
3837
</p>
3938

40-
41-
4239
## Try it out!
4340

4441
[Sign up for a free account](https://builder.io/signup) to dive right in.
4542

46-
4743
## What's in this repository?
4844

4945
This repo houses all of the various [SDKs](packages), [usage examples](examples), [starter projects](starters), and [plugins](plugins).

packages/core/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ builder.canTrack = false;
4242
View all options for `builder.get` [here](./docs/interfaces/GetContentOptions.md)
4343

4444
Learn more about how to use the Builder core SDK:
45+
4546
- [Content API](https://www.builder.io/c/docs/content-api)
4647
- [Querying Cheatsheet](https://www.builder.io/c/docs/querying)

packages/core/tsconfig.json

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,10 @@
1111
"moduleResolution": "node",
1212
"resolveJsonModule": true,
1313
"declarationDir": "dist",
14-
"lib": [
15-
"dom",
16-
"es5",
17-
"es2015.promise"
18-
],
14+
"lib": ["dom", "es5", "es2015.promise"],
1915
"allowSyntheticDefaultImports": true,
2016
"esModuleInterop": true,
21-
"typeRoots": [
22-
"./node_modules/@types"
23-
]
17+
"typeRoots": ["./node_modules/@types"]
2418
},
25-
"include": [
26-
"./package.json",
27-
"./index.ts",
28-
"./src/**/*.ts",
29-
"./types.d.ts"
30-
]
19+
"include": ["./package.json", "./index.ts", "./src/**/*.ts", "./types.d.ts"]
3120
}

packages/react/CHANGELOG.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,18 @@
235235
These events can be listened to for analytics or other custom behaviors:
236236

237237
```javascript
238-
document.addEventListener("builder.variantLoaded", (event) => {
238+
document.addEventListener('builder.variantLoaded', event => {
239239
// This will either be a variant object like { name: 'My Variant', query: [...], startDate: ..., endDate: ... }
240240
// or the string 'default'
241-
console.log("Variant loaded:", event.detail.variant);
241+
console.log('Variant loaded:', event.detail.variant);
242242
// This will be the content object like { name: 'My page', id: '...', ... }
243-
console.log("Content:", event.detail.content);
243+
console.log('Content:', event.detail.content);
244244
// Perform analytics or other actions
245245
});
246246

247-
document.addEventListener("builder.variantDisplayed", (event) => {
248-
console.log("Variant displayed:", event.detail.variant);
249-
console.log("Content:", event.detail.content);
247+
document.addEventListener('builder.variantDisplayed', event => {
248+
console.log('Variant displayed:', event.detail.variant);
249+
console.log('Content:', event.detail.content);
250250
// Track impressions or perform other visibility-dependent actions
251251
});
252252
```
@@ -291,7 +291,7 @@
291291

292292
```js
293293
userAttributes: {
294-
stringWithStrs: ["a", "c"];
294+
stringWithStrs: ['a', 'c'];
295295
}
296296
```
297297

@@ -307,7 +307,7 @@
307307

308308
```js
309309
userAttributes: {
310-
stringWithNums: ["1", "2"];
310+
stringWithNums: ['1', '2'];
311311
}
312312
```
313313

@@ -517,10 +517,10 @@
517517
In case you feel the need to use our older API Version `v1`, reach out to us at [email protected] first. But you can override the default by setting `apiVersion` explicitly to `v1` as follows:
518518

519519
```js
520-
import { builder } from "@builder.io/react";
520+
import { builder } from '@builder.io/react';
521521

522-
builder.init("YOUR_BUILDER_PUBLIC_KEY");
523-
builder.apiVersion = "v1";
522+
builder.init('YOUR_BUILDER_PUBLIC_KEY');
523+
builder.apiVersion = 'v1';
524524
```
525525

526526
More details on the Builder API Versions visit [this link](https://www.builder.io/c/docs/content-api-versions).
@@ -532,10 +532,10 @@ More details on the Builder API Versions visit [this link](https://www.builder.i
532532
You can set the apiVersion using `builder.init` or `builder.apiVersion`:
533533

534534
```js
535-
import { builder } from "@builder.io/react";
535+
import { builder } from '@builder.io/react';
536536

537-
builder.init("YOUR_BUILDER_PUBLIC_KEY");
538-
builder.apiVersion = "v3";
537+
builder.init('YOUR_BUILDER_PUBLIC_KEY');
538+
builder.apiVersion = 'v3';
539539
```
540540

541541
## 2.0.16

packages/sdks-tests/playwright.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const getDirName = () => {
2222
};
2323

2424
const things = serverNames.map((packageName, i) => {
25-
const isReactNative = packageName === 'react-native';
25+
const isReactNative =
26+
packageName === 'react-native-74' || packageName === 'react-native-76-fabric';
2627
const port = 1111 + i;
2728
const portFlag = isReactNative ? `-l ${port}` : `--port=${port}`;
2829

@@ -89,7 +90,9 @@ export default defineConfig({
8990
command: `PORT=${port} yarn workspace @${testType}/${packageName} ${IS_DEV_MODE ? 'dev' : 'serve'} ${portFlag}`,
9091
port,
9192
reuseExistingServer: false,
92-
...(packageName === 'react-native' ? { timeout: 120 * 1000 } : {}),
93+
...(packageName === 'react-native-74' || packageName === 'react-native-76-fabric'
94+
? { timeout: 120 * 1000 }
95+
: {}),
9396
}))
9497
.concat([
9598
{

packages/sdks-tests/src/e2e-tests/ab-test.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const initializeAbTest = async (
4545
if (!baseURL) throw new Error('Missing baseURL');
4646

4747
// RN can't have SSR, we don't support/export it.
48-
test.skip(packageName === 'react-native');
48+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
4949

5050
/**
5151
* This test is flaky on `nextjs-sdk-next-app` and `qwik-city`. Most likely because it is the very first test that runs.

packages/sdks-tests/src/e2e-tests/blocks-class-name.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test.describe('Blocks className', () => {
88
packageName,
99
}) => {
1010
test.skip(excludeGen1(sdk));
11-
test.skip(packageName === 'react-native');
11+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
1212

1313
await page.goto('/blocks-class-name');
1414
const countOfBuilderBlocksWithClassName = await page

packages/sdks-tests/src/e2e-tests/css-properties.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isSSRFramework, test } from '../helpers/index.js';
33

44
test.describe('CSS Properties from Builder Content (js enabled)', () => {
55
test('set image width CSS properties correctly', async ({ page, packageName }) => {
6-
test.skip(packageName === 'react-native');
6+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
77
await page.goto('/css-properties');
88

99
const image = page.locator('.builder-image');
@@ -12,7 +12,7 @@ test.describe('CSS Properties from Builder Content (js enabled)', () => {
1212
});
1313

1414
test('set var(--red-color) bg color in Box properly', async ({ page, packageName }) => {
15-
test.skip(packageName === 'react-native');
15+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
1616
await page.goto('/css-properties');
1717

1818
const div = page.locator('.builder-4f5a09e2a52747f8b7cb48b880636a3c');
@@ -24,7 +24,7 @@ test.describe('CSS Properties from Builder Content (js enabled)', () => {
2424

2525
test.describe('CSS Properties from Builder Content (js disabled)', () => {
2626
test('set image width CSS properties correctly', async ({ browser, packageName }) => {
27-
test.skip(packageName === 'react-native');
27+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
2828
test.fail(!isSSRFramework(packageName));
2929

3030
const context = await browser.newContext({
@@ -39,7 +39,7 @@ test.describe('CSS Properties from Builder Content (js disabled)', () => {
3939
});
4040

4141
test('set var(--red-color) bg color in Box properly', async ({ browser, packageName }) => {
42-
test.skip(packageName === 'react-native');
42+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
4343
test.fail(!isSSRFramework(packageName));
4444

4545
const context = await browser.newContext({

packages/sdks-tests/src/e2e-tests/default-styles.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ test.describe('Default styles', () => {
1717
test.skip(excludeGen1(sdk));
1818
// TODO: need to check why angular-ssr is failing, working as expected though
1919
test.fail(
20-
packageName === 'react-native' ||
20+
packageName === 'react-native-74' ||
21+
packageName === 'react-native-76-fabric' ||
2122
packageName === 'angular-16-ssr' ||
2223
packageName === 'angular-19-ssr'
2324
);
@@ -40,7 +41,7 @@ test.describe('Default styles', () => {
4041
});
4142

4243
test('button should have default styles', async ({ page, packageName }) => {
43-
test.fail(packageName === 'react-native');
44+
test.fail(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
4445

4546
await page.goto('/default-styles');
4647
const button = page.locator('text=Click me!');

packages/sdks-tests/src/e2e-tests/duplicate-attributes.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test.describe('Duplicate Attributes', () => {
77
excludeTestFor({ angular: true }, sdk),
88
'attributes not spread out so cant set footer'
99
);
10-
test.skip(packageName === 'react-native');
10+
test.skip(packageName === 'react-native-74' || packageName === 'react-native-76-fabric');
1111
await page.goto('/duplicate-attributes');
1212

1313
const footer = await page.locator('footer');

packages/sdks-tests/src/e2e-tests/editing.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ test.describe('Visual Editing', () => {
209209
});
210210
test('correctly updates width props', async ({ page, basePort, packageName, sdk }) => {
211211
test.skip(
212-
packageName === 'react-native' ||
212+
packageName === 'react-native-74' ||
213+
packageName === 'react-native-76-fabric' ||
213214
packageName === 'nextjs-sdk-next-app' ||
214215
packageName === 'gen1-next14-pages' ||
215216
packageName === 'gen1-next15-app' ||

packages/sdks-tests/src/e2e-tests/http-requests.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ test.describe('HTTP Requests', () => {
3939

4040
test('call proxy API only once - in editor', async ({ page, basePort, packageName, sdk }) => {
4141
test.skip(excludeGen1(sdk));
42-
test.skip(packageName === 'react-native', 'editor tests not supported in react-native');
42+
test.skip(
43+
packageName === 'react-native-74' || packageName === 'react-native-76-fabric',
44+
'editor tests not supported in react-native'
45+
);
4346
test.skip(
4447
packageName === 'nextjs-sdk-next-app',
4548
'editor tests not supported in nextjs-sdk-next-app'

packages/sdks-tests/src/e2e-tests/localization.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ test.describe('Localization', () => {
1010
await page.goto('/localization-locale-passed');
1111
const text = page.locator(`text=${HI_IN_TEXT}`);
1212
const image =
13-
packageName === 'react-native' ? page.locator('img').first() : page.locator('.builder-image');
13+
packageName === 'react-native-74' || packageName === 'react-native-76-fabric'
14+
? page.locator('img').first()
15+
: page.locator('.builder-image');
1416
await expect(text).toBeVisible();
1517
await expect(image).toHaveAttribute('src', HI_IN_IMAGE);
1618
});

packages/sdks-tests/src/e2e-tests/state-binding.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ test.describe('State binding', () => {
1111

1212
// flaky, can't `test.fail()`
1313
test.skip(
14-
packageName === 'react-native' ||
14+
packageName === 'react-native-74' ||
15+
packageName === 'react-native-76-fabric' ||
1516
packageName === 'solid' ||
1617
packageName === 'solid-start' ||
1718
packageName === 'svelte' ||

packages/sdks-tests/src/helpers/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ export const isSSRFramework = (packageName: ServerName | 'DEFAULT') => {
103103
packageName === 'solid' ||
104104
packageName === 'react' ||
105105
packageName === 'svelte' ||
106-
packageName === 'react-native' ||
106+
packageName === 'react-native-74' ||
107+
packageName === 'react-native-76-fabric' ||
107108
packageName === 'angular-16' ||
108109
packageName === 'gen1-react';
109110
return !isNonSSR;

packages/sdks-tests/src/helpers/sdk.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export type Sdk =
1212
| 'angular';
1313

1414
const serverNameEnumValues = [
15-
'react-native',
15+
'react-native-74',
16+
'react-native-76-fabric',
1617
'solid',
1718
'solid-start',
1819
'qwik-city',
@@ -53,7 +54,8 @@ export type Generation = 'gen1' | 'gen2';
5354
* Map of server names to SDKs.
5455
*/
5556
export const SDK_MAP: Record<ServerName, { sdk: Sdk; gen: Generation }> = {
56-
'react-native': { sdk: 'reactNative', gen: 'gen2' },
57+
'react-native-74': { sdk: 'reactNative', gen: 'gen2' },
58+
'react-native-76-fabric': { sdk: 'reactNative', gen: 'gen2' },
5759
solid: { sdk: 'solid', gen: 'gen2' },
5860
'solid-start': { sdk: 'solid', gen: 'gen2' },
5961
'qwik-city': { sdk: 'qwik', gen: 'gen2' },

0 commit comments

Comments
 (0)