test: separate suites to optimize execute time on CI (#7017)

* test: separate suites to optimize execute time on CI
This commit is contained in:
Svetoslav
2019-03-12 09:59:43 +02:00
committed by SvetoslavTsenov
parent 043cbf3a61
commit a31e75b129
4 changed files with 57 additions and 43 deletions

View File

@ -1,10 +1,11 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { Screen, playersData, home, somePage, teamsData, driverDefaultWaitTime } from "./screen";
import * as shared from "./shared.e2e-spec";
import { Screen, playersData, teamsData, driverDefaultWaitTime, Item } from "./screen";
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 screen: Screen;
@ -38,7 +39,18 @@ describe("frame-root:", () => {
const teamOne = teamsData[`teamOne${transition}`];
const teamTwo = teamsData[`teamTwo${transition}`];
describe(`transition: ${transition} scenarios:`, () => {
describe(`${rootType}-transition-${transition}-scenarios:`, () => {
before(async function () {
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();
}
});
it("loaded home page", async () => {
await screen.loadedHome();
});

View File

@ -7,15 +7,13 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
// NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom)
const roots = ["TabTop", "TabBottom"];
function hyphenate(s: string) {
return s.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
}
describe("frame-tab-root:", () => {
const rootType = "frame-tab-root";
describe(rootType, () => {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
logWarn(`====== ${rootType} ========`);
driver = await createDriver();
screen = new Screen(driver);
if (dontKeepActivities) {
@ -39,24 +37,25 @@ describe("frame-tab-root:", () => {
}
});
roots.forEach(root => {
const rootWithHyphen = hyphenate(root);
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${rootWithHyphen} scenarios:`, () => {
describe(`${rootType}-${root} scenarios:`, () => {
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}`];
transitions.forEach(transition => {
const playerOne = playersData[`playerOne${transition}`];
const playerTwo = playersData[`playerTwo${transition}`];
const teamOne = teamsData[`teamOne${transition}`];
const teamTwo = teamsData[`teamTwo${transition}`];
describe(`transition: ${transition} scenarios:`, () => {
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => {
it("loaded home page", async () => {
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[`loadedPage${root}WithFrames`]();
});

View File

@ -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 * as shared from "./shared.e2e-spec";
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
describe("layout-root:", () => {
const rootType = "layout-root";
describe(rootType, () => {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
driver = await createDriver();
screen = new Screen(driver);
logWarn("====== layout-root ========")
if (dontKeepActivities) {
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 playerTwo = playersData[`playerTwo${transition}`];
const teamOne = teamsData[`teamOne${transition}`];
describe(`transition: ${transition} scenarios:`, () => {
describe(`${rootType}-transition-${transition}-scenarios:`, () => {
it("loaded home page", async () => {
await screen.loadedHome();
@ -291,9 +295,9 @@ describe("layout-root:", () => {
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 playerTwo = playersData["playerTwoSlide"];
@ -352,7 +356,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 playerTwo = playersData["playerTwoSlide"];
@ -411,7 +415,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 playerTwo = playersData["playerTwoFlip"];
@ -470,7 +474,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 playerTwo = playersData["playerTwoFlip"];

View File

@ -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 * 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)
const roots = ["TabTop", "TabBottom"];
function hyphenate(s: string) {
return s.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase();
}
describe("tab-root:", () => {
const rootType = "tab-root";
describe(rootType, () => {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
logWarn(`====== ${rootType} ========`)
driver = await createDriver();
screen = new Screen(driver);
if (dontKeepActivities) {
@ -39,24 +37,25 @@ describe("tab-root:", () => {
}
});
roots.forEach(root => {
const rootWithHyphen = hyphenate(root);
for (let index = 0; index < roots.length; index++) {
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 playerTwo = playersData[`playerTwo${transition}`];
const teamOne = teamsData[`teamOne${transition}`];
const teamTwo = teamsData[`teamTwo${transition}`];
describe(`transition: ${transition} scenarios:`, () => {
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => {
it("loaded home page", async () => {
await screen.loadedHome();
});
it(`loaded ${rootWithHyphen} root with frames`, async () => {
it(`loaded ${root} root with frames`, async () => {
await screen[`navigateTo${root}RootWithFrames`]();
await screen[`loaded${root}RootWithFrames`]();
});
@ -155,7 +154,7 @@ describe("tab-root:", () => {
await screen.loadedHome();
});
});
};
});
});
});
}
});