tests: include mochawesome reporter

This commit is contained in:
SvetoslavTsenov
2019-05-07 09:55:41 +03:00
parent 237e93b657
commit a2a044cfa8
6 changed files with 28 additions and 19 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@
"version": "next"
},
"tns-android": {
"version": "5.4.0-2019-05-02-235338-05"
"version": "next"
}
},
"dependencies": {

View File

@ -9,7 +9,7 @@
"version": "next"
},
"tns-android": {
"version": "5.4.0-2019-05-02-235338-05"
"version": "next"
}
},
"dependencies": {