Merge branch 'master' into vchimev/app-root-frame-hmr-local-styles

This commit is contained in:
Alexander Vakrilov
2019-05-08 10:24:28 +03:00
committed by GitHub
29 changed files with 370 additions and 231 deletions

View File

@ -16,6 +16,7 @@ John Bristowe <john.bristowe@telerik.com>
Joe D <joed@destefano.homelinux.com> Joe D <joed@destefano.homelinux.com>
Kamen Velikov <kamen.velikov@telerik.com> Kamen Velikov <kamen.velikov@telerik.com>
Lubomir Blagoev <lubomir.blagoev@telerik.com> Lubomir Blagoev <lubomir.blagoev@telerik.com>
Luke Curran <luke@pepper.me>
Matt Donovan <unsecurepeax@gmail.com> Matt Donovan <unsecurepeax@gmail.com>
Matthew Knight <anarchicknight@gmail.com> Matthew Knight <anarchicknight@gmail.com>
Mihail Slavchev <mihail.slavchev@telerik.com> Mihail Slavchev <mihail.slavchev@telerik.com>
@ -37,4 +38,4 @@ Vasil Chimev <Vasil.Chimev@telerik.com>
Victor Nascimento <victormota15@gmail.com> Victor Nascimento <victormota15@gmail.com>
Vladimir Enchev <vladimir.enchev@telerik.com> Vladimir Enchev <vladimir.enchev@telerik.com>
Wei Zhang <sagamail@gmail.com> Wei Zhang <sagamail@gmail.com>
Yavor Georgiev <yavor.georgiev@telerik.com> Yavor Georgiev <yavor.georgiev@telerik.com>

View File

