From 0e1f19a76a28f620e13b5ba9e5ed527d4b40f3d3 Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Fri, 20 Apr 2018 14:29:28 +0300 Subject: [PATCH] test(modal-navigation): add close modal, modal layout and root layout tests (#5680) --- e2e/modal-navigation/.gitignore | 1 + e2e/modal-navigation/.vscode/launch.json | 4 +- e2e/modal-navigation/README.md | 20 ++++- e2e/modal-navigation/app/home/home-page.ts | 6 +- ...ayout-root.xml => layout-root.android.xml} | 2 +- e2e/modal-navigation/app/layout-root.ios.ts | 10 +++ e2e/modal-navigation/app/layout-root.ios.xml | 11 +++ .../app/modal-layout/modal-layout.xml | 2 +- .../app/modal-nested/modal-nested-page.xml | 4 +- .../app/modal-second/modal-second-page.ts | 4 + .../app/modal-second/modal-second-page.xml | 1 + e2e/modal-navigation/app/modal/modal-page.xml | 2 +- .../e2e/config/appium.capabilities.json | 10 ++- .../app-root-modal-frame.e2e-spec.ts | 58 ------------- .../app-root-modal-page.e2e-spec.ts | 50 ------------ .../app-root-modal-tab.e2e-spec.ts | 64 --------------- .../tab-root-modal-frame.e2e-spec.ts | 58 ------------- .../tab-root-modal-page.e2e-spec.ts | 50 ------------ .../tab-root-modal-tab.e2e-spec.ts | 64 --------------- .../e2e/modal-frame.e2e-spec.ts | 72 +++++++++++++++++ .../e2e/modal-layout.e2e-spec.ts | 75 +++++++++++++++++ .../e2e/modal-page.e2e-spec.ts | 62 ++++++++++++++ .../e2e/modal-tab.e2e-spec.ts | 81 +++++++++++++++++++ e2e/modal-navigation/e2e/screen.ts | 44 ++++++++-- e2e/modal-navigation/e2e/shared.e2e-spec.ts | 10 +++ e2e/modal-navigation/package.json | 3 +- e2e/modal-navigation/webpack.config.js | 62 +++++++++++--- 27 files changed, 453 insertions(+), 377 deletions(-) create mode 100644 e2e/modal-navigation/.gitignore rename e2e/modal-navigation/app/{layout-root.xml => layout-root.android.xml} (80%) create mode 100644 e2e/modal-navigation/app/layout-root.ios.ts create mode 100644 e2e/modal-navigation/app/layout-root.ios.xml delete mode 100644 e2e/modal-navigation/e2e/e2e-spec-app-root/app-root-modal-frame.e2e-spec.ts delete mode 100644 e2e/modal-navigation/e2e/e2e-spec-app-root/app-root-modal-page.e2e-spec.ts delete mode 100644 e2e/modal-navigation/e2e/e2e-spec-app-root/app-root-modal-tab.e2e-spec.ts delete mode 100644 e2e/modal-navigation/e2e/e2e-spec-tab-root/tab-root-modal-frame.e2e-spec.ts delete mode 100644 e2e/modal-navigation/e2e/e2e-spec-tab-root/tab-root-modal-page.e2e-spec.ts delete mode 100644 e2e/modal-navigation/e2e/e2e-spec-tab-root/tab-root-modal-tab.e2e-spec.ts create mode 100644 e2e/modal-navigation/e2e/modal-frame.e2e-spec.ts create mode 100644 e2e/modal-navigation/e2e/modal-layout.e2e-spec.ts create mode 100644 e2e/modal-navigation/e2e/modal-page.e2e-spec.ts create mode 100644 e2e/modal-navigation/e2e/modal-tab.e2e-spec.ts diff --git a/e2e/modal-navigation/.gitignore b/e2e/modal-navigation/.gitignore new file mode 100644 index 000000000..c6f9a448e --- /dev/null +++ b/e2e/modal-navigation/.gitignore @@ -0,0 +1 @@ +.vscode/settings.json diff --git a/e2e/modal-navigation/.vscode/launch.json b/e2e/modal-navigation/.vscode/launch.json index 55dae90bf..a017624a8 100644 --- a/e2e/modal-navigation/.vscode/launch.json +++ b/e2e/modal-navigation/.vscode/launch.json @@ -53,7 +53,7 @@ "platform": "ios", "appRoot": "${workspaceRoot}", "sourceMaps": true, - "stopOnEntry": true, + "stopOnEntry": false, "tnsArgs": [ "--syncAllFiles" ], @@ -78,7 +78,7 @@ "platform": "android", "appRoot": "${workspaceRoot}", "sourceMaps": true, - "stopOnEntry": true, + "stopOnEntry": false, "tnsArgs": [ "--syncAllFiles" ], diff --git a/e2e/modal-navigation/README.md b/e2e/modal-navigation/README.md index b3371f391..02de270d7 100644 --- a/e2e/modal-navigation/README.md +++ b/e2e/modal-navigation/README.md @@ -4,13 +4,13 @@ Execute Tests Android: ``` -npm run e2e -- --runType android23 --reuseDevice +npm run e2e -- --runType android23 # --devMode ``` iOS: ``` -npm run e2e -- --runType sim.iPhoneX.iOS112 --reuseDevice +npm run e2e -- --runType sim.iPhoneX.iOS112 # --devMode ``` Scenarios @@ -32,7 +32,15 @@ ROOT FRAME: 2. Show nested modal dialog with frame 2. Close nested modal dialog 3. Close modal dialog -3. [Done] Show modal tabview +3. [Done] Show modal layout + 1. Navigate to modal second page within modal dialog + 1. Go back + 2. Show nested modal dialog + 2. Close nested modal dialog + 3. Show nested modal dialog with frame + 3. Close nested modal dialog + 4. Close modal dialog +4. [Done] Show modal tabview 1. Navigate to second page within tab item frame 1. Go back 2. Show nested modal dialog @@ -40,7 +48,7 @@ ROOT FRAME: 3. Show nested modal dialog with frame 3. Close nested modal dialog 4. Close modal dialog -4. Navigate to second page within root frame +5. Navigate to second page within root frame 1. Show modal dialog with frame 1. Navigate to second page within modal dialog 1. Go back @@ -57,6 +65,10 @@ ROOT FRAME: 3. Close modal dialog 3. Go back +ROOT LAYOUT: + +[Same as above] + ROOT TABVIEW: [Same as above] diff --git a/e2e/modal-navigation/app/home/home-page.ts b/e2e/modal-navigation/app/home/home-page.ts index 3a0b9a9af..f7871e800 100644 --- a/e2e/modal-navigation/app/home/home-page.ts +++ b/e2e/modal-navigation/app/home/home-page.ts @@ -5,7 +5,6 @@ import { View, EventData } from "tns-core-modules/ui/core/view"; import { Frame } from "tns-core-modules/ui/frame"; export function onNavigatingTo(args: NavigatedData) { - const page = args.object; console.log("home-page onNavigatingTo"); } @@ -66,7 +65,10 @@ export function onModalTabView(args: EventData) { export function onNavigate(args: EventData) { const view = args.object as View; const page = view.page as Page; - page.frame.navigate("second/second-page"); + // In the layout root case for iOS, the page will be null + if (page) { + page.frame.navigate("second/second-page"); + } } export function onFrameRootViewReset() { diff --git a/e2e/modal-navigation/app/layout-root.xml b/e2e/modal-navigation/app/layout-root.android.xml similarity index 80% rename from e2e/modal-navigation/app/layout-root.xml rename to e2e/modal-navigation/app/layout-root.android.xml index ee0b59854..313834dc1 100644 --- a/e2e/modal-navigation/app/layout-root.xml +++ b/e2e/modal-navigation/app/layout-root.android.xml @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/e2e/modal-navigation/app/layout-root.ios.ts b/e2e/modal-navigation/app/layout-root.ios.ts new file mode 100644 index 000000000..403480d1e --- /dev/null +++ b/e2e/modal-navigation/app/layout-root.ios.ts @@ -0,0 +1,10 @@ +export { + onModalFrame, + onModalPage, + onModalLayout, + onModalTabView, + onNavigate, + onFrameRootViewReset, + onTabRootViewReset, + onLayoutRootViewReset +} from "./home/home-page"; diff --git a/e2e/modal-navigation/app/layout-root.ios.xml b/e2e/modal-navigation/app/layout-root.ios.xml new file mode 100644 index 000000000..40d6d68bd --- /dev/null +++ b/e2e/modal-navigation/app/layout-root.ios.xml @@ -0,0 +1,11 @@ + +