mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #7593 from NativeScript/myankov/merge-release
chore: merge release to master
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,6 +32,7 @@ package-lock.json
|
||||
# Appium files
|
||||
e2e/**/*.trace/
|
||||
e2e/**/test-results.xml
|
||||
e2e/**/e2e/resources/
|
||||
|
||||
# Webpack configuration files
|
||||
webpack.config.js
|
||||
|
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
@ -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" />
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
@ -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" />
|
||||
|
@ -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>
|
||||
|
@ -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,0 +1,264 @@
|
||||
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
|
||||
|
||||
import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "./screen";
|
||||
import * as shared from "./shared.e2e-spec";
|
||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
||||
|
||||
const roots = ["BottomNavigation"];
|
||||
|
||||
const rootType = "frame-bottom-navigation-root";
|
||||
describe(rootType, async function () {
|
||||
let driver: AppiumDriver;
|
||||
let screen: Screen;
|
||||
|
||||
before(async () => {
|
||||
nsCapabilities.testReporter.context = this;
|
||||
logWarn(`====== ${rootType} ========`);
|
||||
driver = await createDriver();
|
||||
screen = new Screen(driver);
|
||||
if (dontKeepActivities) {
|
||||
await driver.setDontKeepActivities(true);
|
||||
}
|
||||
|
||||
driver.defaultWaitTime = driverDefaultWaitTime;
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
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 () {
|
||||
logWarn(`===== Root: ${root}`);
|
||||
for (let trIndex = 0; trIndex < transitions.length; trIndex++) {
|
||||
const transition = transitions[trIndex];
|
||||
const playerOne: Item = playersData[`playerOne${transition}`];
|
||||
const playerTwo: Item = playersData[`playerTwo${transition}`];
|
||||
const teamOne: Item = teamsData[`teamOne${transition}`];
|
||||
const teamTwo: Item = teamsData[`teamTwo${transition}`];
|
||||
|
||||
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {
|
||||
|
||||
before(async function () {
|
||||
nsCapabilities.testReporter.context = this;
|
||||
logWarn(`========= ${root}-${transition} =========`);
|
||||
|
||||
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 () => {
|
||||
await screen.loadedHome();
|
||||
});
|
||||
|
||||
it(`loaded frame ${root} root with nested frames`, async () => {
|
||||
await screen[`navigateToPage${root}WithFrames`]();
|
||||
await screen[`loadedPage${root}WithFrames`]();
|
||||
});
|
||||
|
||||
it("loaded players list", async () => {
|
||||
await screen.loadedPlayersList();
|
||||
});
|
||||
|
||||
it("loaded player details and go back twice", async () => {
|
||||
await shared.testPlayerNavigated(playerTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(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("navigate parent frame and go back", async () => {
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
await screen.loadedPlayersList();
|
||||
});
|
||||
|
||||
it("loaded player details and navigate parent frame and go back", async () => {
|
||||
await shared.testPlayerNavigated(playerTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerTwo.name); // wait for player
|
||||
}
|
||||
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
await screen.loadedPlayerDetails(playerTwo);
|
||||
|
||||
await screen.goBackToPlayersList();
|
||||
await screen.loadedPlayersList();
|
||||
});
|
||||
|
||||
it("toggle teams tab", async () => {
|
||||
await screen.toggleTeamsTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamOne.name); // wait for team
|
||||
}
|
||||
});
|
||||
|
||||
it("loaded teams list", async () => {
|
||||
await screen.loadedTeamsList();
|
||||
});
|
||||
|
||||
it("mix player and team list actions and go back", async () => {
|
||||
await screen.togglePlayersTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerOne.name); // wait for players list
|
||||
}
|
||||
|
||||
await screen.loadedPlayersList();
|
||||
|
||||
await shared.testPlayerNavigated(playerTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerTwo.name); // wait for player
|
||||
}
|
||||
|
||||
await screen.loadedPlayerDetails(playerTwo);
|
||||
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
if (appSuspendResume) {
|
||||
// This sleeps prevent test to fail
|
||||
await driver.sleep(1000);
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerTwo.name); // wait for player
|
||||
}
|
||||
|
||||
await screen.loadedPlayerDetails(playerTwo);
|
||||
|
||||
await screen.toggleTeamsTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamOne.name); // wait for teams list
|
||||
}
|
||||
|
||||
await screen.loadedTeamsList();
|
||||
|
||||
await shared.testTeamNavigated(teamTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
}
|
||||
|
||||
await screen.loadedTeamDetails(teamTwo);
|
||||
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
if (appSuspendResume) {
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
}
|
||||
|
||||
await screen.loadedTeamDetails(teamTwo);
|
||||
|
||||
await screen.togglePlayersTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(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 () => {
|
||||
await screen[`goBackFrom${root}Page`]();
|
||||
await screen.loadedHome();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -4,8 +4,8 @@ import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item }
|
||||
import * as shared from "./shared.e2e-spec";
|
||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
||||
|
||||
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
|
||||
const roots = ["TabTop", "TabBottom"];
|
||||
// NOTE: TabViewTop is Android only scenario (for iOS we will essentially execute 2x TabViewBottom)
|
||||
const roots = ["TabViewTop", "TabViewBottom"];
|
||||
|
||||
const rootType = "frame-tab-root";
|
||||
describe(rootType, async function () {
|
||||
|
264
e2e/nested-frame-navigation/e2e/frame-tabs-root.e2e-spec.ts
Normal file
264
e2e/nested-frame-navigation/e2e/frame-tabs-root.e2e-spec.ts
Normal file
@ -0,0 +1,264 @@
|
||||
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
|
||||
|
||||
import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "./screen";
|
||||
import * as shared from "./shared.e2e-spec";
|
||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
||||
|
||||
const roots = ["TabsTop", "TabsBottom"];
|
||||
|
||||
const rootType = "frame-tabs-root";
|
||||
describe(rootType, async function () {
|
||||
let driver: AppiumDriver;
|
||||
let screen: Screen;
|
||||
|
||||
before(async () => {
|
||||
nsCapabilities.testReporter.context = this;
|
||||
logWarn(`====== ${rootType} ========`);
|
||||
driver = await createDriver();
|
||||
screen = new Screen(driver);
|
||||
if (dontKeepActivities) {
|
||||
await driver.setDontKeepActivities(true);
|
||||
}
|
||||
|
||||
driver.defaultWaitTime = driverDefaultWaitTime;
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
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 () {
|
||||
logWarn(`===== Root: ${root}`);
|
||||
for (let trIndex = 0; trIndex < transitions.length; trIndex++) {
|
||||
const transition = transitions[trIndex];
|
||||
const playerOne: Item = playersData[`playerOne${transition}`];
|
||||
const playerTwo: Item = playersData[`playerTwo${transition}`];
|
||||
const teamOne: Item = teamsData[`teamOne${transition}`];
|
||||
const teamTwo: Item = teamsData[`teamTwo${transition}`];
|
||||
|
||||
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {
|
||||
|
||||
before(async function () {
|
||||
nsCapabilities.testReporter.context = this;
|
||||
logWarn(`========= ${root}-${transition} =========`);
|
||||
|
||||
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 () => {
|
||||
await screen.loadedHome();
|
||||
});
|
||||
|
||||
it(`loaded frame ${root} root with nested frames`, async () => {
|
||||
await screen[`navigateToPage${root}WithFrames`]();
|
||||
await screen[`loadedPage${root}WithFrames`]();
|
||||
});
|
||||
|
||||
it("loaded players list", async () => {
|
||||
await screen.loadedPlayersList();
|
||||
});
|
||||
|
||||
it("loaded player details and go back twice", async () => {
|
||||
await shared.testPlayerNavigated(playerTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(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("navigate parent frame and go back", async () => {
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
await screen.loadedPlayersList();
|
||||
});
|
||||
|
||||
it("loaded player details and navigate parent frame and go back", async () => {
|
||||
await shared.testPlayerNavigated(playerTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerTwo.name); // wait for player
|
||||
}
|
||||
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
await screen.loadedPlayerDetails(playerTwo);
|
||||
|
||||
await screen.goBackToPlayersList();
|
||||
await screen.loadedPlayersList();
|
||||
});
|
||||
|
||||
it("toggle teams tab", async () => {
|
||||
await screen.toggleTeamsTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamOne.name); // wait for team
|
||||
}
|
||||
});
|
||||
|
||||
it("loaded teams list", async () => {
|
||||
await screen.loadedTeamsList();
|
||||
});
|
||||
|
||||
it("mix player and team list actions and go back", async () => {
|
||||
await screen.togglePlayersTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerOne.name); // wait for players list
|
||||
}
|
||||
|
||||
await screen.loadedPlayersList();
|
||||
|
||||
await shared.testPlayerNavigated(playerTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerTwo.name); // wait for player
|
||||
}
|
||||
|
||||
await screen.loadedPlayerDetails(playerTwo);
|
||||
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
if (appSuspendResume) {
|
||||
// This sleeps prevent test to fail
|
||||
await driver.sleep(1000);
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(playerTwo.name); // wait for player
|
||||
}
|
||||
|
||||
await screen.loadedPlayerDetails(playerTwo);
|
||||
|
||||
await screen.toggleTeamsTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamOne.name); // wait for teams list
|
||||
}
|
||||
|
||||
await screen.loadedTeamsList();
|
||||
|
||||
await shared.testTeamNavigated(teamTwo, screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
}
|
||||
|
||||
await screen.loadedTeamDetails(teamTwo);
|
||||
|
||||
await shared[`testSomePageNavigated${transition}`](screen);
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(somePage); // wait for some page
|
||||
}
|
||||
|
||||
if (driver.isAndroid) {
|
||||
await driver.navBack();
|
||||
} else {
|
||||
await screen.goBackFromSomePage();
|
||||
}
|
||||
|
||||
if (appSuspendResume) {
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(teamTwo.name); // wait for team
|
||||
}
|
||||
|
||||
await screen.loadedTeamDetails(teamTwo);
|
||||
|
||||
await screen.togglePlayersTab();
|
||||
|
||||
if (appSuspendResume) {
|
||||
await driver.backgroundApp(suspendTime);
|
||||
await screen.loadedElement(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 () => {
|
||||
await screen[`goBackFrom${root}Page`]();
|
||||
await screen.loadedHome();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -6,18 +6,30 @@ 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/ tabview (top)";
|
||||
const pageTabBottomWithFrames = "Page w/ tabview (bottom)";
|
||||
const pageTabViewTopWithFrames = "Page w/ tabview (top)";
|
||||
const pageTabViewBottomWithFrames = "Page w/ tabview (bottom)";
|
||||
const tabTopRootWithFrames = "Root tabview (top)";
|
||||
const tabBottomRootWithFrames = "Root tabview (bottom)";
|
||||
const pageTabsTopWithFrames = "Page w/ tabs (top)";
|
||||
const pageTabsBottomWithFrames = "Page w/ tabs (bottom)";
|
||||
const pageBottomNavigationWithFrames = "Page w/ bottom navigation";
|
||||
const tabsTopRootWithFrames = "Root tabs (top)";
|
||||
const tabsBottomRootWithFrames = "Root tabs (bottom)";
|
||||
const bottomNavigationRootWithFrames = "Root bottom navigation";
|
||||
const layoutHome = "layout home page";
|
||||
const layoutHomeSecondary = "layout home secondary page";
|
||||
const frameHome = "frame home page";
|
||||
const frameHomeSecondary = "multi frame home page";
|
||||
const tabViewTopHome = "tabview top page";
|
||||
const tabViewBottomHome = "tabview bottom page";
|
||||
const tabViewRootTopHome = "tabview root top home";
|
||||
const tabViewRootBottomHome = "tabview root bottom home";
|
||||
const tabViewTopRootHome = "tabview root top home";
|
||||
const tabViewBottomRootHome = "tabview root bottom home";
|
||||
const tabsTopHome = "tabs top page";
|
||||
const tabsBottomHome = "tabs bottom page";
|
||||
const tabsTopRootHome = "tabs root top home";
|
||||
const tabsBottomRootHome = "tabs root bottom home";
|
||||
const bottomNavigationHome = "bottom navigation page";
|
||||
const bottomNavigationRootHome = "bottom navigation root 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)";
|
||||
@ -29,14 +41,20 @@ const navigateToOtherPageSlide = "navigate to other page (slide transition)";
|
||||
const navigateToOtherPageFlip = "navigate to other page (flip transition)";
|
||||
const players = "Players";
|
||||
const teams = "Teams";
|
||||
const playersTab = "playersTabNavigation";
|
||||
const teamsTab = "teamsTabNavigation";
|
||||
const dummyTab = "dummyTabNavigation";
|
||||
const playerBack = "playerBack";
|
||||
const stillOtherPageBack = "stillOtherPageBack";
|
||||
const somePageBack = "somePageBack";
|
||||
const otherPageBack = "otherPageBack";
|
||||
const teamBack = "teamBack";
|
||||
const frameHomeBack = "frameHomeBack";
|
||||
const tabTopBack = "tabTopBack";
|
||||
const tabBottomBack = "tabBottomBack";
|
||||
const tabViewTopBack = "tabViewTopBack";
|
||||
const tabViewBottomBack = "tabViewBottomBack";
|
||||
const tabsTopBack = "tabsTopBack";
|
||||
const tabsBottomBack = "tabsBottomBack";
|
||||
const bottomNavigationBack = "bottomNavigationBack";
|
||||
const resetApp = "reset app";
|
||||
|
||||
export const driverDefaultWaitTime = 10000;
|
||||
@ -165,22 +183,46 @@ export class Screen {
|
||||
await this.navigateToPage(pageWithMultiFrame);
|
||||
}
|
||||
|
||||
navigateToPageTabTopWithFrames = async () => {
|
||||
await this.navigateToPage(pageTabTopWithFrames);
|
||||
navigateToPageTabViewTopWithFrames = async () => {
|
||||
await this.navigateToPage(pageTabViewTopWithFrames);
|
||||
}
|
||||
|
||||
navigateToPageTabBottomWithFrames = async () => {
|
||||
await this.navigateToPage(pageTabBottomWithFrames);
|
||||
navigateToPageTabViewBottomWithFrames = async () => {
|
||||
await this.navigateToPage(pageTabViewBottomWithFrames);
|
||||
}
|
||||
|
||||
navigateToTabTopRootWithFrames = async () => {
|
||||
navigateToTabViewTopRootWithFrames = async () => {
|
||||
await this.navigateToPage(tabTopRootWithFrames);
|
||||
}
|
||||
|
||||
navigateToTabBottomRootWithFrames = async () => {
|
||||
navigateToTabViewBottomRootWithFrames = async () => {
|
||||
await this.navigateToPage(tabBottomRootWithFrames);
|
||||
}
|
||||
|
||||
navigateToPageTabsTopWithFrames = async () => {
|
||||
await this.navigateToPage(pageTabsTopWithFrames);
|
||||
}
|
||||
|
||||
navigateToPageTabsBottomWithFrames = async () => {
|
||||
await this.navigateToPage(pageTabsBottomWithFrames);
|
||||
}
|
||||
|
||||
navigateToPageBottomNavigationWithFrames = async () => {
|
||||
await this.navigateToPage(pageBottomNavigationWithFrames);
|
||||
}
|
||||
|
||||
navigateToTabsTopRootWithFrames = async () => {
|
||||
await this.navigateToPage(tabsTopRootWithFrames);
|
||||
}
|
||||
|
||||
navigateToTabsBottomRootWithFrames = async () => {
|
||||
await this.navigateToPage(tabsBottomRootWithFrames);
|
||||
}
|
||||
|
||||
navigateToBottomNavigationRootWithFrames = async () => {
|
||||
await this.navigateToPage(bottomNavigationRootWithFrames);
|
||||
}
|
||||
|
||||
navigateToStillOtherPageSlide = async () => {
|
||||
await this.navigateToPage(navigateToStillOtherPageSlide);
|
||||
}
|
||||
@ -256,22 +298,34 @@ export class Screen {
|
||||
await this.goBack(frameHomeBack);
|
||||
}
|
||||
|
||||
goBackFromTabTopPage = async () => {
|
||||
await this.goBack(tabTopBack);
|
||||
goBackFromTabViewTopPage = async () => {
|
||||
await this.goBack(tabViewTopBack);
|
||||
}
|
||||
|
||||
goBackFromTabBottomPage = async () => {
|
||||
await this.goBack(tabBottomBack);
|
||||
goBackFromTabViewBottomPage = async () => {
|
||||
await this.goBack(tabViewBottomBack);
|
||||
}
|
||||
|
||||
goBackFromTabsTopPage = async () => {
|
||||
await this.goBack(tabsTopBack);
|
||||
}
|
||||
|
||||
goBackFromTabsBottomPage = async () => {
|
||||
await this.goBack(tabsBottomBack);
|
||||
}
|
||||
|
||||
goBackFromBottomNavigationPage = async () => {
|
||||
await this.goBack(bottomNavigationBack);
|
||||
}
|
||||
|
||||
togglePlayersTab = async () => {
|
||||
const lblPlayers = await this._driver.waitForElement(players);
|
||||
const lblPlayers = await this._driver.waitForElement(playersTab);
|
||||
logInfo(`====== Navigate to "${players}"`);
|
||||
await lblPlayers.tap();
|
||||
}
|
||||
|
||||
toggleTeamsTab = async () => {
|
||||
const lblTeams = await this._driver.waitForElement(teams);
|
||||
const lblTeams = await this._driver.waitForElement(teamsTab);
|
||||
logInfo(`====== Navigate to "${teams}"`);
|
||||
await lblTeams.tap();
|
||||
}
|
||||
@ -299,20 +353,44 @@ export class Screen {
|
||||
await this.loadedPage(frameHomeSecondary);
|
||||
}
|
||||
|
||||
loadedPageTabTopWithFrames = async () => {
|
||||
loadedPageTabViewTopWithFrames = async () => {
|
||||
await this.loadedPage(tabViewTopHome);
|
||||
}
|
||||
|
||||
loadedPageTabBottomWithFrames = async () => {
|
||||
loadedPageTabViewBottomWithFrames = async () => {
|
||||
await this.loadedPage(tabViewBottomHome);
|
||||
}
|
||||
|
||||
loadedTabTopRootWithFrames = async () => {
|
||||
await this.loadedPage(tabViewRootTopHome);
|
||||
loadedTabViewTopRootWithFrames = async () => {
|
||||
await this.loadedPage(tabViewTopRootHome);
|
||||
}
|
||||
|
||||
loadedTabBottomRootWithFrames = async () => {
|
||||
await this.loadedPage(tabViewRootBottomHome);
|
||||
loadedTabViewBottomRootWithFrames = async () => {
|
||||
await this.loadedPage(tabViewBottomRootHome);
|
||||
}
|
||||
|
||||
loadedPageTabsTopWithFrames = async () => {
|
||||
await this.loadedPage(tabsTopHome);
|
||||
}
|
||||
|
||||
loadedPageTabsBottomWithFrames = async () => {
|
||||
await this.loadedPage(tabsBottomHome);
|
||||
}
|
||||
|
||||
loadedPageBottomNavigationWithFrames = async () => {
|
||||
await this.loadedPage(bottomNavigationHome);
|
||||
}
|
||||
|
||||
loadedTabsTopRootWithFrames = async () => {
|
||||
await this.loadedPage(tabsTopRootHome);
|
||||
}
|
||||
|
||||
loadedTabsBottomRootWithFrames = async () => {
|
||||
await this.loadedPage(tabsBottomRootHome);
|
||||
}
|
||||
|
||||
loadedBottomNavigationRootWithFrames = async () => {
|
||||
await this.loadedPage(bottomNavigationRootHome);
|
||||
}
|
||||
|
||||
loadedStillOtherPage = async () => {
|
||||
|
@ -4,8 +4,8 @@ import { Screen, playersData, teamsData } from "./screen";
|
||||
import * as shared from "./shared.e2e-spec";
|
||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
||||
|
||||
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
|
||||
const roots = ["TabTop", "TabBottom"];
|
||||
// NOTE: TabViewTop is Android only scenario (for iOS we will essentially execute 2x TabViewBottom)
|
||||
const roots = ["TabViewTop", "TabViewBottom"];
|
||||
|
||||
const rootType = "tab-root";
|
||||
describe(rootType, async function () {
|
||||
|
180
e2e/nested-frame-navigation/e2e/tabs-root.e2e-spec.ts
Normal file
180
e2e/nested-frame-navigation/e2e/tabs-root.e2e-spec.ts
Normal file
@ -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 = ["TabsTop", "TabsBottom"];
|
||||
|
||||
const rootType = "tabs-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();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -27,6 +27,8 @@ export function loadExamples() {
|
||||
examples.set("tabs-position", "tabs/tabs-position-page");
|
||||
examples.set("tabs-binding", "tabs/tabs-binding-page");
|
||||
examples.set("font-icons", "tabs/font-icons-page");
|
||||
examples.set("nested-layout", "tabs/nested-layout-page");
|
||||
examples.set("nested-bottom-navigation", "tabs/nested-bottom-navigation-page");
|
||||
|
||||
return examples;
|
||||
}
|
||||
|
39
e2e/ui-tests-app/app/tabs/nested-bottom-navigation-page.xml
Normal file
39
e2e/ui-tests-app/app/tabs/nested-bottom-navigation-page.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<Page class="page">
|
||||
|
||||
<ActionBar title="Tabs nested in Layout" icon="" class="action-bar">
|
||||
</ActionBar>
|
||||
|
||||
<BottomNavigation>
|
||||
<TabStrip>
|
||||
<TabStripItem title="First"></TabStripItem>
|
||||
<TabStripItem title="Second"></TabStripItem>
|
||||
</TabStrip>
|
||||
|
||||
<TabContentItem>
|
||||
<Tabs>
|
||||
<TabStrip backgroundColor="palevioletred">
|
||||
<TabStripItem title="First"></TabStripItem>
|
||||
<TabStripItem title="Second"></TabStripItem>
|
||||
</TabStrip>
|
||||
|
||||
<TabContentItem>
|
||||
<GridLayout backgroundColor="skyblue">
|
||||
<Label text="First View"/>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
|
||||
<TabContentItem>
|
||||
<GridLayout backgroundColor="gold">
|
||||
<Label text="Second View" />
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
</Tabs>
|
||||
</TabContentItem>
|
||||
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Second View" />
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
</BottomNavigation>
|
||||
</Page>
|
26
e2e/ui-tests-app/app/tabs/nested-layout-page.xml
Normal file
26
e2e/ui-tests-app/app/tabs/nested-layout-page.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<Page class="page">
|
||||
|
||||
<ActionBar title="Tabs nested in Layout" icon="" class="action-bar">
|
||||
</ActionBar>
|
||||
|
||||
<GridLayout>
|
||||
<Tabs>
|
||||
<TabStrip backgroundColor="palevioletred">
|
||||
<TabStripItem title="First"></TabStripItem>
|
||||
<TabStripItem title="Second"></TabStripItem>
|
||||
</TabStrip>
|
||||
|
||||
<TabContentItem>
|
||||
<GridLayout backgroundColor="skyblue">
|
||||
<Label text="First View" />
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
|
||||
<TabContentItem>
|
||||
<GridLayout backgroundColor="gold">
|
||||
<Label text="Second View" />
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
</Tabs>
|
||||
</GridLayout>
|
||||
</Page>
|
@ -3,87 +3,34 @@
|
||||
<ActionBar title="Tabs" icon="" class="action-bar">
|
||||
</ActionBar>
|
||||
|
||||
<!-- w/o TabStrip -->
|
||||
<!-- <BottomNavigation>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="First View"/>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<GridLayout>
|
||||
<Label text="Second View"/>
|
||||
</GridLayout>
|
||||
</TabContentItem>
|
||||
</BottomNavigation> -->
|
||||
|
||||
<!-- w/ TabStrip -->
|
||||
<Tabs id="tabsNav" automationText="tabNavigation" >
|
||||
<TabStrip>
|
||||
<Tabs id="tabsNav" automationText="tabNavigation">
|
||||
<TabStrip backgroundColor="palevioletred">
|
||||
<TabStripItem title="First Tab 11" iconSource="res://icon"></TabStripItem>
|
||||
<TabStripItem>
|
||||
<!-- <Image src="res://icon" /> -->
|
||||
<Label text="News" />
|
||||
</TabStripItem>
|
||||
<!-- <TabStripItem title="Favorites" iconSource="res://icon"></TabStripItem> -->
|
||||
<TabStripItem>
|
||||
<!-- <Image src="res://icon" /> -->
|
||||
<Label text="Places" />
|
||||
</TabStripItem>
|
||||
<!-- <TabStripItem title="Music" iconSource="res://icon"></TabStripItem> -->
|
||||
</TabStrip>
|
||||
|
||||
<TabContentItem>
|
||||
<StackLayout backgroundColor="blue">
|
||||
<StackLayout backgroundColor="skyblue">
|
||||
<Label text="First View"/>
|
||||
<Button tap="goToSecond" text="go to second" />
|
||||
</StackLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<StackLayout backgroundColor="red">
|
||||
<StackLayout backgroundColor="gold">
|
||||
<Label text="Second View"/>
|
||||
<Button tap="goToFirst" text="go to first" />
|
||||
</StackLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<StackLayout backgroundColor="green">
|
||||
<StackLayout backgroundColor="olive">
|
||||
<Label text="First View"/>
|
||||
<Button tap="goToSecond" text="go to second" />
|
||||
</StackLayout>
|
||||
</TabContentItem>
|
||||
<!-- <TabContentItem>
|
||||
<StackLayout>
|
||||
<Label text="Second View"/>
|
||||
<Button tap="goToFirst" text="go to first" />
|
||||
</StackLayout>
|
||||
</TabContentItem>
|
||||
<TabContentItem>
|
||||
<StackLayout>
|
||||
<Label text="First View"/>
|
||||
<Button tap="goToSecond" text="go to second" />
|
||||
</StackLayout>
|
||||
</TabContentItem> -->
|
||||
</Tabs>
|
||||
|
||||
<!-- =============================================================================================== -->
|
||||
|
||||
<!-- Bottom Bar with TabStrip -->
|
||||
<!-- <BottomNavigationBar>
|
||||
<TabStrip>
|
||||
<TabStripItem title="First Tab" iconSource="res://icon"></TabStripItem>
|
||||
<TabStripItem>
|
||||
<Image src="res://icon" />
|
||||
<Label text="Second Tab" />
|
||||
</TabStripItem>
|
||||
</TabStrip>
|
||||
</BottomNavigationBar> -->
|
||||
|
||||
<!-- Bottom Bar w/o TabStrip -->
|
||||
<!-- <BottomNavigationBar>
|
||||
<TabStripItem title="First Tab" iconSource="res://icon"></TabStripItem>
|
||||
<TabStripItem>
|
||||
<Image src="res://icon" />
|
||||
<Label text="Second Tab" />
|
||||
</TabStripItem>
|
||||
</BottomNavigationBar> -->
|
||||
</Page>
|
@ -1 +0,0 @@
|
||||
/Users/tsenov/git/nativescript/e2e/ui-tests-app/../../../functional-tests-images/uitestsapp
|
@ -10,7 +10,7 @@ import { Button } from "tns-core-modules/ui/button";
|
||||
|
||||
var ASYNC = 2;
|
||||
|
||||
function _createBottomNavigation(): Tabs {
|
||||
function _createTabsNavigation(): Tabs {
|
||||
var tabView = new Tabs();
|
||||
tabView.id = "BottomNavigation";
|
||||
|
||||
@ -97,7 +97,7 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
|
||||
let tabView: Tabs;
|
||||
|
||||
const pageFactory = function (): Page {
|
||||
tabView = _createBottomNavigation();
|
||||
tabView = _createTabsNavigation();
|
||||
let items = Array<TabContentItem>();
|
||||
let tabViewitem = new TabContentItem();
|
||||
// tabViewitem.title = "Item1";
|
||||
@ -141,7 +141,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
|
||||
let tabView: Tabs;
|
||||
|
||||
let pageFactory = function (): Page {
|
||||
tabView = _createBottomNavigation();
|
||||
tabView = _createTabsNavigation();
|
||||
let items = Array<TabContentItem>();
|
||||
let tabViewitem = new TabContentItem();
|
||||
// tabViewitem.title = "List";
|
||||
@ -215,7 +215,7 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
|
||||
let loadedEventsCount = [0, 0];
|
||||
let unloadedEventsCount = [0, 0];
|
||||
|
||||
const tabView = _createBottomNavigation();
|
||||
const tabView = _createTabsNavigation();
|
||||
tabView.items = _createContentItems(itemCount);
|
||||
tabView.tabStrip = _createTabStrip(itemCount);
|
||||
|
||||
|
@ -68,13 +68,20 @@ function initializeTapAndDoubleTapGestureListener() {
|
||||
}
|
||||
|
||||
private _handleSingleTap(motionEvent: android.view.MotionEvent): void {
|
||||
this._tapTimeoutId = timer.setTimeout(() => {
|
||||
if (this._target.getGestureObservers(GestureTypes.doubleTap)) {
|
||||
this._tapTimeoutId = timer.setTimeout(() => {
|
||||
if (this._type & GestureTypes.tap) {
|
||||
const args = _getArgs(GestureTypes.tap, this._target, motionEvent);
|
||||
_executeCallback(this._observer, args);
|
||||
}
|
||||
timer.clearTimeout(this._tapTimeoutId);
|
||||
}, TapAndDoubleTapGestureListenerImpl.DoubleTapTimeout);
|
||||
} else {
|
||||
if (this._type & GestureTypes.tap) {
|
||||
const args = _getArgs(GestureTypes.tap, this._target, motionEvent);
|
||||
_executeCallback(this._observer, args);
|
||||
}
|
||||
timer.clearTimeout(this._tapTimeoutId);
|
||||
}, TapAndDoubleTapGestureListenerImpl.DoubleTapTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
private _handleDoubleTap(motionEvent: android.view.MotionEvent): void {
|
||||
|
@ -111,14 +111,23 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
|
||||
public viewDidLayoutSubviews(): void {
|
||||
super.viewDidLayoutSubviews();
|
||||
|
||||
const owner = this._owner.get();
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tabsPosition = owner.tabsPosition;
|
||||
const parent = owner.parent;
|
||||
|
||||
let tabBarTop = this.view.safeAreaInsets.top;
|
||||
let tabBarHeight = this.tabBar.frame.size.height;
|
||||
let scrollViewTop = this.tabBar.frame.size.height;
|
||||
let scrollViewHeight = this.view.bounds.size.height - this.tabBar.frame.size.height + this.view.safeAreaInsets.bottom;
|
||||
let scrollViewHeight = this.view.bounds.size.height - this.tabBar.frame.size.height;
|
||||
|
||||
if (parent) {
|
||||
// TODO: Figure out a better way to handle ViewController nesting/Safe Area nesting
|
||||
tabBarTop = Math.max(this.view.safeAreaInsets.top, owner.parent.nativeView.safeAreaInsets.top);
|
||||
}
|
||||
|
||||
if (tabsPosition === "bottom") {
|
||||
tabBarTop = this.view.frame.size.height - this.tabBar.frame.size.height - this.view.safeAreaInsets.bottom;
|
||||
@ -126,45 +135,7 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
scrollViewHeight = this.view.frame.size.height - this.view.safeAreaInsets.bottom;
|
||||
}
|
||||
|
||||
this.tabBar.frame = CGRectMake(this.view.safeAreaInsets.left, tabBarTop, this.tabBar.frame.size.width, tabBarHeight); //this.view.safeAreaLayoutGuide.layoutFrame;
|
||||
// this.additionalSafeAreaInsets = new UIEdgeInsets({ top: this.tabBar.frame.size.height, left: 0, bottom: 0, right: 0 });
|
||||
// const tabBar = MDCTabBar.alloc().initWithFrame(this.view.safeAreaLayoutGuide.layoutFrame);
|
||||
|
||||
// tabBar.items = <NSArray<UITabBarItem>>NSArray.alloc().initWithArray([
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// ]);
|
||||
|
||||
// tabBar.itemAppearance = MDCTabBarItemAppearance.Titles;
|
||||
// tabBar.tintColor = UIColor.greenColor;
|
||||
// tabBar.barTintColor = UIColor.yellowColor;
|
||||
// tabBar.setTitleColorForState(UIColor.blackColor, MDCTabBarItemState.Normal);
|
||||
// tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
|
||||
// tabBar.sizeToFit();
|
||||
// this.view.addSubview(tabBar);
|
||||
|
||||
// this.view.bringSubviewToFront(tabBar);
|
||||
|
||||
// const tabBar = MDCTabBar.alloc().initWithFrame(this.view.bounds);
|
||||
// tabBar.items = <NSArray<UITabBarItem>>NSArray.alloc().initWithArray([
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0),
|
||||
// UITabBarItem.alloc().initWithTitleImageTag("Test", null, 0)
|
||||
// ]);
|
||||
|
||||
// tabBar.itemAppearance = MDCTabBarItemAppearance.Titles;
|
||||
// tabBar.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
|
||||
// tabBar.sizeToFit();
|
||||
// this.view.addSubview(tabBar);
|
||||
this.tabBar.frame = CGRectMake(this.view.safeAreaInsets.left, tabBarTop, this.tabBar.frame.size.width, tabBarHeight);
|
||||
|
||||
const subViews: NSArray<UIView> = this.view.subviews;
|
||||
let scrollView: UIScrollView = null;
|
||||
@ -192,47 +163,6 @@ class UIPageViewControllerImpl extends UIPageViewController {
|
||||
|
||||
scrollView.frame = CGRectMake(this.view.safeAreaInsets.left, scrollViewTop, this.view.bounds.size.width, scrollViewHeight); //this.view.bounds;
|
||||
}
|
||||
|
||||
// if (mdcBar) {
|
||||
// mdcBar.frame = this.view.bounds;
|
||||
// }
|
||||
|
||||
// const owner = this.owner.get();
|
||||
// if (owner) {
|
||||
// if (majorVersion >= 11) {
|
||||
// // Handle nested UILayoutViewController safe area application.
|
||||
// // Currently, UILayoutViewController can be nested only in a TabView.
|
||||
// // The TabView itself is handled by the OS, so we check the TabView's parent (usually a Page, but can be a Layout).
|
||||
// const tabViewItem = owner.parent;
|
||||
// const tabView = tabViewItem && tabViewItem.parent;
|
||||
// let parent = tabView && tabView.parent;
|
||||
|
||||
// // Handle Angular scenario where TabView is in a ProxyViewContainer
|
||||
// // It is possible to wrap components in ProxyViewContainers indefinitely
|
||||
// // Not using instanceof ProxyViewContainer to avoid circular dependency
|
||||
// // TODO: Try moving UILayoutViewController out of view module
|
||||
// while (parent && !parent.nativeViewProtected) {
|
||||
// parent = parent.parent;
|
||||
// }
|
||||
|
||||
// if (parent) {
|
||||
// const parentPageInsetsTop = parent.nativeViewProtected.safeAreaInsets.top;
|
||||
// const currentInsetsTop = this.view.safeAreaInsets.top;
|
||||
// const additionalInsetsTop = Math.max(parentPageInsetsTop - currentInsetsTop, 0);
|
||||
|
||||
// const parentPageInsetsBottom = parent.nativeViewProtected.safeAreaInsets.bottom;
|
||||
// const currentInsetsBottom = this.view.safeAreaInsets.bottom;
|
||||
// const additionalInsetsBottom = Math.max(parentPageInsetsBottom - currentInsetsBottom, 0);
|
||||
|
||||
// if (additionalInsetsTop > 0 || additionalInsetsBottom > 0) {
|
||||
// const additionalInsets = new UIEdgeInsets({ top: additionalInsetsTop, left: 0, bottom: additionalInsetsBottom, right: 0 });
|
||||
// this.additionalSafeAreaInsets = additionalInsets;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// layoutView(this, owner);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,7 +199,8 @@ class UIPageViewControllerDataSourceImpl extends NSObject implements UIPageViewC
|
||||
// prevViewController = owner.getViewController(prevItem);
|
||||
// }
|
||||
|
||||
(<TabContentItem>prevItem).canBeLoaded = true;
|
||||
owner._setCanBeLoaded(selectedIndex);
|
||||
owner._loadUnloadTabItems(selectedIndex);
|
||||
|
||||
return prevViewController;
|
||||
}
|
||||
@ -295,7 +226,8 @@ class UIPageViewControllerDataSourceImpl extends NSObject implements UIPageViewC
|
||||
// nextViewController = owner.getViewController(nextItem);
|
||||
// }
|
||||
|
||||
(<TabContentItem>nextItem).canBeLoaded = true;
|
||||
owner._setCanBeLoaded(selectedIndex);
|
||||
owner._loadUnloadTabItems(selectedIndex);
|
||||
// nextItem.loadView(nextItem.view);
|
||||
|
||||
return nextViewController;
|
||||
@ -590,6 +522,11 @@ export class Tabs extends TabsBase {
|
||||
|
||||
this._ios.dataSource = this._dataSource;
|
||||
this._ios.delegate = this._delegate;
|
||||
|
||||
if (!this.tabBarItems) {
|
||||
const tabStripItems = this.tabStrip ? this.tabStrip.items : null;
|
||||
this.setTabStripItems(tabStripItems);
|
||||
}
|
||||
}
|
||||
|
||||
public onUnloaded() {
|
||||
@ -670,7 +607,6 @@ export class Tabs extends TabsBase {
|
||||
toLoad.forEach(index => {
|
||||
const item = items[index];
|
||||
if (this.isLoaded && items[index]) {
|
||||
(<any>item).canBeLoaded = true;
|
||||
item.loadView(item.view);
|
||||
}
|
||||
});
|
||||
@ -770,6 +706,18 @@ export class Tabs extends TabsBase {
|
||||
return newController;
|
||||
}
|
||||
|
||||
public _setCanBeLoaded(index: number) {
|
||||
const items = this.items;
|
||||
const lastIndex = items.length - 1;
|
||||
const offsideItems = this.offscreenTabLimit;
|
||||
|
||||
iterateIndexRange(index, offsideItems, lastIndex, (i) => {
|
||||
if (items[i]) {
|
||||
(<TabContentItem>items[i]).canBeLoaded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private setViewControllers(items: TabContentItem[]) {
|
||||
const length = items ? items.length : 0;
|
||||
if (length === 0) {
|
||||
@ -836,6 +784,10 @@ export class Tabs extends TabsBase {
|
||||
}
|
||||
|
||||
public setTabStripItems(items: Array<TabStripItem>) {
|
||||
if (!this.tabStrip || !items) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tabBarItems = [];
|
||||
|
||||
items.forEach((item: TabStripItem, i) => {
|
||||
@ -1024,7 +976,6 @@ export class Tabs extends TabsBase {
|
||||
// if (traceEnabled()) {
|
||||
// traceWrite("TabView._onSelectedIndexPropertyChangedSetNativeValue(" + value + ")", traceCategories.Debug);
|
||||
// }
|
||||
const that = this;
|
||||
|
||||
if (value > -1) {
|
||||
const item = this.items[value];
|
||||
@ -1047,7 +998,9 @@ export class Tabs extends TabsBase {
|
||||
this._currentNativeSelectedIndex = value;
|
||||
this.viewController.setViewControllersDirectionAnimatedCompletion(controllers, navigationDirection, true, (finished: boolean) => {
|
||||
if (finished) {
|
||||
that._canSelectItem = true;
|
||||
this._canSelectItem = true;
|
||||
this._setCanBeLoaded(value);
|
||||
this._loadUnloadTabItems(value);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user