Skip to content

Commit 61589a3

Browse files
windows: add tests
Adds windows tests to the example app.
1 parent ad3d8bd commit 61589a3

File tree

7 files changed

+3836
-64
lines changed

7 files changed

+3836
-64
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { driver, By2 } from 'selenium-appium';
2+
import { until } from 'selenium-webdriver';
3+
4+
const setup = require('../jest-windows/driver.setup');
5+
jest.setTimeout(60000);
6+
7+
beforeAll(() => {
8+
return driver.startWithCapabilities(setup.capabilites);
9+
});
10+
11+
afterAll(() => {
12+
return driver.quit();
13+
});
14+
15+
describe('Control Renders', () => {
16+
17+
test('Renders Splash Screen', async () => {
18+
await driver.wait(until.elementLocated(By2.nativeAccessibilityId('SplashImage')));
19+
});
20+
21+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { windowsAppDriverCapabilities } from 'selenium-appium'
2+
3+
switch (platform) {
4+
case "windows":
5+
const webViewWindowsAppId = 'RNSplashScreenExample_tzd3rs38zxb7w!App';
6+
module.exports = {
7+
capabilites: windowsAppDriverCapabilities(webViewWindowsAppId)
8+
}
9+
break;
10+
default:
11+
throw "Unknown platform: " + platform;
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
platform = "windows"

examples/jest.windows.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
testMatch: ['**/__windows_tests__/**/*.[jt]s?(x)'],
3+
setupFiles: ['./jest-windows/jest.setup.js']
4+
}

examples/package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
"private": true,
55
"scripts": {
66
"android": "react-native run-android",
7+
"appium": "appium",
78
"ios": "react-native run-ios",
89
"start": "react-native start",
910
"test": "jest",
10-
"lint": "eslint ."
11+
"test:windows": "yarn jest --config=./jest.windows.config.js --runInBand",
12+
"lint": "eslint .",
13+
"windows": "react-native run-windows"
1114
},
1215
"dependencies": {
1316
"react": "16.13.1",
@@ -19,13 +22,16 @@
1922
"@babel/core": "^7.8.4",
2023
"@babel/runtime": "^7.8.4",
2124
"@react-native-community/eslint-config": "^1.1.0",
25+
"appium": "1.18.3",
2226
"babel-jest": "^25.1.0",
2327
"eslint": "^6.8.0",
2428
"jest": "^25.1.0",
2529
"metro-react-native-babel-preset": "^0.59.0",
26-
"react-test-renderer": "16.13.1"
30+
"react-test-renderer": "16.13.1",
31+
"selenium-appium": "0.0.15",
32+
"selenium-webdriver": "4.0.0-alpha.7"
2733
},
2834
"jest": {
2935
"preset": "react-native"
3036
}
31-
}
37+
}

examples/windows/examples/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
IgnorableNamespaces="uap mp">
88

99
<Identity
10-
Name="87048d27-346f-49bc-a163-a3ae0a048f39"
10+
Name="RNSplashScreenExample"
1111
Publisher="CN=Jaime"
1212
Version="1.0.0.0" />
1313

0 commit comments

Comments
 (0)