Skip to content

Commit 2ef3229

Browse files
author
Zdravko
authored
Merge pull request #1952 from NativeScript/zbranzov/renderer-tests
Zbranzov/renderer-tests
2 parents 4eacbf1 + d194fe5 commit 2ef3229

File tree

81 files changed

+120
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+120
-54
lines changed

Diff for: e2e/animation-examples/e2e/pages/animation-with-options-page.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,33 @@ export class AnimationWithOptionsPage extends BasePage {
1212
async enterExample() {
1313
const exampleBtn = await this._driver.findElementByAccessibilityId("options");
1414
await exampleBtn.click();
15-
this.initialPositionOfAnimatedBtn = await (await this.animatedBtn).location();
15+
const animatedBtn = await this.animatedBtn();
16+
this.initialPositionOfAnimatedBtn = await animatedBtn.location();
1617
}
1718

18-
get btnToggleAnimation() {
19-
return this._driver.findElementByAccessibilityId("toggleAnimation");
19+
async btnToggleAnimation() {
20+
return await this._driver.findElementByAccessibilityId("toggleAnimation");
2021
}
2122

22-
get animatedBtn() {
23-
this._driver.findElementsByAccessibilityId("animatedBtn", 10000);
24-
return this._driver.findElementByAccessibilityIdIfExists("animatedBtn");
23+
async animatedBtn() {
24+
await this._driver.wait(2000);
25+
const btn = await this._driver.findElementByAccessibilityIdIfExists("animatedBtn");
26+
return btn;
2527
}
2628

2729
async toggleAnimation() {
28-
const btnTapToDisappear = await this.btnToggleAnimation;
30+
const btnTapToDisappear = await this.btnToggleAnimation();
2931
await btnTapToDisappear.click();
3032
}
3133

3234
async waitElementToHide() {
33-
return this.waitElementTo(() => this.animatedBtn, false, 10000);
35+
await this._driver.wait(2000);
36+
return await this._driver.findElementByAccessibilityIdIfExists("animatedBtn");
3437
}
3538

3639
async assertPositionOfToggleAnimationBtn() {
37-
this.waitElementTo(() => this.btnToggleAnimation, true, 5000);
38-
const point: Point = await (await this.btnToggleAnimation).location();
40+
await this.waitElementTo(() => this.btnToggleAnimation(), true, 5000);
41+
const point: Point = await (await this.btnToggleAnimation()).location();
3942
assert.isTrue(point.y === this.initialPositionOfAnimatedBtn.y);
4043
}
4144
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe("smoke-tests", async function () {
8787
await animationWithOptionsPage.enterExample();
8888
await animationWithOptionsPage.toggleAnimation();
8989
const result = await animationWithOptionsPage.waitElementToHide();
90-
assert.isFalse(result.isVisible, "The button should disappear!");
90+
assert.isUndefined(result, "The button should disappear!");
9191

9292
await animationWithOptionsPage.assertPositionOfToggleAnimationBtn();
9393
});

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": "^5.3.0",
44+
"nativescript-dev-appium": "next",
4545
"nativescript-dev-webpack": "next",
4646
"typescript": "~3.5.3"
4747
},

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

+7
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@
2222
]
2323
}
2424
},
25+
"include": [
26+
"../../nativescript-angular",
27+
"**/*"
28+
],
2529
"exclude": [
30+
"../../nativescript-angular/node_modules",
31+
"../../nativescript-angular/**/*.d.ts",
2632
"node_modules",
2733
"platforms",
34+
"**/*.aot",
2835
"e2e"
2936
]
3037
}

Diff for: e2e/config/appium.capabilities.json

+15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@
4545
"noReset": false,
4646
"fullReset": false
4747
},
48+
"android22.sauce": {
49+
"platformName": "Android",
50+
"platformVersion": "5.1",
51+
"deviceName": "Android GoogleAPI Emulator",
52+
"lt": 60000,
53+
"newCommandTimeout": 720,
54+
"appiumVersion": "1.13.0",
55+
"noReset": true,
56+
"fullReset": false,
57+
"app": "",
58+
"idleTimeout": 120,
59+
"automationName": "Appium",
60+
"density":3.2,
61+
"offsetPixels":51
62+
},
4863
"android23": {
4964
"platformName": "Android",
5065
"platformVersion": "6.0",

Diff for: e2e/config/mocha.opts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--timeout 60000
1+
--timeout 120000
22
--recursive e2e
33
--reporter mochawesome
4-
--reporter-options quiet=true,html=true,inline=true,autoOpen=true
4+
--reporter-options quiet=true,html=true,inline=true
55
--exit

Diff for: e2e/modal-navigation-ng/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"lazy": "1.0.11",
4141
"mocha": "~5.2.0",
4242
"mochawesome": "~3.1.2",
43-
"nativescript-dev-appium": "^5.3.0",
43+
"nativescript-dev-appium": "next",
4444
"nativescript-dev-webpack": "next",
4545
"tns-platform-declarations": "next",
4646
"typescript": "~3.5.3"

Diff for: e2e/nested-router-tab-view/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"lazy": "1.0.11",
3535
"mocha": "~5.2.0",
3636
"mochawesome": "~3.1.2",
37-
"nativescript-dev-appium": "^5.3.0",
37+
"nativescript-dev-appium": "next",
3838
"nativescript-dev-webpack": "next",
3939
"typescript": "~3.5.3"
4040
},

