Skip to content

Commit

Permalink
chore: update 'autocomplete' demo for nativescript-ui-autocomplete v3…
Browse files Browse the repository at this point in the history
….11.0
  • Loading branch information
NSBuildUser committed Feb 25, 2019
1 parent 3314077 commit 946466a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion autocomplete/e2e/config/mocha.opts
@@ -1,5 +1,5 @@
--timeout 800000
--recursive e2e
--reporter mocha-multi
--reporter-options spec=-,mocha-junit-reporter=test-results.xml
--reporter-options mochawesome=-,mocha-junit-reporter=test-results.xml
--exit
20 changes: 17 additions & 3 deletions autocomplete/e2e/tests.e2e.ts
Expand Up @@ -2,7 +2,9 @@ import { AppiumDriver, createDriver, SearchOptions, Locator, Direction } from "n
import { isSauceLab, runType } from "nativescript-dev-appium/lib/parser";
import { expect } from "chai";
import { navigateBackToView, navigateBackToHome, clickBelowElement, scrollToElement } from "./helper";

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

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

after(async () => {
Expand All @@ -37,8 +44,15 @@ describe("Autocomplete", () => {
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logScreenshot(this.currentTest.title);
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');
}
});

Expand Down
17 changes: 11 additions & 6 deletions autocomplete/package.json
Expand Up @@ -6,17 +6,17 @@
"nativescript": {
"id": "org.nativescript.demo",
"tns-ios": {
"version": "5.1.0"
"version": "5.2.0"
},
"tns-android": {
"version": "5.1.0"
"version": "5.2.0"
}
},
"dependencies": {
"nativescript-theme-core": "^1.0.4",
"nativescript-ui-autocomplete": "*",
"nativescript-unit-test-runner": "^0.3.4",
"tns-core-modules": "^5.1.0",
"tns-core-modules": "^5.2.0",
"nativescript-ui-core": "*"
},
"devDependencies": {
Expand All @@ -28,11 +28,16 @@
"karma": "^1.3.0",
"karma-jasmine": "^1.0.2",
"karma-nativescript-launcher": "^0.4.0",
"markdown-snippet-injector": "^0.2.2",
"mocha": "^3.3.0",
"mocha-junit-reporter": "^1.18.0",
"mocha-multi": "^1.0.1",
"mochawesome": "^3.1.1",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-appium": "4.0.9",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "~0.18.0",
"tns-platform-declarations": "^5.1.2",
"nativescript-dev-typescript": "~0.8.0",
"nativescript-dev-webpack": "~0.20.0",
"tns-platform-declarations": "^5.2.1",
"tslint": "~5.11.0",
"typescript": "^3.1.6"
}
Expand Down

0 comments on commit 946466a

Please sign in to comment.