Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
6ef0b8b
Save State: App builds and deploys, loads JS when metro started in pl…
chiaramooney Mar 15, 2023
a5575f2
Save State: Basic E2E Test App Working!
chiaramooney Mar 16, 2023
baf9efe
Remove CompositionHost
chiaramooney Mar 16, 2023
2b4e2ea
Shift File Names
chiaramooney Mar 16, 2023
03ad746
Save State: Automatic App Launch
chiaramooney Mar 17, 2023
58a0e2e
Save State: Remove Settings and New Window Code
chiaramooney Mar 17, 2023
1b082fd
Save State: Remove Menu Completely
chiaramooney Mar 17, 2023
339b889
Save State: Remove Unneeded .h Files
chiaramooney Mar 17, 2023
757eaef
Merge
chiaramooney Mar 21, 2023
bd27e77
Remove Tests + Alter Entry to index
chiaramooney Mar 21, 2023
3b85202
Remove Sample Entry
chiaramooney Mar 21, 2023
95628a0
Clean Up, Remove Excess Macros
chiaramooney Mar 21, 2023
ff399ec
Remove Extra
chiaramooney Mar 21, 2023
f605744
Remove Extra File
chiaramooney Mar 21, 2023
b0a76b4
Merge branch 'main' of https://github.com/microsoft/react-native-wind…
chiaramooney Mar 22, 2023
0b8ba9c
Merge
chiaramooney Mar 22, 2023
e6ebbca
Address Feedback
chiaramooney Mar 22, 2023
155ffc3
Address Feedback
chiaramooney Mar 22, 2023
77d29d4
Address Feedback
chiaramooney Mar 22, 2023
8534d2a
Address Feedback
chiaramooney Mar 22, 2023
ed04c2c
Address Feedback
chiaramooney Mar 22, 2023
214982e
Address Feedback
chiaramooney Mar 22, 2023
47c255c
Address Feedback
chiaramooney Mar 22, 2023
5b20922
Address Feedback
chiaramooney Mar 22, 2023
f8cc221
Address Feedback
chiaramooney Mar 22, 2023
f55d746
Address Feedback
chiaramooney Mar 22, 2023
0224833
Address Feedback
chiaramooney Mar 22, 2023
5bfe505
Address Feedback
chiaramooney Mar 22, 2023
84cf9b0
Address Feedback
chiaramooney Mar 23, 2023
d3b2c81
Merge branch 'cm-fabric-e2e' of https://github.com/chiaramooney/react…
chiaramooney Mar 23, 2023
16ca5e0
Address Feedback
chiaramooney Mar 23, 2023
4b999a8
Address Feedback
chiaramooney Mar 23, 2023
25a131d
Address Feedback
chiaramooney Mar 23, 2023
1ebfc08
Merge branch 'main' of https://github.com/microsoft/react-native-wind…
chiaramooney Mar 23, 2023
b572937
Address Feedback
chiaramooney Mar 23, 2023
a17038a
Merge
chiaramooney Mar 23, 2023
39ee6a4
Update packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTest…
chiaramooney Mar 27, 2023
1035d4e
Address Feedback
chiaramooney Mar 27, 2023
d0ba641
Address Feedback
chiaramooney Mar 27, 2023
e250c74
Address Feedback
chiaramooney Mar 27, 2023
d3aab61
Merge branch 'main' of https://github.com/microsoft/react-native-wind…
chiaramooney Mar 27, 2023
9c6bbdb
Add YML
chiaramooney Mar 27, 2023
f7d2ba3
Merge branch 'main' of https://github.com/microsoft/react-native-wind…
chiaramooney Mar 27, 2023
a53d70d
Fix
chiaramooney Mar 27, 2023
aaee358
Rename Index
chiaramooney Mar 27, 2023
8b793c5
Adjust Pipeline
chiaramooney Mar 27, 2023
4e396d9
Adjust Pipeline
chiaramooney Mar 28, 2023
9fdc326
Save State: App builds and deploys, loads JS when metro started in pl…
chiaramooney Mar 15, 2023
c76ffbc
Save State: Basic E2E Test App Working!
chiaramooney Mar 16, 2023
223b0e5
Remove CompositionHost
chiaramooney Mar 16, 2023
fc20e0e
Rebase
chiaramooney Mar 28, 2023
fa53b21
Save State: Automatic App Launch
chiaramooney Mar 17, 2023
2d9d3bb
Save State: Remove Settings and New Window Code
chiaramooney Mar 17, 2023
5bcc27c
Save State: Remove Menu Completely
chiaramooney Mar 17, 2023
af5388b
Save State: Remove Unneeded .h Files
chiaramooney Mar 17, 2023
c22d223
Remove Tests + Alter Entry to index
chiaramooney Mar 21, 2023
9ef6a09
Remove Sample Entry
chiaramooney Mar 21, 2023
fe69c50
Clean Up, Remove Excess Macros
chiaramooney Mar 21, 2023
651159e
Remove Extra
chiaramooney Mar 21, 2023
375c9be
Remove Extra File
chiaramooney Mar 21, 2023
9d9d754
Merge
chiaramooney Mar 22, 2023
515776f
Address Feedback
chiaramooney Mar 22, 2023
ba9b6c1
Address Feedback
chiaramooney Mar 22, 2023
caefe1e
Address Feedback
chiaramooney Mar 22, 2023
b53d833
Address Feedback
chiaramooney Mar 22, 2023
7d50d73
Address Feedback
chiaramooney Mar 22, 2023
64c05d0
Address Feedback
chiaramooney Mar 22, 2023
8745397
Address Feedback
chiaramooney Mar 22, 2023
c7cd675
Address Feedback
chiaramooney Mar 22, 2023
834115e
Address Feedback
chiaramooney Mar 22, 2023
aae642d
Address Feedback
chiaramooney Mar 22, 2023
f68d4c8
Address Feedback
chiaramooney Mar 22, 2023
b77aaeb
Address Feedback
chiaramooney Mar 23, 2023
5b94553
Address Feedback
chiaramooney Mar 23, 2023
11180f6
Address Feedback
chiaramooney Mar 23, 2023
22a5e57
Address Feedback
chiaramooney Mar 23, 2023
56fd7d5
Address Feedback
chiaramooney Mar 23, 2023
19ce8b0
Update packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTest…
chiaramooney Mar 27, 2023
29e690b
Address Feedback
chiaramooney Mar 27, 2023
00a19f9
Address Feedback
chiaramooney Mar 27, 2023
5e5b8a0
Address Feedback
chiaramooney Mar 27, 2023
0bf1b51
Add YML
chiaramooney Mar 27, 2023
3a1ed66
Fix
chiaramooney Mar 27, 2023
f6bdc5f
Rename Index
chiaramooney Mar 27, 2023
0840294
Adjust Pipeline
chiaramooney Mar 27, 2023
b3afcd8
Adjust Pipeline
chiaramooney Mar 28, 2023
c8a865c
Merge branch 'cm-fabric-e2e' of https://github.com/chiaramooney/react…
chiaramooney Mar 29, 2023
6a2928a
Delete Bundle
chiaramooney Mar 29, 2023
c4cdd59
Merge
chiaramooney Mar 29, 2023
0414216
Merge branch 'cm-test2' of https://github.com/chiaramooney/react-nati…
chiaramooney Mar 29, 2023
48aac50
Delete msbuildproperties.g.json
chiaramooney Mar 29, 2023
51d45ff
Alter App.json
chiaramooney Mar 29, 2023
818a2e0
Merge branch 'cm-test2' of https://github.com/chiaramooney/react-nati…
chiaramooney Mar 29, 2023
5027aae
Merge pull request #302 from chiaramooney/cm-test2
chiaramooney Mar 29, 2023
36b4397
Merge branch 'main' of https://github.com/microsoft/react-native-wind…
chiaramooney Mar 29, 2023
41eb047
Merge branch 'main' into cm-fabric-e2e
jonthysell Mar 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .ado/jobs/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,61 @@ jobs:
- template: ../templates/upload-build-logs.yml
parameters:
buildLogDirectory: '$(BuildLogDirectory)'
- ${{ each config in parameters.buildMatrix }}:
- ${{ if eq(config.BuildEnvironment, parameters.buildEnvironment) }}:
- ${{ each matrix in config.Matrix }}:
- job: E2ETestFabric${{ matrix.Name }}
displayName: E2E Test App Fabric ${{ matrix.Name }}

