Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 028089b

Browse files
author
Vasil Chimev
authored
test(JavaScriptApp): update demo and tests (#334)
1 parent f6006dd commit 028089b

File tree

10 files changed

+228
-15
lines changed

10 files changed

+228
-15
lines changed

Diff for: demo/JavaScriptApp/app/main-page.android.xml

+9-6
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ https://docs.nativescript.org/ui/components.
2525
class names available for styling your app at https://docs.nativescript.org/ui/theme.
2626
-->
2727
<StackLayout class="p-20">
28-
<StackLayout horizontalAlignment="left" verticalAlignment="top" orientation="horizontal" margin="30px">
29-
<GridLayout width="30px" height="30px" backgroundColor="#7F9" margin="10px" />
30-
<GridLayout width="30px" height="30px" class="app-class" margin="10px" />
31-
<GridLayout width="30px" height="30px" class="page-class" margin="10px" />
32-
</StackLayout>
28+
<GridLayout rows="50px, 50px, 50px" columns="50px, auto">
29+
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#7F9" />
30+
<Label row="0" col="1" text="inline style" verticalAlignment="center" />
31+
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" />
32+
<Label row="1" col="1" text="page style" verticalAlignment="center" />
33+
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" />
34+
<Label row="2" col="1" text="app style" verticalAlignment="center" />
35+
</GridLayout>
3336
<Label text="Tap the button" class="h1 text-center"/>
3437
<Button text="TAP" tap="{{ onTap }}" class="btn btn-primary btn-active"/>
3538
<Label text="{{ message }}" class="h2 text-center" textWrap="true"/>
36-
<Button text="Android, Navigate to second-page.xml" tap="goToSecondPage" />
39+
<Button automationText="btnNav" text="Android, Navigate to second-page.xml" tap="goToSecondPage" />
3740
<Label id="platform" text="-" />
3841
</StackLayout>
3942
</Page>

Diff for: demo/JavaScriptApp/app/main-page.ios.xml

+9-6
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@ https://docs.nativescript.org/ui/components.
2525
class names available for styling your app at https://docs.nativescript.org/ui/theme.
2626
-->
2727
<StackLayout class="p-20">
28-
<StackLayout horizontalAlignment="left" verticalAlignment="top" orientation="horizontal" margin="30px">
29-
<GridLayout width="30px" height="30px" backgroundColor="#999" margin="10px" />
30-
<GridLayout width="30px" height="30px" class="app-class" margin="10px" />
31-
<GridLayout width="30px" height="30px" class="page-class" margin="10px" />
32-
</StackLayout>
28+
<GridLayout rows="50px, 50px, 50px" columns="50px, auto">
29+
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#999" />
30+
<Label row="0" col="1" text="inline style" verticalAlignment="center" />
31+
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" />
32+
<Label row="1" col="1" text="page style" verticalAlignment="center" />
33+
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" />
34+
<Label row="2" col="1" text="app style" verticalAlignment="center" />
35+
</GridLayout>
3336
<Label text="Tap the button" class="h1 text-center"/>
3437
<Button text="TAP" tap="{{ onTap }}" class="btn btn-primary btn-active"/>
3538
<Label text="{{ message }}" class="h2 text-center" textWrap="true"/>
36-
<Button text="iOS, Navigate to second-page.xml" tap="goToSecondPage" />
39+
<Button automationText="btnNav" text="iOS, Navigate to second-page.xml" tap="goToSecondPage" />
3740
<Label id="platform" text="-" />
3841
</StackLayout>
3942
</Page>
+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"android19": {
3+
"platformName": "Android",
4+
"platformVersion": "4.4",
5+
"deviceName": "Emulator-Api19-Default",
6+
"avd": "Emulator-Api19-Default",
7+
"lt": 60000,
8+
"appActivity": "com.tns.NativeScriptActivity",
9+
"newCommandTimeout": 720,
10+
"noReset": true,
11+
"fullReset": false,
12+
"app": ""
13+
},
14+
"android21": {
15+
"platformName": "Android",
16+
"platformVersion": "5.0",
17+
"deviceName": "Emulator-Api21-Default",
18+
"avd": "Emulator-Api21-Default",
19+
"lt": 60000,
20+
"appActivity": "com.tns.NativeScriptActivity",
21+
"newCommandTimeout": 720,
22+
"noReset": true,
23+
"fullReset": false,
24+
"app": ""
25+
},
26+
"android23": {
27+
"platformName": "Android",
28+
"platformVersion": "6.0",
29+
"deviceName": "Emulator-Api23-Default",
30+
"avd": "Emulator-Api23-Default",
31+
"lt": 60000,
32+
"appActivity": "com.tns.NativeScriptActivity",
33+
"newCommandTimeout": 720,
34+
"noReset": true,
35+
"fullReset": false,
36+
"app": ""
37+
},
38+
"android24": {
39+
"platformName": "Android",
40+
"platformVersion": "7.0",
41+
"deviceName": "Emulator-Api24-Default",
42+
"avd": "Emulator-Api24-Default",
43+
"lt": 60000,
44+
"appActivity": "com.tns.NativeScriptActivity",
45+
"newCommandTimeout": 720,
46+
"noReset": true,
47+
"fullReset": false,
48+
"app": ""
49+
},
50+
"android25": {
51+
"platformName": "Android",
52+
"platformVersion": "7.1",
53+
"deviceName": "Emulator-Api25-Google",
54+
"avd": "Emulator-Api25-Google",
55+
"lt": 60000,
56+
"appActivity": "com.tns.NativeScriptActivity",
57+
"newCommandTimeout": 720,
58+
"noReset": true,
59+
"fullReset": false,
60+
"app": ""
61+
},
62+
"android26": {
63+
"platformName": "Android",
64+
"platformVersion": "8.0",
65+
"deviceName": "Emulator-Api26-Google",
66+
"avd": "Emulator-Api26-Google",
67+
"lt": 60000,
68+
"appActivity": "com.tns.NativeScriptActivity",
69+
"newCommandTimeout": 720,
70+
"noReset": true,
71+
"fullReset": false,
72+
"app": ""
73+
},
74+
"sim.iPhone7.iOS100": {
75+
"platformName": "iOS",
76+
"platformVersion": "10.0",
77+
"deviceName": "iPhone 7 100",
78+
"noReset": true,
79+
"fullReset": false,
80+
"app": ""
81+
},
82+
"sim.iPhone8.iOS110": {
83+
"platformName": "iOS",
84+
"platformVersion": "11.0",
85+
"deviceName": "iPhone 8 110",
86+
"noReset": true,
87+
"fullReset": false,
88+
"app": ""
89+
},
90+
"sim.iPhoneX.iOS110": {
91+
"platformName": "iOS",
92+
"platformVersion": "11.0",
93+
"deviceName": "iPhone X",
94+
"noReset": true,
95+
"fullReset": false,
96+
"app": ""
97+
},
98+
"sim.iPhoneX.iOS111": {
99+
"platformName": "iOS",
100+
"platformVersion": "11.1",
101+
"deviceName": "iPhone X",
102+
"noReset": true,
103+
"fullReset": false,
104+
"app": ""
105+
}
106+
}