@ -1,3 +1,15 @@
## [5.3.2](https://github.com/NativeScript/NativeScript/compare/5.3.1...5.3.2) (2019-05-03)
### Bug Fixes
* no trace message on empty app.css ([#7135](https://github.com/NativeScript/NativeScript/issues/7135)) ([170d2a8](https://github.com/NativeScript/NativeScript/commit/170d2a8))
* **ios:** application.displayedEvent does not depend on trace to fire ([#7141](https://github.com/NativeScript/NativeScript/issues/7141)) ([f6f7b51](https://github.com/NativeScript/NativeScript/commit/f6f7b51))
* **ios:** flat action bar incorrect layout after navigation ([#7077](https://github.com/NativeScript/NativeScript/issues/7077)) ([1dc3952](https://github.com/NativeScript/NativeScript/commit/1dc3952))
* **ios-http-get:** http failure during parsing xml ([#7175](https://github.com/NativeScript/NativeScript/issues/7175)) ([c227c50](https://github.com/NativeScript/NativeScript/commit/c227c50))
## [5.3.1](https://github.com/NativeScript/NativeScript/compare/5.3.0...5.3.1) (2019-03-28) ## [5.3.1](https://github.com/NativeScript/NativeScript/compare/5.3.0...5.3.1) (2019-03-28)

View File

@ -1 +1,2 @@
.vscode/settings.json .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 { Screen } from "./screen";
import { assert } from "chai"; import { assert } from "chai";
describe("animation:", () => { describe("animation:", async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
screen = new Screen(driver); screen = new Screen(driver);
await driver.resetApp(); await driver.resetApp();
}); });
after(async () => { after(async function () {
await driver.quit(); await driver.quit();
console.log("Quit driver!"); 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.loadedHome();
await screen.loadedChainingWithAnimationSet(); 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); const buttonAnimate = await driver.findElementByText("Animate Sequentially", SearchOptions.exact);
await buttonAnimate.click(); await buttonAnimate.click();
@ -39,7 +40,7 @@ describe("animation:", () => {
assert.isTrue(await label.isDisplayed()); assert.isTrue(await label.isDisplayed());
}); });
it ("should reset example", async() => { it("should reset example", async () => {
const buttonReset = await driver.findElementByText("Reset", SearchOptions.exact); const buttonReset = await driver.findElementByText("Reset", SearchOptions.exact);
await buttonReset.click(); await buttonReset.click();
@ -47,7 +48,7 @@ describe("animation:", () => {
assert.isTrue(await label.isDisplayed()); 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); const button = await driver.findElementByText("Animate Simultaneously", SearchOptions.exact);
await button.click(); 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; let driver: AppiumDriver;
before("start server", async () => { before("start server", async function () {
nsCapabilities.testReporter.context = this;
await startServer(); await startServer();
driver = await createDriver(); driver = await createDriver();
await driver.setDontKeepActivities(true); await driver.setDontKeepActivities(true);
}); });
after("stop server", async () => { after("stop server", async function () {
await driver.setDontKeepActivities(false); await driver.setDontKeepActivities(false);
await driver.quit(); await driver.quit();
await stopServer(); await stopServer();

View File

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

View File

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

View File

@ -1 +1,2 @@
.vscode/settings.json .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 { Screen, driverDefaultWaitTime, elementDefaultWaitTimeInSeconds } from "./screen"
import { assert } from "chai"; import { assert } from "chai";
const exampleAndroidBackBtnEvents = "Android Back Btn Events"; const exampleAndroidBackBtnEvents = "Android Back Btn Events";
describe("android-navigate-back", () => { describe("android-navigate-back", async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver); screen = new Screen(driver);
@ -22,7 +23,7 @@ describe("android-navigate-back", () => {
} }
}); });
after(async () => { after(async function () {
await driver.resetApp(); 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 { Screen, driverDefaultWaitTime } from "./screen"
import { import {
roots, roots,
@ -10,21 +10,24 @@ import {
testDialogBackground testDialogBackground
} from "./shared.e2e-spec" } from "./shared.e2e-spec"
describe("modal-frame:", () => { describe("modal-frame:", async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver); screen = new Screen(driver);
}); });
roots.forEach(root => { for (let index = 0; index < roots.length; index++) {
describe(`${root} modal frame background scenarios:`, () => { const root = roots[index];
describe(`${root} modal frame background scenarios:`, async function () {
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
await screen[root](); await screen[root]();
}); });
@ -40,38 +43,38 @@ describe("modal-frame:", () => {
} }
}); });
after(async () => { after(async function () {
await screen.closeModal(); await screen.closeModal();
await screen.loadedHome(); 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); 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); 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); 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); 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); 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); 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); 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 { Screen, driverDefaultWaitTime } from "./screen"
import { import {
roots, roots,
@ -10,21 +10,25 @@ import {
testDialogBackground testDialogBackground
} from "./shared.e2e-spec" } from "./shared.e2e-spec"
describe("modal-layout:", () => { describe("modal-layout:", async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver); screen = new Screen(driver);
}); });
roots.forEach(root => { for (let index = 0; index < roots.length; index++) {
describe(`${root} modal layout background scenarios:`, () => { const root = roots[index];
describe(`${root} modal layout background scenarios:`, async function () {
before(async function () {
nsCapabilities.testReporter.context = this;
before(async () => {
if (driver.isAndroid) { if (driver.isAndroid) {
await driver.resetApp(); await driver.resetApp();
} }
@ -43,38 +47,38 @@ describe("modal-layout:", () => {
} }
}); });
after(async () => { after(async function () {
await screen.closeModal(); await screen.closeModal();
await screen.loadedHome(); 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); 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); 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); 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); 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); 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); 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); 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 { Screen, driverDefaultWaitTime } from "./screen"
import { import {
roots, roots,
@ -9,21 +9,24 @@ import {
testDialogBackground testDialogBackground
} from "./shared.e2e-spec" } from "./shared.e2e-spec"
describe("modal-page:", () => { describe("modal-page:", async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver); screen = new Screen(driver);
}); });
roots.forEach(root => { for (let index = 0; index < roots.length; index++) {
describe(`${root} modal page background scenarios:`, () => { const root = roots[index];
describe(`${root} modal page background scenarios:`, async function () {
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
if (driver.isAndroid) { if (driver.isAndroid) {
await driver.resetApp(); await driver.resetApp();
} }
@ -42,26 +45,26 @@ describe("modal-page:", () => {
} }
}); });
after(async () => { after(async function () {
await screen.closeModal(); await screen.closeModal();
await screen.loadedHome(); 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); 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); 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); 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); 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 { Screen, driverDefaultWaitTime } from "./screen"
import { import {
roots, roots,
@ -17,16 +17,19 @@ describe("modal-tab:", () => {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
screen = new Screen(driver); screen = new Screen(driver);
}); });
roots.forEach(root => { for (let index = 0; index < roots.length; index++) {
describe(`${root} modal tab view background scenarios:`, () => { const root = roots[index];
before(async () => { describe(`${root} modal tab view background scenarios:`, () => {
before(async function () {
nsCapabilities.testReporter.context = this;
if (driver.isAndroid) { if (driver.isAndroid) {
await driver.resetApp(); await driver.resetApp();
} }
@ -45,42 +48,42 @@ describe("modal-tab:", () => {
} }
}); });
after(async () => { after(async function () {
await screen.closeModal(); await screen.closeModal();
await screen.loadedHome(); 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); 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); 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); 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); 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); 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); 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); 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); 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; 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(); await startServer();
driver = await createDriver(); driver = await createDriver();
await driver.setDontKeepActivities(true); await driver.setDontKeepActivities(true);
}); });
after("stop server", async () => { after("stop server", async function () {
nsCapabilities.testReporter.context = this;
await driver.setDontKeepActivities(false); await driver.setDontKeepActivities(false);
await driver.quit(); await driver.quit();
await stopServer(); await stopServer();

View File

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

View File

@ -1 +1,2 @@
.vscode/settings.json .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 { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item, stillOtherPage } from "./screen";
import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config"; import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config";
import * as shared from "./shared.e2e-spec"; import * as shared from "./shared.e2e-spec";
const rootType = "frame-root"; const rootType = "frame-root";
describe(rootType, () => { describe(rootType, async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
screen = new Screen(driver); screen = new Screen(driver);
if (dontKeepActivities) { if (dontKeepActivities) {
@ -19,7 +20,7 @@ describe(rootType, () => {
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
}); });
after(async () => { after(async function () {
if (dontKeepActivities) { if (dontKeepActivities) {
await driver.setDontKeepActivities(false); await driver.setDontKeepActivities(false);
} }
@ -41,8 +42,9 @@ describe(rootType, () => {
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(`${rootType}-transition-${transition}-scenarios:`, () => { describe(`${rootType}-transition-${transition}-scenarios:`, async function () {
before(async function () { before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`==== Transition ${transition}`); logWarn(`==== Transition ${transition}`);
if (transition === "Flip" && if (transition === "Flip" &&
@ -53,20 +55,20 @@ describe(rootType, () => {
} }
}); });
it("loaded home page", async () => { it("loaded home page", async function () {
await screen.loadedHome(); 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.navigateToPageWithFrame();
await screen.loadedPageWithFrame(); await screen.loadedPageWithFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -85,7 +87,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver); 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); await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -102,7 +104,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -129,7 +131,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded home page again", async () => { it("loaded home page again", async function () {
await screen.goBackFromFrameHome(); await screen.goBackFromFrameHome();
await screen.loadedHome(); 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.navigateToPageWithMultiFrame();
await screen.loadedPageWithMultiFrame(); await screen.loadedPageWithMultiFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded teams list", async () => { it("loaded teams list", async function () {
await screen.loadedTeamsList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -171,7 +173,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver); 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); await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -188,7 +190,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -216,19 +218,19 @@ describe(rootType, () => {
await screen.loadedPlayersList(); 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(); await screen.loadedPageWithMultiFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded teams list", async () => { it("loaded teams list", async function () {
await screen.loadedTeamsList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -292,26 +294,30 @@ describe(rootType, () => {
await screen.loadedTeamsList(); await screen.loadedTeamsList();
}); });
it("loaded home page again", async () => { it("loaded home page again", async function () {
await screen.goBackFromFrameHome(); await screen.goBackFromFrameHome();
await screen.loadedHome(); 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"]; 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(); 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.navigateToPageWithFrameNonDefaultTransition();
await screen.loadedPageWithFrame(); await screen.loadedPageWithFrame();
}); });
it ("go back to home page again", async () => { it("go back to home page again", async function () {
if (appSuspendResume) { if (appSuspendResume) {
await driver.backgroundApp(suspendTime); await driver.backgroundApp(suspendTime);
await driver.waitForElement(playerOne.name); // wait for players list await driver.waitForElement(playerOne.name); // wait for players list
@ -322,17 +328,22 @@ describe(rootType, () => {
}); });
}); });
describe("nested frame to frame with non-default transition", () => { describe("nested frame to frame with non-default transition", async function () {
it("loaded home page", async () => {
before(async function () {
nsCapabilities.testReporter.context = this;
});
it("loaded home page", async function () {
await screen.loadedHome(); 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.navigateToPageWithFrame();
await screen.loadedPageWithFrame(); 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); shared.testSomePageNavigatedSlide(screen);
if (appSuspendResume) { 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); shared.testStillOtherPageNavigatedSlide(screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -378,7 +389,7 @@ describe(rootType, () => {
await screen.loadedSomePage(); 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.goBackFromSomePage();
await screen.goBackFromFrameHome(); 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 { Screen, playersData, somePage, teamsData, driverDefaultWaitTime, Item } from "./screen";
import * as shared from "./shared.e2e-spec"; import * as shared from "./shared.e2e-spec";
@ -8,11 +8,12 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
const roots = ["TabTop", "TabBottom"]; const roots = ["TabTop", "TabBottom"];
const rootType = "frame-tab-root"; const rootType = "frame-tab-root";
describe(rootType, () => { describe(rootType, async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async () => {
nsCapabilities.testReporter.context = this;
logWarn(`====== ${rootType} ========`); logWarn(`====== ${rootType} ========`);
driver = await createDriver(); driver = await createDriver();
screen = new Screen(driver); screen = new Screen(driver);
@ -40,7 +41,7 @@ describe(rootType, () => {
for (let index = 0; index < roots.length; index++) { for (let index = 0; index < roots.length; index++) {
const root = roots[index]; const root = roots[index];
describe(`${rootType}-${root} scenarios:`, () => { describe(`${rootType}-${root} scenarios:`, async function () {
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];
@ -49,9 +50,10 @@ describe(rootType, () => {
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(`${rootType}-${root}-transition-${transition}-scenarios:`, () => { describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {
before(async function () { before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`========= ${root}-${transition} =========`); logWarn(`========= ${root}-${transition} =========`);
if (transition === "Flip" && 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 { Screen } from "./screen";
import { suspendTime, dontKeepActivities } from "./config"; import { suspendTime, dontKeepActivities } from "./config";
describe("issues", () => { describe("issues", async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
screen = new Screen(driver); screen = new Screen(driver);
if (dontKeepActivities) { if (dontKeepActivities) {
@ -14,7 +15,7 @@ describe("issues", () => {
} }
}); });
after(async () => { after(async function () {
if (dontKeepActivities) { if (dontKeepActivities) {
await driver.setDontKeepActivities(false); await driver.setDontKeepActivities(false);
} }
@ -29,9 +30,9 @@ describe("issues", () => {
} }
}); });
it("issue-6488", async () => { it("issue-6488", async function () {
await screen.loadedHome(); await screen.loadedHome();
const showSomePage = async () => { const showSomePage = async function () {
const somePageBtn = await driver.waitForElement("somePageOnRoot"); const somePageBtn = await driver.waitForElement("somePageOnRoot");
await somePageBtn.tap(); await somePageBtn.tap();
await screen.loadedSomePage(); 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 { 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";
const rootType = "layout-root"; const rootType = "layout-root";
describe(rootType, () => { describe(rootType, async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver(); driver = await createDriver();
screen = new Screen(driver); screen = new Screen(driver);
logWarn("====== layout-root ========") logWarn("====== layout-root ========")
@ -20,7 +21,7 @@ describe(rootType, () => {
driver.defaultWaitTime = driverDefaultWaitTime; driver.defaultWaitTime = driverDefaultWaitTime;
}); });
after(async () => { after(async function () {
if (dontKeepActivities) { if (dontKeepActivities) {
await driver.setDontKeepActivities(false); await driver.setDontKeepActivities(false);
} }
@ -41,9 +42,10 @@ describe(rootType, () => {
const playerTwo = playersData[`playerTwo${transition}`]; const playerTwo = playersData[`playerTwo${transition}`];
const teamOne = teamsData[`teamOne${transition}`]; const teamOne = teamsData[`teamOne${transition}`];
describe(`${rootType}-transition-${transition}-scenarios:`, () => { describe(`${rootType}-transition-${transition}-scenarios:`, async function () {
before(async function () { before(async function () {
nsCapabilities.testReporter.context = this;
if (transition === "Flip" && if (transition === "Flip" &&
driver.isAndroid && parseInt(driver.platformVersion) === 19) { driver.isAndroid && parseInt(driver.platformVersion) === 19) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 // 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(); 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.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame(); await screen.loadedLayoutWithFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -84,7 +86,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver); 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); await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -101,7 +103,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -128,7 +130,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded home page again", async () => { it("loaded home page again", async function () {
await screen.resetToHome(); await screen.resetToHome();
await screen.loadedHome(); 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.navigateToLayoutWithMultiFrame();
await screen.loadedLayoutWithMultiFrame(); await screen.loadedLayoutWithMultiFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded teams list", async () => { it("loaded teams list", async function () {
await screen.loadedTeamsList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -170,7 +172,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver); 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); await shared[`testSomePageNavigated${transition}`](screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -187,7 +189,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -214,19 +216,19 @@ describe(rootType, () => {
await screen.loadedPlayersList(); 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(); await screen.loadedLayoutWithMultiFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded teams list", async () => { it("loaded teams list", async function () {
await screen.loadedTeamsList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -299,27 +301,27 @@ describe(rootType, () => {
await screen.loadedTeamsList(); await screen.loadedTeamsList();
}); });
it("loaded home page again", async () => { it("loaded home page again", async function () {
await screen.resetToHome(); await screen.resetToHome();
await screen.loadedHome(); 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 playerOne = playersData["playerOneSlide"];
const playerTwo = playersData["playerTwoSlide"]; 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.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame(); await screen.loadedLayoutWithFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded player details with slide", async () => { it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { 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); await shared.testSomePageNavigatedDefault(screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -350,7 +352,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo); await screen.loadedPlayerDetails(playerTwo);
}); });
it("loaded player list", async () => { it("loaded player list", async function () {
await screen.goBackToPlayersList(); await screen.goBackToPlayersList();
if (appSuspendResume) { 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.resetToHome();
await screen.loadedHome(); 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 playerOne = playersData["playerOneSlide"];
const playerTwo = playersData["playerTwoSlide"]; 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.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame(); await screen.loadedLayoutWithFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded player details with slide", async () => { it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { 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); await shared.testSomePageNavigatedNone(screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -409,7 +411,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo); await screen.loadedPlayerDetails(playerTwo);
}); });
it("loaded player list", async () => { it("loaded player list", async function () {
await screen.goBackToPlayersList(); await screen.goBackToPlayersList();
if (appSuspendResume) { 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.resetToHome();
await screen.loadedHome(); 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 playerOne = playersData["playerOneFlip"];
const playerTwo = playersData["playerTwoFlip"]; 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.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame(); await screen.loadedLayoutWithFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded player details with slide", async () => { it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { 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); await shared.testSomePageNavigatedDefault(screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -468,7 +474,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo); await screen.loadedPlayerDetails(playerTwo);
}); });
it("loaded player list", async () => { it("loaded player list", async function () {
await screen.goBackToPlayersList(); await screen.goBackToPlayersList();
if (appSuspendResume) { 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.resetToHome();
await screen.loadedHome(); 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 playerOne = playersData["playerOneFlip"];
const playerTwo = playersData["playerTwoFlip"]; 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.navigateToLayoutWithFrame();
await screen.loadedLayoutWithFrame(); await screen.loadedLayoutWithFrame();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded player details with slide", async () => { it("loaded player details with slide", async function () {
await shared.testPlayerNavigated(playerTwo, screen); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { 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); await shared.testSomePageNavigatedNone(screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -527,7 +537,7 @@ describe(rootType, () => {
await screen.loadedPlayerDetails(playerTwo); await screen.loadedPlayerDetails(playerTwo);
}); });
it("loaded player list", async () => { it("loaded player list", async function () {
await screen.goBackToPlayersList(); await screen.goBackToPlayersList();
if (appSuspendResume) { 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.resetToHome();
await screen.loadedHome(); 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(); await startServer();
}); });
after("stop server", async () => { after("stop server", async function () {
nsCapabilities.testReporter.context = this;
await stopServer(); 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 { Screen, playersData, teamsData } from "./screen";
import * as shared from "./shared.e2e-spec"; import * as shared from "./shared.e2e-spec";
@ -8,11 +8,12 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "
const roots = ["TabTop", "TabBottom"]; const roots = ["TabTop", "TabBottom"];
const rootType = "tab-root"; const rootType = "tab-root";
describe(rootType, () => { describe(rootType, async function () {
let driver: AppiumDriver; let driver: AppiumDriver;
let screen: Screen; let screen: Screen;
before(async () => { before(async function () {
nsCapabilities.testReporter.context = this;
logWarn(`====== ${rootType} ========`) logWarn(`====== ${rootType} ========`)
driver = await createDriver(); driver = await createDriver();
screen = new Screen(driver); screen = new Screen(driver);
@ -23,7 +24,7 @@ describe(rootType, () => {
driver.defaultWaitTime = 8000; driver.defaultWaitTime = 8000;
}); });
after(async () => { after(async function () {
if (dontKeepActivities) { if (dontKeepActivities) {
await driver.setDontKeepActivities(false); await driver.setDontKeepActivities(false);
} }
@ -39,7 +40,11 @@ describe(rootType, () => {
for (let index = 0; index < roots.length; index++) { for (let index = 0; index < roots.length; index++) {
const root = roots[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++) { for (let index = 0; index < transitions.length; index++) {
const transition = transitions[index]; const transition = transitions[index];
@ -49,9 +54,11 @@ describe(rootType, () => {
const teamOne = teamsData[`teamOne${transition}`]; const teamOne = teamsData[`teamOne${transition}`];
const teamTwo = teamsData[`teamTwo${transition}`]; const teamTwo = teamsData[`teamTwo${transition}`];
describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => { describe(`${rootType}-${root}-transition-${transition}-scenarios:`, async function () {
before(async function () { before(async function () {
nsCapabilities.testReporter.context = this;
if (transition === "Flip" && if (transition === "Flip" &&
driver.isAndroid && parseInt(driver.platformVersion) === 19) { driver.isAndroid && parseInt(driver.platformVersion) === 19) {
// TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 // 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(); 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[`navigateTo${root}RootWithFrames`]();
await screen[`loaded${root}RootWithFrames`](); await screen[`loaded${root}RootWithFrames`]();
}); });
it("loaded players list", async () => { it("loaded players list", async function () {
await screen.loadedPlayersList(); 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); await shared.testPlayerNavigated(playerTwo, screen);
if (appSuspendResume) { if (appSuspendResume) {
@ -92,7 +99,7 @@ describe(rootType, () => {
await shared.testPlayerNavigatedBack(screen, driver); await shared.testPlayerNavigatedBack(screen, driver);
}); });
it("toggle teams tab", async () => { it("toggle teams tab", async function () {
await screen.toggleTeamsTab(); await screen.toggleTeamsTab();
if (appSuspendResume) { if (appSuspendResume) {
@ -101,11 +108,11 @@ describe(rootType, () => {
} }
}); });
it("loaded teams list", async () => { it("loaded teams list", async function () {
await screen.loadedTeamsList(); 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(); await screen.togglePlayersTab();
if (appSuspendResume) { if (appSuspendResume) {
@ -163,7 +170,7 @@ describe(rootType, () => {
await screen.loadedPlayersList(); await screen.loadedPlayersList();
}); });
it("loaded home page again", async () => { it("loaded home page again", async function () {
await screen.resetToHome(); await screen.resetToHome();
await screen.loadedHome(); await screen.loadedHome();
}); });

View File

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

View File

@ -26,7 +26,6 @@
"grunt-simple-mocha": "0.4.1", "grunt-simple-mocha": "0.4.1",
"grunt-ts": "6.0.0-beta.11", "grunt-ts": "6.0.0-beta.11",
"grunt-typedoc": "0.2.4", "grunt-typedoc": "0.2.4",
"http-server": "^0.9.0",
"madge": "^2.2.0", "madge": "^2.2.0",
"markdown-snippet-injector": "0.2.2", "markdown-snippet-injector": "0.2.2",
"mocha": "^3.5.0", "mocha": "^3.5.0",

View File

@ -189,6 +189,9 @@ allTests["TAB-VIEW-NAVIGATION"] = tabViewNavigationTests;
import * as imageTests from "./ui/image/image-tests"; import * as imageTests from "./ui/image/image-tests";
allTests["IMAGE"] = imageTests; allTests["IMAGE"] = imageTests;
import * as imageCacheTests from "./ui/image-cache/image-cache-tests";
allTests["IMAGE-CACHE"] = imageCacheTests;
import * as sliderTests from "./ui/slider/slider-tests"; import * as sliderTests from "./ui/slider/slider-tests";
allTests["SLIDER"] = sliderTests; allTests["SLIDER"] = sliderTests;

View File

@ -1,25 +1,21 @@
// >> image-cache-require import * as imageCacheModule from "tns-core-modules/ui/image-cache";
import * as imageCacheModule from "tns-core-modules/ui/image-cache";
import * as imageSource from "tns-core-modules/image-source"; import * as imageSource from "tns-core-modules/image-source";
import * as fs from "tns-core-modules/file-system"; import * as types from "tns-core-modules/utils/types";
// << image-cache-require import * as TKUnit from "../../TKUnit";
export function test_DummyTestForSnippetOnly() { export const test_ImageCache_ValidUrl = function() {
// >> image-cache-request-images const cache = new imageCacheModule.Cache();
var cache = new imageCacheModule.Cache();
cache.placeholder = imageSource.fromFile(fs.path.join(__dirname, "res/no-image.png"));
cache.maxRequests = 5; cache.maxRequests = 5;
// Enable download while not scrolling let validKey: string;
cache.enableDownload();
let imgSource: imageSource.ImageSource;
var imgSouce: imageSource.ImageSource; const url = "https://github.com/NativeScript.png";
var url = "https://github.com/NativeScript.png";
// Try to read the image from the cache // Try to read the image from the cache
var image = cache.get(url); const image = cache.get(url);
if (image) { if (image) {
// If present -- use it. // If present -- use it.
imgSouce = imageSource.fromNativeSource(image); imgSource = imageSource.fromNativeSource(image);
} }
else { else {
// If not present -- request its download. // If not present -- request its download.
@ -28,13 +24,51 @@ export function test_DummyTestForSnippetOnly() {
url: url, url: url,
completed: (image: any, key: string) => { completed: (image: any, key: string) => {
if (url === key) { if (url === key) {
imgSouce = imageSource.fromNativeSource(image); imgSource = imageSource.fromNativeSource(image);
validKey = key;
console.log("Valid url: ", key);
} }
} }
}); });
} }
// Disable download while scrolling TKUnit.waitUntilReady(() => types.isDefined(validKey), 8);
cache.disableDownload(); TKUnit.assertEqual(validKey, url, "Key should equal the provided url");
// << image-cache-request-images }
export const test_ImageCache_NothingAtProvidedUrl = function() {
const cache = new imageCacheModule.Cache();
cache.maxRequests = 5;
let errorCaught = false;
let errorMessage: string;
let imgSource: imageSource.ImageSource;
const url = "https://github.com/NativeScript-NoImage.png";
// Try to read the image from the cache
const image = cache.get(url);
if (image) {
// If present -- use it.
imgSource = imageSource.fromNativeSource(image);
}
else {
// If not present -- request its download.
cache.push({
key: url,
url: url,
completed: (image: any, key: string) => {
if (url === key) {
imgSource = imageSource.fromNativeSource(image);
}
},
error: (key: string) => {
console.log("No image for key: ", key);
errorMessage = `No image for key: ${key}`;
errorCaught = true;
}
});
}
TKUnit.waitUntilReady(() => errorCaught);
TKUnit.assertEqual(`No image for key: ${url}`, errorMessage);
} }

View File

@ -197,11 +197,21 @@ export function request(options: httpModule.HttpRequestOptions): Promise<httpMod
} }
function NSDataToString(data: any, encoding?: HttpResponseEncoding): string { function NSDataToString(data: any, encoding?: HttpResponseEncoding): string {
let code = 4; //UTF8 let code = NSUTF8StringEncoding; // long:4
if (encoding === HttpResponseEncoding.GBK) { if (encoding === HttpResponseEncoding.GBK) {
code = 1586; code = CFStringEncodings.kCFStringEncodingGB_18030_2000; // long:1586
} }
return NSString.alloc().initWithDataEncoding(data, code).toString();
let encodedString = NSString.alloc().initWithDataEncoding(data, code);
// If UTF8 string encoding fails try with ISO-8859-1
if (!encodedString) {
code = NSISOLatin1StringEncoding; // long:5
encodedString = NSString.alloc().initWithDataEncoding(data, code);
}
return encodedString.toString();
} }
export function addHeader(headers: httpModule.Headers, key: string, value: string): void { export function addHeader(headers: httpModule.Headers, key: string, value: string): void {

View File

@ -91,6 +91,7 @@ export class Button extends ButtonBase {
this._highlightedHandler = this._highlightedHandler || ((args: TouchGestureEventData) => { this._highlightedHandler = this._highlightedHandler || ((args: TouchGestureEventData) => {
switch (args.action) { switch (args.action) {
case TouchAction.up: case TouchAction.up:
case TouchAction.cancel:
this._goToVisualState("normal"); this._goToVisualState("normal");
break; break;
case TouchAction.down: case TouchAction.down:

View File

@ -72,7 +72,11 @@ export class Cache extends common.Cache {
.then((response) => { .then((response) => {
try { try {
const image = UIImage.alloc().initWithData(response.content.raw); const image = UIImage.alloc().initWithData(response.content.raw);
this._onDownloadCompleted(request.key, image); if (image) {
this._onDownloadCompleted(request.key, image);
} else {
this._onDownloadError(request.key, new Error("No result for provided url"));
}
} catch (err) { } catch (err) {
this._onDownloadError(request.key, err); this._onDownloadError(request.key, err);
} }