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

test(JavaScriptApp): update demo and tests #334

Merged
merged 1 commit into from
Dec 6, 2017
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
15 changes: 9 additions & 6 deletions demo/JavaScriptApp/app/main-page.android.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ https://docs.nativescript.org/ui/components.
class names available for styling your app at https://docs.nativescript.org/ui/theme.
-->
<StackLayout class="p-20">
<StackLayout horizontalAlignment="left" verticalAlignment="top" orientation="horizontal" margin="30px">
<GridLayout width="30px" height="30px" backgroundColor="#7F9" margin="10px" />
<GridLayout width="30px" height="30px" class="app-class" margin="10px" />
<GridLayout width="30px" height="30px" class="page-class" margin="10px" />
</StackLayout>
<GridLayout rows="50px, 50px, 50px" columns="50px, auto">
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#7F9" />
<Label row="0" col="1" text="inline style" verticalAlignment="center" />
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" />
<Label row="1" col="1" text="page style" verticalAlignment="center" />
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" />
<Label row="2" col="1" text="app style" verticalAlignment="center" />
</GridLayout>
<Label text="Tap the button" class="h1 text-center"/>
<Button text="TAP" tap="{{ onTap }}" class="btn btn-primary btn-active"/>
<Label text="{{ message }}" class="h2 text-center" textWrap="true"/>
<Button text="Android, Navigate to second-page.xml" tap="goToSecondPage" />
<Button automationText="btnNav" text="Android, Navigate to second-page.xml" tap="goToSecondPage" />
<Label id="platform" text="-" />
</StackLayout>
</Page>
15 changes: 9 additions & 6 deletions demo/JavaScriptApp/app/main-page.ios.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ https://docs.nativescript.org/ui/components.
class names available for styling your app at https://docs.nativescript.org/ui/theme.
-->
<StackLayout class="p-20">
<StackLayout horizontalAlignment="left" verticalAlignment="top" orientation="horizontal" margin="30px">
<GridLayout width="30px" height="30px" backgroundColor="#999" margin="10px" />
<GridLayout width="30px" height="30px" class="app-class" margin="10px" />
<GridLayout width="30px" height="30px" class="page-class" margin="10px" />
</StackLayout>
<GridLayout rows="50px, 50px, 50px" columns="50px, auto">
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#999" />
<Label row="0" col="1" text="inline style" verticalAlignment="center" />
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" />
<Label row="1" col="1" text="page style" verticalAlignment="center" />
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" />
<Label row="2" col="1" text="app style" verticalAlignment="center" />
</GridLayout>
<Label text="Tap the button" class="h1 text-center"/>
<Button text="TAP" tap="{{ onTap }}" class="btn btn-primary btn-active"/>
<Label text="{{ message }}" class="h2 text-center" textWrap="true"/>
<Button text="iOS, Navigate to second-page.xml" tap="goToSecondPage" />
<Button automationText="btnNav" text="iOS, Navigate to second-page.xml" tap="goToSecondPage" />
<Label id="platform" text="-" />
</StackLayout>
</Page>
106 changes: 106 additions & 0 deletions demo/JavaScriptApp/e2e/config/appium.capabilities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"android19": {
"platformName": "Android",
"platformVersion": "4.4",
"deviceName": "Emulator-Api19-Default",
"avd": "Emulator-Api19-Default",
"lt": 60000,
"appActivity": "com.tns.NativeScriptActivity",
"newCommandTimeout": 720,
"noReset": true,
"fullReset": false,
"app": ""
},
"android21": {
"platformName": "Android",
"platformVersion": "5.0",
"deviceName": "Emulator-Api21-Default",
"avd": "Emulator-Api21-Default",
"lt": 60000,
"appActivity": "com.tns.NativeScriptActivity",
"newCommandTimeout": 720,
"noReset": true,
"fullReset": false,
"app": ""
},
"android23": {
"platformName": "Android",
"platformVersion": "6.0",
"deviceName": "Emulator-Api23-Default",
"avd": "Emulator-Api23-Default",
"lt": 60000,
"appActivity": "com.tns.NativeScriptActivity",
"newCommandTimeout": 720,
"noReset": true,
"fullReset": false,
"app": ""
},
"android24": {
"platformName": "Android",
"platformVersion": "7.0",
"deviceName": "Emulator-Api24-Default",
"avd": "Emulator-Api24-Default",
"lt": 60000,
"appActivity": "com.tns.NativeScriptActivity",
"newCommandTimeout": 720,
"noReset": true,
"fullReset": false,
"app": ""
},
"android25": {
"platformName": "Android",
"platformVersion": "7.1",
"deviceName": "Emulator-Api25-Google",
"avd": "Emulator-Api25-Google",
"lt": 60000,
"appActivity": "com.tns.NativeScriptActivity",
"newCommandTimeout": 720,
"noReset": true,
"fullReset": false,
"app": ""
},
"android26": {
"platformName": "Android",
"platformVersion": "8.0",
"deviceName": "Emulator-Api26-Google",
"avd": "Emulator-Api26-Google",
"lt": 60000,
"appActivity": "com.tns.NativeScriptActivity",
"newCommandTimeout": 720,
"noReset": true,
"fullReset": false,
"app": ""
},
"sim.iPhone7.iOS100": {
"platformName": "iOS",
"platformVersion": "10.0",
"deviceName": "iPhone 7 100",
"noReset": true,
"fullReset": false,
"app": ""
},
"sim.iPhone8.iOS110": {
"platformName": "iOS",
"platformVersion": "11.0",
"deviceName": "iPhone 8 110",
"noReset": true,
"fullReset": false,
"app": ""
},
"sim.iPhoneX.iOS110": {
"platformName": "iOS",
"platformVersion": "11.0",
"deviceName": "iPhone X",
"noReset": true,
"fullReset": false,
"app": ""
},
"sim.iPhoneX.iOS111": {
"platformName": "iOS",
"platformVersion": "11.1",
"deviceName": "iPhone X",
"noReset": true,
"fullReset": false,
"app": ""
}
}
4 changes: 4 additions & 0 deletions demo/JavaScriptApp/e2e/config/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--timeout 80000
--recursive e2e
--reporter mocha-multi
--reporter-options spec=-,mocha-junit-reporter=test-results.xml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions demo/JavaScriptApp/e2e/setup.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions demo/JavaScriptApp/e2e/tests.e2e-spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions demo/JavaScriptApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"css-loader": "~0.28.7",
"extract-text-webpack-plugin": "~3.0.0",
"lazy": "1.0.11",
"nativescript-dev-appium": "next",
"nativescript-dev-sass": "^1.3.5",
"nativescript-dev-webpack": "file:../..",
"nativescript-worker-loader": "~0.8.1",
Expand All @@ -42,6 +43,7 @@
"build-android-bundle": "npm run ns-bundle --android --build-app",
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
"e2e": "mocha --opts ./e2e/config/mocha.opts"
}
}
}
2 changes: 1 addition & 1 deletion demo/TypeScriptApp/e2e/tests.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appi
import { assert } from "chai";

describe("sample scenario", () => {
const defaultWaitTime = 5000;
let driver: AppiumDriver;

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

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logPageSource(this.currentTest.title);
await driver.logScreenshot(this.currentTest.title);
}
});
Expand Down