variables: [template: ../variables/windows.yml]
pool: ${{ parameters.AgentPool.Medium }}
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them

steps:
- template: ../templates/checkout-shallow.yml

- template: ../templates/prepare-js-env.yml

- template: ../templates/prepare-build-env.yml
parameters:
platform: ${{ matrix.BuildPlatform }}
configuration: Release
buildEnvironment: ${{ config.buildEnvironment }}

- powershell: |
Write-Host "##vso[task.setvariable variable=BuildLogDirectory]$(Build.BinariesDirectory)\${{ parameters.BuildPlatform }}\BuildLogs"
displayName: Set BuildLogDirectory

- template: ../templates/set-experimental-feature.yml
parameters:
package: packages/e2e-test-app-fabric
feature: UseHermes
value: ${{ matrix.UseHermes }}

- template: ../templates/msbuild-sln.yml
parameters:
solutionDir: packages/e2e-test-app-fabric/windows
solutionName: RNTesterApp-Fabric.sln
buildPlatform: ${{ matrix.BuildPlatform}}
buildConfiguration: Debug
warnAsError: false

- task: CopyFiles@2
displayName: Copy RNTesterApp artifacts
inputs:
sourceFolder: $(Build.SourcesDirectory)/packages/e2e-test-app-fabic/windows/RNTesterApp-Fabric
targetFolder: $(Build.StagingDirectory)/RNTesterApp-Fabric
contents: AppPackages\**
condition: failed()

