Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f6006dd

Browse files
author
Vasil Chimev
authoredDec 6, 2017
test(AngularApp): update demo tests (#333)
* test(AngularApp): update demo tests * refactor: remove unused variable
1 parent 5539ddb commit f6006dd

File tree

2 files changed

+71
-47
lines changed

2 files changed

+71
-47
lines changed
 

‎demo/AngularApp/e2e/sample.e2e-spec.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

‎demo/AngularApp/e2e/tests.e2e-spec.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
2+
import { assert } from "chai";
3+
4+
describe("sample scenario", () => {
5+
let driver: AppiumDriver;
6+
7+
before(async () => {
8+
driver = await createDriver();
9+
});
10+
11+
beforeEach(async function () {
12+
try {
13+
const items = await getItems();
14+
} catch (err) {
15+
try {
16+
const lblNinjas = await driver.findElementByText("Ninjas!");
17+
}
18+
catch (err) {
19+
console.log("Navigating to ninjas page ...");
20+
await driver.navBack();
21+
}
22+
console.log("Navigating to main page ...");
23+
await driver.navBack();
24+
}
25+
});
26+
27+
afterEach(async function () {
28+
if (this.currentTest.state === "failed") {
29+
await driver.logPageSource(this.currentTest.title);
30+
await driver.logScreenshot(this.currentTest.title);
31+
}
32+
});
33+
34+
after(async () => {
35+
await driver.quit();
36+
console.log("Quit driver!");
37+
});
38+
39+
it("should navigate to a ninja", async () => {
40+
const btnNinjas = await driver.findElementByText("Ninjas");
41+
await btnNinjas.click();
42+
43+
const itemMichaelangelo = await driver.findElementByText("Michaelangelo");
44+
await itemMichaelangelo.click();
45+
46+
const lblMichaelangelo = await driver.findElementByText("Ninja Michaelangelo!");
47+
await lblMichaelangelo.isDisplayed();
48+
49+
const btnBackToNinjas = await driver.findElementByText("Back to ninjas");
50+
await btnBackToNinjas.click();
51+
52+
const btnGoBackHome = await driver.findElementByText("Go back home");
53+
await btnGoBackHome.click();
54+
});
55+
56+
const styleTypes = {
57+
"inline": "styleInline",
58+
"page": "stylePage",
59+
"app": "styleApp"
60+
};
61+
62+
for (let styleType in styleTypes) {
63+
it(`should find an element with ${styleType} style applied`, async function () {
64+
const element = await driver.findElementByText(styleTypes[styleType]);
65+
const result = await driver.compareElement(element, "style");
66+
assert.isTrue(result);
67+
});
68+
}
69+
70+
const getItems = async () => { return driver.isAndroid ? await driver.findElementsByText("(Android)") : await driver.findElementsByText("(ios)"); }
71+
});

0 commit comments

Comments
 (0)
This repository has been archived.