mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
test: separate suites to optimize execute time on CI (#7017)
* test: separate suites to optimize execute time on CI
This commit is contained in:
@ -1,10 +1,11 @@
|
|||||||
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
|
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
|
||||||
|
|
||||||
import { Screen, playersData, home, somePage, teamsData, driverDefaultWaitTime, Item } from "./screen";
|
import { Screen, playersData, teamsData, driverDefaultWaitTime, Item } from "./screen";
|
||||||
import * as shared from "./shared.e2e-spec";
|
|
||||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
||||||
|
import * as shared from "./shared.e2e-spec";
|
||||||
|
|
||||||
describe("frame-root:", () => {
|
const rootType = "frame-root";
|
||||||
|
describe(rootType, () => {
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ describe("frame-root:", () => {
|
|||||||
const teamOne: Item = teamsData[`teamOne${transition}`];
|
const teamOne: Item = teamsData[`teamOne${transition}`];
|
||||||
const teamTwo: Item = teamsData[`teamTwo${transition}`];
|
const teamTwo: Item = teamsData[`teamTwo${transition}`];
|
||||||
|
|
||||||
describe(`transition: ${transition} scenarios:`, () => {
|
describe(`${rootType}-transition-${transition}-scenarios:`, () => {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
logWarn(`==== Transition ${transition}`);
|
logWarn(`==== Transition ${transition}`);
|
||||||
|
|
||||||
|
@ -7,16 +7,13 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
|
|||||||
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
|
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
|
||||||
const roots = ["TabTop", "TabBottom"];
|
const roots = ["TabTop", "TabBottom"];
|
||||||
|
|
||||||
function hyphenate(s: string) {
|
const rootType = "frame-tab-root";
|
||||||
return s.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
|
describe(rootType, () => {
|
||||||
}
|
|
||||||
|
|
||||||
describe("frame-tab-root:", () => {
|
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
logWarn("====== frame-tab-root ========")
|
logWarn(`====== ${rootType} ========`);
|
||||||
driver = await createDriver();
|
driver = await createDriver();
|
||||||
screen = new Screen(driver);
|
screen = new Screen(driver);
|
||||||
if (dontKeepActivities) {
|
if (dontKeepActivities) {
|
||||||
@ -42,9 +39,8 @@ describe("frame-tab-root:", () => {
|
|||||||
|
|
||||||
for (let index = 0; index < roots.length; index++) {
|
for (let index = 0; index < roots.length; index++) {
|
||||||
const root = roots[index];
|
const root = roots[index];
|
||||||
const rootWithHyphen = hyphenate(root);
|
|
||||||
|
|
||||||
describe(`${rootWithHyphen} scenarios:`, () => {
|
describe(`${rootType}-${root} scenarios:`, () => {
|
||||||
logWarn(`===== Root: ${root}`);
|
logWarn(`===== Root: ${root}`);
|
||||||
for (let trIndex = 0; trIndex < transitions.length; trIndex++) {
|
for (let trIndex = 0; trIndex < transitions.length; trIndex++) {
|
||||||
const transition = transitions[trIndex];
|
const transition = transitions[trIndex];
|
||||||
@ -53,7 +49,7 @@ describe("frame-tab-root:", () => {
|
|||||||
const teamOne: Item = teamsData[`teamOne${transition}`];
|
const teamOne: Item = teamsData[`teamOne${transition}`];
|
||||||
const teamTwo: Item = teamsData[`teamTwo${transition}`];
|
const teamTwo: Item = teamsData[`teamTwo${transition}`];
|
||||||
|
|
||||||
describe(`transition: ${transition} scenarios:`, () => {
|
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => {
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
logWarn(`========= ${root}-${transition} =========`);
|
logWarn(`========= ${root}-${transition} =========`);
|
||||||
@ -70,7 +66,7 @@ describe("frame-tab-root:", () => {
|
|||||||
await screen.loadedHome();
|
await screen.loadedHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`loaded frame ${rootWithHyphen} root with nested frames`, async () => {
|
it(`loaded frame ${root} root with nested frames`, async () => {
|
||||||
await screen[`navigateToPage${root}WithFrames`]();
|
await screen[`navigateToPage${root}WithFrames`]();
|
||||||
await screen[`loadedPage${root}WithFrames`]();
|
await screen[`loadedPage${root}WithFrames`]();
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
|
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
|
||||||
|
|
||||||
import { Screen, playersData, home, somePage, otherPage, teamsData, driverDefaultWaitTime } from "./screen";
|
import { Screen, playersData, home, somePage, otherPage, teamsData, driverDefaultWaitTime } from "./screen";
|
||||||
import * as shared from "./shared.e2e-spec";
|
import * as shared from "./shared.e2e-spec";
|
||||||
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
|
||||||
|
|
||||||
describe("layout-root:", () => {
|
const rootType = "layout-root";
|
||||||
|
describe(rootType, () => {
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
driver = await createDriver();
|
driver = await createDriver();
|
||||||
screen = new Screen(driver);
|
screen = new Screen(driver);
|
||||||
|
logWarn("====== layout-root ========")
|
||||||
if (dontKeepActivities) {
|
if (dontKeepActivities) {
|
||||||
await driver.setDontKeepActivities(true);
|
await driver.setDontKeepActivities(true);
|
||||||
}
|
}
|
||||||
@ -32,12 +34,14 @@ describe("layout-root:", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
transitions.forEach(transition => {
|
for (let index = 0; index < transitions.length; index++) {
|
||||||
|
const transition = transitions[index];
|
||||||
|
|
||||||
const playerOne = playersData[`playerOne${transition}`];
|
const playerOne = playersData[`playerOne${transition}`];
|
||||||
const playerTwo = playersData[`playerTwo${transition}`];
|
const playerTwo = playersData[`playerTwo${transition}`];
|
||||||
const teamOne = teamsData[`teamOne${transition}`];
|
const teamOne = teamsData[`teamOne${transition}`];
|
||||||
|
|
||||||
describe(`transition: ${transition} scenarios:`, () => {
|
describe(`${rootType}-transition-${transition}-scenarios:`, () => {
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
if (transition === "Flip" &&
|
if (transition === "Flip" &&
|
||||||
@ -300,9 +304,9 @@ describe("layout-root:", () => {
|
|||||||
await screen.loadedHome();
|
await screen.loadedHome();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
describe("players list slide transition with parent frame default transition:", () => {
|
describe(`${rootType}-players-list-slide-transition with parent frame default transition:`, () => {
|
||||||
const playerOne = playersData["playerOneSlide"];
|
const playerOne = playersData["playerOneSlide"];
|
||||||
const playerTwo = playersData["playerTwoSlide"];
|
const playerTwo = playersData["playerTwoSlide"];
|
||||||
|
|
||||||
@ -361,7 +365,7 @@ describe("layout-root:", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("players list slide transition with parent frame no transition:", () => {
|
describe(`${rootType}-players-list-slide-transition with parent frame no transition:`, () => {
|
||||||
const playerOne = playersData["playerOneSlide"];
|
const playerOne = playersData["playerOneSlide"];
|
||||||
const playerTwo = playersData["playerTwoSlide"];
|
const playerTwo = playersData["playerTwoSlide"];
|
||||||
|
|
||||||
@ -420,7 +424,7 @@ describe("layout-root:", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("players list flip transition with parent frame default transition:", () => {
|
describe(`${rootType}-players-list-flip-transition with parent frame default transition:`, () => {
|
||||||
const playerOne = playersData["playerOneFlip"];
|
const playerOne = playersData["playerOneFlip"];
|
||||||
const playerTwo = playersData["playerTwoFlip"];
|
const playerTwo = playersData["playerTwoFlip"];
|
||||||
|
|
||||||
@ -479,7 +483,7 @@ describe("layout-root:", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("players list flip transition with parent frame no transition:", () => {
|
describe(`${rootType}-players-list-flip-transition with parent frame no transition:`, () => {
|
||||||
const playerOne = playersData["playerOneFlip"];
|
const playerOne = playersData["playerOneFlip"];
|
||||||
const playerTwo = playersData["playerTwoFlip"];
|
const playerTwo = playersData["playerTwoFlip"];
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
|
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
|
||||||
|
|
||||||
import { Screen, playersData, teamsData } from "./screen";
|
import { Screen, playersData, teamsData } from "./screen";
|
||||||
import * as shared from "./shared.e2e-spec";
|
import * as shared from "./shared.e2e-spec";
|
||||||
@ -7,15 +7,13 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
|
|||||||
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
|
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
|
||||||
const roots = ["TabTop", "TabBottom"];
|
const roots = ["TabTop", "TabBottom"];
|
||||||
|
|
||||||
function hyphenate(s: string) {
|
const rootType = "tab-root";
|
||||||
return s.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
|
describe(rootType, () => {
|
||||||
}
|
|
||||||
|
|
||||||
describe("tab-root:", () => {
|
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
logWarn(`====== ${rootType} ========`)
|
||||||
driver = await createDriver();
|
driver = await createDriver();
|
||||||
screen = new Screen(driver);
|
screen = new Screen(driver);
|
||||||
if (dontKeepActivities) {
|
if (dontKeepActivities) {
|
||||||
@ -39,18 +37,19 @@ describe("tab-root:", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
roots.forEach(root => {
|
for (let index = 0; index < roots.length; index++) {
|
||||||
const rootWithHyphen = hyphenate(root);
|
const root = roots[index];
|
||||||
|
describe(`${rootType}-${root}-scenarios:`, () => {
|
||||||
|
|
||||||
describe(`${rootWithHyphen} scenarios:`, () => {
|
for (let index = 0; index < transitions.length; index++) {
|
||||||
|
const transition = transitions[index];
|
||||||
|
|
||||||
transitions.forEach(transition => {
|
|
||||||
const playerOne = playersData[`playerOne${transition}`];
|
const playerOne = playersData[`playerOne${transition}`];
|
||||||
const playerTwo = playersData[`playerTwo${transition}`];
|
const playerTwo = playersData[`playerTwo${transition}`];
|
||||||
const teamOne = teamsData[`teamOne${transition}`];
|
const teamOne = teamsData[`teamOne${transition}`];
|
||||||
const teamTwo = teamsData[`teamTwo${transition}`];
|
const teamTwo = teamsData[`teamTwo${transition}`];
|
||||||
|
|
||||||
describe(`transition: ${transition} scenarios:`, () => {
|
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => {
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
if (transition === "Flip" &&
|
if (transition === "Flip" &&
|
||||||
@ -65,7 +64,7 @@ describe("tab-root:", () => {
|
|||||||
await screen.loadedHome();
|
await screen.loadedHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`loaded ${rootWithHyphen} root with frames`, async () => {
|
it(`loaded ${root} root with frames`, async () => {
|
||||||
await screen[`navigateTo${root}RootWithFrames`]();
|
await screen[`navigateTo${root}RootWithFrames`]();
|
||||||
await screen[`loaded${root}RootWithFrames`]();
|
await screen[`loaded${root}RootWithFrames`]();
|
||||||
});
|
});
|
||||||
@ -169,7 +168,7 @@ describe("tab-root:", () => {
|
|||||||
await screen.loadedHome();
|
await screen.loadedHome();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user