- task: PublishPipelineArtifact@1
displayName: "Publish Artifact: RNTesterApp Fabric"
inputs:
artifactName: RNTesterApp-Fabric-${{ matrix.Name }}-$(System.JobAttempt)
targetPath: $(Build.StagingDirectory)/RNTesterApp-Fabric
condition: failed()

- template: ../templates/upload-build-logs.yml
parameters:
buildLogDirectory: '$(BuildLogDirectory)'
1 change: 1 addition & 0 deletions .unbroken_exclusions
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ URL not found https://docs.github.com/get-started/quickstart while parsing CONTR
!packages/override-tools/node_modules
!packages/@office-iss/react-native-win32/node_modules
!packages/e2e-test-app/node_modules
!packages/e2e-test-app-fabric/node_modules
!packages/sample-apps/node_modules
!packages/playground/node_modules
!packages/@react-native-windows/codegen/node_modules
Expand Down
1 change: 1 addition & 0 deletions lgtm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ path_classifiers:
- "**/packages/@react-native/tester"
- "**/packages/@react-native-windows/tester"
- "**/packages/e2e-test-app"
- "**/packages/e2e-test-app-fabric"
- "**/packages/integration-test-app"
- "**/packages/playground"
- "**/packages/sample-apps"
Expand Down
9 changes: 9 additions & 0 deletions packages/e2e-test-app-fabric/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: ['@rnw-scripts'],
parserOptions: { tsconfigRootDir: __dirname },
globals: {
expect: 'readonly',
fail: 'readonly',
AutomationClient: 'readonly',
},
};
9 changes: 9 additions & 0 deletions packages/e2e-test-app-fabric/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.vscode
/node_modules
/windows/RNTesterApp-Fabric/Generated Files/
/build
/errorShots
/reports
/dist
/windows/RNTesterApp-Fabric/Bundle/
msbuild.binlog
1 change: 1 addition & 0 deletions packages/e2e-test-app-fabric/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
5 changes: 5 additions & 0 deletions packages/e2e-test-app-fabric/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# e2e-test-app-fabric project

