Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions demo-vue/e2e/config/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--timeout 800000
--recursive e2e
--reporter mocha-multi
--reporter-options mochawesome=-,mocha-junit-reporter=test-results.xml
--exit
22 changes: 21 additions & 1 deletion demo-vue/e2e/test.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
import { isSauceLab, runType } from "nativescript-dev-appium/lib/parser";
import { expect } from "chai";
import "mocha";

const fs = require('fs');
const addContext = require('mochawesome/addContext');
const rimraf = require('rimraf');
const isSauceRun = isSauceLab;
const isAndroid: boolean = runType.includes("android");

Expand All @@ -21,6 +23,11 @@ describe("Facebook tests", async function () {
before(async () => {
driver = await createDriver();
driver.defaultWaitTime = 20000;
let dir = "mochawesome-report";
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
rimraf('mochawesome-report/*', function () { });
});

after(async () => {
Expand All @@ -33,6 +40,19 @@ describe("Facebook tests", async function () {
console.log("Driver successfully quit");
});

afterEach(async function () {
if (this.currentTest.state && this.currentTest.state === "failed") {
let png = await driver.logScreenshot(this.currentTest.title);
fs.copyFile(png, './mochawesome-report/' + this.currentTest.title + '.png', function (err) {
if (err) {
throw err;
}
console.log('Screenshot saved.');
});
addContext(this, './' + this.currentTest.title + '.png');
}
});

it("should log in via custom button", async function () {
if (isAndroid) {
var userNameLabelElement = "Nativescript User";
Expand Down
7 changes: 5 additions & 2 deletions demo-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
"chai-as-promised": "~7.1.1",
"karma": "^2.0.2",
"karma-nativescript-launcher": "^0.4.0",
"mocha": "~5.2.0",
"nativescript-dev-appium": "^4.0.9",
"mocha": "^3.3.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi": "^1.0.1",
"mochawesome": "^3.1.1",
"nativescript-dev-appium": "5.0.0",
"nativescript-dev-typescript": "~0.8.0",
"nativescript-dev-webpack": "~0.20.0",
"nativescript-vue-template-compiler": "~2.0.2",
Expand Down
2 changes: 2 additions & 0 deletions demo/e2e/config/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--timeout 800000
--recursive e2e
--reporter mocha-multi
--reporter-options mochawesome=-,mocha-junit-reporter=test-results.xml
--exit
21 changes: 21 additions & 0 deletions demo/e2e/test.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import {
import { isSauceLab, runType } from "nativescript-dev-appium/lib/parser";
import { expect } from "chai";
import "mocha";
const fs = require('fs');
const addContext = require('mochawesome/addContext');
const rimraf = require('rimraf');

const isSauceRun = isSauceLab;
const isAndroid: boolean = runType.includes("android");
Expand All @@ -21,6 +24,11 @@ describe("Facebook tests", async function () {
before(async () => {
driver = await createDriver();
driver.defaultWaitTime = 20000;
let dir = "mochawesome-report";
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
rimraf('mochawesome-report/*', function () { });
});

after(async () => {
Expand All @@ -33,6 +41,19 @@ describe("Facebook tests", async function () {
console.log("Driver successfully quit");
});

afterEach(async function (){
if (this.currentTest.state && this.currentTest.state === "failed") {
let png = await driver.logScreenshot(this.currentTest.title);
fs.copyFile(png, './mochawesome-report/' + this.currentTest.title + '.png', function (err) {
if (err) {
throw err;
}
console.log('Screenshot saved.');
});
addContext(this, './' + this.currentTest.title + '.png');
}
})

it("should log in via custom button", async function () {
if (isAndroid) {
var userNameLabelElement = "[@text='Nativescript User']";
Expand Down
7 changes: 5 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
"karma": "^2.0.2",
"karma-jasmine": "^1.1.2",
"karma-nativescript-launcher": "^0.4.0",
"mocha": "~5.2.0",
"mocha": "^3.3.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi": "^1.0.1",
"mochawesome": "^3.1.1",
"nativescript-css-loader": "~0.26.1",
"nativescript-dev-appium": "4.0.9",
"nativescript-dev-appium": "5.0.0",
"nativescript-dev-typescript": "~0.8.0",
"nativescript-dev-webpack": "~0.20.0",
"tslint": "~5.11.0",
Expand Down