mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: navigation b/n single and nested frame pages (#7011)
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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)";
|
||||
@@ -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)";
|
||||
@@ -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";
|
||||
@@ -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";
|
||||
|
||||
@@ -153,6 +157,10 @@ export class Screen {
|
||||
await this.navigateToPage(pageWithFrame);
|
||||
}
|
||||
|
||||
navigateToPageWithFrameNonDefaultTransition = async () => {
|
||||
await this.navigateToPage(pageWithFrameNonDefaultTransition);
|
||||
}
|
||||
|
||||
navigateToPageWithMultiFrame = async () => {
|
||||
await this.navigateToPage(pageWithMultiFrame);
|
||||
}
|
||||
@@ -173,6 +181,10 @@ export class Screen {
|
||||
await this.navigateToPage(tabBottomRootWithFrames);
|
||||
}
|
||||
|
||||
navigateToStillOtherPageSlide = async () => {
|
||||
await this.navigateToPage(navigateToStillOtherPageSlide);
|
||||
};
|
||||
|
||||
navigateToSomePageDefault = async () => {
|
||||
await this.navigateToPage(navigateToSomePageDefault);
|
||||
};
|
||||
@@ -228,6 +240,10 @@ export class Screen {
|
||||
await this.goBack(teamBack);
|
||||
};
|
||||
|
||||
goBackFromStillOtherPage = async () => {
|
||||
await this.goBack(stillOtherPageBack);
|
||||
}
|
||||
|
||||
goBackFromSomePage = async () => {
|
||||
await this.goBack(somePageBack);
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user