This package is not published, and is just used to verify a standalone app

For information on how to run and debug this project, see [e2e-testing](https://github.com/microsoft/react-native-windows/blob/main/docs/e2e-testing.md).
4 changes: 4 additions & 0 deletions packages/e2e-test-app-fabric/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "RNTesterApp-Fabric",
"displayName": "RNTesterApp-Fabric"
}
3 changes: 3 additions & 0 deletions packages/e2e-test-app-fabric/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: "@rnw-scripts/babel-react-native-config",
};
25 changes: 25 additions & 0 deletions packages/e2e-test-app-fabric/custom-transformer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @format
* @ts-check
*/

'use strict';

const generate = require('@babel/generator').default;
const transformer = require('metro-react-native-babel-transformer');
module.exports = {
process(src /*: string */, file /*: string */) /*: {code: string, ...} */ {
const {ast} = transformer.transform({
filename: file,
options: {
inlineRequires: true,
},
src,
});

return generate(ast, {}, src);
},
};
1 change: 1 addition & 0 deletions packages/e2e-test-app-fabric/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('@react-native-windows/tester/js/RNTesterApp');
63 changes: 63 additions & 0 deletions packages/e2e-test-app-fabric/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @format
* @ts-check
*/

// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

const assetTransform = 'react-native-windows/jest/assetFileTransformer.js';
const reactNativeTransform = './custom-transformer.js';
const defaultTransform = [
'babel-jest',
require('@rnw-scripts/babel-node-config'),
];

module.exports = {
preset: '@rnx-kit/jest-preset',

// A list of paths to directories that Jest should use to search for files in
roots: ['<rootDir>/test/'],

// The test environment that will be used for testing
testEnvironment: '@react-native-windows/automation',

// The pattern or patterns Jest uses to detect test files
testRegex: '.*\\.test\\.ts$',

// Default timeout of a test in milliseconds
testTimeout: 70000,

// A map from regular expressions to paths to transformers
transform: {
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': assetTransform,
'node_modules\\\\@?react-native\\\\.*': reactNativeTransform,
'@react-native-windows\\\\tester\\\\.*': reactNativeTransform,
'vnext\\\\.*': reactNativeTransform,
'^.+\\.[jt]sx?$': defaultTransform,
},

snapshotResolver: 'react-native-windows/jest-snapshot-resolver.js',

// An array of regexp pattern strings that are matched against all source file paths before transformation.
// If the file path matches any of the patterns, it will not be transformed.
transformIgnorePatterns: ['jest-runner'],

// Specifies the maximum number of workers the worker-pool will spawn for running tests.
maxWorkers: 1,

// Indicates whether each individual test should be reported during the run.
verbose: true,

// A list of paths to modules that run some code to configure or set up the testing framework
// before each test file in the suite is executed
setupFilesAfterEnv: ['react-native-windows/jest/setup', './jest.setup.js'],

testEnvironmentOptions: {
app: 'RNTesterApp',
enableAutomationChannel: true,
},
};
12 changes: 12 additions & 0 deletions packages/e2e-test-app-fabric/jest.debug.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @format
* @ts-check
*/

const config = require('./jest.config');

config.testEnvironmentOptions.breakOnStart = true;
module.exports = config;
17 changes: 17 additions & 0 deletions packages/e2e-test-app-fabric/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @format
* @ts-check
*/

const fs = require('fs');
const path = require('path');
const sanitizeFilename = require('sanitize-filename');
const {LogBox} = require('react-native');

const screenshotDir = './errorShots';
fs.mkdirSync(screenshotDir, {recursive: true});

LogBox.ignoreAllLogs(true);
2 changes: 2 additions & 0 deletions packages/e2e-test-app-fabric/just-task.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

require('@rnw-scripts/just-task');
153 changes: 153 additions & 0 deletions packages/e2e-test-app-fabric/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
const {makeMetroConfig} = require('@rnw-scripts/metro-dev-config');

/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const fs = require('fs');
const path = require('path');

