Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
node_modules
jest-setups/jest.setup.js
jest-setups/jest.setup.windows.js
65 changes: 65 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Windows CI
on: [pull_request]

jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
name: Checkout Code

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '12.9.1'

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.0
with:
vs-version: 16.5

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2

- name: Check node modules cache
uses: actions/cache@v1
id: yarn-cache
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node modules
if: steps.yarn-cache.outputs.cache-hit != 'true'
run:
yarn add react-native@0.62 --dev
yarn --pure-lockfile

- name: yarn build
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: |
yarn build
yarn tsc

- name: NuGet restore
run: nuget restore example\windows\ProgressViewExample.sln

- name: Build x64 release
run: msbuild .\example\windows\ProgressViewExample.sln /p:Configuration=Release /p:Platform=x64 -m

- name: Deploy
shell: powershell
run: |
cd example
Copy-Item -Path windows\x64\Release -Recurse -Destination windows\
npx react-native run-windows --arch x64 --release --no-build --no-packager


- name: Start Appium server
shell: powershell
run: Start-Process PowerShell -ArgumentList "yarn appium"

- name: Run tests
run: yarn test:windows
104 changes: 104 additions & 0 deletions __tests__/ProgressViewWindows.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

import {driver, By2} from 'selenium-appium';
import {until} from 'selenium-webdriver';

const setup = require('../jest-setups/jest.setup');
jest.setTimeout(50000);

beforeAll(() => {
return driver.startWithCapabilities(setup.capabilites);
});

afterAll(() => {
return driver.quit();
});

describe('Windows Tests', () => {
test('Render every windows example app progress bars', async () => {
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="p1"]'),
),
);
} catch (error) {
throw new Error('Progress Bar 1 failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="p2"]'),
),
);
} catch (error) {
throw new Error('Progress Bar 2 failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="p3"]'),
),
);
} catch (error) {
throw new Error('Progress Bar 3 failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="p4"]'),
),
);
} catch (error) {
throw new Error('Progress Bar 4 failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="Indeterminate"]'),
),
);
} catch (error) {
throw new Error('Indeterminate Progress Bar failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="localimage"]'),
),
);
} catch (error) {
throw new Error('Local Image Progress Bar failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="networkimage"]'),
),
);
} catch (error) {
throw new Error('Network Image Progress Bar failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="trackcolor"]'),
),
);
} catch (error) {
throw new Error('Track Color Progress Bar failed to render');
}
try {
await driver.wait(
until.elementLocated(
By2.nativeXpath('//ProgressBar[@AutomationId="bar"]'),
),
);
} catch (error) {
throw new Error('Bar Style Progress Bar failed to render');
}
});
});
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
.DS_Store

*.binlog

# Xcode
#
build/
Expand Down
15 changes: 14 additions & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,45 @@ export class App extends React.Component<Props, State> {
<ProgressView
style={styles.progressView}
progress={this.getProgress(0)}
testID={'p1'}
/>
<ProgressView
style={styles.progressView}
progressTintColor="purple"
progress={this.getProgress(0.2)}
testID={'p2'}
/>
<ProgressView
style={styles.progressView}
progressTintColor="red"
progress={this.getProgress(0.4)}
testID={'p3'}
/>
<ProgressView
style={styles.progressView}
progressTintColor="orange"
progress={this.getProgress(0.6)}
testID={'p4'}
/>
<ProgressView
style={styles.progressView}
progressTintColor="yellow"
progress={this.getProgress(0.8)}
testID={'p5'}
/>

<Text style={styles.text}>isIndeterminate</Text>
<ProgressView style={styles.progressView} isIndeterminate={true} />
<ProgressView
style={styles.progressView}
isIndeterminate={true}
testID={'Indeterminate'}
/>
<Text style={styles.text}>ProgressImage with local image</Text>
<ProgressView
style={styles.progressView}
progress={0.5}
progressImage={require('./test.png')}
testID={'localimage'}
/>
<Text style={styles.text}>TrackImage with network image</Text>
{Platform.OS === 'windows' ? (
Expand All @@ -83,6 +93,7 @@ export class App extends React.Component<Props, State> {
trackImage={{
uri: 'https://homepages.cae.wisc.edu/~ece533/images/cat.png',
}}
testID={'networkimage'}
/>
) : (
<Text>Network Images only work on Windows</Text>
Expand All @@ -93,12 +104,14 @@ export class App extends React.Component<Props, State> {
progress={0.8}
trackTintColor={'red'}
progressTintColor={'yellow'}
testID={'trackcolor'}
/>
<Text style={styles.text}>Bar Style</Text>
<ProgressView
style={styles.progressView}
progress={0.4}
progressViewStyle={'bar'}
testID={'bar'}
/>
</SafeAreaView>
);
Expand Down
79 changes: 78 additions & 1 deletion example/windows/ProgressViewExample/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
/Bundle
*AppPackages*
*BundleArtifacts*
*Bundle

#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
#MonoDevelop
*.pidb
*.userprefs
#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache
#Project files
[Bb]uild/
#Subversion files
.svn
# Office Temp Files
~$*
# vim Temp Files
*~
#NuGet
packages/
*.nupkg
#ncrunch
*ncrunch*
*crunch*.local.xml
# visual studio database projects
*.dbmdl
#Test files
*.testsettings
#Other files
*.DotSettings
.vs/
*project.lock.json
#Files generated by the VS build
**/Generated Files/**
2 changes: 1 addition & 1 deletion example/windows/ProgressViewExample/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
IgnorableNamespaces="uap mp">

<Identity
Name="a0fe1646-6d2d-45b5-bd15-05b556266ebe"
Name="ProgressViewExample"
Publisher="CN=t-takapo"
Version="1.0.0.0" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageCertificateKeyFile>ProgressViewExample_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>3A8F3D8AE21263D498BBEFD56EF6908E4B03496F</PackageCertificateThumbprint>
<PackageCertificatePassword>password</PackageCertificatePassword>
<AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<ItemGroup Label="ProjectConfigurations">
Expand Down Expand Up @@ -143,6 +144,7 @@
<ItemGroup>
<None Include="packages.config" />
<None Include="PropertySheet.props" />
<None Include="ProgressViewExample_TemporaryKey.pfx" />
<Text Include="readme.txt">
<DeploymentContent>false</DeploymentContent>
</Text>
Expand All @@ -153,6 +155,12 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<PropertyGroup>
<BundleEntryFile>index.js</BundleEntryFile>
<BundlerExtraArgs>--use-react-native-windows</BundlerExtraArgs>
</PropertyGroup>
<Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.props" />
<Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.Cpp.targets" />
<PropertyGroup Label="ReactNativeWindowsNodeProps">
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<ItemGroup>
<None Include="PropertySheet.props" />
<None Include="packages.config" />
<None Include="ProgressViewExample_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Text Include="readme.txt" />
Expand Down
12 changes: 12 additions & 0 deletions jest-setups/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {windowsAppDriverCapabilities} from 'selenium-appium';

switch (platform) {
case 'windows':
const webViewWindowsAppId = 'ProgressViewExample_kvqejeg71e612!App';
module.exports = {
capabilites: windowsAppDriverCapabilities(webViewWindowsAppId),
};
break;
default:
throw 'Unknown platform: ' + platform;
}
1 change: 1 addition & 0 deletions jest-setups/jest.setup.windows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
platform = 'windows';
Loading