mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
test: separate layout-root suites
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
"4723",
|
||||
"-a",
|
||||
"--grep",
|
||||
"layout-root"
|
||||
"layout-root-with-multi-frames"
|
||||
],
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const suspendTime = 1;
|
||||
export const appSuspendResume = true;
|
||||
export const dontKeepActivities = true;
|
||||
export const dontKeepActivities = process.env["DONT_KEEP_ACTIVITIES"] === "true" ? true : false;
|
||||
export const transitions = ["Default", "None", "Slide", "Flip"];
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
|
||||
|
||||
import { Screen, playersData, 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";
|
||||
|
||||
describe("layout-root-with-multi-frames", async function () {
|
||||
let driver: AppiumDriver;
|
||||
let screen: Screen;
|
||||
|
||||
before(async function () {
|
||||
nsCapabilities.testReporter.context = this;
|
||||
driver = await createDriver();
|
||||
await driver.restartApp();
|
||||
screen = new TabNavigationScreen(driver);
|
||||
logWarn("====== layout-root-with-multi-frames ========");
|
||||
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 < transitions.length; index++) {
|
||||
const transition = transitions[index];
|
||||
|
||||
const playerOne = playersData[`playerOne${transition}`];
|
||||
const playerTwo = playersData[`playerTwo${transition}`];
|
||||
const teamOne = teamsData[`teamOne${transition}`];
|
||||
|
||||
describe(`layout-root-with-multi-frames-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 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();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,23 +1,21 @@
|
||||
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 "../screen";
|
||||
import * as shared from "../shared.e2e-spec";
|
||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "../config";
|
||||
import { TabNavigationScreen } from "../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;
|
||||
|
||||
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);
|
||||
|
||||
driver.defaultWaitTime = driverDefaultWaitTime;
|
||||
});
|
||||
@@ -43,8 +41,7 @@ describe(rootType, async function () {
|
||||
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" &&
|
||||
@@ -140,176 +137,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 +199,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 +258,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 +321,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();
|
||||
Reference in New Issue
Block a user