const rnwPath = fs.realpathSync(
path.dirname(require.resolve('react-native-windows/package.json')),
);
console.log(rnwPath);

const rnwTesterPath = fs.realpathSync(
path.dirname(require.resolve('@react-native-windows/tester/package.json')),
);
console.log(rnwTesterPath);

const devPackages = {
'react-native': path.normalize(rnwPath),
'react-native-windows': path.normalize(rnwPath),
'@react-native-windows/tester': path.normalize(rnwTesterPath),
};

function isRelativeImport(filePath) {
return /^[.][.]?(?:[/]|$)/.test(filePath);
}

// Example: devResolve('C:/Repos/react-native-windows/vnext/', './Libraries/Text/Text');
// Returns a full path to the resolved location which would be in the src subdirectory if
// the file exists or the directory root otherwise
function devResolve(packageName, originDir, moduleName) {
const originDirSrc = originDir.replace(
devPackages[packageName],
path.join(devPackages[packageName], 'src'),
);

// redirect the resolution to src if an appropriate file exists there
const extensions = [
'',
'.windows.tsx',
'.windows.ts',
'.windows.jsx',
'.windows.js',
'.tsx',
'.ts',
'.jsx',
'.js',
];

// For each potential extension we need to check for the file in either src and root
for (const extension of extensions) {
// Start with the src folder
let potentialSrcModuleName = path.resolve(originDirSrc, moduleName);
if (fs.existsSync(potentialSrcModuleName) &&
fs.statSync(potentialSrcModuleName).isDirectory()) {
potentialSrcModuleName = path.resolve(potentialSrcModuleName, 'index');
}
potentialSrcModuleName += extension;

if (fs.existsSync(potentialSrcModuleName)) {
return potentialSrcModuleName;
}

// Next check under root folder
let potentialModuleName = path.resolve(originDir, moduleName);
if (fs.existsSync(potentialModuleName) &&
fs.statSync(potentialModuleName).isDirectory()) {
potentialModuleName = path.resolve(potentialModuleName, 'index');
}
potentialModuleName += extension;

if (fs.existsSync(potentialModuleName)) {
return potentialModuleName;
}
}
}

/**
* Allows the usage of live reload in packages in our repo which merges
* Windows-specific over core. These normally work by copying from the "src"
* subdirectory to package root during build time, but this resolver will
* instead prefere the copy in "src" to avoid the need to build.
*/
function devResolveRequest(
context,
moduleName /* string */,
platform /* string */,
) {
const modifiedModuleName =
tryResolveDevPackage(moduleName) ||
tryResolveDevAbsoluteImport(moduleName) ||
tryResolveDevRelativeImport(context.originModulePath, moduleName) ||
moduleName;
return context.resolveRequest(context, modifiedModuleName, platform);
}

function tryResolveDevPackage(moduleName) /*: string | null*/ {
if (devPackages[moduleName]) {
return devResolve(moduleName, devPackages[moduleName], './index');
}

return null;
}

function tryResolveDevAbsoluteImport(moduleName) /*: string | null*/ {
for (const [packageName, packagePath] of Object.entries(devPackages)) {
if (moduleName.startsWith(`${packageName}/`)) {
return devResolve(
packageName,
packagePath,
`./${moduleName.slice(`${packageName}/`.length)}`,
);
}
}

return null;
}

function tryResolveDevRelativeImport(
originModulePath,
moduleName,
) /*: string | null*/ {
for (const [packageName, packagePath] of Object.entries(devPackages)) {
if (
isRelativeImport(moduleName) &&
originModulePath.startsWith(packagePath)
) {
const packageSrcPath = path.join(packagePath, 'src');
const originPathWithoutSrc = originModulePath.replace(
packageSrcPath,
packagePath,
);

return devResolve(
packageName,
path.dirname(originPathWithoutSrc),
moduleName,
);
}
}

return null;
}

module.exports = makeMetroConfig({
resolver: {
resolveRequest: devResolveRequest,
},
});
Loading