Skip to content

Commit e1a1d64

Browse files
author
Vasil Chimev
authored
test(e2e): add modal-navigation app tests (NativeScript#5445)
* test(e2e): modal-navigation app webpack support * test(e2e): add modal-navigation app smoke test * chore(e2e): tslint disable next line * chore(e2e): modal-navigation app compilation * refactor(e2e): modal-nabivation app pages * test(e2e): add app root modal frame tests * test(e2e): add app root modal frame background tests * refactor(e2e): app root modal frame tests * test(e2e): add tab root modal frame tests * refactor(e2e): modal frame tests * test(e2e): add modal page tests * docs(e2e): add scenarios * refactor(e2e): modal-navigation app tests * test(e2e): turn on/off "Don't keep activities" * test(e2e): delete no background tests * test(e2e): add modal tab tests * refactor(e2e): quit driver after all tests * refactor(e2e): config files * fix(e2e): tab root tests * refactor(e2e): skip tab root tests until fix app * chore(e2e): config files
1 parent 1cbb1e8 commit e1a1d64

30 files changed

+1108
-53
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ apps/hooks/
5252
apps/node_modules/
5353

5454
e2e/**/platforms
55+
!e2e/**/webpack.config.js
56+
e2e/**/reports/
57+
e2e/**/*.trace/
58+
e2e/**/test-results.xml
5559

5660
package-lock.json
5761

58-
.nsbuildinfo
62+
.nsbuildinfo

DevelopmentWorkflow.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Managing dependencies:
2020
- `tns-platform-declarations`
2121
- `tns-core-modules`
2222
- `e2e` depends on:
23-
- `tns-platform-declarations`
2423
- `tns-core-modules`
2524
- `tests` depends on:
2625
- `tns-platform-declarations`
@@ -43,7 +42,7 @@ Install devDependencies:
4342
npm install
4443
```
4544

46-
Run `setup` script. This will [`npm link`](https://docs.npmjs.com/cli/link) the `tns-core-modules` and `tns-core-modules-declarations` dependencies inside the `tests`, `apps` and `e2e` projects.
45+
Run `setup` script. This will [`npm link`](https://docs.npmjs.com/cli/link) the `tns-core-modules` and `tns-core-modules-declarations` dependencies inside the `tests` and `apps` projects.
4746

4847
```bash
4948
npm run setup
@@ -69,7 +68,7 @@ The modules have `typescript` as a devDependency so you should also be able to u
6968
./node_modules/.bin/tsc
7069
```
7170

72-
You can compile the TypeScript files in the `tns-core-modules`, `tns-platform-declarations`, `apps`, `e2e` and `tests` at once at the root of the repo:
71+
You can compile the TypeScript files in the `tns-core-modules`, `tns-platform-declarations`, `apps` and `tests` at once at the root of the repo:
7372

7473
```bash
7574
npm run tsc

e2e/modal-navigation/.vscode/launch.json

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,48 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Tests on Android",
11+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
12+
"args": [
13+
"-u",
14+
"tdd",
15+
"--timeout",
16+
"999999",
17+
"--colors",
18+
// "${workspaceFolder}/test",
19+
"--opts",
20+
"./e2e/config/mocha.opts",
21+
"--runType",
22+
"android23",
23+
"--reuseDevice",
24+
"--verbose"
25+
],
26+
"internalConsoleOptions": "openOnSessionStart"
27+
},
28+
{
29+
"type": "node",
30+
"request": "launch",
31+
"name": "Launch Tests on iOS",
32+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
33+
"args": [
34+
"-u",
35+
"tdd",
36+
"--timeout",
37+
"999999",
38+
"--colors",
39+
// "${workspaceFolder}/test",
40+
"--opts",
41+
"./e2e/config/mocha.opts",
42+
"--runType",
43+
"sim.iPhoneX.iOS112",
44+
"--reuseDevice",
45+
"--verbose"
46+
],
47+
"internalConsoleOptions": "openOnSessionStart"
48+
},
849
{
950
"name": "Launch on iOS",
1051
"type": "nativescript",
@@ -25,7 +66,6 @@
2566
"platform": "ios",
2667
"appRoot": "${workspaceRoot}",
2768
"sourceMaps": true,
28-
"stopOnEntry": true,
2969
"tnsArgs": [
3070
"--syncAllFiles"
3171
],
@@ -51,7 +91,6 @@
5191
"platform": "android",
5292
"appRoot": "${workspaceRoot}",
5393
"sourceMaps": true,
54-
"stopOnEntry": true,
5594
"tnsArgs": [
5695
"--syncAllFiles"
5796
],

e2e/modal-navigation/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Execute Tests
2+
=============
3+
4+
Android:
5+
6+
```
7+
npm run e2e -- --runType android23 --reuseDevice
8+
```
9+
10+
iOS:
11+
12+
```
13+
npm run e2e -- --runType sim.iPhoneX.iOS112 --reuseDevice
14+
```
15+
16+
Scenarios
17+
=============
18+
19+
ROOT FRAME:
20+
21+
1. [Done] Show modal dialog with frame
22+
1. Navigate to modal second page within modal dialog
23+
1. Go back
24+
2. Show nested modal dialog
25+
2. Close nested modal dialog
26+
3. Show nested modal dialog with frame
27+
3. Close nested modal dialog
28+
4. Close modal dialog
29+
2. [Done] Show modal dialog
30+
1. Show nested modal dialog
31+
1. Close nested modal dialog
32+
2. Show nested modal dialog with frame
33+
2. Close nested modal dialog
34+
3. Close modal dialog
35+
3. [Done] Show modal tabview
36+
1. Navigate to second page within tab item frame
37+
1. Go back
38+
2. Show nested modal dialog
39+
2. Close nested modal dialog
40+
3. Show nested modal dialog with frame
41+
3. Close nested modal dialog
42+
4. Close modal dialog
43+
4. Navigate to second page within root frame
44+
1. Show modal dialog with frame
45+
1. Navigate to second page within modal dialog
46+
1. Go back
47+
2. Show nested modal dialog
48+
2. Close nested modal dialog
49+
3. Show nested modal dialog with frame
50+
3. Close nested modal dialog
51+
4. Close modal dialog
52+
2. Show modal dialog
53+
1. Show nested modal dialog
54+
1. Close nested modal dialog
55+
2. Show nested modal dialog with frame
56+
2. Close nested modal dialog
57+
3. Close modal dialog
58+
3. Go back
59+
60+
ROOT TABVIEW:
61+
62+
[Same as above]

e2e/modal-navigation/app/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "./bundle-config";
12
import * as application from "tns-core-modules/application";
23

34
application.run({ moduleName: "app-root" });
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if ((<any>global).TNS_WEBPACK) {
2+
// Register tns-core-modules UI framework modules
3+
require("bundle-entry-points");
4+
5+
// Register application modules
6+
// This will register each `root`, `page`, `fragment` postfixed xml, css, js, ts, scss file in the app/ folder
7+
const context = (<any>require).context("~/", true, /(root|page|fragment)\.(xml|css|js|ts|scss|less|sass)$/);
8+
global.registerWebpackModules(context);
9+
}

e2e/modal-navigation/app/home/home-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ export function onNavigate(args: EventData) {
5656
}
5757

5858
export function onRootViewChange() {
59-
let rootView: View = application.getRootView();
60-
rootView.typeName === "Frame" ? application._resetRootView({moduleName: "tab-root"}) : application._resetRootView({moduleName: "app-root"});
59+
let rootView = application.getRootView();
60+
rootView instanceof Frame ? application._resetRootView({moduleName: "tab-root"}) : application._resetRootView({moduleName: "app-root"});
6161
}

e2e/modal-navigation/app/modal-nested/modal-nested-page.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
navigatedFrom="onNavigatedFrom">
66

77
<ActionBar class="action-bar">
8-
<Label class="action-bar-title" text="Nested Modal"></Label>
8+
<Label class="action-bar-title" text="Modal Nested"></Label>
99
</ActionBar>
1010

1111
<StackLayout backgroundColor="darkBlue">
12-
<Button text="Close Modal" tap="closeModal" />
12+
<Button text="Close Modal Nested" tap="closeModal" />
1313
</StackLayout>
1414
</Page>

e2e/modal-navigation/app/modal/modal-page.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ export function closeModal(args: EventData) {
3939
(args.object as View).closeModal();
4040
}
4141

42-
export function showNestedModalPage(args: EventData) {
43-
const view = args.object as View;
44-
45-
view.showModal("modal-nested/modal-nested-page",
46-
"nested-context",
47-
() => console.log("modal page nested closed"),
48-
false);
49-
}
50-
5142
export function showNestedModalFrame(args: EventData) {
5243
const view = args.object as View;
5344

@@ -60,6 +51,15 @@ export function showNestedModalFrame(args: EventData) {
6051
false);
6152
}
6253

54+
export function showNestedModalPage(args: EventData) {
55+
const view = args.object as View;
56+
57+
view.showModal("modal-nested/modal-nested-page",
58+
"nested-context",
59+
() => console.log("modal page nested closed"),
60+
false);
61+
}
62+
6363
export function onNavigate(args: EventData) {
6464
const view = args.object as View;
6565
const page = view.page as Page;

e2e/modal-navigation/app/modal/modal-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
<StackLayout backgroundColor="maroon">
1212
<Button text="Navigate To Second Page" tap="onNavigate" visibility="{{ navigationVisibility }}" />
13-
<Button text="Show Nested Modal Page" tap="showNestedModalPage" />
1413
<Button text="Show Nested Modal Page With Frame" tap="showNestedModalFrame" />
14+
<Button text="Show Nested Modal Page" tap="showNestedModalPage" />
1515
<Button text="Close Modal" tap="closeModal" />
1616
</StackLayout>
1717
</Page>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy