Skip to content

Commit 413cec2

Browse files
authored
Merge pull request #1980 from NativeScript/zbranzov/tests-changes
chore: set dev-appium version and sanitise tests
2 parents 1219a19 + 99499be commit 413cec2

27 files changed

+821
-721
lines changed

Diff for: e2e/animation-examples/e2e/smoke.e2e-spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,30 @@ import { AnimationWithOptionsPage } from "./pages/animation-with-options-page";
99
import { AnimationsWithDefaultOptionsPage } from "./pages/animations-with-default-options-page";
1010
import { AnimateChildPage } from "./pages/animate-child-page";
1111
import { HeroPage } from "./pages/hero-page";
12+
import { isSauceLab } from "nativescript-dev-appium/lib/parser";
13+
14+
const QUEUE_WAIT_TIME: number = 600000; // Sometimes SauceLabs threads are not available and the tests wait in a queue to start. Wait 10 min before timeout.
15+
const isSauceRun = isSauceLab;
1216

1317
describe("smoke-tests", async function () {
1418
let driver: AppiumDriver;
1519

1620
before(async function () {
21+
this.timeout(QUEUE_WAIT_TIME);
1722
nsCapabilities.testReporter.context = this;
1823
driver = await createDriver();
1924
});
2025

26+
after(async function () {
27+
if (isSauceRun) {
28+
driver.sessionId().then(function (sessionId) {
29+
console.log("Report https://saucelabs.com/beta/tests/" + sessionId);
30+
});
31+
}
32+
await driver.quit();
33+
console.log("Quit driver!");
34+
});
35+
2136
afterEach(async function () {
2237
if (this.currentTest.state === "failed") {
2338
await driver.logTestArtifacts(this.currentTest.title);

Diff for: e2e/animation-examples/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"mocha": "~5.2.0",
4242
"mochawesome": "~3.1.2",
4343
"nativescript-css-loader": "~0.26.0",
44-
"nativescript-dev-appium": "next",
44+
"nativescript-dev-appium": "^6.0.0",
4545
"nativescript-dev-webpack": "next",
4646
"typescript": "~3.5.3"
4747
},

Diff for: e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
2-
import { Screen } from "./screens/screen"
2+
import { Screen } from "./screens/screen";
33
import {
44
roots,
55
modalFrameBackground,
@@ -8,19 +8,34 @@ import {
88
testNestedModalFrameBackground,
99
testNestedModalPageBackground,
1010
testDialogBackground
11-
} from "./screens/shared-screen"
11+
} from "./screens/shared-screen";
12+
import { isSauceLab } from "nativescript-dev-appium/lib/parser";
13+
14+
const QUEUE_WAIT_TIME: number = 600000; // Sometimes SauceLabs threads are not available and the tests wait in a queue to start. Wait 10 min before timeout.
15+
const isSauceRun = isSauceLab;
1216

1317
describe("modal-frame:", async function () {
1418

1519
let driver: AppiumDriver;
1620
let screen: Screen;
1721

1822
before(async function () {
23+
this.timeout(QUEUE_WAIT_TIME);
1924
nsCapabilities.testReporter.context = this;
2025
driver = await createDriver();
2126
screen = new Screen(driver);
2227
});
2328

29+
after(async function () {
30+
if (isSauceRun) {
31+
driver.sessionId().then(function (sessionId) {
32+
console.log("Report https://saucelabs.com/beta/tests/" + sessionId);
33+
});
34+
}
35+
await driver.quit();
36+
console.log("Quit driver!");
37+
});
38+
2439
for (let index = 0; index < roots.length; index++) {
2540
const root = roots[index];
2641
describe(`${root} modal frame background scenarios:`, async function () {
@@ -30,9 +45,6 @@ describe("modal-frame:", async function () {
3045
await screen[root]();
3146
});
3247

33-
beforeEach(async function () {
34-
});
35-
3648
afterEach(async function () {
3749
if (this.currentTest.state === "failed") {
3850
await driver.logTestArtifacts(this.currentTest.title);

Diff for: e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,33 @@ import {
44
roots,
55
testNestedModalPageBackground,
66
testDialogBackground,
7-
} from "./screens/shared-screen"
7+
} from "./screens/shared-screen";
8+
import { isSauceLab } from "nativescript-dev-appium/lib/parser";
9+
10+
const QUEUE_WAIT_TIME: number = 600000; // Sometimes SauceLabs threads are not available and the tests wait in a queue to start. Wait 10 min before timeout.
11+
const isSauceRun = isSauceLab;
812

913
describe("modal-layout:", async function () {
1014
let driver: AppiumDriver;
1115
let screen: Screen;
1216

1317
before(async function () {
18+
this.timeout(QUEUE_WAIT_TIME);
1419
nsCapabilities.testReporter.context = this;
1520
driver = await createDriver();
1621
screen = new Screen(driver);
1722
});
23+
24+
after(async function () {
25+
if (isSauceRun) {
26+
driver.sessionId().then(function (sessionId) {
27+
console.log("Report https://saucelabs.com/beta/tests/" + sessionId);
28+
});
29+
}
30+
await driver.quit();
31+
console.log("Quit driver!");
32+
});
33+
1834
for (let index = 0; index < roots.length; index++) {
1935
const root = roots[index];
2036
describe(`${root} modal no frame background scenarios:`, async function () {

0 commit comments

Comments
 (0)