Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions e2e/nested-frame-navigation/app/home/home-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ export function onNavigateToTabsTopRoot(args: EventData) {
export function onNavigateToTabsBottomRoot(args: EventData) {
application._resetRootView({ moduleName: "tab-root/tab-bottom-root" });
}

export function onFrameToNestedFrame(args: EventData) {
const button = <Button>args.object;
button.page.frame.navigate({
moduleName: "frame-root/frame-home-page",
animated: true,
transition: {
name: "slide",
duration: 300,
curve: "easeIn"
}
});
}
1 change: 1 addition & 0 deletions e2e/nested-frame-navigation/app/home/home-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Button text="Page w/ tabs (bottom)" tap="onNavigateToTabsBottomPage" />
<Button text="Root tabs (top)" tap="onNavigateToTabsTopRoot" />
<Button text="Root tabs (bottom)" tap="onNavigateToTabsBottomRoot" />
<Button text="Frame to NestedFrame (non-default transition)" tap="onFrameToNestedFrame" />
</StackLayout>
</GridLayout>
</Page>
13 changes: 13 additions & 0 deletions e2e/nested-frame-navigation/app/some-page/some-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ export function onBackButtonTap(args: EventData): void {
const button = <Button>args.object;
button.page.frame.goBack();
}

export function onNavigateSlide(args: EventData) {
const button = <Button>args.object;
button.page.frame.navigate({
moduleName: "still-other-page/still-other-page",
animated: true,
transition: {
name: "slide",
duration: 300,
curve: "easeIn"
}
});
}
4 changes: 3 additions & 1 deletion e2e/nested-frame-navigation/app/some-page/some-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
</ActionBar>

<GridLayout>

<StackLayout>
<Button text="navigate to still other page (slide transition)" tap="onNavigateSlide" />
</StackLayout>
</GridLayout>

</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { EventData } from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";

export function onBackButtonTap(args: EventData): void {
const button = <Button>args.object;
button.page.frame.goBack();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" class="page">

<ActionBar class="action-bar">
<NavigationButton text="stillOtherPageBack" tap="onBackButtonTap" android.systemIcon="ic_menu_back" />
<Label class="action-bar-title" text="still other page" />
</ActionBar>

<GridLayout>

</GridLayout>

</Page>
92 changes: 90 additions & 2 deletions e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";

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

Expand Down Expand Up @@ -297,5 +297,93 @@ describe(rootType, () => {
await screen.loadedHome();
});
});
};
}

describe("frame to nested frame with non-default transition", () => {
const playerOne = playersData["playerOneSlide"];

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

it("loaded frame root with nested frame non-default transition", async () => {
await screen.navigateToPageWithFrameNonDefaultTransition();
await screen.loadedPageWithFrame();
});

it ("go back to home page again", async () => {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerOne.name); // wait for players list
}

await screen.goBackFromFrameHome();
await screen.loadedHome();
});
});

describe("nested frame to frame with non-default transition", () => {
it("loaded home page", async () => {
await screen.loadedHome();
});

it("loaded frame root with nested frame", async () => {
await screen.navigateToPageWithFrame();
await screen.loadedPageWithFrame();
});

it("navigate to some page with slide transition", async () => {
shared.testSomePageNavigatedSlide(screen);

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(somePage); // wait for some page
}
});

it("navigate to still other page and go back twice", async () => {
shared.testStillOtherPageNavigatedSlide(screen);

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(stillOtherPage); // wait for still other page
}

if (driver.isAndroid) {
await driver.navBack(); // some page back navigation
} else {
await screen.goBackFromStillOtherPage();
}

await screen.loadedSomePage();

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(somePage); // wait for some page
}

shared.testStillOtherPageNavigatedSlide(screen);

if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(stillOtherPage); // wait for still other page
}

if (driver.isAndroid) {
await driver.navBack(); // some page back navigation
} else {
await screen.goBackFromStillOtherPage();
}

await screen.loadedSomePage();
});

it("go back to home page again", async () => {
await screen.goBackFromSomePage();

await screen.goBackFromFrameHome();

await screen.loadedHome();
});
});
});
20 changes: 20 additions & 0 deletions e2e/nested-frame-navigation/e2e/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { assert } from "chai";
const layoutWithFrame = "Layout w/ frame";
const layoutWithMultiFrame = "Layout w/ multi frame";
const pageWithFrame = "Page w/ frame";
const pageWithFrameNonDefaultTransition = "Frame to NestedFrame (non-default transition)";
const pageWithMultiFrame = "Page w/ multi frame";
const pageTabTopWithFrames = "Page w/ tabs (top)";
const pageTabBottomWithFrames = "Page w/ tabs (bottom)";
Expand All @@ -17,6 +18,7 @@ const tabTopHome = "tab top page";
const tabBottomHome = "tab bottom page";
const tabRootTopHome = "tab root top home";
const tabRootBottomHome = "tab root bottom home";
const navigateToStillOtherPageSlide = "navigate to still other page (slide transition)";
const navigateToSomePageDefault = "navigate to some page (default transition)";
const navigateToSomePageNone = "navigate to some page (no transition)";
const navigateToSomePageSlide = "navigate to some page (slide transition)";
Expand All @@ -28,6 +30,7 @@ const navigateToOtherPageFlip = "navigate to other page (flip transition)";
const players = "Players";
const teams = "Teams";
const playerBack = "playerBack";
const stillOtherPageBack = "stillOtherPageBack";
const somePageBack = "somePageBack";
const otherPageBack = "otherPageBack";
const teamBack = "teamBack";
Expand All @@ -38,6 +41,7 @@ const resetApp = "reset app";

export const driverDefaultWaitTime = 10000;
export const home = "Home";
export const stillOtherPage = "still other page";
export const somePage = "some page";
export const otherPage = "other page";

Expand Down Expand Up @@ -153,6 +157,10 @@ export class Screen {
await this.navigateToPage(pageWithFrame);
}

navigateToPageWithFrameNonDefaultTransition = async () => {
await this.navigateToPage(pageWithFrameNonDefaultTransition);
}

navigateToPageWithMultiFrame = async () => {
await this.navigateToPage(pageWithMultiFrame);
}
Expand All @@ -173,6 +181,10 @@ export class Screen {
await this.navigateToPage(tabBottomRootWithFrames);
}

navigateToStillOtherPageSlide = async () => {
await this.navigateToPage(navigateToStillOtherPageSlide);
};

navigateToSomePageDefault = async () => {
await this.navigateToPage(navigateToSomePageDefault);
};
Expand Down Expand Up @@ -228,6 +240,10 @@ export class Screen {
await this.goBack(teamBack);
};

goBackFromStillOtherPage = async () => {
await this.goBack(stillOtherPageBack);
}

goBackFromSomePage = async () => {
await this.goBack(somePageBack);
}
Expand Down Expand Up @@ -298,6 +314,10 @@ export class Screen {
loadedTabBottomRootWithFrames = async () => {
await this.loadedPage(tabRootBottomHome);
}

loadedStillOtherPage = async () => {
await this.loadedPage(stillOtherPage);
}

loadedSomePage = async () => {
await this.loadedPage(somePage);
Expand Down
5 changes: 5 additions & 0 deletions e2e/nested-frame-navigation/e2e/shared.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export async function testPlayerNavigatedBack(screen: Screen, driver: AppiumDriv
await screen.loadedPlayersList();
}

export async function testStillOtherPageNavigatedSlide(screen: Screen) {
await screen.navigateToStillOtherPageSlide();
await screen.loadedStillOtherPage();
}

export async function testSomePageNavigatedDefault(screen: Screen) {
await screen.navigateToSomePageDefault();
await screen.loadedSomePage();
Expand Down
9 changes: 6 additions & 3 deletions tns-core-modules/ui/frame/fragment.transitions.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface ExpandedEntry extends BackstackEntry {
transition: Transition;
transitionName: string;
frameId: number
useLollipopTransition: boolean;
}

const sdkVersion = lazy(() => parseInt(device.sdkVersion));
Expand Down Expand Up @@ -100,6 +101,8 @@ export function _setAndroidFragmentTransitions(
useLollipopTransition = false;
}

newEntry.useLollipopTransition = useLollipopTransition;

if (!animated) {
name = "none";
} else if (transition) {
Expand All @@ -116,6 +119,7 @@ export function _setAndroidFragmentTransitions(
_updateTransitions(currentEntry);
if (currentEntry.transitionName !== name ||
currentEntry.transition !== transition ||
!!currentEntry.useLollipopTransition !== useLollipopTransition ||
!useLollipopTransition) {
clearExitAndReenterTransitions(currentEntry, true);
currentFragmentNeedsDifferentAnimation = true;
Expand Down Expand Up @@ -190,11 +194,11 @@ export function _onFragmentCreateAnimator(entry: ExpandedEntry, fragment: androi
let animator: android.animation.Animator;
switch (nextAnim) {
case AnimationType.enterFakeResourceId:
animator = entry.enterAnimator;
animator = entry.enterAnimator || entry.defaultEnterAnimator /* HACK */;
break;

case AnimationType.exitFakeResourceId:
animator = entry.exitAnimator;
animator = entry.exitAnimator || entry.defaultExitAnimator /* HACK */;
break;

case AnimationType.popEnterFakeResourceId:
Expand Down Expand Up @@ -268,7 +272,6 @@ export function _reverseTransitions(previousEntry: ExpandedEntry, currentEntry:
} else {
previousFragment.setEnterTransition(null);
}

}

return transitionUsed;
Expand Down