Skip to content

Commit

Permalink
fix(tabs-ios): unable to return to tab after tab with nested frame vi…
Browse files Browse the repository at this point in the history
…sited (#7574)
  • Loading branch information
ADjenkov authored and SvetoslavTsenov committed Jul 25, 2019
1 parent 4511c76 commit 490cab0
Show file tree
Hide file tree
Showing 18 changed files with 1,043 additions and 65 deletions.
2 changes: 0 additions & 2 deletions e2e/nested-frame-navigation/app/app.ts
@@ -1,5 +1,3 @@
import * as application from "tns-core-modules/application";

application.run({ moduleName: "app-root" });
// application.run({ moduleName: "tab-root" });
// application.run({ moduleName: "layout-root" });
@@ -1,7 +1,7 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">

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

Expand All @@ -16,9 +16,9 @@
<GridLayout row="1">
<BottomNavigation>
<TabStrip>
<TabStripItem title="Players"></TabStripItem>
<TabStripItem title="Dummy"></TabStripItem>
<TabStripItem title="Teams"></TabStripItem>
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
</TabStrip>

<TabContentItem>
Expand Down
@@ -1,14 +1,14 @@
<BottomNavigation>
<TabStrip>
<TabStripItem title="Players"></TabStripItem>
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
<!-- this tab serves as dummy so the actual teams tab is not loaded by default -->
<TabStripItem title="Dummy"></TabStripItem>
<TabStripItem title="Teams"></TabStripItem>
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
</TabStrip>

<TabContentItem>
<GridLayout rows="auto, auto, *">
<Label text="tabs root top home" />
<Label text="bottom navigation root home" />
<Button row="1" text="reset app" tap="onReset" />
<GridLayout row="2">
<Frame defaultPage="players/players-items-page" />
Expand Down
@@ -1,7 +1,7 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">

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

Expand Down
2 changes: 1 addition & 1 deletion e2e/nested-frame-navigation/app/tab-page/tab-top-page.xml
@@ -1,7 +1,7 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">

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

Expand Down
@@ -1,7 +1,7 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">

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

Expand All @@ -16,9 +16,9 @@
<GridLayout row="1">
<Tabs tabsPosition="bottom">
<TabStrip>
<TabStripItem title="Players"></TabStripItem>
<TabStripItem title="Dummy"></TabStripItem>
<TabStripItem title="Teams"></TabStripItem>
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
</TabStrip>

<TabContentItem>
Expand Down
8 changes: 4 additions & 4 deletions e2e/nested-frame-navigation/app/tabs-page/tabs-top-page.xml
@@ -1,7 +1,7 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">

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

Expand All @@ -16,9 +16,9 @@
<GridLayout row="1">
<Tabs tabsPosition="top">
<TabStrip>
<TabStripItem title="Players"></TabStripItem>
<TabStripItem title="Dummy"></TabStripItem>
<TabStripItem title="Teams"></TabStripItem>
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
</TabStrip>

<TabContentItem>
Expand Down
@@ -1,14 +1,14 @@
<Tabs tabsPosition="bottom">
<TabStrip>
<TabStripItem title="Players"></TabStripItem>
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
<!-- this tab serves as dummy so the actual teams tab is not loaded by default -->
<TabStripItem title="Dummy"></TabStripItem>
<TabStripItem title="Teams"></TabStripItem>
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
</TabStrip>

<TabContentItem>
<GridLayout rows="auto, auto, *">
<Label text="tabs root top home" />
<Label text="tabs root bottom home" />
<Button row="1" text="reset app" tap="onReset" />
<GridLayout row="2">
<Frame defaultPage="players/players-items-page" />
Expand Down
8 changes: 4 additions & 4 deletions e2e/nested-frame-navigation/app/tabs-root/tabs-top-root.xml
@@ -1,9 +1,9 @@
<Tabs tabsPosition="top">
<Tabs tabsPosition="top" automationText="tabNavigation">
<TabStrip>
<TabStripItem title="Players"></TabStripItem>
<TabStripItem title="Players" automationText="playersTabNavigation"></TabStripItem>
<!-- this tab serves as dummy so the actual teams tab is not loaded by default -->
<TabStripItem title="Dummy"></TabStripItem>
<TabStripItem title="Teams"></TabStripItem>
<TabStripItem title="Dummy" automationText="dummyTabNavigation"></TabStripItem>
<TabStripItem title="Teams" automationText="teamsTabNavigation"></TabStripItem>
</TabStrip>

<TabContentItem>
Expand Down
180 changes: 180 additions & 0 deletions e2e/nested-frame-navigation/e2e/bottom-navigation-root.e2e-spec.ts
@@ -0,0 +1,180 @@
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";

import { Screen, playersData, teamsData } from "./screen";
import * as shared from "./shared.e2e-spec";
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";

const roots = ["BottomNavigation"];

const rootType = "bottom-navigation-root";
describe(rootType, async function () {
let driver: AppiumDriver;
let screen: Screen;

before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`====== ${rootType} ========`);
driver = await createDriver();
screen = new Screen(driver);
if (dontKeepActivities) {
await driver.setDontKeepActivities(true);
}

driver.defaultWaitTime = 8000;
});

after(async function () {
if (dontKeepActivities) {
await driver.setDontKeepActivities(false);
}
await driver.quit();
console.log("Quit driver!");
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
}
});

for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${rootType}-${root}-scenarios:`, async function () {

before(async function () {
nsCapabilities.testReporter.context = this;
});

for (let index = 0; index < transitions.length; index++) {
const transition = transitions[index];

const playerOne = playersData[`playerOne${transition}`];
const playerTwo = playersData[`playerTwo${transition}`];
const teamOne = teamsData[`teamOne${transition}`];
const teamTwo = teamsData[`teamTwo${transition}`];

describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {

before(async function () {
nsCapabilities.testReporter.context = this;

if (transition === "Flip" &&
driver.isAndroid && parseInt(driver.platformVersion) === 19) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
console.log("skipping flip transition tests on api level 19");
this.skip();
}
});

it("loaded home page", async function () {
await screen.loadedHome();
});

it(`loaded ${root} root with frames`, async function () {
await screen[`navigateTo${root}RootWithFrames`]();
await screen[`loaded${root}RootWithFrames`]();
});

it("loaded players list", async function () {
await screen.loadedPlayersList();
});

it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerTwo.name); // wait for player
}

await shared.testPlayerNavigatedBack(screen, driver);

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerOne.name); // wait for players list
}

await shared.testPlayerNavigated(playerTwo, screen);
await shared.testPlayerNavigatedBack(screen, driver);
});

it("toggle teams tab", async function () {
await screen.toggleTeamsTab();

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(teamOne.name); // wait for teams list
}
});

it("loaded teams list", async function () {
await screen.loadedTeamsList();
});

it("mix player and team list actions and go back", async function () {
await screen.togglePlayersTab();

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerOne.name); // wait for players list
}

await screen.loadedPlayersList();

await shared.testPlayerNavigated(playerTwo, screen);

if (driver.isIOS) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerTwo.name); // wait for player
}
}

await screen.toggleTeamsTab();

if (driver.isIOS) {
// TODO: run in background from appium breaks the test. Investigate the issue, once with the app and with appium
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(teamOne.name); // wait for teams list
}
}

await screen.loadedTeamsList();

await shared.testTeamNavigated(teamTwo, screen);

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(teamTwo.name); // wait for team
}

await screen.togglePlayersTab();

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerTwo.name); // wait for player
}

await screen.loadedPlayerDetails(playerTwo);

await screen.toggleTeamsTab();

await screen.goBackToTeamsList();
await screen.loadedTeamsList();

await screen.togglePlayersTab();

await screen.goBackToPlayersList();
await screen.loadedPlayersList();
});

it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});
});
}
});
}
});

0 comments on commit 490cab0

Please sign in to comment.