test: ignore None transition scenario for api19 (#8035)

This commit is contained in:
Svetoslav
2019-11-02 01:48:38 +02:00
committed by GitHub
parent 8b6c852436
commit 04c65392a2
11 changed files with 131 additions and 85 deletions

View File

@@ -1,4 +1,4 @@
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, logWarn, nsCapabilities, logInfo } from "nativescript-dev-appium";
import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "../screens/screen";
import * as shared from "../screens/shared";
@@ -8,6 +8,7 @@ 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 () {
@@ -18,12 +19,6 @@ describe("frame-root-with-bottom-navigation", async function () {
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 () {
@@ -52,7 +47,13 @@ describe("frame-root-with-bottom-navigation", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`=========${trIndex++}. BottomNavigation-${transition} =========`);
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`${trIndex++}. BottomNavigation-${transition} =========`);
}
});
it("loaded home page", async function () {
@@ -107,7 +108,7 @@ describe("frame-root-with-bottom-navigation", async function () {
it("loaded player details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
@@ -158,9 +159,11 @@ describe("frame-root-with-bottom-navigation", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
}
}
await screen.loadedPlayerDetails(playerTwo);
@@ -198,7 +201,7 @@ describe("frame-root-with-bottom-navigation", async function () {
await shared.testTeamNavigated(teamTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await screen.loadedElement(teamTwo.name); // wait for team
await driver.backgroundApp(suspendTime);

View File

@@ -1,7 +1,7 @@
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
import { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item, stillOtherPage } from "../screens/screen";
import { Screen, playersData, teamsData, driverDefaultWaitTime, Item } from "../screens/screen";
import { suspendTime, appSuspendResume, dontKeepActivities, allTransitions } from "../config";
import * as shared from "../screens/shared";
import { TabNavigationScreen } from "../screens/tab-navigation-screen";
@@ -18,12 +18,6 @@ describe("frame-root-with-multi-frames", async function () {
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 () {
@@ -51,7 +45,13 @@ describe("frame-root-with-multi-frames", async function () {
describe(`frame-root-with-multi-frames-transition-${transition}-scenario:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`====${index}. Transition ${transition}`);
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`==== ${index}. Transition ${transition}`);
}
});
it("loaded home page", async function () {

View File

@@ -17,11 +17,6 @@ describe("frame-root-with-single-frame", async function () {
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 () {
@@ -47,7 +42,13 @@ describe("frame-root-with-single-frame", async function () {
describe(`frame-root-with-single-frame-transition-${transition}-scenario:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`==== ${index}. Transition ${transition}`);
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`==== ${index}. Transition ${transition}`);
}
});
it("loaded home page", async function () {

View File

@@ -27,12 +27,6 @@ describe("frame-root-with-tab-view", async function () {
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;
});
@@ -63,10 +57,15 @@ describe("frame-root-with-tab-view", async function () {
const teamTwo: Item = teamsData[`teamTwo${transition}`];
describe(`frame-root-with-tab-view-${root}-transition-${transition}-scenario:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`========= ${root}-${transition} =========`);
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${root}-${transition} =========`);
}
});
it("loaded home page", async function () {
@@ -85,7 +84,7 @@ describe("frame-root-with-tab-view", async function () {
it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
@@ -122,7 +121,7 @@ describe("frame-root-with-tab-view", async function () {
it("loaded player details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
@@ -173,7 +172,7 @@ describe("frame-root-with-tab-view", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
@@ -215,7 +214,7 @@ describe("frame-root-with-tab-view", async function () {
await shared.testTeamNavigated(teamTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await screen.loadedElement(teamTwo.name); // wait for team
await driver.backgroundApp(suspendTime);

View File

@@ -19,12 +19,6 @@ describe("frame-root-with-tabs", async function () {
await driver.restartApp();
screen = new TabNavigationScreen(driver);
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;
});
@@ -58,7 +52,13 @@ describe("frame-root-with-tabs", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`========= ${root}-${transition} =========`);
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${root}-${transition} =========`);
}
});
it("loaded home page", async function () {
@@ -113,7 +113,7 @@ describe("frame-root-with-tabs", async function () {
it("loaded player details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
@@ -164,7 +164,7 @@ describe("frame-root-with-tabs", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(playerTwo.name); // wait for player
@@ -175,7 +175,7 @@ describe("frame-root-with-tabs", async function () {
await shared[`testSomePageNavigated${transition}`](screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(somePage); // wait for some page
@@ -188,7 +188,7 @@ describe("frame-root-with-tabs", async function () {
await screen.goBackFromSomePage();
}
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
// This sleeps prevent test to fail
await driver.sleep(1000);
@@ -201,7 +201,7 @@ describe("frame-root-with-tabs", async function () {
await screen.toggleTeamsTab();
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await screen.loadedElement(teamOne.name); // wait for teams list
@@ -212,7 +212,7 @@ describe("frame-root-with-tabs", async function () {
await shared.testTeamNavigated(teamTwo, screen);
if (!shared.preventApplicationCrashCauesByAutomation(driver)) {
if (!shared.preventApplicationCrashCausedByAutomation(driver)) {
if (appSuspendResume) {
await screen.loadedElement(teamTwo.name); // wait for team
await driver.backgroundApp(suspendTime);

View File

@@ -17,13 +17,6 @@ describe("layout-root-with-multi-frames", async function () {
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;
});
@@ -52,6 +45,13 @@ describe("layout-root-with-multi-frames", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${index}. ${transition} =========`);
}
});
it("loaded layout root with multi nested frames", async function () {

View File

@@ -17,11 +17,6 @@ describe("layout-root-with-single-frame", async function () {
screen = new TabNavigationScreen(driver);
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;
});
@@ -49,6 +44,13 @@ describe("layout-root-with-single-frame", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${index}. ${transition} =========`);
}
});
it("loaded home page", async function () {
@@ -143,6 +145,10 @@ describe("layout-root-with-single-frame", async function () {
const playerOne = playersData["playerOneSlide"];
const playerTwo = playersData["playerTwoSlide"];
before(async function () {
nsCapabilities.testReporter.context = this;
});
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
@@ -202,6 +208,15 @@ describe("layout-root-with-single-frame", async function () {
const playerOne = playersData["playerOneSlide"];
const playerTwo = playersData["playerTwoSlide"];
before(async function () {
nsCapabilities.testReporter.context = this;
if (shared.isApiLevel19(driver)) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skip tests on api level 19");
this.skip();
}
});
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
@@ -326,6 +341,11 @@ describe("layout-root-with-single-frame", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
if (shared.isApiLevel19(driver)) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skip tests on api level 19");
this.skip();
}
});
it("loaded layout root with nested frames", async function () {

View File

@@ -1,13 +1,32 @@
import { AppiumDriver } from "nativescript-dev-appium";
import { Screen, Item } from "./screen";
import { logWarn } from "nativescript-dev-appium";
export const preventApplicationCrashCauesByAutomation = (driver: AppiumDriver) => {
return +driver.nsCapabilities.device.apiLevel > 23 && driver.isAndroid;
export const preventApplicationCrashCausedByAutomation = (driver: AppiumDriver) => {
if (driver.isIOS) {
return false;
}
let preventApplicationCrashCauesByAutomation = false;
if (Number.isInteger(+driver.nsCapabilities.device.apiLevel)) {
preventApplicationCrashCauesByAutomation = +driver.nsCapabilities.device.apiLevel > 23;
} else {
const majorVersion = driver.nsCapabilities.device.apiLevel.split(".")[0];
preventApplicationCrashCauesByAutomation = +majorVersion > 6;
}
if (preventApplicationCrashCauesByAutomation) {
logWarn("Skip run in background app, since it causes crash related to automation!");
}
return preventApplicationCrashCauesByAutomation;
};
export const isApiLevel19 = (driver: AppiumDriver) => {
return +driver.nsCapabilities.device.apiLevel === 19 && driver.isAndroid;
return driver.isAndroid
&& (`${driver.nsCapabilities.device.apiLevel}`.startsWith("19")
|| `${driver.nsCapabilities.device.apiLevel}`.startsWith("4.4.2"));
};
export async function testPlayerNavigated(player: Item, screen: Screen) {

View File

@@ -16,12 +16,7 @@ describe("tab-navigation-bottom-navigation-root", async function () {
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.setDontKeepActivities(dontKeepActivities);
driver.defaultWaitTime = 8000;
});
@@ -49,6 +44,13 @@ describe("tab-navigation-bottom-navigation-root", async function () {
describe(`bottom-navigation-root-transition-${transition}-scenario:`, async function () {
before(async function () {
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${index}. ${transition} =========`);
}
nsCapabilities.testReporter.context = this;
});

View File

@@ -18,13 +18,6 @@ describe("tab-navigation-tabs-root", async function () {
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;
});
@@ -63,6 +56,13 @@ describe("tab-navigation-tabs-root", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${root}-${transition} =========`);
}
});
it("loaded home page", async function () {

View File

@@ -18,11 +18,6 @@ describe("tab-view-root", async function () {
driver = await createDriver();
await driver.restartApp();
screen = new TabViewNavigationScreen(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;
});
@@ -65,6 +60,13 @@ describe("tab-view-root", async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
if (shared.isApiLevel19(driver) && (transition === "None" || transition === "Flip")) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798
logWarn("Skipping flip or none transition tests on api level 19");
this.skip();
} else {
logWarn(`========= ${root}-${transition} =========`);
}
});
it("loaded home page", async function () {