Diff for: demo/JavaScriptApp/e2e/config/mocha.opts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--timeout 80000
2+
--recursive e2e
3+
--reporter mocha-multi
4+
--reporter-options spec=-,mocha-junit-reporter=test-results.xml
Loading
Loading

Diff for: demo/JavaScriptApp/e2e/setup.js

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: demo/JavaScriptApp/e2e/tests.e2e-spec.js

+77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: demo/JavaScriptApp/package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"css-loader": "~0.28.7",
2525
"extract-text-webpack-plugin": "~3.0.0",
2626
"lazy": "1.0.11",
27+
"nativescript-dev-appium": "next",
2728
"nativescript-dev-sass": "^1.3.5",
2829
"nativescript-dev-webpack": "file:../..",
2930
"nativescript-worker-loader": "~0.8.1",
@@ -42,6 +43,7 @@
4243
"build-android-bundle": "npm run ns-bundle --android --build-app",
4344
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
4445
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
45-
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
46+
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
47+
"e2e": "mocha --opts ./e2e/config/mocha.opts"
4648
}
47-
}
49+
}

Diff for: demo/TypeScriptApp/e2e/tests.e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appi
22
import { assert } from "chai";
33

44
describe("sample scenario", () => {
5-
const defaultWaitTime = 5000;
65
let driver: AppiumDriver;
76

87
before(async () => {
@@ -20,6 +19,7 @@ describe("sample scenario", () => {
2019

2120
afterEach(async function () {
2221
if (this.currentTest.state === "failed") {
22+
await driver.logPageSource(this.currentTest.title);
2323
await driver.logScreenshot(this.currentTest.title);
2424
}
2525
});

0 commit comments

Comments
 (0)