Skip to content

Commit 0806212

Browse files
Copilotanupriya13
andauthored
Add comprehensive tests for React Native Windows creaternwapp with dynamic version fetching (#15054)
* Initial plan * Add comprehensive tests for 0.80.0-preview.2 creaternwapp functionality Co-authored-by: anupriya13 <[email protected]> * Fix linting issues and ensure all tests pass for 0.80.0-preview.2 validation Co-authored-by: anupriya13 <[email protected]> * Refactor tests to be parameterizable and remove vnext/codegen changes Co-authored-by: anupriya13 <[email protected]> * Replace environment variable approach with separate stable/preview test suites Co-authored-by: anupriya13 <[email protected]> * Change files * Run yarn change, lint:fix, and format as requested Co-authored-by: anupriya13 <[email protected]> * Update creaternwapp tests to fetch latest stable and preview versions from npm Co-authored-by: anupriya13 <[email protected]> * Add comprehensive tests for React Native Windows creaternwapp with dynamic version fetching Co-authored-by: anupriya13 <[email protected]> * Remove all changes in vnext/codegen directory as requested Co-authored-by: anupriya13 <[email protected]> * Run yarn lint:fix and yarn format as requested Co-authored-by: anupriya13 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: anupriya13 <[email protected]>
1 parent 7ad6f56 commit 0806212

File tree

3 files changed

+595
-0
lines changed

3 files changed

+595
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Replace environment variable approach with separate stable/preview test suites",
4+
"packageName": "@react-native-windows/cli",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

docs/testing-createRnwApp.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# React Native Windows creaternwapp Testing Guide
2+
3+
This document provides a comprehensive testing guide for validating React Native Windows creaternwapp functionality with both new architecture (Fabric) and old architecture (Paper/UWP).
4+
5+
## Prerequisites
6+
7+
1. Windows development environment with Visual Studio
8+
2. Node.js and yarn installed
9+
3. React Native Windows development dependencies
10+
4. RNW_ROOT environment variable set (if using local development)
11+
12+
## Test Scenarios
13+
14+
The testing covers both stable and preview versions of React Native Windows:
15+
16+
- **Stable Version**: Tests the latest stable release from npm
17+
- **Preview Version**: Tests the latest preview release from npm
18+
19+
### New Architecture (Fabric) Testing
20+
21+
#### Debug Mode
22+
```bash
23+
# Step 1: Create new app with Fabric architecture
24+
# For stable version:
25+
creaternwapp.cmd /rnw latest TestAppFabricStable
26+
# For preview version:
27+
creaternwapp.cmd /rnw preview TestAppFabricPreview
28+
29+
# Step 2: Navigate to app directory
30+
cd TestAppFabric*
31+
32+
# Step 3: Start Metro bundler
33+
yarn start
34+
35+
# Step 4: In a new terminal, build and run in debug mode
36+
cd TestAppFabric*
37+
yarn windows
38+
```
39+
40+
#### Release Mode
41+
```bash
42+
# Using the same app created above, build in release mode
43+
cd TestAppFabric*
44+
yarn windows --release
45+
```
46+
47+
### Old Architecture (Paper/UWP) Testing
48+
49+
#### Debug Mode
50+
```bash
51+
# Step 1: Create new app with UWP/Paper architecture
52+
# For stable version:
53+
creaternwapp.cmd /rnw latest /t old/uwp-cpp-app TestAppPaperStable
54+
# For preview version:
55+
creaternwapp.cmd /rnw preview /t old/uwp-cpp-app TestAppPaperPreview
56+
57+
# Step 2: Navigate to app directory
58+
cd TestAppPaper*
59+
60+
# Step 3: Start Metro bundler
61+
yarn start
62+
63+
# Step 4: In a new terminal, build and run in debug mode
64+
cd TestAppPaper*
65+
yarn windows
66+
```
67+
68+
#### Release Mode
69+
```bash
70+
# Using the same app created above, build in release mode
71+
cd TestAppPaper*
72+
yarn windows --release
73+
```
74+
75+
## Validation Checklist
76+
77+
### App Creation Validation
78+
- [ ] App directory is created successfully
79+
- [ ] package.json contains correct react-native-windows version
80+
- [ ] windows directory is created with project files
81+
- [ ] Solution (.sln) and project files are present
82+
- [ ] Dependencies are installed correctly
83+
84+
### Build Validation
85+
- [ ] Debug build completes without errors
86+
- [ ] Release build completes without errors
87+
- [ ] App launches successfully
88+
- [ ] No critical warnings in build output
89+
- [ ] Bundle creation works (yarn start)
90+
91+
### Architecture-Specific Validation
92+
93+
#### Fabric (New Architecture)
94+
- [ ] Uses modern Fabric renderer
95+
- [ ] Supports new architecture features
96+
- [ ] Compatible with latest React Native patterns
97+
98+
#### Paper/UWP (Old Architecture)
99+
- [ ] Uses legacy Paper renderer
100+
- [ ] UWP-specific features work correctly
101+
- [ ] Compatible with existing UWP applications
102+
103+
## Expected Outcomes
104+
105+
1. **Successful App Creation**: Both architectures should create functional React Native Windows apps for both stable and preview versions
106+
2. **Version Consistency**: All apps should use the correct react-native-windows version (stable or preview as requested)
107+
3. **Build Success**: Both debug and release builds should complete successfully
108+
4. **Runtime Functionality**: Apps should launch and display the default React Native screen
109+
110+
## Troubleshooting
111+
112+
### Common Issues
113+
- **Build Failures**: Check Visual Studio components and Windows SDK versions
114+
- **Version Conflicts**: Ensure clean environment and correct package versions
115+
- **Network Issues**: May need to configure npm/yarn registries
116+
- **Version Mismatch**: Verify npm registry has the expected stable/preview versions available
117+
118+
### Debugging Steps
119+
1. Check creaternwapp.cmd output for errors
120+
2. Verify package.json dependencies
121+
3. Review build logs for specific error messages
122+
4. Ensure all prerequisites are met
123+
5. Verify npm registry connectivity and version availability
124+
125+
## Automation Notes
126+
127+
This testing can be automated in CI/CD environments using:
128+
- Windows-based build agents
129+
- Verdaccio for package registry testing
130+
- MSBuild for compilation validation
131+
- Automated deployment testing
132+
- Npm registry queries to verify version availability
133+
134+
The automated tests now include:
135+
- **Stable Version Tests**: Automatically fetch and test the latest stable version from npm
136+
- **Preview Version Tests**: Automatically fetch and test the latest preview version from npm
137+
- **Version Validation**: Verify that the fetched versions exist and have correct dependencies
138+
139+
## Documentation
140+
141+
For additional information, see:
142+
- React Native Windows documentation
143+
- creaternwapp.cmd script source
144+
- Template documentation in vnext/templates/
145+
- NPM package versions and tags for react-native-windows

0 commit comments

Comments
 (0)