8000 fix(tabs-ios): unable to return to tab after tab with nested frame vi… · NativeScript/NativeScript@490cab0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 490cab0

Browse files
ADjenkovSvetoslavTsenov
authored andcommitted
fix(tabs-ios): unable to return to tab after tab with nested frame visited (#7574)
1 parent 4511c76 commit 490cab0

18 files changed

+1043
-65
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import * as application from "tns-core-modules/application";
22

33
application.run({ moduleName: "app-root" });
4-
// application.run({ moduleName: "tab-root" });
5-
// application.run({ moduleName: "layout-root" });

e2e/nested-frame-navigation/app/bottom-navigation-page/bottom-navigation-page.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
22

33
<ActionBar class="action-bar">
4-
<NavigationButton text="tabBottomBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
4+
<NavigationButton text="bottomNavigationBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
55
<Label class="action-bar-title" text="bottom navigation page" horizontalAlignment="center" />
66
</ActionBar>
77

@@ -16,9 +16,9 @@
1616
<GridLayout row="1">
1717
<BottomNavigation>
1818
<TabStrip>
19-
<TabStripItem title="Players"></TabStripItem>
20-
<TabStripItem title="Dummy"></TabStripItem>
21-
<TabStripItem title="Teams"></TabStripItem>
19+
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
20+
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
21+
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
2222
</TabStrip>
2323

2424
<TabContentItem>

e2e/nested-frame-navigation/app/bottom-navigation-root/bottom-navigation-root.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<BottomNavigation>
22
<TabStrip>
3-
<TabStripItem title="Players"></TabStripItem>
3+
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
44
<!-- this tab serves as dummy so the actual teams tab is not loaded by default -->
5-
<TabStripItem title="Dummy"></TabStripItem>
6-
<TabStripItem title="Teams"></TabStripItem>
5+
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
6+
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
77
</TabStrip>
88

99
<TabContentItem>
1010
<GridLayout rows="auto, auto, *">
11-
<Label text="tabs root top home" />
11+
<Label text="bottom navigation root home" />
1212
<Button row="1" text="reset app" tap="onReset" />
1313
<GridLayout row="2">
1414
<Frame defaultPage="players/players-items-page" />

e2e/nested-frame-navigation/app/tab-page/tab-bottom-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
22

33
<ActionBar class="action-bar">
4-
<NavigationButton text="tabBottomBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
4+
<NavigationButton text="tabViewBottomBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
55
<Label class="action-bar-title" text="tabview bottom page" horizontalAlignment="center" />
66
</ActionBar>
77

e2e/nested-frame-navigation/app/tab-page/tab-top-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
22

33
<ActionBar class="action-bar">
4-
<NavigationButton text="tabTopBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
4+
<NavigationButton text="tabViewTopBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
55
<Label class="action-bar-title" text="tabview top page" horizontalAlignment="center" />
66
</ActionBar>
77

e2e/nested-frame-navigation/app/tabs-page/tabs-bottom-page.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
22

33
<ActionBar class="action-bar">
4-
<NavigationButton text="tabBottomBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
4+
<NavigationButton text="tabsBottomBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
55
<Label class="action-bar-title" text="tabs bottom page" horizontalAlignment="center" />
66
</ActionBar>
77

@@ -16,9 +16,9 @@
1616
<GridLayout row="1">
1717
<Tabs tabsPosition="bottom">
1818
<TabStrip>
19-
<TabStripItem title="Players"></TabStripItem>
20-
<TabStripItem title="Dummy"></TabStripItem>
21-
<TabStripItem title="Teams"></TabStripItem>
19+
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
20+
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
21+
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
2222
</TabStrip>
2323

2424
<TabContentItem>

e2e/nested-frame-navigation/app/tabs-page/tabs-top-page.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
22

33
<ActionBar class="action-bar">
4-
<NavigationButton text="tabTopBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
4+
<NavigationButton text="tabsTopBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
55
<Label class="action-bar-title" text="tabs top page" horizontalAlignment="center" />
66
</ActionBar>
77

@@ -16,9 +16,9 @@
1616
<GridLayout row="1">
1717
<Tabs tabsPosition="top">
1818
<TabStrip>
19-
<TabStripItem title="Players"></TabStripItem>
20-
<TabStripItem title="Dummy"></TabStripItem>
21-
<TabStripItem title="Teams"></TabStripItem>
19+
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
20+
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
21+
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
2222
</TabStrip>
2323

2424
<TabContentItem>

e2e/nested-frame-navigation/app/tabs-root/tabs-bottom-root.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Tabs tabsPosition="bottom">
22
<TabStrip>
3-
<TabStripItem title="Players"></TabStripItem>
3+
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
44
<!-- this tab serves as dummy so the actual teams tab is not loaded by default -->
5-
<TabStripItem title="Dummy"></TabStripItem>
6-
<TabStripItem title="Teams"></TabStripItem>
5+
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
6+
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
77
</TabStrip>
88

99
<TabContentItem>
1010
<GridLayout rows="auto, auto, *">
11-
<Label text="tabs root top home" />
11+
<Label text="tabs root bottom home" />
1212
<Button row="1" text="reset app" tap="onReset" />
1313
<GridLayout row="2">
1414
<Frame defaultPage="players/players-items-page" />

e2e/nested-frame-navigation/app/tabs-root/tabs-top-root.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<Tabs tabsPosition="top">
1+
<Tabs tabsPosition="top" automationText="tabNavigation">
22
<TabStrip>
3-
<TabStripItem title="Players"></TabStripItem>
3+
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
44
<!-- this tab serves as dummy so the actual teams tab is not loaded by default -->
5-
<TabStripItem title="Dummy"></TabStripItem>
6-
<TabStripItem title="Teams"></TabStripItem>
5+
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
6+
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
77
</TabStrip>
88

99
<TabContentItem>
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
2+
3+
import { Screen, playersData, teamsData } from "./screen";
4+
import * as shared from "./shared.e2e-spec";
5+
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
6+
7+
const roots = ["BottomNavigation"];
8+
9+
const rootType = "bottom-navigation-root";
10+
describe(rootType, async function () {
11+
let driver: AppiumDriver;
12+
let screen: Screen;
13+
14+
before(async function () {
15+
nsCapabilities.testReporter.context = this;
16+
logWarn(`====== ${rootType} ========`);
17+
driver = await createDriver();
18+
screen = new Screen(driver);
19+
if (dontKeepActivities) {
20+
await driver.setDontKeepActivities(true);
21+
}
22+
23+
driver.defaultWaitTime = 8000;
24+
});
25+
26+
after(async function () {
27+
if (dontKeepActivities) {
28+
await driver.setDontKeepActivities(false);
29+
}
30+
await driver.quit();
31+
console.log("Quit driver!");
32+
});
33+
34+
afterEach(async function () {
35+
if (this.currentTest.state === "failed") {
36+
await driver.logTestArtifacts(this.currentTest.title);
37+
}
38+
});
39+
40+
for (let index = 0; index < roots.length; index++) {
41+
const root = roots[index];
42+
describe(`${rootType}-${root}-scenarios:`, async function () {
43+
44+
before(async function () {
45+
nsCapabilities.testReporter.context = this;
46+
});
47+
48+
for (let index = 0; index < transitions.length; index++) {
49+
const transition = transitions[index];
50+
51+
const playerOne = playersData[`playerOne${transition}`];
52+
const playerTwo = playersData[`playerTwo${transition}`];
53+
const teamOne = teamsData[`teamOne${transition}`];
54+
const teamTwo = teamsData[`teamTwo${transition}`];
55+
56+
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {
57+
58+
before(async function () {
59+
nsCapabilities.testReporter.context = this;
60+
61+
if (transition === "Flip" &&
62+
driver.isAndroid && parseInt(driver.platformVersion) === 19) {
63+
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
64+
console.log("skipping flip transition tests on api level 19");
65+
this.skip();
66+
}
67+
});
68+
69+
it("loaded home page", async function () {
70+
await screen.loadedHome();
71+
});
72+
73+
it(`loaded ${root} root with frames`, async function () {
74+
await screen[`navigateTo${root}RootWithFrames`]();
75+
await screen[`loaded${root}RootWithFrames`]();
76+
});
77+
78+
it("loaded players list", async function () {
79+
await screen.loadedPlayersList();
80+
});
81+
82+
it("loaded player details and go back twice", async function () {
83+
await shared.testPlayerNavigated(playerTwo, screen);
84+
85+
if (appSuspendResume) {
86+
await driver.backgroundApp(suspendTime);
87+
await driver.waitForElement(playerTwo.name); // wait for player
88+
}
89+
90+
await shared.testPlayerNavigatedBack(screen, driver);
91+
92+
if (appSuspendResume) {
93+
await driver.backgroundApp(suspendTime);
94+
await driver.waitForElement(playerOne.name); // wait for players list
95+
}
96+
97+
await shared.testPlayerNavigated(playerTwo, screen);
98+
await shared.testPlayerNavigatedBack(screen, driver);
99+
});
100+
101+
it("toggle teams tab", async function () {
102+
await screen.toggleTeamsTab();
103+
104+
if (appSuspendResume) {
105+
await driver.backgroundApp(suspendTime);
106+
await driver.waitForElement(teamOne.name); // wait for teams list
107+
}
108+
});
109+
110+
it("loaded teams list", async function () {
111+
await screen.loadedTeamsList();
112+
});
113+
114+
it("mix player and team list actions and go back", async function () {
115+
await screen.togglePlayersTab();
116+
117+
if (appSuspendResume) {
118+
await driver.backgroundApp(suspendTime);
119+
await driver.waitForElement(playerOne.name); // wait for players list
120+
}
121+
122+
await screen.loadedPlayersList();
123+
124+
await shared.testPlayerNavigated(playerTwo, screen);
125+
126+
if (driver.isIOS) {
127+
if (appSuspendResume) {
128+
await driver.backgroundApp(suspendTime);
129+
await driver.waitForElement(playerTwo.name); // wait for player
130+
}
131+
}
132+
133+
await screen.toggleTeamsTab();
134+
135+
if (driver.isIOS) {
136+
// TODO: run in background from appium breaks the test. Investigate the issue, once with the app and with appium
137+
if (appSuspendResume) {
138+
await driver.backgroundApp(suspendTime);
139+
await driver.waitForElement(teamOne.name); // wait for teams list
140+
}
141+
}
142+
143+
await screen.loadedTeamsList();
144+
145+
await shared.testTeamNavigated(teamTwo, screen);
146+
147+
if (appSuspendResume) {
148+
await driver.backgroundApp(suspendTime);
149+
await driver.waitForElement(teamTwo.name); // wait for team
150+
}
151+
152+
await screen.togglePlayersTab();
153+
154+
if (appSuspendResume) {
155+
await driver.backgroundApp(suspendTime);
156+
await driver.waitForElement(playerTwo.name); // wait for player
157+
}
158+
159+
await screen.loadedPlayerDetails(playerTwo);
160+
161+
await screen.toggleTeamsTab();
162+
163+
await screen.goBackToTeamsList();
164+
await screen.loadedTeamsList();
165+
166+
await screen.togglePlayersTab();
167+
168+
await screen.goBackToPlayersList();
169+
await screen.loadedPlayersList();
170+
});
171+
172+
it("loaded home page again", async function () {
173+
await screen.resetToHome();
174+
await screen.loadedHome();
175+
});
176+
});
177+
}
178+
});
179+
}
180+
});

0 commit comments

Comments
 (0)
2951
0