Skip to content

Commit 17fb263

Browse files
author
Vasil Chimev
authored
test: update to nativescript-dev-appium@3.0.0 (#1)
1 parent d690568 commit 17fb263

File tree

12 files changed

+2493
-358
lines changed

12 files changed

+2493
-358
lines changed

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
**/.DS_Store
2+
13
hooks
24
node_modules
35
platforms
4-
report
56

67
app/**/*.js
78
e2e/**/*.js
89
e2e/**/*.map
10+
e2e/reports/
911
test-results.xml

Diff for: .vscode/launch.json

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Mocha Tests",
8+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
9+
"args": [
10+
"-u",
11+
"tdd",
12+
"--timeout",
13+
"999999",
14+
"--colors",
15+
"--opts", "./e2e/config/mocha.opts",
16+
"--runType", "sim.iPhone7.iOS100"
17+
],
18+
"internalConsoleOptions": "openOnSessionStart"
19+
},
420
{
521
"name": "Launch on iOS",
622
"type": "nativescript",

Diff for: e2e/config/appium.capabilities.json

+39-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
22
"android19": {
3-
"browserName": "",
4-
"appium-version": "1.6.5",
53
"platformName": "Android",
64
"platformVersion": "4.4",
75
"deviceName": "Emulator-Api19-Default",
86
"avd": "Emulator-Api19-Default",
9-
"-lt": 60000,
7+
"lt": 60000,
108
"automationName": "Appium",
119
"appActivity": "com.tns.NativeScriptActivity",
1210
"newCommandTimeout": 720,
@@ -15,13 +13,11 @@
1513
"app": ""
1614
},
1715
"android21": {
18-
"browserName": "",
19-
"appium-version": "1.6.5",
2016
"platformName": "Android",
2117
"platformVersion": "5.0",
2218
"deviceName": "Emulator-Api21-Default",
2319
"avd": "Emulator-Api21-Default",
24-
"-lt": 60000,
20+
"lt": 60000,
2521
"automationName": "Appium",
2622
"appActivity": "com.tns.NativeScriptActivity",
2723
"newCommandTimeout": 720,
@@ -30,13 +26,11 @@
3026
"app": ""
3127
},
3228
"android23": {
33-
"browserName": "",
34-
"appium-version": "1.6.5",
3529
"platformName": "Android",
3630
"platformVersion": "6.0",
3731
"deviceName": "Emulator-Api23-Default",
3832
"avd": "Emulator-Api23-Default",
39-
"-lt": 60000,
33+
"lt": 60000,
4034
"automationName": "Appium",
4135
"appActivity": "com.tns.NativeScriptActivity",
4236
"newCommandTimeout": 720,
@@ -45,28 +39,58 @@
4539
"app": ""
4640
},
4741
"android24": {
48-
"browserName": "",
49-
"appium-version": "1.6.5",
5042
"platformName": "Android",
5143
"platformVersion": "7.0",
5244
"deviceName": "Emulator-Api24-Default",
5345
"avd": "Emulator-Api24-Default",
54-
"-lt": 60000,
46+
"lt": 60000,
5547
"automationName": "UIAutomator2",
5648
"appActivity": "com.tns.NativeScriptActivity",
5749
"newCommandTimeout": 720,
5850
"noReset": false,
5951
"fullReset": true,
6052
"app": ""
6153
},
62-
"ios-simulator.iPhone7.ios10": {
63-
"browserName": "",
64-
"appium-version": "1.6.5",
54+
"android25": {
55+
"platformName": "Android",
56+
"platformVersion": "7.1",
57+
"deviceName": "Emulator-Api25-Google",
58+
"avd": "Emulator-Api25-Google",
59+
"lt": 60000,
60+
"automationName": "UIAutomator2",
61+
"appActivity": "com.tns.NativeScriptActivity",
62+
"newCommandTimeout": 720,
63+
"noReset": false,
64+
"fullReset": true,
65+
"app": ""
66+
},
67+
"android26": {
68+
"platformName": "Android",
69+
"platformVersion": "8.0",
70+
"deviceName": "Emulator-Api26-Google",
71+
"avd": "Emulator-Api26-Google",
72+
"lt": 60000,
73+
"automationName": "UIAutomator2",
74+
"appActivity": "com.tns.NativeScriptActivity",
75+
"newCommandTimeout": 720,
76+
"noReset": false,
77+
"fullReset": true,
78+
"app": ""
79+
},
80+
"sim.iPhone7.iOS100": {
6581
"platformName": "iOS",
6682
"platformVersion": "10.0",
6783
"deviceName": "iPhone 7 100",
6884
"noReset": true,
6985
"fullReset": false,
7086
"app": ""
87+
},
88+
"sim.iPhoneX.iOS110": {
89+
"platformName": "iOS",
90+
"platformVersion": "11.0",
91+
"deviceName": "iPhone X 110",
92+
"noReset": true,
93+
"fullReset": false,
94+
"app": ""
7195
}
7296
}
Loading
Loading
Loading
Loading

Diff for: e2e/sample-test.e2e.ts

-31
This file was deleted.

Diff for: e2e/setup.ts

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
import * as setup from "nativescript-dev-appium";
2-
import * as portastic from "portastic";
1+
import { startServer, stopServer } from "nativescript-dev-appium";
32

4-
before("setup server", async () => {
5-
console.log("Setting up server");
6-
const port = 9191;
7-
await setup.startAppiumServer(port);
8-
console.log("Server is started");
3+
before("start server", async () => {
4+
await startServer();
95
});
106

11-
before("setup driver", async () => {
12-
console.log("Setting up driver");
7+
after("stop server", async () => {
8+
await stopServer();
139
});
14-
15-
after("kill driver", async () => {
16-
console.log("Kill driver");
17-
});
18-
19-
after("kill server", async () => {
20-
await setup.killAppiumServer();
21-
console.log("Server stopped");
22-
});

Diff for: e2e/tests.e2e.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
2+
import { assert } from "chai";
3+
4+
describe("sample scenario", () => {
5+
const defaultWaitTime = 5000;
6+
let driver: AppiumDriver;
7+
8+
before(async () => {
9+
driver = await createDriver();
10+
});
11+
12+
after(async () => {
13+
await driver.quit();
14+
console.log("Quit driver!");
15+
});
16+
17+
afterEach(async function () {
18+
if (this.currentTest.state === "failed") {
19+
await driver.logScreenshoot(this.currentTest.title);
20+
}
21+
});
22+
23+
it("should go to support page", async () => {
24+
const btnGoToSupportPage = await driver.findElementByText("go to support page", SearchOptions.exact);
25+
const homeImage = await driver.compareScreen("home");
26+
assert.isTrue(homeImage);
27+
await btnGoToSupportPage.click();
28+
const titleSupportPage = await driver.findElementByText("Support Page", SearchOptions.exact);
29+
console.log(await titleSupportPage.text());
30+
});
31+
32+
it("should go back to home page", async () => {
33+
const btnGoBackToHomePage = await driver.findElementByText("go back to home page", SearchOptions.exact);
34+
const supportImage = await driver.compareScreen("support");
35+
assert.isTrue(supportImage);
36+
await btnGoBackToHomePage.click();
37+
const titleHomePage = await driver.findElementByText("Home Page", SearchOptions.exact);
38+
console.log(await titleHomePage.text());
39+
});
40+
});

0 commit comments

Comments
 (0)