Merge pull request #7216 from NativeScript/merge-release-in-master

chore: merge release in master
This commit is contained in:
Svetoslav
2019-05-07 11:52:00 +02:00
committed by GitHub
21 changed files with 280 additions and 205 deletions

View File

@ -1 +1,2 @@
.vscode/settings.json
mochawesome-report

View File

@ -1,20 +1,21 @@
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium";
import { Screen } from "./screen";
import { assert } from "chai";
describe("animation:", () => {
describe("animation:", async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
screen = new Screen(driver);
await driver.resetApp();
});
after(async () => {
after(async function () {
await driver.quit();
console.log("Quit driver!");
});
@ -26,12 +27,12 @@ describe("animation:", () => {
}
});
it("should navigate to chaining with animation set example", async () => {
it("should navigate to chaining with animation set example", async function () {
await screen.loadedHome();
await screen.loadedChainingWithAnimationSet();
});
it("should play animation sequentially", async () => {
it("should play animation sequentially", async function () {
const buttonAnimate = await driver.findElementByText("Animate Sequentially", SearchOptions.exact);
await buttonAnimate.click();
@ -39,7 +40,7 @@ describe("animation:", () => {
assert.isTrue(await label.isDisplayed());
});
it ("should reset example", async() => {
it("should reset example", async () => {
const buttonReset = await driver.findElementByText("Reset", SearchOptions.exact);
await buttonReset.click();
@ -47,7 +48,7 @@ describe("animation:", () => {
assert.isTrue(await label.isDisplayed());
});
it("should play animation simultaneously", async () => {
it("should play animation simultaneously", async function () {
const button = await driver.findElementByText("Animate Simultaneously", SearchOptions.exact);
await button.click();

View File

@ -1,14 +1,22 @@
import { AppiumDriver, createDriver, startServer, stopServer } from "nativescript-dev-appium";
import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType, AppiumDriver, createDriver } from "nativescript-dev-appium";
const addContext = require("mochawesome/addContext");
const testReporterContext = <ITestReporter>{};
testReporterContext.name = "mochawesome";
testReporterContext.reportDir = "mochawesome-report";
testReporterContext.log = addContext;
testReporterContext.logImageTypes = [LogImageType.screenshots];
nsCapabilities.testReporter = testReporterContext;
let driver: AppiumDriver;
before("start server", async () => {
before("start server", async function () {
nsCapabilities.testReporter.context = this;
await startServer();
driver = await createDriver();
await driver.setDontKeepActivities(true);
});
after("stop server", async () => {
after("stop server", async function () {
await driver.setDontKeepActivities(false);
await driver.quit();
await stopServer();

View File

@ -17,16 +17,15 @@
"tns-core-modules": "next"
},
"devDependencies": {
"@types/chai": "~4.1.3",
"@types/mocha": "~5.2.1",
"@types/node": "10.11.4",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11",
"mocha": "~5.1.0",
"mocha-junit-reporter": "~1.17.0",
"mocha-multi": "~1.0.0",
"mocha": "~5.2.0",
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-typescript": "next",
"nativescript-dev-webpack": "next"

View File

@ -1,4 +1,5 @@
--timeout 300000
--recursive e2e
--reporter mocha-multi
--reporter-options spec=-,mocha-junit-reporter=test-results.xml
--reporter mochawesome
--reporter-options quiet=true,html=true,inline=true,autoOpen=true
--exit

View File

@ -1 +1,2 @@
.vscode/settings.json
mochawesome-report

View File

@ -1,14 +1,15 @@
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium";
import { Screen, driverDefaultWaitTime, elementDefaultWaitTimeInSeconds } from "./screen"
import { assert } from "chai";
const exampleAndroidBackBtnEvents = "Android Back Btn Events";
describe("android-navigate-back", () => {
describe("android-navigate-back", async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver);
@ -22,7 +23,7 @@ describe("android-navigate-back", () => {
}
});
after(async () => {
after(async function () {
await driver.resetApp();
});

View File

@ -1,4 +1,4 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { Screen, driverDefaultWaitTime } from "./screen"
import {
roots,
@ -10,21 +10,24 @@ import {
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-frame:", () => {
describe("modal-frame:", async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver);
});
roots.forEach(root => {
describe(`${root} modal frame background scenarios:`, () => {
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${root} modal frame background scenarios:`, async function () {
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
await screen[root]();
});
@ -40,38 +43,38 @@ describe("modal-frame:", () => {
}
});
after(async () => {
after(async function () {
await screen.closeModal();
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
it("should show dialog confirm, run in background", async function () {
await testDialogBackground(driver, screen);
});
it("should run modal page with frame in background", async () => {
it("should run modal page with frame in background", async function () {
await modalFrameBackground(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
it("should navigate to second page, run in background, go back", async function () {
await testSecondPageBackground(driver, screen);
});
it("should show nested modal page with frame, run in background, close", async () => {
it("should show nested modal page with frame, run in background, close", async function () {
await testNestedModalFrameBackground(driver, screen);
});
it("should show nested modal page, run in background, close", async () => {
it("should show nested modal page, run in background, close", async function () {
await testNestedModalPageBackground(driver, screen);
});
it("should navigate to second page, close", async () => {
it("should navigate to second page, close", async function () {
await testSecondPageClose(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
it("should navigate to second page, run in background, go back", async function () {
await testSecondPageBackground(driver, screen);
});
});
});
};
});

View File

@ -1,4 +1,4 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { Screen, driverDefaultWaitTime } from "./screen"
import {
roots,
@ -10,21 +10,25 @@ import {
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-layout:", () => {
describe("modal-layout:", async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver);
});
roots.forEach(root => {
describe(`${root} modal layout background scenarios:`, () => {
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${root} modal layout background scenarios:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
before(async () => {
if (driver.isAndroid) {
await driver.resetApp();
}
@ -43,38 +47,38 @@ describe("modal-layout:", () => {
}
});
after(async () => {
after(async function () {
await screen.closeModal();
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
it("should show dialog confirm, run in background", async function () {
await testDialogBackground(driver, screen);
});
it("should run modal layout in background", async () => {
it("should run modal layout in background", async function () {
await modalFrameBackground(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
it("should navigate to second page, run in background, go back", async function () {
await testSecondPageBackground(driver, screen);
});
it("should show nested modal page with frame, run in background, close", async () => {
it("should show nested modal page with frame, run in background, close", async function () {
await testNestedModalFrameBackground(driver, screen);
});
it("should show nested modal page, run in background, close", async () => {
it("should show nested modal page, run in background, close", async function () {
await testNestedModalPageBackground(driver, screen);
});
it("should navigate to second page, close", async () => {
it("should navigate to second page, close", async function () {
await testSecondPageClose(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
it("should navigate to second page, run in background, go back", async function () {
await testSecondPageBackground(driver, screen);
});
});
});
};
});

View File

@ -1,4 +1,4 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { Screen, driverDefaultWaitTime } from "./screen"
import {
roots,
@ -9,21 +9,24 @@ import {
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-page:", () => {
describe("modal-page:", async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver);
});
roots.forEach(root => {
describe(`${root} modal page background scenarios:`, () => {
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${root} modal page background scenarios:`, async function () {
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
if (driver.isAndroid) {
await driver.resetApp();
}
@ -42,26 +45,26 @@ describe("modal-page:", () => {
}
});
after(async () => {
after(async function () {
await screen.closeModal();
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
it("should show dialog confirm, run in background", async function () {
await testDialogBackground(driver, screen, false);
});
it("should run modal page in background", async () => {
it("should run modal page in background", async function () {
await modalPageBackground(driver, screen, false);
});
it("should show nested modal page with frame, run in background, close", async () => {
it("should show nested modal page with frame, run in background, close", async function () {
await testNestedModalFrameBackground(driver, screen, false);
});
it("should show nested modal page, run in background, close", async () => {
it("should show nested modal page, run in background, close", async function () {
await testNestedModalPageBackground(driver, screen, false);
});
});
});
};
});

View File

@ -1,4 +1,4 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { Screen, driverDefaultWaitTime } from "./screen"
import {
roots,
@ -17,16 +17,19 @@ describe("modal-tab:", () => {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver);
});
roots.forEach(root => {
describe(`${root} modal tab view background scenarios:`, () => {
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
before(async () => {
describe(`${root} modal tab view background scenarios:`, () => {
before(async function () {
nsCapabilities.testReporter.context = this;
if (driver.isAndroid) {
await driver.resetApp();
}
@ -45,42 +48,42 @@ describe("modal-tab:", () => {
}
});
after(async () => {
after(async function () {
await screen.closeModal();
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
it("should show dialog confirm, run in background", async function () {
await testDialogBackground(driver, screen);
});
it("should run modal tab view in background", async () => {
it("should run modal tab view in background", async function () {
await modalTabViewBackground(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
it("should navigate to second page, run in background, go back", async function () {
await testSecondPageBackground(driver, screen);
});
it("should show nested modal page with frame, run in background, close", async () => {
it("should show nested modal page with frame, run in background, close", async function () {
await testNestedModalFrameBackground(driver, screen);
});
it("should show nested modal page, run in background, close", async () => {
it("should show nested modal page, run in background, close", async function () {
await testNestedModalPageBackground(driver, screen);
});
it("should navigate to second item, run in background, navigate back to first item", async () => {
it("should navigate to second item, run in background, navigate back to first item", async function () {
await testSecondItemBackground(driver, screen);
});
it("should navigate to second page, close", async () => {
it("should navigate to second page, close", async function () {
await testSecondPageClose(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
it("should navigate to second page, run in background, go back", async function () {
await testSecondPageBackground(driver, screen);
});
});
});
};
});

View File

@ -1,14 +1,24 @@
import { AppiumDriver, createDriver, startServer, stopServer } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, startServer, stopServer, LogImageType, ITestReporter, nsCapabilities } from "nativescript-dev-appium";
const addContext = require("mochawesome/addContext");
let driver: AppiumDriver;
before("start server", async () => {
const testReporterContext = <ITestReporter>{};
testReporterContext.name = "mochawesome";
testReporterContext.reportDir = "mochawesome-report";
testReporterContext.log = addContext;
testReporterContext.logImageTypes = [LogImageType.screenshots];
nsCapabilities.testReporter = testReporterContext;
before("start server", async function () {
nsCapabilities.testReporter.context = this;
await startServer();
driver = await createDriver();
await driver.setDontKeepActivities(true);
});
after("stop server", async () => {
after("stop server", async function () {
nsCapabilities.testReporter.context = this;
await driver.setDontKeepActivities(false);
await driver.quit();
await stopServer();

View File

@ -17,12 +17,11 @@
"tns-core-modules": "next"
},
"devDependencies": {
"@types/chai": "~4.1.3",
"@types/mocha": "~5.2.1",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "^7.0.5",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi": "^1.0.1",
"mocha": "~5.2.0",
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-typescript": "next",
"nativescript-dev-webpack": "next",

View File

@ -1 +1,2 @@
.vscode/settings.json
mochawesome-report

View File

@ -1,15 +1,16 @@
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
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";
const rootType = "frame-root";
describe(rootType, () => {
describe(rootType, async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
screen = new Screen(driver);
if (dontKeepActivities) {
@ -19,7 +20,7 @@ describe(rootType, () => {
driver.defaultWaitTime = driverDefaultWaitTime;
});
after(async () => {
after(async function () {
if (dontKeepActivities) {
await driver.setDontKeepActivities(false);
}
@ -41,8 +42,9 @@ describe(rootType, () => {
const teamOne: Item = teamsData[`teamOne${transition}`];
const teamTwo: Item = teamsData[`teamTwo${transition}`];
describe(`${rootType}-transition-${transition}-scenarios:`, () => {
describe(`${rootType}-transition-${transition}-scenarios:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`==== Transition ${transition}`);
if (transition === "Flip" &&
@ -53,20 +55,20 @@ describe(rootType, () => {
}
});
it("loaded home page", async () => {
it("loaded home page", async function () {
await screen.loadedHome();
});
it("loaded frame root with nested frame", async () => {
it("loaded frame root with nested frame", async function () {
await screen.navigateToPageWithFrame();
await screen.loadedPageWithFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details and go back twice", async () => {
it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -85,7 +87,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver);
});
it("navigate parent frame and go back", async () => {
it("navigate parent frame and go back", async function () {
await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) {
@ -102,7 +104,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded player details and navigate parent frame and go back", async () => {
it("loaded player details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -129,7 +131,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.goBackFromFrameHome();
await screen.loadedHome();
@ -139,20 +141,20 @@ describe(rootType, () => {
}
});
it("loaded frame root with multi nested frames", async () => {
it("loaded frame root with multi nested frames", async function () {
await screen.navigateToPageWithMultiFrame();
await screen.loadedPageWithMultiFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded teams list", async () => {
it("loaded teams list", async function () {
await screen.loadedTeamsList();
});
it("loaded player details and go back twice", async () => {
it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -171,7 +173,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver);
});
it("navigate players parent frame and go back", async () => {
it("navigate players parent frame and go back", async function () {
await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) {
@ -188,7 +190,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded players details and navigate parent frame and go back", async () => {
it("loaded players details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -216,19 +218,19 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded frame root with multi nested frames again", async () => {
it("loaded frame root with multi nested frames again", async function () {
await screen.loadedPageWithMultiFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded teams list", async () => {
it("loaded teams list", async function () {
await screen.loadedTeamsList();
});
it("mix player and team list actions and go back", async () => {
it("mix player and team list actions and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -292,26 +294,30 @@ describe(rootType, () => {
await screen.loadedTeamsList();
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.goBackFromFrameHome();
await screen.loadedHome();
});
});
}
describe("frame to nested frame with non-default transition", () => {
describe("frame to nested frame with non-default transition", async function () {
const playerOne = playersData["playerOneSlide"];
it("loaded home page", async () => {
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 () => {
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 () => {
it("go back to home page again", async function () {
if (appSuspendResume) {
await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerOne.name); // wait for players list
@ -322,17 +328,22 @@ describe(rootType, () => {
});
});
describe("nested frame to frame with non-default transition", () => {
it("loaded home page", async () => {
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 () => {
it("loaded frame root with nested frame", async function () {
await screen.navigateToPageWithFrame();
await screen.loadedPageWithFrame();
});
it("navigate to some page with slide transition", async () => {
it("navigate to some page with slide transition", async function () {
shared.testSomePageNavigatedSlide(screen);
if (appSuspendResume) {
@ -341,7 +352,7 @@ describe(rootType, () => {
}
});
it("navigate to still other page and go back twice", async () => {
it("navigate to still other page and go back twice", async function () {
shared.testStillOtherPageNavigatedSlide(screen);
if (appSuspendResume) {
@ -378,7 +389,7 @@ describe(rootType, () => {
await screen.loadedSomePage();
});
it("go back to home page again", async () => {
it("go back to home page again", async function () {
await screen.goBackFromSomePage();
await screen.goBackFromFrameHome();

View File

@ -1,4 +1,4 @@
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
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";
@ -8,11 +8,12 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
const roots = ["TabTop", "TabBottom"];
const rootType = "frame-tab-root";
describe(rootType, () => {
describe(rootType, async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
nsCapabilities.testReporter.context = this;
logWarn(`====== ${rootType} ========`);
driver = await createDriver();
screen = new Screen(driver);
@ -40,7 +41,7 @@ describe(rootType, () => {
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${rootType}-${root} scenarios:`, () => {
describe(`${rootType}-${root} scenarios:`, async function () {
logWarn(`===== Root: ${root}`);
for (let trIndex = 0; trIndex < transitions.length; trIndex++) {
const transition = transitions[trIndex];
@ -49,9 +50,10 @@ describe(rootType, () => {
const teamOne: Item = teamsData[`teamOne${transition}`];
const teamTwo: Item = teamsData[`teamTwo${transition}`];
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => {
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`========= ${root}-${transition} =========`);
if (transition === "Flip" &&

View File

@ -1,12 +1,13 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { Screen } from "./screen";
import { suspendTime, dontKeepActivities } from "./config";
describe("issues", () => {
describe("issues", async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
screen = new Screen(driver);
if (dontKeepActivities) {
@ -14,7 +15,7 @@ describe("issues", () => {
}
});
after(async () => {
after(async function () {
if (dontKeepActivities) {
await driver.setDontKeepActivities(false);
}
@ -29,9 +30,9 @@ describe("issues", () => {
}
});
it("issue-6488", async () => {
it("issue-6488", async function () {
await screen.loadedHome();
const showSomePage = async () => {
const showSomePage = async function () {
const somePageBtn = await driver.waitForElement("somePageOnRoot");
await somePageBtn.tap();
await screen.loadedSomePage();

View File

@ -1,15 +1,16 @@
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
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";
const rootType = "layout-root";
describe(rootType, () => {
describe(rootType, async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
screen = new Screen(driver);
logWarn("====== layout-root ========")
@ -20,7 +21,7 @@ describe(rootType, () => {
driver.defaultWaitTime = driverDefaultWaitTime;
});
after(async () => {
after(async function () {
if (dontKeepActivities) {
await driver.setDontKeepActivities(false);
}
@ -41,9 +42,10 @@ describe(rootType, () => {
const playerTwo = playersData[`playerTwo${transition}`];
const teamOne = teamsData[`teamOne${transition}`];
describe(`${rootType}-transition-${transition}-scenarios:`, () => {
describe(`${rootType}-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
@ -52,20 +54,20 @@ describe(rootType, () => {
}
});
it("loaded home page", async () => {
it("loaded home page", async function () {
await screen.loadedHome();
});
it("loaded layout root with nested frames", async () => {
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details and go back twice", async () => {
it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -84,7 +86,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver);
});
it("navigate parent frame and go back", async () => {
it("navigate parent frame and go back", async function () {
await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) {
@ -101,7 +103,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded player details and navigate parent frame and go back", async () => {
it("loaded player details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -128,7 +130,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
@ -138,20 +140,20 @@ describe(rootType, () => {
}
});
it("loaded layout root with multi nested frames", async () => {
it("loaded layout root with multi nested frames", async function () {
await screen.navigateToLayoutWithMultiFrame();
await screen.loadedLayoutWithMultiFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded teams list", async () => {
it("loaded teams list", async function () {
await screen.loadedTeamsList();
});
it("loaded player details and go back twice", async () => {
it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -170,7 +172,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver);
});
it("navigate players parent frame and go back", async () => {
it("navigate players parent frame and go back", async function () {
await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) {
@ -187,7 +189,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded players details and navigate parent frame and go back", async () => {
it("loaded players details and navigate parent frame and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -214,19 +216,19 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded layout root with multi nested frames again", async () => {
it("loaded layout root with multi nested frames again", async function () {
await screen.loadedLayoutWithMultiFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded teams list", async () => {
it("loaded teams list", async function () {
await screen.loadedTeamsList();
});
it("mix player and team list actions and go back", async () => {
it("mix player and team list actions and go back", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -299,27 +301,27 @@ describe(rootType, () => {
await screen.loadedTeamsList();
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});
});
};
describe(`${rootType}-players-list-slide-transition with parent frame default transition:`, () => {
describe(`${rootType}-players-list-slide-transition with parent frame default transition:`, async function () {
const playerOne = playersData["playerOneSlide"];
const playerTwo = playersData["playerTwoSlide"];
it("loaded layout root with nested frames", async () => {
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details with slide", async () => {
it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -328,7 +330,7 @@ describe(rootType, () => {
}
});
it("navigate parent frame and go back", async () => {
it("navigate parent frame and go back", async function () {
await shared.testSomePageNavigatedDefault(screen);
if (appSuspendResume) {
@ -350,7 +352,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo);
});
it("loaded player list", async () => {
it("loaded player list", async function () {
await screen.goBackToPlayersList();
if (appSuspendResume) {
@ -359,26 +361,26 @@ describe(rootType, () => {
}
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});
});
describe(`${rootType}-players-list-slide-transition with parent frame no transition:`, () => {
describe(`${rootType}-players-list-slide-transition with parent frame no transition:`, async function () {
const playerOne = playersData["playerOneSlide"];
const playerTwo = playersData["playerTwoSlide"];
it("loaded layout root with nested frames", async () => {
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details with slide", async () => {
it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -387,7 +389,7 @@ describe(rootType, () => {
}
});
it("navigate parent frame and go back", async () => {
it("navigate parent frame and go back", async function () {
await shared.testSomePageNavigatedNone(screen);
if (appSuspendResume) {
@ -409,7 +411,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo);
});
it("loaded player list", async () => {
it("loaded player list", async function () {
await screen.goBackToPlayersList();
if (appSuspendResume) {
@ -418,26 +420,30 @@ describe(rootType, () => {
}
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});
});
describe(`${rootType}-players-list-flip-transition with parent frame default transition:`, () => {
describe(`${rootType}-players-list-flip-transition with parent frame default transition:`, async function () {
const playerOne = playersData["playerOneFlip"];
const playerTwo = playersData["playerTwoFlip"];
it("loaded layout root with nested frames", async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
});
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details with slide", async () => {
it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -446,7 +452,7 @@ describe(rootType, () => {
}
});
it("navigate parent frame and go back", async () => {
it("navigate parent frame and go back", async function () {
await shared.testSomePageNavigatedDefault(screen);
if (appSuspendResume) {
@ -468,7 +474,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo);
});
it("loaded player list", async () => {
it("loaded player list", async function () {
await screen.goBackToPlayersList();
if (appSuspendResume) {
@ -477,26 +483,30 @@ describe(rootType, () => {
}
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});
});
describe(`${rootType}-players-list-flip-transition with parent frame no transition:`, () => {
describe(`${rootType}-players-list-flip-transition with parent frame no transition:`, async function () {
const playerOne = playersData["playerOneFlip"];
const playerTwo = playersData["playerTwoFlip"];
it("loaded layout root with nested frames", async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
});
it("loaded layout root with nested frames", async function () {
await screen.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details with slide", async () => {
it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -505,7 +515,7 @@ describe(rootType, () => {
}
});
it("navigate parent frame and go back", async () => {
it("navigate parent frame and go back", async function () {
await shared.testSomePageNavigatedNone(screen);
if (appSuspendResume) {
@ -527,7 +537,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo);
});
it("loaded player list", async () => {
it("loaded player list", async function () {
await screen.goBackToPlayersList();
if (appSuspendResume) {
@ -536,7 +546,7 @@ describe(rootType, () => {
}
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});

View File

@ -1,9 +1,19 @@
import { startServer, stopServer } from "nativescript-dev-appium";
import { startServer, stopServer, nsCapabilities, ITestReporter, LogImageType } from "nativescript-dev-appium";
const addContext = require("mochawesome/addContext");
before("start server", async () => {
const testReporterContext = <ITestReporter>{};
testReporterContext.name = "mochawesome";
testReporterContext.reportDir = "mochawesome-report";
testReporterContext.log = addContext;
testReporterContext.logImageTypes = [LogImageType.screenshots];
nsCapabilities.testReporter = testReporterContext;
before("start server", async function () {
nsCapabilities.testReporter.context = this;
await startServer();
});
after("stop server", async () => {
after("stop server", async function () {
nsCapabilities.testReporter.context = this;
await stopServer();
});

View File

@ -1,4 +1,4 @@
import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, logWarn, nsCapabilities } from "nativescript-dev-appium";
import { Screen, playersData, teamsData } from "./screen";
import * as shared from "./shared.e2e-spec";
@ -8,11 +8,12 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
const roots = ["TabTop", "TabBottom"];
const rootType = "tab-root";
describe(rootType, () => {
describe(rootType, async function () {
let driver: AppiumDriver;
let screen: Screen;
before(async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`====== ${rootType} ========`)
driver = await createDriver();
screen = new Screen(driver);
@ -23,7 +24,7 @@ describe(rootType, () => {
driver.defaultWaitTime = 8000;
});
after(async () => {
after(async function () {
if (dontKeepActivities) {
await driver.setDontKeepActivities(false);
}
@ -39,7 +40,11 @@ describe(rootType, () => {
for (let index = 0; index < roots.length; index++) {
const root = roots[index];
describe(`${rootType}-${root}-scenarios:`, () => {
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];
@ -49,9 +54,11 @@ describe(rootType, () => {
const teamOne = teamsData[`teamOne${transition}`];
const teamTwo = teamsData[`teamTwo${transition}`];
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => {
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
@ -60,20 +67,20 @@ describe(rootType, () => {
}
});
it("loaded home page", async () => {
it("loaded home page", async function () {
await screen.loadedHome();
});
it(`loaded ${root} root with frames`, async () => {
it(`loaded ${root} root with frames`, async function () {
await screen[`navigateTo${root}RootWithFrames`]();
await screen[`loaded${root}RootWithFrames`]();
});
it("loaded players list", async () => {
it("loaded players list", async function () {
await screen.loadedPlayersList();
});
it("loaded player details and go back twice", async () => {
it("loaded player details and go back twice", async function () {
await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) {
@ -92,7 +99,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver);
});
it("toggle teams tab", async () => {
it("toggle teams tab", async function () {
await screen.toggleTeamsTab();
if (appSuspendResume) {
@ -101,11 +108,11 @@ describe(rootType, () => {
}
});
it("loaded teams list", async () => {
it("loaded teams list", async function () {
await screen.loadedTeamsList();
});
it("mix player and team list actions and go back", async () => {
it("mix player and team list actions and go back", async function () {
await screen.togglePlayersTab();
if (appSuspendResume) {
@ -163,7 +170,7 @@ describe(rootType, () => {
await screen.loadedPlayersList();
});
it("loaded home page again", async () => {
it("loaded home page again", async function () {
await screen.resetToHome();
await screen.loadedHome();
});

View File

@ -17,12 +17,11 @@
"tns-core-modules": "next"
},
"devDependencies": {
"@types/chai": "~4.1.3",
"@types/mocha": "~5.2.1",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "^7.0.5",
"mocha": "^5.2.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi": "^1.0.1",
"mocha": "~5.2.0",
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-typescript": "next",
"nativescript-dev-webpack": "next",