diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a955ef1f..bba452911 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## [7.2.4](https://github.com/NativeScript/nativescript-angular/compare/7.2.3...7.2.4) (2019-04-24) + + +### Bug Fixes + +* **router:** routing services should be provided in forRoot only ([#1729](https://github.com/NativeScript/nativescript-angular/issues/1729)) ([0f6a975](https://github.com/NativeScript/nativescript-angular/commit/0f6a975)) +* ngOnDestroy not called on Android back button ([#923](https://github.com/NativeScript/nativescript-angular/issues/923)) + + +### Features + +* **modal:** add ‘ios presentationStyle’ option to ModalDialogParams ([9cfa127](https://github.com/NativeScript/nativescript-angular/commit/9cfa127)) + + + ## [7.2.3](https://github.com/NativeScript/nativescript-angular/compare/7.2.2...7.2.3) (2019-03-14) diff --git a/e2e/config/mocha.opts b/e2e/config/mocha.opts index 65bcb91f7..719c7e05a 100644 --- a/e2e/config/mocha.opts +++ b/e2e/config/mocha.opts @@ -1,4 +1,5 @@ --timeout 60000 --recursive e2e ---reporter mocha-multi ---reporter-options spec=-,mocha-junit-reporter=test-results.xml \ No newline at end of file +--reporter mochawesome +--reporter-options quiet=true,html=true,inline=true,autoOpen=true +--exit \ No newline at end of file diff --git a/e2e/modal-navigation-ng/.gitignore b/e2e/modal-navigation-ng/.gitignore index 06947f093..23d2d7b1d 100644 --- a/e2e/modal-navigation-ng/.gitignore +++ b/e2e/modal-navigation-ng/.gitignore @@ -6,3 +6,4 @@ app/**/*.js e2e/**/*.js e2e/reports test-results.xml +mochawesome-report diff --git a/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts index d5de6c2bb..ff58c3843 100644 --- a/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts +++ b/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screens/screen" import { roots, @@ -10,20 +10,23 @@ import { testDialogBackground } from "./screens/shared-screen" -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(); 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](); }); @@ -38,45 +41,45 @@ 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 screen.loadModalFrame(true); 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 screen.loadModalFrame(false); 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 screen.loadModalFrame(false); 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 screen.loadModalFrame(false); 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 screen.loadModalFrame(false); await testNestedModalPageBackground(driver, screen); }); - it("should navigate to second page, close", async () => { + it("should navigate to second page, close", async function () { await screen.loadModalFrame(false); 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 screen.loadModalFrame(true); await testSecondPageBackground(driver, screen); }); }); - }); + }; }); diff --git a/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts index b518f1a95..1cdcdf333 100644 --- a/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts +++ b/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screens/screen" import { roots, @@ -6,19 +6,20 @@ import { testDialogBackground, } from "./screens/shared-screen" -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(); screen = new Screen(driver); }); - - roots.forEach(root => { - describe(`${root} modal no frame background scenarios:`, () => { - before(async () => { + for (let index = 0; index < roots.length; index++) { + const root = roots[index]; + describe(`${root} modal no frame background scenarios:`, async function () { + before(async function () { + nsCapabilities.testReporter.context = this; await screen[root](); }); @@ -30,21 +31,21 @@ describe("modal-layout:", () => { } }); - after(async () => { + after(async function () { await screen.closeModal(); await screen.loadedHome(); }); - it("should show nested modal page, run in background, close", async () => { + it("should show nested modal page, run in background, close", async function () { await screen.loadModalNoFrame(true); await testNestedModalPageBackground(driver, screen, false); }); - it("should show dialog confirm inside modal view with no frame, run in background", async () => { + it("should show dialog confirm inside modal view with no frame, run in background", async function () { await screen.loadModalNoFrame(false); await testDialogBackground(driver, screen, false); }); }); - }); + }; }); diff --git a/e2e/modal-navigation-ng/e2e/modal-on-init.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal-on-init.e2e-spec.ts index 394fa5d49..34f682b77 100644 --- a/e2e/modal-navigation-ng/e2e/modal-on-init.e2e-spec.ts +++ b/e2e/modal-navigation-ng/e2e/modal-on-init.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; import { Screen, sharedModalView, homeComponent } from "./screens/screen"; import { assertComponent, @@ -12,29 +12,33 @@ const roots = [ "setNamedFrameRootViewModal", ]; -describe("modal-on-init:", () => { +describe("modal-on-init:", async function () { let driver: AppiumDriver; let screen: Screen; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; + driver = await createDriver(); screen = new Screen(driver); }); - after("modal-on-init after all hook", async () => { + after("modal-on-init after all hook", async function () { await driver.logTestArtifacts("modal-on-init"); }); - roots.forEach(root => { - describe("Shared Modal on Init", () => { - before(async () => { + for (let index = 0; index < roots.length; index++) { + const root = roots[index]; + describe("Shared Modal on Init", async function () { + before(async function () { + nsCapabilities.testReporter.context = this; await screen[root](); console.log(`Root: ${root}`); }); - beforeEach(async function() {}); + beforeEach(async function () { }); - afterEach(async function() { + afterEach(async function () { if (this.currentTest.state === "failed") { await driver.logTestArtifacts(this.currentTest.title); await driver.resetApp(); @@ -42,72 +46,73 @@ describe("modal-on-init:", () => { } }); - after("root after all hook", async function() { + after("root after all hook", async function () { await driver.logTestArtifacts(`${root}_root_after_all_hook`); }); - it("should shared modal view", async () => { + it("should shared modal view", async function () { await assertComponent(driver, sharedModalView); }); - it("run in background", async () => { + it("run in background", async function () { await driver.backgroundApp(1); await assertComponent(driver, sharedModalView); }); - it("should close shared modal ", async () => { + it("should close shared modal ", async function () { await screen.closeModal(); await screen.loadedHome(); }); - it("should open/close shared modal", async () => { + it("should open/close shared modal", async function () { await screen.loadSharedModal(true); await screen.closeModal(); await screen.loadedHome(); }); - it("should open/close shared modal again", async () => { + it("should open/close shared modal again", async function () { await screen.loadSharedModal(true); if (driver.isAndroid) { - await driver.navBack(); - }else{ - await screen.closeModal(); + await driver.navBack(); + } else { + await screen.closeModal(); } await screen.loadedHome(); }); - it("should open/close modal with frame", async () => { + it("should open/close modal with frame", async function () { await screen.loadModalFrame(true); await screen.closeModal(); }); - it("should open/close shared modal again", async () => { + it("should open/close shared modal again", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - it("run in background again", async () => { + it("run in background again", async function () { await driver.backgroundApp(1); await screen.loadedHome(); }); - it("should open/close shared modal second", async () => { - await screen.loadModalFrame(true); - await screen.closeModal(); + it("should open/close shared modal second", async function () { + await screen.loadModalFrame(true); + await screen.closeModal(); }); }); - }); + }; - describe("Shared Modal on Init", () => { + describe("Shared Modal on Init", async function () { const root = "setLayoutRootViewModal"; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; await screen[root](); console.log(`Root: ${root}`); }); - beforeEach(async function() {}); + beforeEach(async function () { }); - afterEach(async function() { + afterEach(async function () { if (this.currentTest.state === "failed") { await driver.logTestArtifacts(this.currentTest.title); await driver.resetApp(); @@ -115,40 +120,40 @@ describe("modal-on-init:", () => { } }); - after("root after all hook", async function() { + after("root after all hook", async function () { await driver.logTestArtifacts(`${root}_root_after_all_hook`); }); - it("should shared modal view", async () => { + it("should shared modal view", async function () { await assertComponent(driver, sharedModalView); }); - it("run in background", async () => { + it("run in background", async function () { await driver.backgroundApp(1); await assertComponent(driver, sharedModalView); }); - it("should close shared modal ", async () => { + it("should close shared modal ", async function () { await screen.closeModal(); await screen.loadedHome(); }); - it("should open/close shared modal", async () => { + it("should open/close shared modal", async function () { await screen.loadModalFrame(true); await screen.closeModal(); }); - it("run in background again", async () => { + it("run in background again", async function () { await driver.backgroundApp(1); await screen.loadedHome(); }); - it("should open/close shared modal second", async () => { - await screen.loadModalFrame(true); - await screen.closeModal(); + it("should open/close shared modal second", async function () { + await screen.loadModalFrame(true); + await screen.closeModal(); }); - it("should open/close shared modal", async () => { + it("should open/close shared modal", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); diff --git a/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts index 1ad368ff2..0bfbb6501 100644 --- a/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts +++ b/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts @@ -1,23 +1,26 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screens/screen" import { assertComponent, goBack, navigateToSecondComponent } from "./screens/shared-screen"; const homeComponent = "Home Component"; const roots = ["setFrameRootView", "setTabRootView"]; -describe("modal-shared:", () => { +describe("modal-shared:", async function () { let driver: AppiumDriver; let screen: Screen; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); screen = new Screen(driver); }); - roots.forEach(root => { - describe("Shared modal from home component and back", () => { + for (let index = 0; index < roots.length; index++) { + const root = roots[index]; + describe("Shared modal from home component and back", async function () { - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; await screen[root](); }); @@ -32,125 +35,128 @@ describe("modal-shared:", () => { } }); - it("should find home component", async () => { + it("should find home component", async function () { await assertComponent(driver, homeComponent); }); - it("should open/close shared modal from home component", async () => { + it("should open/close shared modal from home component", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - it("should open/close shared modal from home component again", async () => { + it("should open/close shared modal from home component again", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - it("should open/close shared modal with presentation style from home component", async () => { + it("should open/close shared modal with presentation style from home component", async function () { await screen.loadSharedModalWithPresentationStyle(true); await screen.closeModal(); }); - it("should find home component again", async () => { + it("should find home component again", async function () { await screen.loadedHome(); }); - it("should navigate to second component", async () => { + it("should navigate to second component", async function () { await navigateToSecondComponent(driver); }); - it("should find second component", async () => { + it("should find second component", async function () { await assertComponent(driver, "second component"); }); - it("should open/close shared modal from second component", async () => { + it("should open/close shared modal from second component", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - it("should find second component again", async () => { + it("should find second component again", async function () { await assertComponent(driver, "second component"); }); - it("should navigate back to home component", async () => { + it("should navigate back to home component", async function () { await goBack(driver); await assertComponent(driver, homeComponent); }); }); - }); + }; - describe("modal-shared-different-component:", () => { + describe("modal-shared-different-component:", async function () { let driver: AppiumDriver; let screen: Screen; - - before(async () => { + + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); screen = new Screen(driver); }); - - roots.forEach(root => { - describe("Shared modal from different components", () => { - before(async () => { + + for (let index = 0; index < roots.length; index++) { + const root = roots[index]; + describe("Shared modal from different components", async function () { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - - after(async () => { + + after(async function () { await driver.quit(); console.log("Quit driver!"); }); - + afterEach(async function () { if (this.currentTest.state === "failed") { await driver.logTestArtifacts(this.currentTest.title); } }); - - it("should find home component", async () => { + + it("should find home component", async function () { await screen.loadedHome(); }); - - it("should open/close shared modal from home component", async () => { + + it("should open/close shared modal from home component", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - - it("should find home component again", async () => { + + it("should find home component again", async function () { await screen.loadedHome(); }); - - it("should navigate to second component", async () => { + + it("should navigate to second component", async function () { await navigateToSecondComponent(driver); }); - - it("should find second component", async () => { + + it("should find second component", async function () { await assertComponent(driver, "second component"); }); - - it("should open/close shared modal from second component", async () => { + + it("should open/close shared modal from second component", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - - it("should find second component again", async () => { + + it("should find second component again", async function () { await assertComponent(driver, "second component"); }); - - it("should navigate back to home component", async () => { + + it("should navigate back to home component", async function () { await goBack(driver); await screen.loadedHome(); }); - - it("should open/close shared modal from home component after manipulations with second", async () => { + + it("should open/close shared modal from home component after manipulations with second", async function () { await screen.loadSharedModal(true); await screen.closeModal(); }); - - it("should find home component again", async () => { + + it("should find home component again", async function () { await screen.loadedHome(); }); }); - }); + }; }); }); diff --git a/e2e/modal-navigation-ng/e2e/setup.ts b/e2e/modal-navigation-ng/e2e/setup.ts index 8b26e66e9..acfc6f70a 100644 --- a/e2e/modal-navigation-ng/e2e/setup.ts +++ b/e2e/modal-navigation-ng/e2e/setup.ts @@ -1,9 +1,18 @@ -import { startServer, stopServer } from "nativescript-dev-appium"; +import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium"; +const addContext = require('mochawesome/addContext'); -before("start server", async () => { +const testReporterContext = {}; +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 () { await stopServer(); -}); +}); \ No newline at end of file diff --git a/e2e/modal-navigation-ng/package.json b/e2e/modal-navigation-ng/package.json index fc6209dc9..31c2d0eeb 100644 --- a/e2e/modal-navigation-ng/package.json +++ b/e2e/modal-navigation-ng/package.json @@ -32,17 +32,15 @@ "devDependencies": { "@angular/compiler-cli": "~7.2.0", "@ngtools/webpack": "~7.2.0", - "@types/chai": "^4.0.2", - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.12", + "@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", - "chai": "^4.2.0", "lazy": "1.0.11", - "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", diff --git a/e2e/nested-router-tab-view/.gitignore b/e2e/nested-router-tab-view/.gitignore index dbb747daa..e2c82407c 100644 --- a/e2e/nested-router-tab-view/.gitignore +++ b/e2e/nested-router-tab-view/.gitignore @@ -9,4 +9,5 @@ hooks e2e/reports test-results.xml -instrumentscli*.trace \ No newline at end of file +instrumentscli*.trace +mochawesome-report \ No newline at end of file diff --git a/e2e/nested-router-tab-view/e2e/custom-tabs.e2e-spec.ts b/e2e/nested-router-tab-view/e2e/custom-tabs.e2e-spec.ts index e41b858e3..654e2a3ff 100644 --- a/e2e/nested-router-tab-view/e2e/custom-tabs.e2e-spec.ts +++ b/e2e/nested-router-tab-view/e2e/custom-tabs.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screen" import { testPlayerNavigated, @@ -7,16 +7,17 @@ import { testTeamNextNavigated, } from "./shared.e2e-spec" -describe("custom-tabs:", () => { +describe("custom-tabs:", async function () { let driver: AppiumDriver; let screen: Screen; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); screen = new Screen(driver); }); - after(async () => { + after(async function () { await driver.quit(); console.log("Quit driver!"); }); @@ -27,7 +28,7 @@ describe("custom-tabs:", () => { } }); - it("loaded custom tab component and tabs", async () => { + it("loaded custom tab component and tabs", async function () { await screen.navigateCustomTabsPage(); await screen.loadedCustomTabsPage(); await screen.loadedPlayersList(); @@ -35,7 +36,7 @@ describe("custom-tabs:", () => { await screen.loadedTeamList(); }); - it("navigate back to login and again to custom tabs", async () => { + it("navigate back to login and again to custom tabs", async function () { await backRoot(driver); await screen.loadedLogin(); await screen.navigateCustomTabsPage(); @@ -45,7 +46,7 @@ describe("custom-tabs:", () => { await screen.loadedTeamList(); }); - it("navigate back to login and again to custom tabs", async () => { + it("navigate back to login and again to custom tabs", async function () { await gotoPlayersTab(driver); await testPlayerNavigated(screen, screen.playerOne); await gotoTeamsTab(driver); diff --git a/e2e/nested-router-tab-view/e2e/home-tabs.e2e-spec.ts b/e2e/nested-router-tab-view/e2e/home-tabs.e2e-spec.ts index af4d6e65e..9444c7177 100644 --- a/e2e/nested-router-tab-view/e2e/home-tabs.e2e-spec.ts +++ b/e2e/nested-router-tab-view/e2e/home-tabs.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screen" import { testPlayerNavigated, @@ -12,22 +12,28 @@ import { const pages = ["Go To Home Page", "Go To Lazy Home Page"]; -describe("home-tabs:", () => { +describe("home-tabs:", async function () { let driver: AppiumDriver; let screen: Screen; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); screen = new Screen(driver); }); - after(async () => { + after(async function () { await driver.quit(); console.log("Quit driver!"); }); - pages.forEach(page => { - describe(`${page} home-tab:`, () => { + for (let index = 0; index < pages.length; index++) { + const page = pages[index]; + describe(`${page} home-tab:`, async function () { + + before(async function () { + nsCapabilities.testReporter.context = this; + }); afterEach(async function () { if (this.currentTest.state === "failed") { @@ -35,14 +41,14 @@ describe("home-tabs:", () => { } }); - it("loaded home component and lists", async () => { + it("loaded home component and lists", async function () { await screen.navigateToHomePage(page); await screen.loadedHome(); await screen.loadedPlayersList(); await screen.loadedTeamList(); }); - it("should navigate to Tabs then to About forward", async () => { + it("should navigate to Tabs then to About forward", async function () { await screen.navigateToTabsPage(); await screen.loadedTabs(); await screen.loadedPlayersList(); @@ -51,7 +57,7 @@ describe("home-tabs:", () => { await screen.loadedNestedAbout(); }); - it("should go back to Tabs and then back to Home", async () => { + it("should go back to Tabs and then back to Home", async function () { await backActivatedRoute(driver); await screen.loadedTabs(); await screen.loadedPlayersList(); @@ -61,7 +67,7 @@ describe("home-tabs:", () => { await screen.loadedTeamList(); }); - it("should navigate to Tabs without Players/Teams navigation", async () => { + it("should navigate to Tabs without Players/Teams navigation", async function () { await screen.navigateToTabsPage(); await screen.loadedTabs(); await screen.loadedPlayersList(); @@ -71,7 +77,7 @@ describe("home-tabs:", () => { await screen.loadedTeamList(); }); - it("should navigate Player One/Team One then go to Tabs and back", async () => { + it("should navigate Player One/Team One then go to Tabs and back", async function () { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); await screen.navigateToTabsPage(); @@ -88,7 +94,7 @@ describe("home-tabs:", () => { await screen.loadedTeamList(); }); - it("should navigate 2 times in Players go to Tabs and back", async () => { + it("should navigate 2 times in Players go to Tabs and back", async function () { await testPlayerNavigated(screen, screen.playerOne); await testPlayerNextNavigated(screen, screen.playerTwo); await screen.navigateToTabsPage(); @@ -112,7 +118,7 @@ describe("home-tabs:", () => { await screen.loadedLogin; }); }); - }); + }; }); async function backActivatedRoute(driver: AppiumDriver) { diff --git a/e2e/nested-router-tab-view/e2e/setup.ts b/e2e/nested-router-tab-view/e2e/setup.ts index 8b26e66e9..cd73140bb 100644 --- a/e2e/nested-router-tab-view/e2e/setup.ts +++ b/e2e/nested-router-tab-view/e2e/setup.ts @@ -1,9 +1,18 @@ -import { startServer, stopServer } from "nativescript-dev-appium"; +import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium"; +const addContext = require('mochawesome/addContext'); -before("start server", async () => { +const testReporterContext = {}; +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 () { await stopServer(); }); diff --git a/e2e/nested-router-tab-view/e2e/split-view.e2e-spec.ts b/e2e/nested-router-tab-view/e2e/split-view.e2e-spec.ts index abf6ce955..6b7710ebb 100644 --- a/e2e/nested-router-tab-view/e2e/split-view.e2e-spec.ts +++ b/e2e/nested-router-tab-view/e2e/split-view.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screen" import { testPlayerNavigated, @@ -11,22 +11,29 @@ import { const pages = ["Go To Home Page", "Go To Lazy Home Page"]; -describe("split-view:", () => { +describe("split-view:", async function () { let driver: AppiumDriver; let screen: Screen; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); screen = new Screen(driver); }); - after(async () => { + after(async function () { await driver.quit(); console.log("Quit driver!"); }); - pages.forEach(page => { - describe(`${page} split-view:`, () => { + + for (let index = 0; index < pages.length; index++) { + const page = pages[index]; + describe(`${page} split-view:`, async function () { + + before(async function () { + nsCapabilities.testReporter.context = this; + }); afterEach(async function () { if (this.currentTest.state === "failed") { @@ -34,7 +41,7 @@ describe("split-view:", () => { } }); - it("loaded home component and lists", async () => { + it("loaded home component and lists", async function () { await screen.navigateToHomePage(page); await screen.loadedHome(); await screen.loadedPlayersList(); @@ -42,7 +49,7 @@ describe("split-view:", () => { await canGoBack(screen, screen.canGoBackActivatedRoute, true); }); - it("should navigate Player One/Team One then back separately", async () => { + it("should navigate Player One/Team One then back separately", async function () { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); await canGoBack(screen, screen.canGoBackPlayers, true); @@ -54,7 +61,7 @@ describe("split-view:", () => { await screen.loadedTeamList(); }); - it("should navigate Player One/Team One then back separately (keep order)", async () => { + it("should navigate Player One/Team One then back separately (keep order)", async function () { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); await backTeams(driver); @@ -63,7 +70,7 @@ describe("split-view:", () => { await screen.loadedPlayersList(); }); - it("should navigate Player One/Team One then back simultaneously", async () => { + it("should navigate Player One/Team One then back simultaneously", async function () { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); await canGoBack(screen, screen.canGoBackBoth, true); @@ -73,7 +80,7 @@ describe("split-view:", () => { await screen.loadedPlayersList(); }); - it("should navigate Player One/Team One then next Player/Team then back separately", async () => { + it("should navigate Player One/Team One then next Player/Team then back separately", async function () { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); await testPlayerNextNavigated(screen, screen.playerTwo); @@ -88,7 +95,7 @@ describe("split-view:", () => { await screen.loadedPlayersList(); }); - it("should navigate Player One/Team One then back", async () => { + it("should navigate Player One/Team One then back", async function () { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); await back(driver); @@ -99,7 +106,7 @@ describe("split-view:", () => { await screen.loadedPlayersList(); }); - it("should navigate Player One then navigate Players list then back", async () => { + it("should navigate Player One then navigate Players list then back", async function () { await testPlayerNavigated(screen, screen.playerOne); await testPlayerNextNavigated(screen, screen.playerTwo); await testPlayersNavigated(screen); @@ -111,7 +118,7 @@ describe("split-view:", () => { await screen.loadedPlayersList(); }); - it("should navigate Player One/Team One then Android back button", async () => { + it("should navigate Player One/Team One then Android back button", async function () { if (driver.isAndroid) { await testPlayerNavigated(screen, screen.playerOne); await testTeamNavigated(screen, screen.teamOne); @@ -148,7 +155,7 @@ describe("split-view:", () => { await screen.loadedLogin; }); }); - }); + }; }); async function backActivatedRoute(driver: AppiumDriver) { diff --git a/e2e/nested-router-tab-view/e2e/tab-view.e2e-spec.ts b/e2e/nested-router-tab-view/e2e/tab-view.e2e-spec.ts index 3fa7b35e0..d40cc07dd 100644 --- a/e2e/nested-router-tab-view/e2e/tab-view.e2e-spec.ts +++ b/e2e/nested-router-tab-view/e2e/tab-view.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium"; import { Screen } from "./screen" import { testPlayerNavigated, @@ -7,11 +7,12 @@ import { testTeamNextNavigated, } from "./shared.e2e-spec" -describe("tab-view:", () => { +describe("tab-view:", async function () { let driver: AppiumDriver; let screen: Screen; before(async () => { + nsCapabilities.testReporter.context = this; driver = await createDriver(); screen = new Screen(driver); }); diff --git a/e2e/nested-router-tab-view/package.json b/e2e/nested-router-tab-view/package.json index d4398ba15..ff096ee2f 100644 --- a/e2e/nested-router-tab-view/package.json +++ b/e2e/nested-router-tab-view/package.json @@ -32,17 +32,15 @@ "devDependencies": { "@angular/compiler-cli": "~7.2.0", "@ngtools/webpack": "~7.2.0", - "@types/chai": "^4.0.2", - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.12", + "@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", - "chai": "^4.2.0", "lazy": "1.0.11", - "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", @@ -52,4 +50,4 @@ "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", "compile-tests": "tsc -p e2e --watch" } -} \ No newline at end of file +} diff --git a/e2e/renderer/.gitignore b/e2e/renderer/.gitignore index 5a67ca289..f2486e508 100644 --- a/e2e/renderer/.gitignore +++ b/e2e/renderer/.gitignore @@ -6,4 +6,5 @@ app/**/*.js e2e/**/*.js test-results.xml e2e/reports +mochawesome-report diff --git a/e2e/renderer/e2e/action-bar.e2e-spec.ts b/e2e/renderer/e2e/action-bar.e2e-spec.ts index 011c17645..7b62008ff 100644 --- a/e2e/renderer/e2e/action-bar.e2e-spec.ts +++ b/e2e/renderer/e2e/action-bar.e2e-spec.ts @@ -2,22 +2,24 @@ import { AppiumDriver, createDriver, SearchOptions, - UIElement + UIElement, + nsCapabilities } from "nativescript-dev-appium"; import { isOnTheLeft } from "./helpers/location"; import { assert } from "chai"; -describe("Action Bar scenario", () => { +describe("Action Bar scenario", async function () { let driver: AppiumDriver; - describe("dynamically add/remove ActionItems", async () => { + describe("dynamically add/remove ActionItems", async function () { let firstActionItem: UIElement; let secondActionItem: UIElement; let toggleFirstButton: UIElement; let toggleSecondButton: UIElement; before(async () => { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -28,7 +30,7 @@ describe("Action Bar scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("ActionBar dynamic"); await navigationButton.click(); @@ -37,7 +39,7 @@ describe("Action Bar scenario", () => { await driver.findElementByAutomationText("Action Bar Dynamic Items"); }); - it("should find elements", async () => { + it("should find elements", async function () { firstActionItem = await driver.findElementByAutomationText("one"); secondActionItem = await driver.findElementByAutomationText("two"); @@ -45,7 +47,7 @@ describe("Action Bar scenario", () => { toggleSecondButton = await driver.findElementByAutomationText("toggle 2"); }); - it("should initially render the action items in the correct order", async () => { + it("should initially render the action items in the correct order", async function () { await checkOrderIsCorrect(); }); @@ -61,7 +63,7 @@ describe("Action Bar scenario", () => { })(); }); - it("should attach first element in the correct position", async () => { + it("should attach first element in the correct position", async function () { await toggleFirst(); await checkOrderIsCorrect(); }); @@ -78,12 +80,12 @@ describe("Action Bar scenario", () => { })(); }); - it("should attach second element in the correct position", async () => { + it("should attach second element in the correct position", async function () { await toggleSecond(); await checkOrderIsCorrect(); }); - it("should detach and then reattach both at correct places", async () => { + it("should detach and then reattach both at correct places", async function () { await toggleFirst(); await toggleSecond(); @@ -107,11 +109,12 @@ describe("Action Bar scenario", () => { }); - describe("Action Bar extension with dynamic ActionItem", async () => { + describe("Action Bar extension with dynamic ActionItem", async function () { let toggleButton: UIElement; let conditional: UIElement; before(async () => { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -122,28 +125,28 @@ describe("Action Bar scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("ActionBarExtension"); await navigationButton.click(); }); - it("should find elements", async () => { + it("should find elements", async function () { toggleButton = await driver.findElementByAutomationText("toggle"); conditional = await driver.findElementByAutomationText("conditional"); }); - it("should detach conditional action item when its condition is false", async () => { + it("should detach conditional action item when its condition is false", async function () { await toggle(); const conditionalBtn = await driver.waitForElement("conditional", 1000); assert.isUndefined(conditionalBtn, "Conditional button should not be visible!"); }); - it("should reattach conditional action item at correct place", async () => { + it("should reattach conditional action item at correct place", async function () { await toggle(); await checkOrderIsCorrect(); }); - + const checkOrderIsCorrect = async () => { await isOnTheLeft(toggleButton, conditional); }; diff --git a/e2e/renderer/e2e/ngfor.e2e-spec.ts b/e2e/renderer/e2e/ngfor.e2e-spec.ts index 007def76f..cca35b8c1 100644 --- a/e2e/renderer/e2e/ngfor.e2e-spec.ts +++ b/e2e/renderer/e2e/ngfor.e2e-spec.ts @@ -2,12 +2,13 @@ import { AppiumDriver, createDriver, SearchOptions, - UIElement + UIElement, + nsCapabilities } from "nativescript-dev-appium"; import { isAbove } from "./helpers/location"; -describe("ngFor scenario", () => { +describe("ngFor scenario", async function () { let driver: AppiumDriver; let addButton: UIElement; let removeButton: UIElement; @@ -15,6 +16,7 @@ describe("ngFor scenario", () => { let lastAddedElementId = 0; before(async () => { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -25,7 +27,7 @@ describe("ngFor scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgFor"); await navigationButton.click(); @@ -34,7 +36,7 @@ describe("ngFor scenario", () => { await driver.findElementByAutomationText("ngFor"); }); - it("should find elements", async () => { + it("should find elements", async function () { const first = await driver.findElementByAutomationText( lastAddedElementId.toString()); elements.push(first); @@ -45,33 +47,33 @@ describe("ngFor scenario", () => { await isAbove(first, addButton); }); - it("should render elements in correct order", async () => { + it("should render elements in correct order", async function () { await isAbove(elements[0], addButton); await isAbove(addButton, removeButton); }); - it("should place new elements in the right places", async () => { + it("should place new elements in the right places", async function () { for (let i = 0; i < 5; i += 1) { await addElement(); await checkAppendedCorrectly(); } }); - it("shouldn't reorder elements when last is removed", async () => { + it("shouldn't reorder elements when last is removed", async function () { while (elements.length) { await removeElement(); await checkCorrectOrderAll(); } }); - it("should render new elements correctly after all old ones are removed", async () => { + it("should render new elements correctly after all old ones are removed", async function () { for (let i = 0; i < 5; i += 1) { await addElement(); await checkCorrectOrderAll(); } }); - it("shouldn't reorder elements when middle is removed", async () => { + it("shouldn't reorder elements when middle is removed", async function () { const middleIndex = Math.floor(elements.length / 2); await removeElement(middleIndex); await checkCorrectOrderAll(); diff --git a/e2e/renderer/e2e/ngforof.e2e-spec.ts b/e2e/renderer/e2e/ngforof.e2e-spec.ts index 219fa08bb..e14e079f4 100644 --- a/e2e/renderer/e2e/ngforof.e2e-spec.ts +++ b/e2e/renderer/e2e/ngforof.e2e-spec.ts @@ -2,7 +2,8 @@ import { AppiumDriver, createDriver, SearchOptions, - UIElement + UIElement, + nsCapabilities } from "nativescript-dev-appium"; import { isAbove } from "./helpers/location"; @@ -21,6 +22,7 @@ describe("ngForOf scenario", function () { let lastAddedElementId = 0; before(async () => { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -31,7 +33,7 @@ describe("ngForOf scenario", function () { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgForOf"); await navigationButton.click(); @@ -40,7 +42,7 @@ describe("ngForOf scenario", function () { await driver.findElementByAutomationText("ngForOf"); }); - it("should find elements", async () => { + it("should find elements", async function () { const firstElement = await getElement(lastAddedElementId); elements.push(firstElement); @@ -51,35 +53,35 @@ describe("ngForOf scenario", function () { await isAbove(firstElement.button, addButton); }); - it("should render elements in correct order", async () => { + it("should render elements in correct order", async function () { await elementTupleCorrectlyRendered(elements[0]); await isAbove(elements[0].button, addButton); await isAbove(addButton, removeButton); }); - it("should place new elements in the right places", async () => { + it("should place new elements in the right places", async function () { for (let i = 0; i < 2; i += 1) { await addElement(); await checkAppendedCorrectly(); } }); - it("shouldn't reorder elements when last is removed", async () => { + it("shouldn't reorder elements when last is removed", async function () { while (elements.length) { await removeElement(); await checkCorrectOrderAll(); } }); - it("should render new elements correctly after all old ones are removed", async () => { + it("should render new elements correctly after all old ones are removed", async function () { for (let i = 0; i < 5; i += 1) { await addElement(); await checkCorrectOrderAll(); } }); - it("shouldn't reorder elements when middle is removed", async () => { + it("shouldn't reorder elements when middle is removed", async function () { const middleIndex = Math.floor(elements.length / 2); await removeElement(middleIndex); await checkCorrectOrderAll(); @@ -148,7 +150,7 @@ describe("ngForOf scenario", function () { const getElement = async (id: number) => { let label = null; let button = null; - + if (driver.platformName.toLowerCase().includes("ios")) { label = await driver.findElementByAccessibilityId( "label: " + id.toString()); diff --git a/e2e/renderer/e2e/ngif.e2e-spec.ts b/e2e/renderer/e2e/ngif.e2e-spec.ts index e164114f8..c81c37a26 100644 --- a/e2e/renderer/e2e/ngif.e2e-spec.ts +++ b/e2e/renderer/e2e/ngif.e2e-spec.ts @@ -2,7 +2,8 @@ import { AppiumDriver, createDriver, SearchOptions, - UIElement + UIElement, + nsCapabilities } from "nativescript-dev-appium"; import { isAbove } from "./helpers/location"; @@ -13,8 +14,9 @@ describe("ngIf scenario", () => { let driver: AppiumDriver; let toggleButton: UIElement; - describe("without layout", async () => { - before(async () => { + describe("without layout", async function () { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -25,7 +27,7 @@ describe("ngIf scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgIf no layout"); await navigationButton.click(); @@ -34,27 +36,28 @@ describe("ngIf scenario", () => { await driver.findElementByAutomationText("ngIf - no layout"); }); - it("should find elements", async () => { + it("should find elements", async function () { await driver.findElementByAutomationText("false"); toggleButton = await driver.findElementByAutomationText("Toggle"); }); - it("show 'true' button when show is true", async () => { + it("show 'true' button when show is true", async function () { await toggleButton.click(); await driver.findElementByAutomationText("true"); }); }); - describe("label inbetween", async () => { + describe("label inbetween", async function () { let firstButton: UIElement; let secondButton: UIElement; let conditionalLabel: UIElement; let toggle: UIElement; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); - await driver.driver.resetApp(); + await driver.driver.resetApp(); }); afterEach(async function () { @@ -63,7 +66,7 @@ describe("ngIf scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgIf inbetween"); await navigationButton.click(); @@ -72,7 +75,7 @@ describe("ngIf scenario", () => { await driver.findElementByAutomationText("ngIf - inbetween"); }); - it("should find elements", async () => { + it("should find elements", async function () { firstButton = await driver.findElementByAutomationText("Button 1"); secondButton = await driver.findElementByAutomationText("Button 2"); toggleButton = await driver.findElementByAutomationText("Toggle"); @@ -83,7 +86,7 @@ describe("ngIf scenario", () => { }); it("detach label when condition is false", done => { - (async () => { + (async function () { await toggleButton.click(); try { @@ -95,14 +98,15 @@ describe("ngIf scenario", () => { }); }); - describe("with else template", async () => { + describe("with else template", async function () { let ifButton: UIElement; let elseButton: UIElement; let toggle: UIElement; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); - await driver.driver.resetApp(); + await driver.driver.resetApp(); }); afterEach(async function () { @@ -111,7 +115,7 @@ describe("ngIf scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgIfElse"); await navigationButton.click(); @@ -120,7 +124,7 @@ describe("ngIf scenario", () => { await driver.findElementByAutomationText("ngIfElse"); }); - it("should find elements", async () => { + it("should find elements", async function () { toggleButton = await driver.findElementByAutomationText("Toggle"); ifButton = await driver.findElementByAutomationText("If"); }); @@ -131,7 +135,7 @@ describe("ngIf scenario", () => { .catch(() => done()); }); - it("should attach 'else' template when condition is changed to false", async () => { + it("should attach 'else' template when condition is changed to false", async function () { await toggleButton.click(); elseButton = await driver.findElementByAutomationText("Else"); @@ -144,7 +148,7 @@ describe("ngIf scenario", () => { }); it("should swap the content when condition is changed", done => { - (async () => { + (async function () { await toggleButton.click(); try { @@ -156,14 +160,15 @@ describe("ngIf scenario", () => { }); }); - describe("with then-else template", async () => { + describe("with then-else template", async function () { let thenButton: UIElement; let elseButton: UIElement; let toggle: UIElement; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); - await driver.driver.resetApp(); + await driver.driver.resetApp(); }); afterEach(async function () { @@ -172,7 +177,7 @@ describe("ngIf scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgIf Then Else"); await navigationButton.click(); @@ -181,7 +186,7 @@ describe("ngIf scenario", () => { await driver.findElementByAutomationText("ngIf Then Else"); }); - it("should find elements", async () => { + it("should find elements", async function () { toggleButton = await driver.findElementByAutomationText("Toggle"); thenButton = await driver.findElementByAutomationText("Then"); }); @@ -192,7 +197,7 @@ describe("ngIf scenario", () => { .catch(() => done()); }); - it("should attach 'else' template when condition is changed to false", async () => { + it("should attach 'else' template when condition is changed to false", async function () { await toggleButton.click(); elseButton = await driver.findElementByAutomationText("Else"); @@ -205,7 +210,7 @@ describe("ngIf scenario", () => { }); it("should swap the content when condition is changed", done => { - (async () => { + (async function () { await toggleButton.click(); try { @@ -217,14 +222,15 @@ describe("ngIf scenario", () => { }); }); - describe("then-else templates inside content view", async () => { + describe("then-else templates inside content view", async function () { let thenButton: UIElement; let elseButton: UIElement; let toggle: UIElement; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); - await driver.driver.resetApp(); + await driver.driver.resetApp(); }); afterEach(async function () { @@ -233,7 +239,7 @@ describe("ngIf scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("Content view"); await navigationButton.click(); @@ -242,7 +248,7 @@ describe("ngIf scenario", () => { await driver.findElementByAutomationText("Content View"); }); - it("should find elements", async () => { + it("should find elements", async function () { toggleButton = await driver.findElementByAutomationText("Toggle"); thenButton = await driver.findElementByAutomationText("Then"); }); @@ -253,7 +259,7 @@ describe("ngIf scenario", () => { .catch(() => done()); }); - it("should attach 'else' template when condition is changed to false", async () => { + it("should attach 'else' template when condition is changed to false", async function () { await toggleButton.click(); elseButton = await driver.findElementByAutomationText("Else"); @@ -266,7 +272,7 @@ describe("ngIf scenario", () => { }); it("should swap the content when condition is changed", done => { - (async () => { + (async function () { await toggleButton.click(); try { @@ -278,13 +284,14 @@ describe("ngIf scenario", () => { }); }); - describe("subsequent ifs", async () => { + describe("subsequent ifs", async function () { let firstButton: UIElement; let secondButton: UIElement; let firstLabel: UIElement; let secondLabel: UIElement; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -294,14 +301,14 @@ describe("ngIf scenario", () => { await driver.logTestArtifacts(this.currentTest.title); } }); - - it("should navigate to page", async () => { + + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("NgIf Subsequent Ifs"); await navigationButton.click(); }); - it("should find elements", async () => { + it("should find elements", async function () { firstButton = await driver.findElementByAutomationText("Toggle first"); secondButton = await driver.findElementByAutomationText("Toggle second"); @@ -314,7 +321,7 @@ describe("ngIf scenario", () => { assert.isDefined(secondLabel); }); - it("should toggle on first view", async () => { + it("should toggle on first view", async function () { await firstButton.click(); let conditional = await driver.findElementByAutomationText("first"); @@ -324,7 +331,7 @@ describe("ngIf scenario", () => { }); it("should toggle off first view", done => { - (async () => { + (async function () { await firstButton.click(); driver.findElementsByAutomationText("first", 500) @@ -333,7 +340,7 @@ describe("ngIf scenario", () => { })(); }); - it("should toggle on second view", async () => { + it("should toggle on second view", async function () { await secondButton.click(); let conditional = await driver.findElementByAutomationText("second"); @@ -342,7 +349,7 @@ describe("ngIf scenario", () => { }); it("should toggle off second view", done => { - (async () => { + (async function () { await secondButton.click(); driver.findElementByAutomationText("first", 500) @@ -351,7 +358,7 @@ describe("ngIf scenario", () => { })(); }); - it("should toggle on both views", async () => { + it("should toggle on both views", async function () { await firstButton.click(); await secondButton.click(); @@ -363,7 +370,7 @@ describe("ngIf scenario", () => { }); it("should toggle off both views", done => { - (async () => { + (async function () { await firstButton.click(); await secondButton.click(); @@ -377,7 +384,7 @@ describe("ngIf scenario", () => { })(); }); - it("should toggle on both views in reverse", async () => { + it("should toggle on both views in reverse", async function () { await secondButton.click(); await firstButton.click(); @@ -389,7 +396,7 @@ describe("ngIf scenario", () => { }); it("should toggle off both views in reverse", done => { - (async () => { + (async function () { await secondButton.click(); await firstButton.click(); diff --git a/e2e/renderer/e2e/page-router-outlet.e2e-spec.ts b/e2e/renderer/e2e/page-router-outlet.e2e-spec.ts index ad79f6116..fb1ef8a84 100644 --- a/e2e/renderer/e2e/page-router-outlet.e2e-spec.ts +++ b/e2e/renderer/e2e/page-router-outlet.e2e-spec.ts @@ -2,15 +2,17 @@ import { AppiumDriver, createDriver, SearchOptions, - UIElement + UIElement, + nsCapabilities } from "nativescript-dev-appium"; import { assert } from "chai"; -describe("page-router-outlet-scenario", () => { +describe("page-router-outlet-scenario", async function () { let driver: AppiumDriver; - describe("actionBarVisibility 'always' shows action bars", async () => { - before(async () => { + describe("actionBarVisibility 'always' shows action bars", async function () { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -21,7 +23,7 @@ describe("page-router-outlet-scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("ActionBarVisibility Always"); await navigationButton.click(); @@ -29,30 +31,31 @@ describe("page-router-outlet-scenario", () => { await driver.findElementByAutomationText("ShowActionBar"); }); - it("should not hide action bar by default", async () => { - const screenMatches = await driver.compareScreen("actionBarVisibility-always-default", 5); + it("should not hide action bar by default", async function () { + const screenMatches = await driver.compareScreen("actionBarVisibility-always-default", 5); assert(screenMatches); }); - it("should not hide action bar when hidden by page", async () => { + it("should not hide action bar when hidden by page", async function () { const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar"); hideActionBarButton.click(); - const screenMatches = await driver.compareScreen("actionBarVisibility-always-hidden", 5); + const screenMatches = await driver.compareScreen("actionBarVisibility-always-hidden", 5); assert(screenMatches); }); - it("should not do anything when shown action bar by page", async () => { + it("should not do anything when shown action bar by page", async function () { const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar"); showActionBarButton.click(); - const screenMatches = await driver.compareScreen("actionBarVisibility-always-shown", 5); + const screenMatches = await driver.compareScreen("actionBarVisibility-always-shown", 5); assert(screenMatches); }); }); - describe("actionBarVisibility 'never' doesn't show action bars", async () => { - before(async () => { + describe("actionBarVisibility 'never' doesn't show action bars", async function () { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -63,7 +66,7 @@ describe("page-router-outlet-scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("ActionBarVisibility Never"); await navigationButton.click(); @@ -71,31 +74,32 @@ describe("page-router-outlet-scenario", () => { await driver.findElementByAutomationText("ShowActionBar"); }); - it("should hide action bar by default", async () => { - const screenMatches = await driver.compareScreen("actionBarVisibility-never-default", 5); + it("should hide action bar by default", async function () { + const screenMatches = await driver.compareScreen("actionBarVisibility-never-default", 5); assert(screenMatches); }); - it("should not show action bar when shown by page", async () => { + it("should not show action bar when shown by page", async function () { const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar"); showActionBarButton.click(); - const screenMatches = await driver.compareScreen("actionBarVisibility-never-shown", 5); + const screenMatches = await driver.compareScreen("actionBarVisibility-never-shown", 5); assert(screenMatches); }); - it("should not do anything when hidden action bar by page", async () => { + it("should not do anything when hidden action bar by page", async function () { const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar"); hideActionBarButton.click(); - const screenMatches = await driver.compareScreen("actionBarVisibility-never-hidden", 5); + const screenMatches = await driver.compareScreen("actionBarVisibility-never-hidden", 5); assert(screenMatches); }); }); - describe("actionBarVisibility 'never' doesn't show action bars in lazy module page", async () => { + describe("actionBarVisibility 'never' doesn't show action bars in lazy module page", async function () { let imagePostFix = ""; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); if (driver.isIOS && driver.nsCapabilities.device.name.toLowerCase().includes("x")) { @@ -109,7 +113,7 @@ describe("page-router-outlet-scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("ActionBarVisibility Never Lazy"); await navigationButton.click(); @@ -117,30 +121,31 @@ describe("page-router-outlet-scenario", () => { await driver.findElementByAutomationText("ShowActionBar"); }); - it("should hide action bar by default", async () => { - const screenMatches = await driver.compareScreen(`actionBarVisibility-never-default${imagePostFix}`, 5); + it("should hide action bar by default", async function () { + const screenMatches = await driver.compareScreen(`actionBarVisibility-never-default${imagePostFix}`, 5); assert(screenMatches); }); - it("should not show action bar when shown by page", async () => { + it("should not show action bar when shown by page", async function () { const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar"); showActionBarButton.click(); - const screenMatches = await driver.compareScreen(`actionBarVisibility-never-shown${imagePostFix}`, 5); + const screenMatches = await driver.compareScreen(`actionBarVisibility-never-shown${imagePostFix}`, 5); assert(screenMatches); }); - it("should not do anything when hidden action bar by page", async () => { + it("should not do anything when hidden action bar by page", async function () { const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar"); hideActionBarButton.click(); - const screenMatches = await driver.compareScreen(`actionBarVisibility-never-hidden${imagePostFix}`, 5); + const screenMatches = await driver.compareScreen(`actionBarVisibility-never-hidden${imagePostFix}`, 5); assert(screenMatches); }); }); - describe("actionBarVisibility 'auto' shows action bars based on page", async () => { - before(async () => { + describe("actionBarVisibility 'auto' shows action bars based on page", async function () { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -151,7 +156,7 @@ describe("page-router-outlet-scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function () { const navigationButton = await driver.findElementByAutomationText("ActionBarVisibility Auto"); await navigationButton.click(); @@ -159,24 +164,24 @@ describe("page-router-outlet-scenario", () => { await driver.findElementByAutomationText("ShowActionBar"); }); - it("should show action bar by default", async () => { - const screenMatches = await driver.compareScreen("actionBarVisibility-auto-default", 5); + it("should show action bar by default", async function () { + const screenMatches = await driver.compareScreen("actionBarVisibility-auto-default", 5); assert(screenMatches); }); - it("should hide action bar when hidden by page", async () => { + it("should hide action bar when hidden by page", async function () { const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar"); hideActionBarButton.click(); - const screenMatches = await driver.compareScreen("actionBarVisibility-auto-hidden", 5); + const screenMatches = await driver.compareScreen("actionBarVisibility-auto-hidden", 5); assert(screenMatches); }); - it("should show action bar when shown by page", async () => { + it("should show action bar when shown by page", async function () { const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar"); showActionBarButton.click(); - const screenMatches = await driver.compareScreen("actionBarVisibility-auto-shown", 5); + const screenMatches = await driver.compareScreen("actionBarVisibility-auto-shown", 5); assert(screenMatches); }); }); diff --git a/e2e/renderer/e2e/setup.ts b/e2e/renderer/e2e/setup.ts index d52e381d0..11b854fca 100644 --- a/e2e/renderer/e2e/setup.ts +++ b/e2e/renderer/e2e/setup.ts @@ -1,13 +1,19 @@ -import { startServer, stopServer, createDriver, AppiumDriver } from "nativescript-dev-appium"; +import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium"; +const addContext = require('mochawesome/addContext'); -let driver: AppiumDriver; +const testReporterContext = {}; +testReporterContext.name = "mochawesome"; +testReporterContext.reportDir = "mochawesome-report"; +testReporterContext.log = addContext; +testReporterContext.logImageTypes = [LogImageType.screenshots]; +nsCapabilities.testReporter = testReporterContext; -before("start server", async () => { +before("start server", async function () { + nsCapabilities.testReporter.context = this; await startServer(); - driver = await createDriver(); }); -after("stop server", async () => { - await driver.quit(); +after("stop server", async function () { + nsCapabilities.testReporter.context = this; await stopServer(); -}); \ No newline at end of file +}); diff --git a/e2e/renderer/e2e/tab-view.e2e-spec.ts b/e2e/renderer/e2e/tab-view.e2e-spec.ts index f5415289f..82f3b6f58 100644 --- a/e2e/renderer/e2e/tab-view.e2e-spec.ts +++ b/e2e/renderer/e2e/tab-view.e2e-spec.ts @@ -2,19 +2,21 @@ import { AppiumDriver, createDriver, SearchOptions, - UIElement + UIElement, + nsCapabilities } from "nativescript-dev-appium"; import { assert } from "chai"; -describe("TabView-scenario", () => { +describe("TabView-scenario", async function(){ let driver: AppiumDriver; - describe("dynamically change TabView item title, icon and textTransform", async () => { + describe("dynamically change TabView item title, icon and textTransform", async function(){ let firstTabItem: UIElement; let secondTabItem: UIElement; let thirdTabItem: UIElement; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.driver.resetApp(); }); @@ -25,7 +27,7 @@ describe("TabView-scenario", () => { } }); - it("should navigate to page", async () => { + it("should navigate to page", async function(){ const navigationButton = await driver.findElementByAutomationText("TabItem Binding"); await navigationButton.click(); @@ -33,7 +35,7 @@ describe("TabView-scenario", () => { await driver.findElementByAutomationText("Tab Item Binding"); }); - it("should find elements", async () => { + it("should find elements", async function(){ await driver.findElementByAutomationText("First Tab"); const notSelectedTabItems = await driver.findElementsByText("not selected"); @@ -46,7 +48,7 @@ describe("TabView-scenario", () => { assert(screenMatches); }); - it("should navigate to second tab item", async () => { + it("should navigate to second tab item", async function(){ await secondTabItem.click(); await driver.findElementByAutomationText("Second Tab"); @@ -61,7 +63,7 @@ describe("TabView-scenario", () => { assert(screenMatches); }); - it("should navigate to third tab item", async () => { + it("should navigate to third tab item", async function(){ await thirdTabItem.click(); await driver.findElementByAutomationText("Third Tab"); diff --git a/e2e/renderer/package.json b/e2e/renderer/package.json index 8683bd45b..e32d7588e 100644 --- a/e2e/renderer/package.json +++ b/e2e/renderer/package.json @@ -25,19 +25,17 @@ "devDependencies": { "@angular/compiler-cli": "~7.2.0", "@ngtools/webpack": "~7.2.0", - "@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.25.0", "babel-types": "6.25.0", "babylon": "6.17.4", - "chai": "~4.1.1", "chai-as-promised": "~7.1.1", "colors": "^1.1.2", "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", diff --git a/e2e/router-tab-view/.gitignore b/e2e/router-tab-view/.gitignore index dbb747daa..e2c82407c 100644 --- a/e2e/router-tab-view/.gitignore +++ b/e2e/router-tab-view/.gitignore @@ -9,4 +9,5 @@ hooks e2e/reports test-results.xml -instrumentscli*.trace \ No newline at end of file +instrumentscli*.trace +mochawesome-report \ No newline at end of file diff --git a/e2e/router-tab-view/e2e/setup.ts b/e2e/router-tab-view/e2e/setup.ts index 8b26e66e9..cd73140bb 100644 --- a/e2e/router-tab-view/e2e/setup.ts +++ b/e2e/router-tab-view/e2e/setup.ts @@ -1,9 +1,18 @@ -import { startServer, stopServer } from "nativescript-dev-appium"; +import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium"; +const addContext = require('mochawesome/addContext'); -before("start server", async () => { +const testReporterContext = {}; +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 () { await stopServer(); }); diff --git a/e2e/router-tab-view/e2e/tab-view-navigation.e2e-spec.ts b/e2e/router-tab-view/e2e/tab-view-navigation.e2e-spec.ts index b57be824d..f0ead8efa 100644 --- a/e2e/router-tab-view/e2e/tab-view-navigation.e2e-spec.ts +++ b/e2e/router-tab-view/e2e/tab-view-navigation.e2e-spec.ts @@ -1,31 +1,27 @@ -import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium"; import { assert } from "chai"; -describe("TabView with page-router-outlet in each tab", () => { +describe("TabView with page-router-outlet in each tab", async function () { let driver: AppiumDriver; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); }); - after(async () => { - await driver.quit(); - console.log("Quit driver!"); - }); - afterEach(async function () { if (this.currentTest.state === "failed") { await driver.logTestArtifacts(this.currentTest.title); } }); - it("should find any tabs by text", async () => { + it("should find any tabs by text", async function () { await driver.findElementByAutomationText("Players"); await driver.findElementByAutomationText("Teams"); await driver.findElementByAutomationText("Player List"); }); - it("should be able to switch between tabs", async () => { + it("should be able to switch between tabs", async function () { await driver.findElementByAutomationText("Player List"); await selectTeamTab(driver); @@ -33,7 +29,7 @@ describe("TabView with page-router-outlet in each tab", () => { await selectPlayerTab(driver); }); - it("should go forward and go back on first(player) tab", async () => { + it("should go forward and go back on first(player) tab", async function () { await driver.findElementByAutomationText("Player List"); await navigateToPlayerItem(driver, "Player One", "1"); @@ -42,7 +38,7 @@ describe("TabView with page-router-outlet in each tab", () => { await driver.findElementByAutomationText("Player List"); }); - it("should go forward and go back on second(team) tab", async () => { + it("should go forward and go back on second(team) tab", async function () { await driver.findElementByAutomationText("Player List"); await selectTeamTab(driver); @@ -55,7 +51,7 @@ describe("TabView with page-router-outlet in each tab", () => { await selectPlayerTab(driver); }); - it("should navigate first(player) tab, second(team) tab and back in the same order ", async () => { + it("should navigate first(player) tab, second(team) tab and back in the same order ", async function () { await driver.findElementByAutomationText("Player List"); // Go forward in player tab @@ -79,7 +75,7 @@ describe("TabView with page-router-outlet in each tab", () => { await driver.findElementByAutomationText("Player List"); }); - it("should navigate second(team) tab, first(player) and back in the same order ", async () => { + it("should navigate second(team) tab, first(player) and back in the same order ", async function () { await driver.findElementByAutomationText("Player List"); // Go forward in team tab @@ -106,7 +102,7 @@ describe("TabView with page-router-outlet in each tab", () => { await selectPlayerTab(driver); }); - it("should navigate first(player) tab, second(team) tab and back in reverse order ", async () => { + it("should navigate first(player) tab, second(team) tab and back in reverse order ", async function () { await driver.findElementByAutomationText("Player List"); // Go forward in player tab @@ -129,10 +125,10 @@ describe("TabView with page-router-outlet in each tab", () => { await driver.navBack(); await driver.findElementByAutomationText("Team List"); - await selectPlayerTab(driver); + await selectPlayerTab(driver); }); - it("should navigate second(team) tab, first(player) tab and back in reverse order ", async () => { + it("should navigate second(team) tab, first(player) tab and back in reverse order ", async function () { await driver.findElementByAutomationText("Player List"); // Go forward in team tab diff --git a/e2e/router-tab-view/package.json b/e2e/router-tab-view/package.json index d4a2a71db..0672cbcfc 100644 --- a/e2e/router-tab-view/package.json +++ b/e2e/router-tab-view/package.json @@ -6,10 +6,10 @@ "nativescript": { "id": "org.nativescript.routertabview", "tns-android": { - "version": "3.4.1-2018-02-06-02" + "version": "next" }, "tns-ios": { - "version": "3.4.1" + "version": "next" } }, "dependencies": { @@ -30,16 +30,15 @@ "zone.js": "^0.8.4" }, "devDependencies": { - "@types/chai": "^4.0.2", - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.12", + "@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", "typescript": "~3.1.1" diff --git a/e2e/router/.gitignore b/e2e/router/.gitignore index 8e824499e..e3eb2283a 100644 --- a/e2e/router/.gitignore +++ b/e2e/router/.gitignore @@ -7,4 +7,5 @@ hooks /**/*.js /**/*.map e2e/reports -test-results.xml \ No newline at end of file +test-results.xml +mochawesome-report \ No newline at end of file diff --git a/e2e/router/e2e/router.e2e-spec.ts b/e2e/router/e2e/router.e2e-spec.ts index ba69f92ef..0b5d1d1e2 100644 --- a/e2e/router/e2e/router.e2e-spec.ts +++ b/e2e/router/e2e/router.e2e-spec.ts @@ -3,53 +3,56 @@ import { UIElement, createDriver, SearchOptions, + nsCapabilities, } from "nativescript-dev-appium"; -describe("Simple navigate and back", () => { +describe("Simple navigate and back", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1); await assureNestedMasterComponent(driver); }); - it("should navigate back to First", async () => { + it("should navigate back to First", async function(){ await goBack(driver); await assureFirstComponent(driver); }); }); -describe("Navigate inside nested outlet", () => { +describe("Navigate inside nested outlet", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1) await assureNestedMasterComponent(driver); }); - it("should navigate to Second(1)/detail(1) and back", async () => { + it("should navigate to Second(1)/detail(1) and back", async function(){ const detailBtn = await driver.findElementByAutomationText("DETAIL 1"); detailBtn.click(); await assureSecondComponent(driver, 1) @@ -60,7 +63,7 @@ describe("Navigate inside nested outlet", () => { await assureNestedMasterComponent(driver); }); - it("should navigate to Second(1)/detail(2) and back", async () => { + it("should navigate to Second(1)/detail(2) and back", async function(){ const detailBtn = await driver.findElementByAutomationText("DETAIL 2"); detailBtn.click(); await assureSecondComponent(driver, 1) @@ -71,32 +74,33 @@ describe("Navigate inside nested outlet", () => { await assureNestedMasterComponent(driver); }); - it("should navigate back to First", async () => { + it("should navigate back to First", async function(){ await goBack(driver); await assureFirstComponent(driver); }); }); -describe("Navigate to same component with different param", () => { +describe("Navigate to same component with different param", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1) await assureNestedMasterComponent(driver); }); - it("should navigate to Second(2)/master", async () => { + it("should navigate to Second(2)/master", async function(){ const navigationButton = await driver.findElementByAutomationText("GO TO NEXT SECOND"); navigationButton.click(); @@ -105,39 +109,40 @@ describe("Navigate to same component with different param", () => { await assureNestedMasterComponent(driver); }); - it("should navigate back to Second(1)/master", async () => { + it("should navigate back to Second(1)/master", async function(){ await goBack(driver); await assureSecondComponent(driver, 1) await assureNestedMasterComponent(driver); }); - it("should navigate back to First", async () => { + it("should navigate back to First", async function(){ await goBack(driver); await assureFirstComponent(driver); }); }); -describe("Nested navigation + page navigation", () => { +describe("Nested navigation + page navigation", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1) await assureNestedMasterComponent(driver); }); - it("should navigate to Second(1)/detail(1)", async () => { + it("should navigate to Second(1)/detail(1)", async function(){ const detailBtn = await driver.findElementByAutomationText("DETAIL 1"); detailBtn.click(); @@ -145,7 +150,7 @@ describe("Nested navigation + page navigation", () => { await assureNestedDetailComponent(driver, 1); }); - it("should navigate to Second(2)/master", async () => { + it("should navigate to Second(2)/master", async function(){ const navigationButton = await driver.findElementByAutomationText("GO TO NEXT SECOND"); navigationButton.click(); @@ -154,7 +159,7 @@ describe("Nested navigation + page navigation", () => { await assureNestedMasterComponent(driver); }); - it("should navigate to Second(2)/detail(2)", async () => { + it("should navigate to Second(2)/detail(2)", async function(){ const detailBtn = await driver.findElementByAutomationText("DETAIL 2"); detailBtn.click(); @@ -162,13 +167,13 @@ describe("Nested navigation + page navigation", () => { await assureNestedDetailComponent(driver, 2); }); - it("should navigate to First", async () => { + it("should navigate to First", async function(){ await findAndClick(driver, "GO TO FIRST"); await assureFirstComponent(driver); }); - it("should navigate the whole stack", async () => { + it("should navigate the whole stack", async function(){ await goBack(driver); await assureSecondComponent(driver, 2) await assureNestedDetailComponent(driver, 2); @@ -190,31 +195,32 @@ describe("Nested navigation + page navigation", () => { }); }); -describe("Nested name navigation + page navigation", () => { +describe("Nested name navigation + page navigation", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1) await assureNestedMasterComponent(driver); }); - it("should load nested named Master", async () => { + it("should load nested named Master", async function(){ await findAndClick(driver, "LOAD NESTED NAMED OUTLET"); await assureNamedNestedMasterComponent(driver); }); - it("should navigate to nested named Master Detail/1", async () => { + it("should navigate to nested named Master Detail/1", async function(){ const navigationButton = await driver.findElementByAutomationText("DETAIL-NAMED 1"); navigationButton.click(); @@ -222,7 +228,7 @@ describe("Nested name navigation + page navigation", () => { await assureNamedNestedDetailComponent(driver, 1); }); - it("should navigate back to Master and navigate to Detail/2", async () => { + it("should navigate back to Master and navigate to Detail/2", async function(){ let navigationButton = await driver.findElementByAutomationText("BACK-NESTED"); navigationButton.click(); @@ -237,68 +243,71 @@ describe("Nested name navigation + page navigation", () => { }); }); -describe("Shouldn't be able to navigate back on startup", () => { +describe("Shouldn't be able to navigate back on startup", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("shouldn't be able to go back", async () => { + it("shouldn't be able to go back", async function(){ await goBack(driver); await driver.findElementByAutomationText("canGoBack() - false"); }); }); -describe("Shouldn't be able to navigate back after cleared history", () => { +describe("Shouldn't be able to navigate back after cleared history", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1) await assureNestedMasterComponent(driver); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO FIRST(CLEAR)"); await assureFirstComponent(driver); }); - it("shouldn't be able to go back", async () => { + it("shouldn't be able to go back", async function(){ await goBack(driver); await driver.findElementByAutomationText("canGoBack() - false"); }); }); -describe("Navigate to componentless route", () => { +describe("Navigate to componentless route", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to ComponentlessSecond(100)/detail(200)", async () => { + it("should navigate to ComponentlessSecond(100)/detail(200)", async function(){ const navigationButton = await driver.findElementByAutomationText("GO TO C-LESS SECOND"); navigationButton.click(); @@ -307,13 +316,13 @@ describe("Navigate to componentless route", () => { await assureNestedDetailComponent(driver, 200); }); - it("should navigate to First", async () => { + it("should navigate to First", async function(){ await findAndClick(driver, "GO TO FIRST"); await assureFirstComponent(driver); }); - it("should navigate the whole stack", async () => { + it("should navigate the whole stack", async function(){ await goBack(driver); await assureSecondComponent(driver, 100) await assureNestedDetailComponent(driver, 200); @@ -323,39 +332,40 @@ describe("Navigate to componentless route", () => { }); }); -describe("Navigate to lazy module", () => { +describe("Navigate to lazy module", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to lazy/home", async () => { + it("should navigate to lazy/home", async function(){ await findAndClick(driver, "GO TO LAZY HOME"); await assureLazyComponent(driver); }); - it("should navigate to First", async () => { + it("should navigate to First", async function(){ await findAndClick(driver, "GO TO FIRST"); await assureFirstComponent(driver); }); - it("should navigate back to lazy/home", async () => { + it("should navigate back to lazy/home", async function(){ await goBack(driver); await assureLazyComponent(driver); }); - it("should navigate to First again", async () => { + it("should navigate to First again", async function(){ await findAndClick(driver, "GO TO FIRST"); await assureFirstComponent(driver); }); - it("should navigate the whole stack", async () => { + it("should navigate the whole stack", async function(){ await goBack(driver); await assureLazyComponent(driver); @@ -364,37 +374,38 @@ describe("Navigate to lazy module", () => { }); }); -describe("Navigate to componentless lazy module route", () => { +describe("Navigate to componentless lazy module route", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should navigate to nest/more (componentless lazy route)", async () => { + it("should navigate to nest/more (componentless lazy route)", async function(){ await findAndClick(driver, "GO TO C-LESS LAZY"); await assureComponentlessLazyComponent(driver); }); - it("should navigate to lazy/home", async () => { + it("should navigate to lazy/home", async function(){ await findAndClick(driver, "GO TO LAZY HOME"); await assureLazyComponent(driver); }); - it("should navigate to First", async () => { + it("should navigate to First", async function(){ await findAndClick(driver, "GO TO FIRST"); await assureFirstComponent(driver); }); - it("should navigate the whole stack", async () => { + it("should navigate the whole stack", async function(){ await goBack(driver); await assureLazyComponent(driver); @@ -406,31 +417,32 @@ describe("Navigate to componentless lazy module route", () => { }); }); -describe("Simple navigate and back should trigger only one CD on FirstComponent", () => { +describe("Simple navigate and back should trigger only one CD on FirstComponent", async function(){ let driver: AppiumDriver; - before(async () => { + before(async function(){ + nsCapabilities.testReporter.context = this; driver = await createDriver(); await driver.resetApp(); }); - it("should find First", async () => { + it("should find First", async function(){ await assureFirstComponent(driver); }); - it("should reset counter", async () => { + it("should reset counter", async function(){ await findAndClick(driver, "RESET"); await driver.waitForElement("CHECK: 1"); }); - it("should navigate to Second(1)/master", async () => { + it("should navigate to Second(1)/master", async function(){ await findAndClick(driver, "GO TO SECOND"); await assureSecondComponent(driver, 1); await assureNestedMasterComponent(driver); }); - it("should navigate back to First", async () => { + it("should navigate back to First", async function(){ await goBack(driver); await assureFirstComponent(driver); await driver.waitForElement("CHECK: 2"); diff --git a/e2e/router/e2e/setup.ts b/e2e/router/e2e/setup.ts index 0c0add14a..11b854fca 100644 --- a/e2e/router/e2e/setup.ts +++ b/e2e/router/e2e/setup.ts @@ -1,19 +1,19 @@ -import { startServer, stopServer , createDriver , AppiumDriver } from "nativescript-dev-appium"; +import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium"; +const addContext = require('mochawesome/addContext'); -let driver: AppiumDriver; +const testReporterContext = {}; +testReporterContext.name = "mochawesome"; +testReporterContext.reportDir = "mochawesome-report"; +testReporterContext.log = addContext; +testReporterContext.logImageTypes = [LogImageType.screenshots]; +nsCapabilities.testReporter = testReporterContext; -before("start server", async () => { +before("start server", async function () { + nsCapabilities.testReporter.context = this; await startServer(); - driver = await createDriver(); }); -after("stop server", async () => { - await driver.quit(); +after("stop server", async function () { + nsCapabilities.testReporter.context = this; await stopServer(); }); - -afterEach(async function () { - if (this.currentTest.state === "failed") { - await driver.logScreenshot(this.currentTest.title); - } -}); \ No newline at end of file diff --git a/e2e/router/package.json b/e2e/router/package.json index 0f38b6720..b7902b35f 100644 --- a/e2e/router/package.json +++ b/e2e/router/package.json @@ -6,7 +6,7 @@ "nativescript": { "id": "org.nativescript.router", "tns-android": { - "version": "5.1.0" + "version": "next" } }, "dependencies": { @@ -35,15 +35,13 @@ "babel-traverse": "6.25.0", "babel-types": "6.25.0", "babylon": "6.17.4", - "chai": "~4.1.1", "chai-as-promised": "~7.1.1", "colors": "^1.1.2", "lazy": "1.0.11", "mocha": "~5.2.0", - "mocha-junit-reporter": "~1.18.0", - "mocha-multi": "~1.0.1", - "nativescript-dev-appium": "^4.0.10-2019-01-16-01", - "nativescript-dev-typescript": "^0.7.10-next-2019-01-07-183215-03", + "mochawesome": "~3.1.2", + "nativescript-dev-appium": "next", + "nativescript-dev-typescript": "next", "nativescript-dev-webpack": "next", "tslib": "^1.7.1", "typescript": "^3.1.6" diff --git a/e2e/single-page/.gitignore b/e2e/single-page/.gitignore index 8e824499e..e3eb2283a 100644 --- a/e2e/single-page/.gitignore +++ b/e2e/single-page/.gitignore @@ -7,4 +7,5 @@ hooks /**/*.js /**/*.map e2e/reports -test-results.xml \ No newline at end of file +test-results.xml +mochawesome-report \ No newline at end of file diff --git a/e2e/single-page/e2e/setup.ts b/e2e/single-page/e2e/setup.ts index 0c0add14a..11b854fca 100644 --- a/e2e/single-page/e2e/setup.ts +++ b/e2e/single-page/e2e/setup.ts @@ -1,19 +1,19 @@ -import { startServer, stopServer , createDriver , AppiumDriver } from "nativescript-dev-appium"; +import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium"; +const addContext = require('mochawesome/addContext'); -let driver: AppiumDriver; +const testReporterContext = {}; +testReporterContext.name = "mochawesome"; +testReporterContext.reportDir = "mochawesome-report"; +testReporterContext.log = addContext; +testReporterContext.logImageTypes = [LogImageType.screenshots]; +nsCapabilities.testReporter = testReporterContext; -before("start server", async () => { +before("start server", async function () { + nsCapabilities.testReporter.context = this; await startServer(); - driver = await createDriver(); }); -after("stop server", async () => { - await driver.quit(); +after("stop server", async function () { + nsCapabilities.testReporter.context = this; await stopServer(); }); - -afterEach(async function () { - if (this.currentTest.state === "failed") { - await driver.logScreenshot(this.currentTest.title); - } -}); \ No newline at end of file diff --git a/e2e/single-page/e2e/tests.e2e-spec.ts b/e2e/single-page/e2e/tests.e2e-spec.ts index 4a9857538..cf06732f1 100644 --- a/e2e/single-page/e2e/tests.e2e-spec.ts +++ b/e2e/single-page/e2e/tests.e2e-spec.ts @@ -1,16 +1,24 @@ import { AppiumDriver, createDriver, + nsCapabilities, } from "nativescript-dev-appium"; -describe("Single page app", () => { +describe("Single page app", async function () { let driver: AppiumDriver; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); }); - it("should load first page", async () => { + afterEach(async function () { + if (this.currentTest.state === "failed") { + await driver.logTestArtifacts(this.currentTest.title); + } + }); + + it("should load first page", async function () { await driver.findElementByAutomationText("First Component"); // ActionBar Title and item @@ -18,7 +26,7 @@ describe("Single page app", () => { await driver.findElementByAutomationText("ACTION1"); }); - it("should load second(1) page", async () => { + it("should load second(1) page", async function () { await findAndClick(driver, "SECOND(1)"); await driver.findElementByAutomationText("Second Component: 1"); @@ -28,7 +36,7 @@ describe("Single page app", () => { await driver.findElementByAutomationText("ACTION2"); }); - it("should load second(2) page", async () => { + it("should load second(2) page", async function () { await findAndClick(driver, "SECOND(2)"); await driver.findElementByAutomationText("Second Component: 2"); @@ -39,7 +47,7 @@ describe("Single page app", () => { await driver.findElementByAutomationText("ADD"); }); - it("should open and close modal view", async () => { + it("should open and close modal view", async function () { await findAndClick(driver, "Show Modal"); await driver.findElementByAutomationText("Welcome to modal"); @@ -48,7 +56,7 @@ describe("Single page app", () => { await driver.findElementByAutomationText("Second Component: 2"); }); - it("should go back to second(1) and first", async () => { + it("should go back to second(1) and first", async function () { await findAndClick(driver, "Back"); await driver.findElementByAutomationText("Second Component: 1"); await findAndClick(driver, "Back"); diff --git a/e2e/single-page/package.json b/e2e/single-page/package.json index c324e1e25..812376667 100644 --- a/e2e/single-page/package.json +++ b/e2e/single-page/package.json @@ -6,10 +6,10 @@ "nativescript": { "id": "org.nativescript.singlepage", "tns-ios": { - "version": "4.0.1-2018-03-26-01" + "version": "next" }, "tns-android": { - "version": "4.0.0-2018.3.22.2" + "version": "next" } }, "dependencies": { @@ -32,19 +32,17 @@ "devDependencies": { "@angular/compiler-cli": "~7.2.0", "@ngtools/webpack": "~7.2.0", - "@types/chai": "^4.0.2", - "@types/mocha": "^5.2.5", - "@types/node": "^10.12.12", + "@types/chai": "~4.1.7", + "@types/mocha": "~5.2.5", + "@types/node": "~10.12.18", "babel-traverse": "6.25.0", "babel-types": "6.25.0", "babylon": "6.17.4", - "chai": "~4.1.1", "chai-as-promised": "~7.1.1", "colors": "^1.1.2", "lazy": "1.0.11", - "mocha": "~3.5.0", - "mocha-junit-reporter": "^1.13.0", - "mocha-multi": "^0.11.0", + "mocha": "~5.2.0", + "mochawesome": "~3.1.2", "nativescript-dev-appium": "next", "nativescript-dev-typescript": "next", "nativescript-dev-webpack": "next", diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 062189aaa..b185a77f9 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-angular", - "version": "7.3.0", + "version": "7.2.4", "description": "An Angular renderer that lets you build mobile apps with NativeScript.", "homepage": "https://www.nativescript.org/", "bugs": "https://github.com/NativeScript/nativescript-angular/issues",