From 1fc98215262b9ee7ccc84d3f9eb5e3c843afce98 Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Tue, 23 Apr 2019 16:33:30 +0300 Subject: [PATCH 1/2] chore: add new test for #1771 --- .gitignore | 1 + .../app/navigation/basic.navigation.component.ts | 2 +- .../e2e/modal.shared.e2e-spec.ts | 7 ++++++- e2e/modal-navigation-ng/e2e/screens/screen.ts | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 610c9ed25..9399b9cd3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ ng-sample/app/**/*.js # Webpack configuration files webpack.config.js tsconfig.esm.json +tsconfig.tns.json # IDEs and editors /.idea diff --git a/e2e/modal-navigation-ng/app/navigation/basic.navigation.component.ts b/e2e/modal-navigation-ng/app/navigation/basic.navigation.component.ts index ad0cd0031..49f7a2567 100644 --- a/e2e/modal-navigation-ng/app/navigation/basic.navigation.component.ts +++ b/e2e/modal-navigation-ng/app/navigation/basic.navigation.component.ts @@ -16,8 +16,8 @@ import { ModalViewComponent } from "~/modal-shared/modal-view.component"; + - ` }) diff --git a/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts index fd76f81eb..1ad368ff2 100644 --- a/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts +++ b/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts @@ -15,7 +15,7 @@ describe("modal-shared:", () => { }); roots.forEach(root => { - describe("Shared modal from second and back", () => { + describe("Shared modal from home component and back", () => { before(async () => { await screen[root](); @@ -46,6 +46,11 @@ describe("modal-shared:", () => { await screen.closeModal(); }); + it("should open/close shared modal with presentation style from home component", async () => { + await screen.loadSharedModalWithPresentationStyle(true); + await screen.closeModal(); + }); + it("should find home component again", async () => { await screen.loadedHome(); }); diff --git a/e2e/modal-navigation-ng/e2e/screens/screen.ts b/e2e/modal-navigation-ng/e2e/screens/screen.ts index 107d34b41..b9c22c8eb 100644 --- a/e2e/modal-navigation-ng/e2e/screens/screen.ts +++ b/e2e/modal-navigation-ng/e2e/screens/screen.ts @@ -165,6 +165,11 @@ export class Screen { await btnTap.click(); } + private showSharedModalPresentationStyle = async () => { + const btnTap = await this._driver.waitForElement("Show shared 'popover' modal"); + await btnTap.click(); + } + loadedModalPage = async () => { const btnShowNestedModalPage = await this._driver.findElementByAutomationText(showNestedModalPage); assert.isTrue(await btnShowNestedModalPage.isDisplayed(), `${showNestedModalPage} is not displayed`); @@ -309,4 +314,13 @@ export class Screen { const lbl = await this._driver.waitForElement(sharedModalView, 5000); assert.isTrue(await lbl.isDisplayed()); } + + loadSharedModalWithPresentationStyle = async (loadShowModalPageWithFrame: boolean) => { + if (loadShowModalPageWithFrame) { + await this.showSharedModalPresentationStyle(); + } + + const lbl = await this._driver.waitForElement(sharedModalView, 5000); + assert.isTrue(await lbl.isDisplayed()); + } } \ No newline at end of file From 4ce38fec39dda55ff6bd427d38523dde9f9f82cf Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Wed, 24 Apr 2019 10:09:15 +0300 Subject: [PATCH 2/2] chore: stabilise tests --- e2e/config/mocha.opts | 2 +- e2e/modal-navigation-ng/e2e/screens/screen.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/config/mocha.opts b/e2e/config/mocha.opts index ea635b0dc..65bcb91f7 100644 --- a/e2e/config/mocha.opts +++ b/e2e/config/mocha.opts @@ -1,4 +1,4 @@ ---timeout 140000 +--timeout 60000 --recursive e2e --reporter mocha-multi --reporter-options spec=-,mocha-junit-reporter=test-results.xml \ No newline at end of file diff --git a/e2e/modal-navigation-ng/e2e/screens/screen.ts b/e2e/modal-navigation-ng/e2e/screens/screen.ts index b9c22c8eb..690edd0ab 100644 --- a/e2e/modal-navigation-ng/e2e/screens/screen.ts +++ b/e2e/modal-navigation-ng/e2e/screens/screen.ts @@ -1,4 +1,4 @@ -import { AppiumDriver } from "nativescript-dev-appium"; +import { AppiumDriver, SearchOptions } from "nativescript-dev-appium"; import { assert } from "chai"; const home = "Home Component" @@ -166,7 +166,7 @@ export class Screen { } private showSharedModalPresentationStyle = async () => { - const btnTap = await this._driver.waitForElement("Show shared 'popover' modal"); + const btnTap = await this._driver.findElementByText("popover", SearchOptions.contains); await btnTap.click(); } @@ -217,6 +217,7 @@ export class Screen { } loadedModalNoFrame = async () => { + await this._driver.wait(2000); const btnShowDialogConfirm = await this._driver.waitForElement(showDialog); const btnCloseModal = await this._driver.waitForElement(closeModal); assert.isTrue(await btnShowDialogConfirm.isDisplayed());