Skip to content

Commit 9556965

Browse files
vakrilovMartoYankov
authored andcommitted
test: TabView with multiple outlets project
1 parent 4ad2046 commit 9556965

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
after(async () => {
12+
await driver.quit();
13+
console.log("Quit driver!");
14+
});
15+
16+
afterEach(async function () {
17+
if (this.currentTest.state === "failed") {
18+
await driver.logScreenshot(this.currentTest.title);
19+
}
20+
});
21+
22+
it("should find an tabs by text", async () => {
23+
await driver.findElementByText("Players", SearchOptions.exact);
24+
await driver.findElementByText("Teams", SearchOptions.exact);
25+
await driver.findElementByText("Player List", SearchOptions.exact);
26+
});
27+
28+
it("should be able to switch between tabs", async () => {
29+
await driver.findElementByText("Player List", SearchOptions.exact);
30+
31+
const teamsTab = await driver.findElementByText("Teams", SearchOptions.exact);
32+
await teamsTab.click();
33+
await driver.findElementByText("Team List", SearchOptions.exact);
34+
35+
const playerTab = await driver.findElementByText("Players", SearchOptions.exact);
36+
await playerTab.click();
37+
await driver.findElementByText("Player List", SearchOptions.exact);
38+
});
39+
40+
it("should go froward and go back on first tab", async () => {
41+
await driver.findElementByText("Player List", SearchOptions.exact);
42+
43+
let player = await driver.findElementByText("Player One", SearchOptions.exact);
44+
await player.click();
45+
46+
await driver.findElementByText("Player Details", SearchOptions.exact);
47+
await driver.findElementByText("1", SearchOptions.exact);
48+
await driver.findElementByText("Player One", SearchOptions.exact);
49+
50+
await driver.navBack();
51+
await driver.findElementByText("Player List", SearchOptions.exact);
52+
});
53+
54+
it("should go froward and go back on second tab", async () => {
55+
await driver.findElementByText("Player List", SearchOptions.exact);
56+
57+
const teamsTab = await driver.findElementByText("Teams", SearchOptions.exact);
58+
await teamsTab.click();
59+
await driver.findElementByText("Team List", SearchOptions.exact);
60+
61+
const team = await driver.findElementByText("Team Two", SearchOptions.exact);
62+
await team.click();
63+
64+
await driver.findElementByText("Team Details", SearchOptions.exact);
65+
await driver.findElementByText("2", SearchOptions.exact);
66+
await driver.findElementByText("Team Two", SearchOptions.exact);
67+
68+
await driver.navBack();
69+
await driver.findElementByText("Team List", SearchOptions.exact);
70+
});
71+
});
72+
73+
async function selectTeamTab(driver: AppiumDriver, text: string) {
74+
const teamsTab = await driver.findElementByText("Teams", SearchOptions.exact);
75+
await teamsTab.click();
76+
await driver.findElementByText("Team List", SearchOptions.exact);
77+
}
78+
79+
async function selectPlayerTab(driver: AppiumDriver, text: string) {
80+
const playerTab = await driver.findElementByText("Players", SearchOptions.exact);
81+
await playerTab.click();
82+
await driver.findElementByText("Player List", SearchOptions.exact);
83+
}

0 commit comments

Comments
 (0)