Diff for: e2e/renderer/.vscode/launch.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
"--timeout",
1313
"999999",
1414
"--colors",
15-
"--reuseDevice",
16-
"--runType",
17-
"sim.iPhone7.iOS110",
18-
"${workspaceRoot}/e2e"
15+
"${workspaceRoot}/e2e",
16+
"-a",
17+
"--grep",
18+
"actionBarVisibility 'auto' shows action bars based on page"
19+
1920
],
2021
"internalConsoleOptions": "openOnSessionStart"
2122
}

Diff for: e2e/renderer/e2e/ngfor.e2e-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("ngFor scenario", async function () {
5353
});
5454

5555
it("should place new elements in the right places", async function () {
56-
for (let i = 0; i < 5; i += 1) {
56+
for (let i = 0; i < 3; i += 1) {
5757
await addElement();
5858
await checkAppendedCorrectly();
5959
}
@@ -67,7 +67,7 @@ describe("ngFor scenario", async function () {
6767
});
6868

6969
it("should render new elements correctly after all old ones are removed", async function () {
70-
for (let i = 0; i < 5; i += 1) {
70+
for (let i = 0; i < 3; i += 1) {
7171
await addElement();
7272
await checkCorrectOrderAll();
7373
}

Diff for: e2e/renderer/e2e/ngforof.e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("ngForOf scenario", function () {
7575
});
7676

7777
it("should render new elements correctly after all old ones are removed", async function () {
78-
for (let i = 0; i < 5; i += 1) {
78+
for (let i = 0; i < 3; i += 1) {
7979
await addElement();
8080
await checkCorrectOrderAll();
8181
}

Diff for: e2e/renderer/e2e/page-router-outlet.e2e-spec.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ describe("page-router-outlet-scenario", async function () {
3838

3939
it("should not hide action bar when hidden by page", async function () {
4040
const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar");
41-
hideActionBarButton.click();
41+
await hideActionBarButton.click();
4242

4343
const screenMatches = await driver.compareScreen("actionBarVisibility-always-hidden", 5);
4444
assert(screenMatches);
4545
});
4646

4747
it("should not do anything when shown action bar by page", async function () {
4848
const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar");
49-
showActionBarButton.click();
49+
await showActionBarButton.click();
5050

5151
const screenMatches = await driver.compareScreen("actionBarVisibility-always-shown", 5);
5252
assert(screenMatches);
@@ -81,15 +81,15 @@ describe("page-router-outlet-scenario", async function () {
8181

8282
it("should not show action bar when shown by page", async function () {
8383
const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar");
84-
showActionBarButton.click();
84+
await showActionBarButton.click();
8585

8686
const screenMatches = await driver.compareScreen("actionBarVisibility-never-shown", 5);
8787
assert(screenMatches);
8888
});
8989

9090
it("should not do anything when hidden action bar by page", async function () {
9191
const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar");
92-
hideActionBarButton.click();
92+
await hideActionBarButton.click();
9393

9494
const screenMatches = await driver.compareScreen("actionBarVisibility-never-hidden", 5);
9595
assert(screenMatches);
@@ -128,15 +128,15 @@ describe("page-router-outlet-scenario", async function () {
128128

129129
it("should not show action bar when shown by page", async function () {
130130
const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar");
131-
showActionBarButton.click();
131+
await showActionBarButton.click();
132132

133133
const screenMatches = await driver.compareScreen(`actionBarVisibility-never-shown${imagePostFix}`, 5);
134134
assert(screenMatches);
135135
});
136136

137137
it("should not do anything when hidden action bar by page", async function () {
138138
const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar");
139-
hideActionBarButton.click();
139+
await hideActionBarButton.click();
140140

141141
const screenMatches = await driver.compareScreen(`actionBarVisibility-never-hidden${imagePostFix}`, 5);
142142
assert(screenMatches);
@@ -171,16 +171,14 @@ describe("page-router-outlet-scenario", async function () {
171171

172172
it("should hide action bar when hidden by page", async function () {
173173
const hideActionBarButton = await driver.findElementByAutomationText("HideActionBar");
174-
hideActionBarButton.click();
175-
174+
await hideActionBarButton.click();
176175
const screenMatches = await driver.compareScreen("actionBarVisibility-auto-hidden", 5);
177176
assert(screenMatches);
178177
});
179178

180179
it("should show action bar when shown by page", async function () {
181180
const showActionBarButton = await driver.findElementByAutomationText("ShowActionBar");
182-
showActionBarButton.click();
183-
181+
await showActionBarButton.click();
184182
const screenMatches = await driver.compareScreen("actionBarVisibility-auto-shown", 5);
185183
assert(screenMatches);
186184
});
Binary file not shown.
Binary file not shown.
Binary file not shown.

Diff for: e2e/renderer/e2e/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
"experimentalDecorators": true,
66
"emitDecoratorMetadata": true,
77
"importHelpers": false,
8+
"sourceMap": true,
89
"types": [
910
"node",
1011
"mocha",
1112
"chai"
1213
],
1314
"lib": [
14-
"es6",
15+
"es2015",
1516
"dom"
1617
]
1718
}

Diff for: e2e/renderer/package.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"id": "org.nativescript.renderer"
88
},
99
"dependencies": {
10+
"@angular/animations": "~8.2.0",
1011
"@angular/common": "~8.2.0",
1112
"@angular/compiler": "~8.2.0",
1213
"@angular/core": "~8.2.0",
@@ -15,7 +16,7 @@
1516
"@angular/platform-browser-dynamic": "~8.2.0",
1617
"@angular/router": "~8.2.0",
1718
"nativescript-angular": "file:../../nativescript-angular",
18-
"nativescript-intl": "^3.0.0",
19+
"nativescript-theme-core": "~1.0.4",
1920
"reflect-metadata": "~0.1.8",
2021
"rxjs": "^6.4.0",
2122
"tns-core-modules": "next",
@@ -27,17 +28,14 @@
2728
"@types/chai": "~4.1.7",
2829
"@types/mocha": "~5.2.5",
2930
"@types/node": "~10.12.18",
30-
"babel-traverse": "6.25.0",
31-
"babel-types": "6.25.0",
32-
"babylon": "6.17.4",
33-
"chai-as-promised": "~7.1.1",
34-
"colors": "^1.1.2",
31+
"babel-traverse": "6.26.0",
32+
"babel-types": "6.26.0",
33+
"babylon": "6.18.0",
3534
"lazy": "1.0.11",
3635
"mocha": "~5.2.0",
3736
"mochawesome": "~3.1.2",
3837
"nativescript-dev-appium": "^5.3.0",
3938
"nativescript-dev-webpack": "next",
40-
"tslib": "^1.7.1",
4139
"typescript": "~3.5.3"
4240
},
4341
"scripts": {

Diff for: e2e/renderer/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@
2222
]
2323
}
2424
},
25+
"include": [
26+
"../../nativescript-angular",
27+
"**/*"
28+
],
2529
"exclude": [
30+
"../../nativescript-angular/node_modules",
31+
"../../nativescript-angular/**/*.d.ts",
2632
"node_modules",
2733
"platforms",
34+
"**/*.aot",
2835
"e2e"
2936
]
3037
}

Diff for: e2e/routable-animations/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ test-results.xml
1414
tsconfig.esm.json
1515
webpack.config.js
1616

17+
# Tests
18+
/**/mochawesome-report
19+
Binary file not shown.
Binary file not shown.

Diff for: e2e/routable-animations/e2e/setup.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
import { startServer, stopServer } from "nativescript-dev-appium";
1+
import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium";
2+
const addContext = require('mochawesome/addContext');
3+
4+
const testReporterContext = <ITestReporter>{};
5+
testReporterContext.name = "mochawesome";
6+
testReporterContext.reportDir = "mochawesome-report";
7+
testReporterContext.log = addContext;
8+
testReporterContext.logImageTypes = [LogImageType.screenshots];
9+
nsCapabilities.testReporter = testReporterContext;
210

311
before("start server", async function () {
12+
nsCapabilities.testReporter.context = this;
413
await startServer();
514
});
615

716
after("stop server", async function () {
17+
nsCapabilities.testReporter.context = this;
818
await stopServer();
919
});

Diff for: e2e/routable-animations/e2e/tests.e2e.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
1+
import { AppiumDriver, createDriver, SearchOptions, nsCapabilities } from "nativescript-dev-appium";
22
import { assert } from "chai";
33

44
describe("sample scenario", () => {
55
const defaultWaitTime = 5000;
66
let driver: AppiumDriver;
77

88
before(async function () {
9+
nsCapabilities.testReporter.context = this;
910
driver = await createDriver();
1011
});
1112

Diff for: e2e/routable-animations/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
"babylon": "6.17.4",
3434
"colors": "^1.1.2",
3535
"lazy": "1.0.11",
36+
"mocha": "~5.2.0",
37+
"mochawesome": "~3.1.2",
3638
"nativescript-css-loader": "~0.26.0",
37-
"nativescript-dev-appium": "^5.3.0",
39+
"nativescript-dev-appium": "next",
3840
"nativescript-dev-webpack": "next",
3941
"typescript": "~3.5.3"
4042
},

Diff for: e2e/routable-animations/tsconfig.json

+7
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@
2222
]
2323
}
2424
},
25+
"include": [
26+
"../../nativescript-angular",
27+
"**/*"
28+
],
2529
"exclude": [
30+
"../../nativescript-angular/node_modules",
31+
"../../nativescript-angular/**/*.d.ts",
2632
"node_modules",
2733
"platforms",
34+
"**/*.aot",
2835
"e2e"
2936
]
3037
}

0 commit comments

Comments
 (0)