diff --git a/e2e/nested-frame-navigation/.vscode/launch.json b/e2e/nested-frame-navigation/.vscode/launch.json index bbd504901..71d650f2e 100644 --- a/e2e/nested-frame-navigation/.vscode/launch.json +++ b/e2e/nested-frame-navigation/.vscode/launch.json @@ -22,7 +22,7 @@ "4723", "-a", "--grep", - "layout-root" + "layout-root-with-multi-frames" ], "internalConsoleOptions": "openOnSessionStart" }, diff --git a/e2e/nested-frame-navigation/app/package.json b/e2e/nested-frame-navigation/app/package.json index 0d6fdb754..f94c1cdba 100644 --- a/e2e/nested-frame-navigation/app/package.json +++ b/e2e/nested-frame-navigation/app/package.json @@ -1,8 +1,9 @@ { "android": { - "v8Flags": "--expose_gc" + "v8Flags": "--expose_gc", + "markingMode": "none" }, "main": "app.js", "name": "tns-template-hello-world-ts", "version": "3.4.0" -} \ No newline at end of file +} diff --git a/e2e/nested-frame-navigation/e2e/bottom-navigation-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/bottom-navigation-root.e2e-spec.ts deleted file mode 100644 index 0e732be16..000000000 --- a/e2e/nested-frame-navigation/e2e/bottom-navigation-root.e2e-spec.ts +++ /dev/null @@ -1,181 +0,0 @@ -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"; -import { TabNavigationScreen } from "./tab-navigation-screen"; - -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 TabNavigationScreen(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(); - }); - }); - } - }); - } -}); diff --git a/e2e/nested-frame-navigation/e2e/config.ts b/e2e/nested-frame-navigation/e2e/config.ts index 9f2147508..87200f16a 100644 --- a/e2e/nested-frame-navigation/e2e/config.ts +++ b/e2e/nested-frame-navigation/e2e/config.ts @@ -1,4 +1,4 @@ export const suspendTime = 1; export const appSuspendResume = true; -export const dontKeepActivities = true; -export const transitions = ["Default", "None", "Slide", "Flip"]; +export const dontKeepActivities = process.env["DONT_KEEP_ACTIVITIES"] === "true" ? true : false; +export const allTransitions = ["Default", "None", "Slide", "Flip"]; diff --git a/e2e/nested-frame-navigation/e2e/frame-bottom-navigation-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-bottom-navigation-root.e2e-spec.ts deleted file mode 100644 index 526fcc917..000000000 --- a/e2e/nested-frame-navigation/e2e/frame-bottom-navigation-root.e2e-spec.ts +++ /dev/null @@ -1,265 +0,0 @@ -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"; -import { TabNavigationScreen } from "./tab-navigation-screen"; - -const roots = ["BottomNavigation"]; - -const rootType = "frame-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 TabNavigationScreen(driver); - if (dontKeepActivities) { - await driver.setDontKeepActivities(true); - } - - driver.defaultWaitTime = driverDefaultWaitTime; - }); - - 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 () { - 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 function () { - await screen.loadedHome(); - }); - - it(`loaded frame ${root} root with nested frames`, async function () { - await screen[`navigateToPage${root}WithFrames`](); - await screen[`loadedPage${root}WithFrames`](); - }); - - 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 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 function () { - 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 function () { - 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 function () { - await screen.toggleTeamsTab(); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(teamOne.name); // wait for team - } - }); - - 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 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 function () { - await screen[`goBackFrom${root}Page`](); - await screen.loadedHome(); - }); - }); - } - }); - } -}); \ No newline at end of file diff --git a/e2e/nested-frame-navigation/e2e/frame-root/bottom-navigation.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-root/bottom-navigation.e2e-spec.ts new file mode 100644 index 000000000..9d8c3ec0b --- /dev/null +++ b/e2e/nested-frame-navigation/e2e/frame-root/bottom-navigation.e2e-spec.ts @@ -0,0 +1,259 @@ +import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium"; + +import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; + +describe("frame-root-with-bottom-navigation", async function () { + let driver: AppiumDriver; + let screen: Screen; + let transitions = [...allTransitions]; + + before(async function () { + nsCapabilities.testReporter.context = this; + logWarn(`====== frame-root-with-bottom-navigation ========`); + driver = await createDriver(); + await driver.restartApp(); + screen = new TabNavigationScreen(driver); + await driver.setDontKeepActivities(dontKeepActivities); + driver.defaultWaitTime = driverDefaultWaitTime; + + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); + } + }); + + 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); + } + }); + + describe(`frame-root-with-bottom-navigation scenarios:`, async function () { + 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(`frame-root-with-bottom-navigation-transition-${transition}-scenario:`, async function () { + + before(async function () { + nsCapabilities.testReporter.context = this; + logWarn(`=========${trIndex++}. BottomNavigation-${transition} =========`); + }); + + it("loaded home page", async function () { + await screen.loadedHome(); + }); + + it(`loaded frame root with bottom-navigation`, async function () { + await screen[`navigateToPageBottomNavigationWithFrames`](); + await screen[`loadedPageBottomNavigationWithFrames`](); + }); + + 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 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 function () { + 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 function () { + await shared.testPlayerNavigated(playerTwo, screen); + + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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 function () { + await screen.toggleTeamsTab(); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(teamOne.name); // wait for team + } + }); + + 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 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 (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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 function () { + await screen[`goBackFromBottomNavigationPage`](); + await screen.loadedHome(); + }); + }); + } + }); +}); \ No newline at end of file diff --git a/e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-root/multi-frames.e2e-spec.ts similarity index 50% rename from e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/frame-root/multi-frames.e2e-spec.ts index 0936ffa07..59ac2d2d0 100644 --- a/e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/frame-root/multi-frames.e2e-spec.ts @@ -1,24 +1,29 @@ + import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium"; -import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item, stillOtherPage } from "./screen"; -import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config"; -import * as shared from "./shared.e2e-spec"; -import { TabNavigationScreen } from "./tab-navigation-screen"; +import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item, stillOtherPage } from "../screens/screen"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import * as shared from "../screens/shared"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; -const rootType = "frame-root"; -describe(rootType, async function () { +describe("frame-root-with-multi-frames", async function () { let driver: AppiumDriver; let screen: Screen; + let transitions = [...allTransitions]; before(async function () { nsCapabilities.testReporter.context = this; driver = await createDriver(); + await driver.restartApp(); screen = new TabNavigationScreen(driver); - if (dontKeepActivities) { - await driver.setDontKeepActivities(true); - } - + await driver.setDontKeepActivities(dontKeepActivities); driver.defaultWaitTime = driverDefaultWaitTime; + + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); + } }); after(async function () { @@ -43,105 +48,16 @@ describe(rootType, async function () { const teamOne: Item = teamsData[`teamOne${transition}`]; const teamTwo: Item = teamsData[`teamTwo${transition}`]; - describe(`${rootType}-transition-${transition}-scenarios:`, async function () { + describe(`frame-root-with-multi-frames-transition-${transition}-scenario:`, async function () { before(async function () { nsCapabilities.testReporter.context = this; - logWarn(`==== Transition ${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(); - } + logWarn(`====${index}. Transition ${transition}`); }); it("loaded home page", async function () { await screen.loadedHome(); }); - it("loaded frame root with nested frame", async function () { - await screen.navigateToPageWithFrame(); - await screen.loadedPageWithFrame(); - }); - - 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 screen.loadedElement(playerTwo.name); - } - - await shared.testPlayerNavigatedBack(screen, driver); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerOne.name); - } - - await shared.testPlayerNavigated(playerTwo, screen); - await shared.testPlayerNavigatedBack(screen, driver); - }); - - it("navigate parent frame and go back", async function () { - await shared[`testSomePageNavigated${transition}`](screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedSomePage(); // wait for some page - } - - if (driver.isAndroid) { - await driver.navBack(); // some page back navigation - } else { - await screen.goBackFromSomePage(); - } - - await screen.loadedPlayersList(); - }); - - it("loaded player details and navigate parent frame and go back", async function () { - await shared.testPlayerNavigated(playerTwo, screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerTwo.name); - } - - await shared[`testSomePageNavigated${transition}`](screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedSomePage(); // wait for some page - } - - if (driver.isAndroid) { - await driver.navBack(); // some page back navigation - } else { - await screen.goBackFromSomePage(); - } - - await screen.loadedPlayerDetails(playerTwo); - - await screen.goBackToPlayersList(); - await screen.loadedPlayersList(); - }); - - it("loaded home page again", async function () { - await screen.goBackFromFrameHome(); - await screen.loadedHome(); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedHome(); - } - }); - it("loaded frame root with multi nested frames", async function () { await screen.navigateToPageWithMultiFrame(); await screen.loadedPageWithMultiFrame(); @@ -301,101 +217,4 @@ describe(rootType, async function () { }); }); } - - describe("frame to nested frame with non-default transition", async function () { - const playerOne = playersData["playerOneSlide"]; - - before(async function () { - nsCapabilities.testReporter.context = this; - }); - - it("loaded home page", async function () { - await screen.loadedHome(); - }); - - it("loaded frame root with nested frame non-default transition", async function () { - await screen.navigateToPageWithFrameNonDefaultTransition(); - await screen.loadedPageWithFrame(); - }); - - it("go back to home page again", async function () { - 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", async function () { - - before(async function () { - nsCapabilities.testReporter.context = this; - }); - - it("loaded home page", async function () { - await screen.loadedHome(); - }); - - it("loaded frame root with nested frame", async function () { - await screen.navigateToPageWithFrame(); - await screen.loadedPageWithFrame(); - }); - - it("navigate to some page with slide transition", async function () { - 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 function () { - 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 function () { - await screen.goBackFromSomePage(); - - await screen.goBackFromFrameHome(); - - await screen.loadedHome(); - }); - }); }); diff --git a/e2e/nested-frame-navigation/e2e/frame-root/single-frame.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-root/single-frame.e2e-spec.ts new file mode 100644 index 000000000..802b06d32 --- /dev/null +++ b/e2e/nested-frame-navigation/e2e/frame-root/single-frame.e2e-spec.ts @@ -0,0 +1,232 @@ +import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium"; + +import { Screen, playersData, somePage, driverDefaultWaitTime, Item, stillOtherPage } from "../screens/screen"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import * as shared from "../screens/shared"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; + +describe("frame-root-with-single-frame", async function () { + let driver: AppiumDriver; + let screen: Screen; + let transitions = [...allTransitions]; + + before(async function () { + nsCapabilities.testReporter.context = this; + driver = await createDriver(); + await driver.restartApp(); + screen = new TabNavigationScreen(driver); + await driver.setDontKeepActivities(dontKeepActivities); + driver.defaultWaitTime = driverDefaultWaitTime; + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); + } + }); + + 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 < transitions.length; index++) { + const transition = transitions[index]; + + const playerOne: Item = playersData[`playerOne${transition}`]; + const playerTwo: Item = playersData[`playerTwo${transition}`]; + + describe(`frame-root-with-single-frame-transition-${transition}-scenario:`, async function () { + before(async function () { + nsCapabilities.testReporter.context = this; + logWarn(`==== ${index}. Transition ${transition}`); + }); + + it("loaded home page", async function () { + await screen.loadedHome(); + }); + + it("loaded frame root with nested frame", async function () { + await screen.navigateToPageWithFrame(); + await screen.loadedPageWithFrame(); + }); + + 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 screen.loadedElement(playerTwo.name); + } + + await shared.testPlayerNavigatedBack(screen, driver); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(playerOne.name); + } + + await shared.testPlayerNavigated(playerTwo, screen); + await shared.testPlayerNavigatedBack(screen, driver); + }); + + it("navigate parent frame and go back", async function () { + await shared[`testSomePageNavigated${transition}`](screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedSomePage(); // wait for some page + } + + if (driver.isAndroid) { + await driver.navBack(); // some page back navigation + } else { + await screen.goBackFromSomePage(); + } + + await screen.loadedPlayersList(); + }); + + it("loaded player details and navigate parent frame and go back", async function () { + await shared.testPlayerNavigated(playerTwo, screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(playerTwo.name); + } + + await shared[`testSomePageNavigated${transition}`](screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedSomePage(); // wait for some page + } + + if (driver.isAndroid) { + await driver.navBack(); // some page back navigation + } else { + await screen.goBackFromSomePage(); + } + + await screen.loadedPlayerDetails(playerTwo); + + await screen.goBackToPlayersList(); + await screen.loadedPlayersList(); + }); + + it("loaded home page again", async function () { + await screen.goBackFromFrameHome(); + await screen.loadedHome(); + }); + }); + } + + describe("frame to nested frame with non-default transition", async function () { + const playerOne = playersData["playerOneSlide"]; + + before(async function () { + nsCapabilities.testReporter.context = this; + }); + + it("loaded home page", async function () { + await screen.loadedHome(); + }); + + it("loaded frame root with nested frame non-default transition", async function () { + await screen.navigateToPageWithFrameNonDefaultTransition(); + await screen.loadedPageWithFrame(); + }); + + it("go back to home page again", async function () { + 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", async function () { + + before(async function () { + nsCapabilities.testReporter.context = this; + }); + + it("loaded home page", async function () { + await screen.loadedHome(); + }); + + it("loaded frame root with nested frame", async function () { + await screen.navigateToPageWithFrame(); + await screen.loadedPageWithFrame(); + }); + + it("navigate to some page with slide transition", async function () { + 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 function () { + 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 function () { + await screen.goBackFromSomePage(); + + await screen.goBackFromFrameHome(); + + await screen.loadedHome(); + }); + }); +}); diff --git a/e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-root/tab-view.e2e-spec.ts similarity index 78% rename from e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/frame-root/tab-view.e2e-spec.ts index ff15b7eea..22cd6f7d2 100644 --- a/e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/frame-root/tab-view.e2e-spec.ts @@ -1,27 +1,37 @@ 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"; -import { TabViewNavigationScreen } from "./tabview-navigation-screen"; +import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabViewNavigationScreen } from "../screens/tabview-navigation-screen"; // 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 () { +describe("frame-root-with-tab-view", async function () { let driver: AppiumDriver; let screen: Screen; + let transitions = [...allTransitions]; before(async function () { nsCapabilities.testReporter.context = this; - logWarn(`====== ${rootType} ========`); + logWarn(`====== frame-root-with-tab-view ========`); driver = await createDriver(); await driver.restartApp(); screen = new TabViewNavigationScreen(driver); if (dontKeepActivities) { await driver.setDontKeepActivities(true); } + if (driver.isIOS) { + logWarn("NOTE: TabViewTop is Android only scenario (for iOS we will not execute it)"); + roots.shift(); + } + + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); + } driver.defaultWaitTime = driverDefaultWaitTime; }); @@ -43,7 +53,7 @@ describe(rootType, async function () { for (let index = 0; index < roots.length; index++) { const root = roots[index]; - describe(`${rootType}-${root} scenarios:`, async function () { + describe(`frame-root-with-tab-view-${root} scenarios:`, async function () { logWarn(`===== Root: ${root}`); for (let trIndex = 0; trIndex < transitions.length; trIndex++) { const transition = transitions[trIndex]; @@ -52,18 +62,11 @@ describe(rootType, async function () { const teamOne: Item = teamsData[`teamOne${transition}`]; const teamTwo: Item = teamsData[`teamTwo${transition}`]; - describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () { + describe(`frame-root-with-tab-view-${root}-transition-${transition}-scenario:`, 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 function () { @@ -82,11 +85,12 @@ describe(rootType, async function () { it("loaded player details and go back twice", async function () { await shared.testPlayerNavigated(playerTwo, screen); - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerTwo.name); // wait for player + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(playerTwo.name); // wait for player + } } - await shared.testPlayerNavigatedBack(screen, driver); if (appSuspendResume) { @@ -118,9 +122,11 @@ describe(rootType, async function () { it("loaded player details and navigate parent frame and go back", async function () { await shared.testPlayerNavigated(playerTwo, screen); - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerTwo.name); // wait for player + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(playerTwo.name); // wait for player + } } await shared[`testSomePageNavigated${transition}`](screen); @@ -167,9 +173,11 @@ describe(rootType, async function () { await shared.testPlayerNavigated(playerTwo, screen); - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerTwo.name); // wait for player + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(playerTwo.name); // wait for player + } } await screen.loadedPlayerDetails(playerTwo); @@ -207,12 +215,13 @@ describe(rootType, async function () { 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 + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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); diff --git a/e2e/nested-frame-navigation/e2e/frame-tabs-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-root/tabs.e2e-spec.ts similarity index 72% rename from e2e/nested-frame-navigation/e2e/frame-tabs-root.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/frame-root/tabs.e2e-spec.ts index 263ca56a2..841d04a00 100644 --- a/e2e/nested-frame-navigation/e2e/frame-tabs-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/frame-root/tabs.e2e-spec.ts @@ -1,24 +1,28 @@ 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"; -import { TabNavigationScreen } from "./tab-navigation-screen"; +import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; const roots = ["TabsTop", "TabsBottom"]; -const rootType = "frame-tabs-root"; -describe(rootType, async function () { +describe("frame-root-with-tabs", async function () { let driver: AppiumDriver; let screen: Screen; + let transitions = [...allTransitions]; before(async function () { nsCapabilities.testReporter.context = this; - logWarn(`====== ${rootType} ========`); + logWarn(`====== frame-root-with-tabs ========`); driver = await createDriver(); + await driver.restartApp(); screen = new TabNavigationScreen(driver); - if (dontKeepActivities) { - await driver.setDontKeepActivities(true); + await driver.setDontKeepActivities(dontKeepActivities); + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); } driver.defaultWaitTime = driverDefaultWaitTime; @@ -41,8 +45,8 @@ describe(rootType, async function () { for (let index = 0; index < roots.length; index++) { const root = roots[index]; - describe(`${rootType}-${root} scenarios:`, async function () { - logWarn(`===== Root: ${root}`); + describe(`frame-root-with-tabs-${root} scenario:`, async function () { + logWarn(`===== ${index++}. Root: ${root}`); for (let trIndex = 0; trIndex < transitions.length; trIndex++) { const transition = transitions[trIndex]; const playerOne: Item = playersData[`playerOne${transition}`]; @@ -50,18 +54,11 @@ describe(rootType, async function () { const teamOne: Item = teamsData[`teamOne${transition}`]; const teamTwo: Item = teamsData[`teamTwo${transition}`]; - describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () { + describe(`frame-root-with-tabs-${root}-transition-${transition}-scenario:`, 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 function () { @@ -116,9 +113,11 @@ describe(rootType, async function () { it("loaded player details and navigate parent frame and go back", async function () { await shared.testPlayerNavigated(playerTwo, screen); - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerTwo.name); // wait for player + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(playerTwo.name); // wait for player + } } await shared[`testSomePageNavigated${transition}`](screen); @@ -165,18 +164,22 @@ describe(rootType, async function () { await shared.testPlayerNavigated(playerTwo, screen); - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await screen.loadedElement(playerTwo.name); // wait for player + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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 (!shared.preventApplicationCrashCauesByAutomation(driver)) { + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await screen.loadedElement(somePage); // wait for some page + } } if (driver.isAndroid) { @@ -185,30 +188,36 @@ describe(rootType, async function () { 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 + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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 + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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 + if (!shared.preventApplicationCrashCauesByAutomation(driver)) { + 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); diff --git a/e2e/nested-frame-navigation/e2e/issues.e2e.spec.ts b/e2e/nested-frame-navigation/e2e/issues/issues.e2e.spec.ts similarity index 84% rename from e2e/nested-frame-navigation/e2e/issues.e2e.spec.ts rename to e2e/nested-frame-navigation/e2e/issues/issues.e2e.spec.ts index 3abce2423..0e29235b4 100644 --- a/e2e/nested-frame-navigation/e2e/issues.e2e.spec.ts +++ b/e2e/nested-frame-navigation/e2e/issues/issues.e2e.spec.ts @@ -1,7 +1,7 @@ import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; -import { Screen } from "./screen"; -import { suspendTime, dontKeepActivities } from "./config"; -import { TabViewNavigationScreen } from "./tabview-navigation-screen"; +import { Screen } from "../screens/screen"; +import { suspendTime, dontKeepActivities } from "../config"; +import { TabViewNavigationScreen } from "../screens/tabview-navigation-screen"; describe("issues", async function () { let driver: AppiumDriver; @@ -10,6 +10,7 @@ describe("issues", async function () { before(async function () { nsCapabilities.testReporter.context = this; driver = await createDriver(); + await driver.restartApp(); screen = new TabViewNavigationScreen(driver); if (dontKeepActivities) { await driver.setDontKeepActivities(true); @@ -35,7 +36,7 @@ describe("issues", async function () { await screen.loadedHome(); const showSomePage = async function () { const somePageBtn = await driver.waitForElement("somePageOnRoot"); - await somePageBtn.tap(); + await somePageBtn.click(); await screen.loadedSomePage(); }; diff --git a/e2e/nested-frame-navigation/e2e/layout-root/multi-frames.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/layout-root/multi-frames.e2e-spec.ts new file mode 100644 index 000000000..320e1dd8d --- /dev/null +++ b/e2e/nested-frame-navigation/e2e/layout-root/multi-frames.e2e-spec.ts @@ -0,0 +1,226 @@ +import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium"; + +import { Screen, playersData, somePage, otherPage, teamsData, driverDefaultWaitTime } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; + +describe("layout-root-with-multi-frames", async function () { + let driver: AppiumDriver; + let screen: Screen; + let transitions = [...allTransitions]; + + before(async function () { + nsCapabilities.testReporter.context = this; + driver = await createDriver(); + await driver.restartApp(); + screen = new TabNavigationScreen(driver); + logWarn("====== layout-root-with-multi-frames ========"); + await driver.setDontKeepActivities(dontKeepActivities); + + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); + } + + driver.defaultWaitTime = driverDefaultWaitTime; + }); + + 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 < transitions.length; index++) { + const transition = allTransitions[index]; + + const playerOne = playersData[`playerOne${transition}`]; + const playerTwo = playersData[`playerTwo${transition}`]; + const teamOne = teamsData[`teamOne${transition}`]; + + describe(`layout-root-with-multi-frames-transition-${transition}-scenario:`, async function () { + + before(async function () { + nsCapabilities.testReporter.context = this; + }); + + it("loaded layout root with multi nested frames", async function () { + await screen.loadedHome(); + + await screen.navigateToLayoutWithMultiFrame(); + await screen.loadedLayoutWithMultiFrame(); + }); + + it("loaded players list", async function () { + await screen.loadedPlayersList(); + }); + + it("loaded teams list", async function () { + await screen.loadedTeamsList(); + }); + + 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("navigate players parent frame and go back", async function () { + await shared[`testSomePageNavigated${transition}`](screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(somePage); // wait for some page + } + + if (driver.isAndroid) { + await driver.navBack(); // some page back navigation + } else { + await screen.goBackFromSomePage(); + } + + await screen.loadedPlayersList(); + }); + + it("loaded players details and navigate parent frame and go back", async function () { + await shared.testPlayerNavigated(playerTwo, screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(playerTwo.name); // wait for player + } + + await shared[`testSomePageNavigated${transition}`](screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(somePage); // wait for some page + } + + if (driver.isAndroid) { + await driver.navBack(); // some page back navigation + } else { + await screen.goBackFromSomePage(); + } + + await screen.loadedPlayerDetails(playerTwo); + + await screen.goBackToPlayersList(); + await screen.loadedPlayersList(); + }); + + it("loaded layout root with multi nested frames again", async function () { + await screen.loadedLayoutWithMultiFrame(); + }); + + it("loaded players list", async function () { + await screen.loadedPlayersList(); + }); + + it("loaded teams list", async function () { + await screen.loadedTeamsList(); + }); + + it("mix player and team list actions and go back", async function () { + await shared.testPlayerNavigated(playerTwo, screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(playerTwo.name); // wait for player + } + + await shared[`testOtherPageNavigated${transition}`](screen); // "teams" parent frame navigation + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(otherPage); // wait for other page + } + + await screen.loadedPlayerDetails(playerTwo); // assert no changes in the sibling frame + + if (driver.isAndroid) { + await driver.navBack(); // other page back navigation + } else { + await screen.goBackFromOtherPage(); + } + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(teamOne.name); // wait for teams list + } + + await screen.loadedTeamsList(); + await screen.loadedPlayerDetails(playerTwo); // assert no changes in the sibling frame + + await shared[`testOtherPageNavigated${transition}`](screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(otherPage); // wait for other page + } + + await shared[`testSomePageNavigated${transition}`](screen); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(somePage); // wait for some page + } + + await screen.loadedOtherPage(); // assert no changes in the sibling frame + + if (driver.isAndroid) { + await driver.navBack(); // some page back navigation + } else { + await screen.goBackFromSomePage(); + } + + await screen.loadedPlayerDetails(playerTwo); + + await screen.goBackToPlayersList(); + await screen.loadedPlayersList(); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(playerOne.name); // wait for players list + } + + await screen.goBackFromOtherPage(); + + if (appSuspendResume) { + await driver.backgroundApp(suspendTime); + await driver.waitForElement(teamOne.name); // wait for team + } + + await screen.loadedTeamsList(); + }); + + it("loaded home page again", async function () { + await screen.resetToHome(); + await screen.loadedHome(); + }); + }); + } +}); diff --git a/e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/layout-root/single-frame.e2e-spec.ts similarity index 61% rename from e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/layout-root/single-frame.e2e-spec.ts index 2346a9c1d..de11ab012 100644 --- a/e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/layout-root/single-frame.e2e-spec.ts @@ -1,24 +1,27 @@ import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium"; -import { Screen, playersData, home, somePage, otherPage, teamsData, driverDefaultWaitTime } from "./screen"; -import * as shared from "./shared.e2e-spec"; -import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config"; -import { TabNavigationScreen } from "./tab-navigation-screen"; +import { Screen, playersData, home, somePage, teamsData, driverDefaultWaitTime } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; -const rootType = "layout-root"; -describe(rootType, async function () { +describe("layout-root-with-single-frame", async function () { let driver: AppiumDriver; let screen: Screen; + let transitions = [...allTransitions]; before(async function () { nsCapabilities.testReporter.context = this; driver = await createDriver(); + await driver.restartApp(); screen = new TabNavigationScreen(driver); - logWarn("====== layout-root ========"); - if (dontKeepActivities) { - await driver.setDontKeepActivities(true); + logWarn("====== layout-root-with-single-frame ========"); + await driver.setDontKeepActivities(dontKeepActivities); + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); } - driver.defaultWaitTime = driverDefaultWaitTime; }); @@ -41,18 +44,11 @@ describe(rootType, async function () { const playerOne = playersData[`playerOne${transition}`]; const playerTwo = playersData[`playerTwo${transition}`]; - const teamOne = teamsData[`teamOne${transition}`]; - describe(`${rootType}-transition-${transition}-scenarios:`, async function () { + describe(`layout-root-with-single-frame-transition-${transition}-scenario:`, 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 () { @@ -140,176 +136,10 @@ describe(rootType, async function () { await driver.waitForElement(home); // wait for home page } }); - - it("loaded layout root with multi nested frames", async function () { - await screen.navigateToLayoutWithMultiFrame(); - await screen.loadedLayoutWithMultiFrame(); - }); - - it("loaded players list", async function () { - await screen.loadedPlayersList(); - }); - - it("loaded teams list", async function () { - await screen.loadedTeamsList(); - }); - - 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("navigate players parent frame and go back", async function () { - await shared[`testSomePageNavigated${transition}`](screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(somePage); // wait for some page - } - - if (driver.isAndroid) { - await driver.navBack(); // some page back navigation - } else { - await screen.goBackFromSomePage(); - } - - await screen.loadedPlayersList(); - }); - - it("loaded players details and navigate parent frame and go back", async function () { - await shared.testPlayerNavigated(playerTwo, screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(playerTwo.name); // wait for player - } - - await shared[`testSomePageNavigated${transition}`](screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(somePage); // wait for some page - } - - if (driver.isAndroid) { - await driver.navBack(); // some page back navigation - } else { - await screen.goBackFromSomePage(); - } - - await screen.loadedPlayerDetails(playerTwo); - - await screen.goBackToPlayersList(); - await screen.loadedPlayersList(); - }); - - it("loaded layout root with multi nested frames again", async function () { - await screen.loadedLayoutWithMultiFrame(); - }); - - it("loaded players list", async function () { - await screen.loadedPlayersList(); - }); - - it("loaded teams list", async function () { - await screen.loadedTeamsList(); - }); - - it("mix player and team list actions and go back", async function () { - await shared.testPlayerNavigated(playerTwo, screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(playerTwo.name); // wait for player - } - - await shared[`testOtherPageNavigated${transition}`](screen); // "teams" parent frame navigation - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(otherPage); // wait for other page - } - - await screen.loadedPlayerDetails(playerTwo); // assert no changes in the sibling frame - - if (driver.isAndroid) { - await driver.navBack(); // other page back navigation - } else { - await screen.goBackFromOtherPage(); - } - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(teamOne.name); // wait for teams list - } - - await screen.loadedTeamsList(); - await screen.loadedPlayerDetails(playerTwo); // assert no changes in the sibling frame - - await shared[`testOtherPageNavigated${transition}`](screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(otherPage); // wait for other page - } - - await shared[`testSomePageNavigated${transition}`](screen); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(somePage); // wait for some page - } - - await screen.loadedOtherPage(); // assert no changes in the sibling frame - - if (driver.isAndroid) { - await driver.navBack(); // some page back navigation - } else { - await screen.goBackFromSomePage(); - } - - await screen.loadedPlayerDetails(playerTwo); - - await screen.goBackToPlayersList(); - await screen.loadedPlayersList(); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(playerOne.name); // wait for players list - } - - await screen.goBackFromOtherPage(); - - if (appSuspendResume) { - await driver.backgroundApp(suspendTime); - await driver.waitForElement(teamOne.name); // wait for team - } - - await screen.loadedTeamsList(); - }); - - it("loaded home page again", async function () { - await screen.resetToHome(); - await screen.loadedHome(); - }); }); } - describe(`${rootType}-players-list-slide-transition with parent frame default transition:`, async function () { + describe(`layout-root-with-single-frame-players-list-slide-transition with parent frame default transition:`, async function () { const playerOne = playersData["playerOneSlide"]; const playerTwo = playersData["playerTwoSlide"]; @@ -368,7 +198,7 @@ describe(rootType, async function () { }); }); - describe(`${rootType}-players-list-slide-transition with parent frame no transition:`, async function () { + describe(`layout-root-with-single-frame-players-list-slide-transition with parent frame no transition:`, async function () { const playerOne = playersData["playerOneSlide"]; const playerTwo = playersData["playerTwoSlide"]; @@ -427,7 +257,7 @@ describe(rootType, async function () { }); }); - describe(`${rootType}-players-list-flip-transition with parent frame default transition:`, async function () { + describe(`layout-root-with-single-frame-players-list-flip-transition with parent frame default transition:`, async function () { const playerOne = playersData["playerOneFlip"]; const playerTwo = playersData["playerTwoFlip"]; @@ -490,14 +320,14 @@ describe(rootType, async function () { }); }); - describe(`${rootType}-players-list-flip-transition with parent frame no transition:`, async function () { + describe(`layout-root-with-single-frame-players-list-flip-transition with parent frame no transition:`, async function () { const playerOne = playersData["playerOneFlip"]; const playerTwo = playersData["playerTwoFlip"]; before(async function () { nsCapabilities.testReporter.context = this; }); - + it("loaded layout root with nested frames", async function () { await screen.navigateToLayoutWithFrame(); await screen.loadedLayoutWithFrame(); diff --git a/e2e/nested-frame-navigation/e2e/screen.ts b/e2e/nested-frame-navigation/e2e/screens/screen.ts similarity index 98% rename from e2e/nested-frame-navigation/e2e/screen.ts rename to e2e/nested-frame-navigation/e2e/screens/screen.ts index b496144ad..446c4a4b9 100644 --- a/e2e/nested-frame-navigation/e2e/screen.ts +++ b/e2e/nested-frame-navigation/e2e/screens/screen.ts @@ -272,7 +272,7 @@ export abstract class Screen { const btnReset = await this._driver.waitForElement(resetApp); console.info(`====== Reset home "${resetApp}"`); - await btnReset.tap(); + await btnReset.click(); } goBackToPlayersList = async () => { @@ -322,13 +322,13 @@ export abstract class Screen { togglePlayersTab = async () => { const lblPlayers = await this._driver.waitForElement(this.playersTab); logInfo(`====== Navigate to "${this.players}"`); - await lblPlayers.tap(); + await lblPlayers.click(); } toggleTeamsTab = async () => { const lblTeams = await this._driver.waitForElement(this.teamsTab); logInfo(`====== Navigate to "${this.teams}"`); - await lblTeams.tap(); + await lblTeams.click(); } loadedHome = async () => { @@ -435,7 +435,7 @@ export abstract class Screen { private navigateToPage = async (page: string) => { const btnPage = await this._driver.waitForElement(page); logInfo(`====== Navigate to "${page}"`); - await btnPage.tap(); + await btnPage.click(); } private loadedPage = async (page: string) => { @@ -447,7 +447,7 @@ export abstract class Screen { private navigateToItem = async (item: Item) => { const lblItem = await this._driver.waitForElement(item.name); logInfo(`====== Navigate to "${item.name}"`); - await lblItem.tap(); + await lblItem.click(); } private loadedItem = async (item: Item) => { @@ -463,6 +463,6 @@ export abstract class Screen { private goBack = async (accessibilityId: string) => { const btnBack = await this._driver.waitForElement(accessibilityId); logInfo(`====== Go back with "${accessibilityId}"`); - await btnBack.tap(); + await btnBack.click(); } } \ No newline at end of file diff --git a/e2e/nested-frame-navigation/e2e/shared.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/screens/shared.ts similarity index 88% rename from e2e/nested-frame-navigation/e2e/shared.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/screens/shared.ts index d3aed10de..0f3756287 100644 --- a/e2e/nested-frame-navigation/e2e/shared.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/screens/shared.ts @@ -2,6 +2,14 @@ import { AppiumDriver } from "nativescript-dev-appium"; import { Screen, Item } from "./screen"; +export const preventApplicationCrashCauesByAutomation = (driver: AppiumDriver) => { + return +driver.nsCapabilities.device.apiLevel > 23 && driver.isAndroid; +}; + +export const isApiLevel19 = (driver: AppiumDriver) => { + return +driver.nsCapabilities.device.apiLevel === 19 && driver.isAndroid; +}; + export async function testPlayerNavigated(player: Item, screen: Screen) { await screen.navigateToPlayerDetails(player); await screen.loadedPlayerDetails(player); diff --git a/e2e/nested-frame-navigation/e2e/tab-navigation-screen.ts b/e2e/nested-frame-navigation/e2e/screens/tab-navigation-screen.ts similarity index 100% rename from e2e/nested-frame-navigation/e2e/tab-navigation-screen.ts rename to e2e/nested-frame-navigation/e2e/screens/tab-navigation-screen.ts diff --git a/e2e/nested-frame-navigation/e2e/tabview-navigation-screen.ts b/e2e/nested-frame-navigation/e2e/screens/tabview-navigation-screen.ts similarity index 100% rename from e2e/nested-frame-navigation/e2e/tabview-navigation-screen.ts rename to e2e/nested-frame-navigation/e2e/screens/tabview-navigation-screen.ts diff --git a/e2e/nested-frame-navigation/e2e/tab-navigation-root/bottom-navigation-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/tab-navigation-root/bottom-navigation-root.e2e-spec.ts new file mode 100644 index 000000000..65ae33ae3 --- /dev/null +++ b/e2e/nested-frame-navigation/e2e/tab-navigation-root/bottom-navigation-root.e2e-spec.ts @@ -0,0 +1,165 @@ +import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium"; + +import { Screen, playersData, teamsData } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; + +describe("tab-navigation-bottom-navigation-root", async function () { + let driver: AppiumDriver; + let screen: Screen; + let transitions = [...allTransitions]; + + before(async function () { + nsCapabilities.testReporter.context = this; + logWarn(`====== "bottom-navigation-root" ========`); + driver = await createDriver(); + await driver.restartApp(); + screen = new TabNavigationScreen(driver); + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); + } + await driver.setDontKeepActivities(dontKeepActivities); + 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 < 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(`bottom-navigation-root-transition-${transition}-scenario:`, async function () { + before(async function () { + nsCapabilities.testReporter.context = this; + }); + + it("loaded home page", async function () { + await screen.loadedHome(); + }); + + it(`loaded BottomNavigation root with frames`, async function () { + await screen[`navigateToBottomNavigationRootWithFrames`](); + await screen[`loadedBottomNavigationRootWithFrames`](); + }); + + 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(); + }); + }); + } + +}); diff --git a/e2e/nested-frame-navigation/e2e/tabs-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/tab-navigation-root/tabs-root.e2e-spec.ts similarity index 85% rename from e2e/nested-frame-navigation/e2e/tabs-root.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/tab-navigation-root/tabs-root.e2e-spec.ts index 24266595e..c28b50221 100644 --- a/e2e/nested-frame-navigation/e2e/tabs-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/tab-navigation-root/tabs-root.e2e-spec.ts @@ -1,26 +1,31 @@ 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"; -import { TabNavigationScreen } from "./tab-navigation-screen"; +import { Screen, playersData, teamsData } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabNavigationScreen } from "../screens/tab-navigation-screen"; const roots = ["TabsTop", "TabsBottom"]; -const rootType = "tabs-root"; -describe(rootType, async function () { +describe("tab-navigation-tabs-root", async function () { let driver: AppiumDriver; let screen: Screen; + let transitions = [...allTransitions]; before(async function () { nsCapabilities.testReporter.context = this; - logWarn(`====== ${rootType} ========`); + logWarn(`====== "tabs-root" ========`); driver = await createDriver(); + await driver.restartApp(); screen = new TabNavigationScreen(driver); - if (dontKeepActivities) { - await driver.setDontKeepActivities(true); + + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); } + await driver.setDontKeepActivities(dontKeepActivities); driver.defaultWaitTime = 8000; }); @@ -40,7 +45,7 @@ describe(rootType, async function () { for (let index = 0; index < roots.length; index++) { const root = roots[index]; - describe(`${rootType}-${root}-scenarios:`, async function () { + describe(`tab-navigation-tabs-root-${root}-scenario:`, async function () { before(async function () { nsCapabilities.testReporter.context = this; @@ -54,17 +59,10 @@ describe(rootType, async function () { const teamOne = teamsData[`teamOne${transition}`]; const teamTwo = teamsData[`teamTwo${transition}`]; - describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () { + describe(`tabs-root-${root}-transition-${transition}-scenario:`, 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 () { diff --git a/e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/tab-view-root/tab-view-root.e2e-spec.ts similarity index 84% rename from e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts rename to e2e/nested-frame-navigation/e2e/tab-view-root/tab-view-root.e2e-spec.ts index f01741f12..ad4500b3f 100644 --- a/e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/tab-view-root/tab-view-root.e2e-spec.ts @@ -1,27 +1,29 @@ 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"; -import { TabViewNavigationScreen } from "./tabview-navigation-screen"; +import { Screen, playersData, teamsData } from "../screens/screen"; +import * as shared from "../screens/shared"; +import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config"; +import { TabViewNavigationScreen } from "../screens/tabview-navigation-screen"; // 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 () { +describe("tab-view-root", async function () { let driver: AppiumDriver; let screen: Screen; - + let transitions = [...allTransitions]; before(async function () { nsCapabilities.testReporter.context = this; - logWarn(`====== ${rootType} ========`); + logWarn(`====== tab-view-root ========`); driver = await createDriver(); + await driver.restartApp(); screen = new TabViewNavigationScreen(driver); - if (dontKeepActivities) { - await driver.setDontKeepActivities(true); + if (shared.isApiLevel19(driver)) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("Skipping flip transition tests on api level 19"); + transitions = transitions.filter(tr => !tr.toLowerCase().includes("flip")); } - + await driver.setDontKeepActivities(dontKeepActivities); driver.defaultWaitTime = 8000; }); @@ -29,6 +31,10 @@ describe(rootType, async function () { if (dontKeepActivities) { await driver.setDontKeepActivities(false); } + if (driver.isIOS) { + roots.shift(); + logWarn("TabViewTop is Android only scenario (for iOS it will be skipped)"); + } await driver.quit(); console.log("Quit driver!"); }); @@ -41,7 +47,7 @@ describe(rootType, async function () { for (let index = 0; index < roots.length; index++) { const root = roots[index]; - describe(`${rootType}-${root}-scenarios:`, async function () { + describe(`tab-view-root-${root}-scenario:`, async function () { before(async function () { nsCapabilities.testReporter.context = this; @@ -55,17 +61,10 @@ describe(rootType, async function () { const teamOne = teamsData[`teamOne${transition}`]; const teamTwo = teamsData[`teamTwo${transition}`]; - describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () { + describe(`tab-view-root-${root}-transition-${transition}-scenario:`, 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 () {