diff --git a/.gitignore b/.gitignore index 406a82a..df41f06 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,5 @@ e2e/reports verify-report e2e/**/*.js e2e/reports -app/App_Resources/iOS/GoogleService-Info.plist \ No newline at end of file +app/App_Resources/iOS/GoogleService-Info.plist +mochawesome-report \ No newline at end of file diff --git a/e2e/config/appium.capabilities.json b/e2e/config/appium.capabilities.json index 65ec905..b4c9be7 100644 --- a/e2e/config/appium.capabilities.json +++ b/e2e/config/appium.capabilities.json @@ -1,4 +1,81 @@ { + "android19": { + "platformName": "Android", + "platformVersion": "4.4", + "deviceName": "Emulator-Api19-Default", + "avd": "Emulator-Api19-Default", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, + "android21": { + "platformName": "Android", + "platformVersion": "5.0", + "deviceName": "Emulator-Api21-Default", + "avd": "Emulator-Api21-Default", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, + "android23": { + "platformName": "Android", + "platformVersion": "6.0", + "deviceName": "Emulator-Api23-Default", + "avd": "Emulator-Api23-Default", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, + "android24": { + "platformName": "Android", + "platformVersion": "7.0", + "deviceName": "Emulator-Api24-Default", + "avd": "Emulator-Api24-Default", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, + "android25": { + "platformName": "Android", + "platformVersion": "7.1", + "deviceName": "Emulator-Api25-Google", + "avd": "Emulator-Api25-Google", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, + "android26": { + "platformName": "Android", + "platformVersion": "8.0", + "deviceName": "Emulator-Api26-Google", + "avd": "Emulator-Api26-Google", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, + "android27": { + "platformName": "Android", + "platformVersion": "27", + "deviceName": "Emulator-Api27-Google", + "avd": "Emulator-Api27-Google", + "lt": 60000, + "newCommandTimeout": 720, + "noReset": false, + "fullReset": false, + "app": "" + }, "android28": { "platformName": "Android", "platformVersion": "28", @@ -6,15 +83,40 @@ "avd": "Emulator-Api28-Google", "lt": 60000, "newCommandTimeout": 720, + "noReset": false, "fullReset": false, "app": "" }, - "sim.iPhoneXS": { + "sim.iPhone7": { + "platformName": "iOS", + "platformVersion": "/12.*/", + "deviceName": "iPhone 7", + "noReset": false, + "fullReset": false, + "app": "" + }, + "sim.iPhone8": { + "platformName": "iOS", + "platformVersion": "/12*/", + "deviceName": "iPhone 8", + "noReset": false, + "fullReset": false, + "app": "" + }, + "sim.iPhoneX": { "platformName": "iOS", - "platformVersion": "12.0", + "platformVersion": "/12*/", + "deviceName": "iPhone X", + "noReset": false, + "fullReset": false, + "app": "" + }, + "sim.iPhoneXS": { + "platformName": "ios", + "platformVersion": "/12*/", "deviceName": "iPhone XS", "noReset": false, "fullReset": false, "app": "" } -} +} \ No newline at end of file diff --git a/e2e/config/mocha.opts b/e2e/config/mocha.opts index 26304a7..c21dcca 100644 --- a/e2e/config/mocha.opts +++ b/e2e/config/mocha.opts @@ -1,5 +1,5 @@ --timeout 999999 --recursive e2e ---reporter mocha-multi ---reporter-options spec=-,mocha-junit-reporter=test-results.xml +--reporter mochawesome +--reporter-options quiet=true,html=true,inline=true,autoOpen=true --exit \ No newline at end of file diff --git a/e2e/sample.e2e-spec.ts b/e2e/sample.e2e-spec.ts index 21f50d1..0491309 100644 --- a/e2e/sample.e2e-spec.ts +++ b/e2e/sample.e2e-spec.ts @@ -1,16 +1,16 @@ -import { AppiumDriver, createDriver, SearchOptions, Point } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, SearchOptions, Point, nsCapabilities } from "nativescript-dev-appium"; import { assert } from "chai"; -describe("sample scenario", () => { - const defaultWaitTime = 5000; +describe("sample scenario", async function () { let driver: AppiumDriver; let sideDrawerBtnRect: Point; - before(async () => { + before(async function () { + nsCapabilities.testReporter.context = this; driver = await createDriver(); }); - after(async () => { + after(async function () { await driver.quit(); console.log("Quit driver!"); }); @@ -21,7 +21,7 @@ describe("sample scenario", () => { } }); - const openSidedrawer = async () => { + const openSidedrawer = async function () { if (driver.isAndroid) { if (!sideDrawerBtnRect) { const btnSideDrawer = await driver.findElementByText("COSMOS Databank"); @@ -46,7 +46,7 @@ describe("sample scenario", () => { } } - const closeSidedrawer = async () => { + const closeSidedrawer = async function () { if (driver.isAndroid) { await driver.clickPoint(sideDrawerBtnRect.x, sideDrawerBtnRect.y); } else { @@ -62,7 +62,7 @@ describe("sample scenario", () => { } } - it("no pass login", async () => { + it("no pass login", async function () { const allowCameraBtn = (await driver.findElementByTextIfExists("Allow")) if (allowCameraBtn) { await allowCameraBtn.click(); @@ -74,23 +74,23 @@ describe("sample scenario", () => { assert.isTrue(astronomicalDayElement != null && (await astronomicalDayElement.isDisplayed())); }); - it("open sidedrawer menu", async () => { + it("open sidedrawer menu", async function () { await openSidedrawer(); const showSideDrawerResult = await driver.compareScreen("side-drawer-displayed", 5, 0.01); assert.isTrue(showSideDrawerResult); }); - it("close sidedrawer menu", async () => { + it("close sidedrawer menu", async function () { await closeSidedrawer(); const showSideDrawerResult = await driver.compareScreen("side-drawer-closed", 5, 0.01); assert.isTrue(showSideDrawerResult); }); - it("navigate to photo of the day and back", async () => { + it("navigate to photo of the day and back", async function () { await openSidedrawer(); await driver.sleep(5000); - const navToPhotoOfTheDay = async () => { + const navToPhotoOfTheDay = async function () { if (driver.isAndroid) { (await driver.findElementByText("Photo of the day")).click(); } else { diff --git a/e2e/setup.ts b/e2e/setup.ts index 8b26e66..cd73140 100644 --- a/e2e/setup.ts +++ b/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/package.json b/package.json index 5d42525..342133a 100644 --- a/package.json +++ b/package.json @@ -1,57 +1,56 @@ { - "description": "NativeScript Application", - "license": "SEE LICENSE IN ", - "readme": "NativeScript Application", - "repository": "", - "nativescript": { - "id": "org.nativescript.curiosity" - }, - "dependencies": { - "@angular/animations": "~7.2.0", - "@angular/common": "~7.2.0", - "@angular/compiler": "~7.2.0", - "@angular/core": "~7.2.0", - "@angular/forms": "~7.2.0", - "@angular/http": "~7.2.0", - "@angular/platform-browser": "~7.2.0", - "@angular/platform-browser-dynamic": "~7.2.0", - "@angular/router": "~7.2.0", - "nativescript-angular": "next", - "nativescript-app-center": "^1.0.3", - "nativescript-cardview": "^3.1.1", - "nativescript-permissions": "^1.3.5", - "nativescript-plugin-firebase": "^8.2.0", - "nativescript-social-share": "^1.5.1", - "nativescript-theme-core": "^1.0.4", - "nativescript-ui-sidedrawer": "^6.0.0", - "reflect-metadata": "~0.1.13", - "rxjs": "^6.3.3", - "tns-core-modules": "next", - "zone.js": "^0.8.4" - }, - "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", - "codelyzer": "^4.4.4", - "mocha": "~5.1.0", - "mocha-junit-reporter": "~1.17.0", - "mocha-multi": "~1.0.0", - "nativescript-dev-appium": "^5.1.0", - "nativescript-dev-typescript": "next", - "nativescript-dev-webpack": "next", - "tns-platform-declarations": "~5.3.1", - "tslint": "^5.11.0", - "typescript": "~3.1.1" - }, - "scripts": { - "tslint": "tslint -p tsconfig.json", - "e2e": "node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts ", - "e2e-watch": "tsc -p e2e --watch", - "update-app-ng-deps": "update-app-ng-deps", - "ns-verify-bundle": "ns-verify-bundle", - "update-ns-webpack": "update-ns-webpack" - } + "description": "NativeScript Application", + "license": "SEE LICENSE IN ", + "readme": "NativeScript Application", + "repository": "", + "nativescript": { + "id": "org.nativescript.curiosity" + }, + "dependencies": { + "@angular/animations": "~7.2.0", + "@angular/common": "~7.2.0", + "@angular/compiler": "~7.2.0", + "@angular/core": "~7.2.0", + "@angular/forms": "~7.2.0", + "@angular/http": "~7.2.0", + "@angular/platform-browser": "~7.2.0", + "@angular/platform-browser-dynamic": "~7.2.0", + "@angular/router": "~7.2.0", + "nativescript-angular": "next", + "nativescript-app-center": "^1.0.3", + "nativescript-cardview": "^3.1.1", + "nativescript-permissions": "^1.3.5", + "nativescript-plugin-firebase": "^8.2.0", + "nativescript-social-share": "^1.5.1", + "nativescript-theme-core": "^1.0.4", + "nativescript-ui-sidedrawer": "^6.0.0", + "reflect-metadata": "~0.1.13", + "rxjs": "^6.3.3", + "tns-core-modules": "next", + "zone.js": "^0.8.4" + }, + "devDependencies": { + "@angular/compiler-cli": "~7.2.0", + "@ngtools/webpack": "~7.2.0", + "@types/chai": "~4.1.7", + "@types/mocha": "~5.2.5", + "@types/node": "~10.12.18", + "codelyzer": "^4.4.4", + "mocha": "~5.2.0", + "mochawesome": "~3.1.2", + "nativescript-dev-appium": "^next", + "nativescript-dev-typescript": "next", + "nativescript-dev-webpack": "next", + "tns-platform-declarations": "~5.3.1", + "tslint": "^5.11.0", + "typescript": "~3.1.1" + }, + "scripts": { + "tslint": "tslint -p tsconfig.json", + "e2e": "node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts ", + "e2e-watch": "tsc -p e2e --watch", + "update-app-ng-deps": "update-app-ng-deps", + "ns-verify-bundle": "ns-verify-bundle", + "update-ns-webpack": "update-ns-webpack" + } }