diff --git a/e2e/modal-navigation-ng/app/home/home.component.html b/e2e/modal-navigation-ng/app/home/home.component.html
index 9601e29ce..a632c3a92 100644
--- a/e2e/modal-navigation-ng/app/home/home.component.html
+++ b/e2e/modal-navigation-ng/app/home/home.component.html
@@ -1,5 +1,5 @@
-
+
@@ -9,7 +9,7 @@
-
+
diff --git a/e2e/modal-navigation-ng/app/modal-nested/modal-nested.component.html b/e2e/modal-navigation-ng/app/modal-nested/modal-nested.component.html
index 13c391cb7..3ffe16a18 100644
--- a/e2e/modal-navigation-ng/app/modal-nested/modal-nested.component.html
+++ b/e2e/modal-navigation-ng/app/modal-nested/modal-nested.component.html
@@ -4,5 +4,5 @@
-
+
\ No newline at end of file
diff --git a/e2e/modal-navigation-ng/app/modal-second/modal-second.component.html b/e2e/modal-navigation-ng/app/modal-second/modal-second.component.html
index 9c6b4052e..f1086298f 100644
--- a/e2e/modal-navigation-ng/app/modal-second/modal-second.component.html
+++ b/e2e/modal-navigation-ng/app/modal-second/modal-second.component.html
@@ -5,5 +5,5 @@
-
+
\ No newline at end of file
diff --git a/e2e/modal-navigation-ng/app/modal/modal.component.html b/e2e/modal-navigation-ng/app/modal/modal.component.html
index 2077becc8..d49c5720f 100644
--- a/e2e/modal-navigation-ng/app/modal/modal.component.html
+++ b/e2e/modal-navigation-ng/app/modal/modal.component.html
@@ -8,6 +8,6 @@
-
+
\ No newline at end of file
diff --git a/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts
index 79010a093..c26ee077c 100644
--- a/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts
+++ b/e2e/modal-navigation-ng/e2e/modal-frame.e2e-spec.ts
@@ -28,7 +28,6 @@ describe("modal-frame:", () => {
});
beforeEach(async function () {
- await screen.loadModalFrame();
});
afterEach(async function () {
@@ -45,30 +44,37 @@ describe("modal-frame:", () => {
});
it("should show dialog confirm, run in background", async () => {
+ await screen.loadModalFrame(true);
await testDialogBackground(driver, screen);
});
it("should run modal page with frame in background", async () => {
+ await screen.loadModalFrame(false);
await modalFrameBackground(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
+ await screen.loadModalFrame(false);
await testSecondPageBackground(driver, screen);
});
it("should show nested modal page with frame, run in background, close", async () => {
+ await screen.loadModalFrame(false);
await testNestedModalFrameBackground(driver, screen);
});
it("should show nested modal page, run in background, close", async () => {
+ await screen.loadModalFrame(false);
await testNestedModalPageBackground(driver, screen);
});
it("should navigate to second page, close", async () => {
+ await screen.loadModalFrame(false);
await testSecondPageClose(driver, screen);
});
it("should navigate to second page, run in background, go back", async () => {
+ await screen.loadModalFrame(true);
await testSecondPageBackground(driver, screen);
});
});
diff --git a/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts
index 6d6846d58..5cb412226 100644
--- a/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts
+++ b/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts
@@ -2,10 +2,6 @@ import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { Screen } from "./screen"
import {
roots,
- modalFrameBackground,
- testSecondPageBackground,
- testSecondPageClose,
- testNestedModalFrameBackground,
testNestedModalPageBackground,
testDialogBackground,
} from "./shared.e2e-spec"
@@ -22,15 +18,10 @@ describe("modal-layout:", () => {
roots.forEach(root => {
describe(`${root} modal no frame background scenarios:`, () => {
-
before(async () => {
await screen[root]();
});
- beforeEach(async function () {
- await screen.loadModalNoFrame();
- });
-
afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
@@ -45,10 +36,13 @@ describe("modal-layout:", () => {
});
it("should show nested modal page, run in background, close", async () => {
+ await screen.loadModalNoFrame(true);
await testNestedModalPageBackground(driver, screen, false);
+
});
it("should show dialog confirm inside modal view with no frame, run in background", async () => {
+ await screen.loadModalNoFrame(false);
await testDialogBackground(driver, screen, false);
});
});
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 b7fbbe9be..cbeafec35 100644
--- a/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts
+++ b/e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts
@@ -11,11 +11,6 @@ describe("Shared modal from home and back", () => {
await driver.resetApp();
});
- after(async () => {
- await driver.quit();
- console.log("Quit driver!");
- });
-
afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
@@ -93,8 +88,7 @@ describe("Shared modal from different components", () => {
afterEach(async function () {
if (this.currentTest.state === "failed") {
- await driver.logPageSource(this.currentTest.title);
- await driver.logScreenshot(this.currentTest.title);
+ await driver.logTestArtifacts(this.currentTest.title);
}
});
diff --git a/e2e/modal-navigation-ng/e2e/screen.ts b/e2e/modal-navigation-ng/e2e/screen.ts
index ba44fdeea..0fdbcb183 100644
--- a/e2e/modal-navigation-ng/e2e/screen.ts
+++ b/e2e/modal-navigation-ng/e2e/screen.ts
@@ -38,36 +38,36 @@ export class Screen {
}
loadedHome = async () => {
- const lblHome = await this._driver.findElementByText(home);
+ const lblHome = await this._driver.findElementByAutomationText(home);
assert.isTrue(await lblHome.isDisplayed());
console.log(home + " loaded!");
}
resetFrameRootView = async () => {
console.log("Setting frame root ...");
- const btnResetFrameRootView = await this._driver.findElementByText(resetFrameRootView);
+ const btnResetFrameRootView = await this._driver.findElementByAutomationText(resetFrameRootView);
await btnResetFrameRootView.tap();
}
resetNamedFrameRootView = async () => {
console.log("Setting named frame root ...");
- const btnResetFrameRootView = await this._driver.findElementByText(resetNamedFrameRootView);
+ const btnResetFrameRootView = await this._driver.findElementByAutomationText(resetNamedFrameRootView);
await btnResetFrameRootView.tap();
}
resetLayoutRootView = async () => {
console.log("Setting layout root ...");
- const btnResetLayoutRootView = await this._driver.findElementByText(resetLayoutRootView);
- await btnResetLayoutRootView.tap();
+ const btnResetLayoutRootView = await this._driver.waitForElement(resetLayoutRootView);
+ await btnResetLayoutRootView.click();
}
resetTabRootView = async () => {
- const btnResetTabRootView = await this._driver.findElementByText(resetTabRootView);
+ const btnResetTabRootView = await this._driver.findElementByAutomationText(resetTabRootView);
await btnResetTabRootView.tap();
}
loadedTabRootView = async () => {
- const tabFirst = await this._driver.findElementByText(first);
+ const tabFirst = await this._driver.findElementByAutomationText(first);
assert.isTrue(await tabFirst.isDisplayed());
console.log("Tab root view loaded!");
}
@@ -87,12 +87,8 @@ export class Screen {
setTabRootView = async () => {
// should load tab root
await this.loadedHome();
- try {
- await this.loadedTabRootView();
- } catch (err) {
- await this.resetTabRootView();
- await this.loadedTabRootView();
- }
+ await this.resetTabRootView();
+ await this.loadedTabRootView();
}
setLayoutRootView = async () => {
@@ -102,29 +98,29 @@ export class Screen {
}
showModalFrame = async () => {
- const btnModalFrame = await this._driver.findElementByText(modalFrame);
+ const btnModalFrame = await this._driver.findElementByAutomationText(modalFrame);
await btnModalFrame.tap();
}
loadedModalFrame = async () => {
- const lblModal = await this._driver.findElementByText(modal);
- assert.isTrue(await lblModal.isDisplayed());
+ const lblModal = await this._driver.findElementByAutomationText(modal, 1000);
+ assert.isTrue(await lblModal.isDisplayed(), `${modal} is not displayed!`);
console.log(modal + " loaded!");
}
showModalNoFrame = async () => {
- const btnModalPage = await this._driver.findElementByText(modalNoFrame);
+ const btnModalPage = await this._driver.findElementByAutomationText(modalNoFrame);
await btnModalPage.tap();
}
loadedModalPage = async () => {
- const btnShowNestedModalPage = await this._driver.findElementByText(showNestedModalPage);
- assert.isTrue(await btnShowNestedModalPage.isDisplayed());
+ const btnShowNestedModalPage = await this._driver.findElementByAutomationText(showNestedModalPage);
+ assert.isTrue(await btnShowNestedModalPage.isDisplayed(), `${showNestedModalPage} is not displayed`);
console.log("Modal Page loaded!");
}
showModalLayout = async () => {
- const btnModalLayout = await this._driver.findElementByText(modalLayout);
+ const btnModalLayout = await this._driver.findElementByAutomationText(modalLayout);
await btnModalLayout.tap();
}
@@ -133,127 +129,123 @@ export class Screen {
}
showModalTabView = async () => {
- const btnModalTabView = await this._driver.findElementByText(modalTabView);
+ const btnModalTabView = await this._driver.findElementByAutomationText(modalTabView);
await btnModalTabView.tap();
}
loadedModalTabView = async () => {
- const itemModalFirst = await this._driver.findElementByText(modalFirst);
+ const itemModalFirst = await this._driver.findElementByAutomationText(modalFirst);
assert.isTrue(await itemModalFirst.isDisplayed());
console.log("Modal TabView loaded!");
}
navigateToSecondPage = async () => {
- const btnNavToSecondPage = await this._driver.findElementByText(navToSecondPage);
+ const btnNavToSecondPage = await this._driver.findElementByAutomationText(navToSecondPage);
await btnNavToSecondPage.tap();
}
showDialogConfirm = async () => {
- const btnShowDialogConfirm = await this._driver.findElementByText(showDialog);
+ const btnShowDialogConfirm = await this._driver.findElementByAutomationText(showDialog);
await btnShowDialogConfirm.tap();
}
navigateToFirstItem = async () => {
- const itemModalFirst = await this._driver.findElementByText(modalFirst);
+ const itemModalFirst = await this._driver.findElementByAutomationText(modalFirst);
await itemModalFirst.tap();
}
navigateToSecondItem = async () => {
- const itemModalSecond = await this._driver.findElementByText(modalSecond);
+ const itemModalSecond = await this._driver.findElementByAutomationText(modalSecond);
await itemModalSecond.tap();
}
loadedModalNoFrame = async () => {
- const btnShowDialogConfirm = await this._driver.findElementByText(showDialog);
- const btnCloseModal = await this._driver.findElementByText(closeModal);
+ const btnShowDialogConfirm = await this._driver.waitForElement(showDialog);
+ const btnCloseModal = await this._driver.waitForElement(closeModal);
assert.isTrue(await btnShowDialogConfirm.isDisplayed());
assert.isTrue(await btnCloseModal.isDisplayed());
console.log("Modal Without Frame shown!");
}
loadedConfirmDialog = async () => {
- const lblDialogMessage = await this._driver.findElementByText(confirmDialogMessage);
+ const lblDialogMessage = await this._driver.findElementByAutomationText(confirmDialogMessage);
assert.isTrue(await lblDialogMessage.isDisplayed());
console.log(dialogConfirm + " shown!");
}
loadedSecondPage = async () => {
- const lblModalSecond = await this._driver.findElementByText(modalSecond);
+ const lblModalSecond = await this._driver.findElementByAutomationText(modalSecond);
assert.isTrue(await lblModalSecond.isDisplayed());
console.log(modalSecond + " loaded!");
}
loadedFirstItem = async () => {
- const lblModal = await this._driver.findElementByText(modal);
+ const lblModal = await this._driver.findElementByAutomationText(modal);
assert.isTrue(await lblModal.isDisplayed());
console.log("First Item loaded!");
}
loadedSecondItem = async () => {
- const btnGoBack = await this._driver.findElementByText(goBack);
+ const btnGoBack = await this._driver.findElementByAutomationText(goBack);
assert.isTrue(await btnGoBack.isDisplayed());
console.log("Second Item loaded!");
}
closeDialog = async () => {
- const btnYesDialog = await this._driver.findElementByText(confirmDialog);
+ const btnYesDialog = await this._driver.findElementByAutomationText(confirmDialog);
await btnYesDialog.tap();
}
goBackFromSecondPage = async () => {
- const btnGoBackFromSecondPage = await this._driver.findElementByText(goBack);
+ const btnGoBackFromSecondPage = await this._driver.findElementByAutomationText(goBack);
await btnGoBackFromSecondPage.tap();
}
showNestedModalFrame = async () => {
- const btnShowNestedModalFrame = await this._driver.findElementByText(showNestedModalFrame);
+ const btnShowNestedModalFrame = await this._driver.findElementByAutomationText(showNestedModalFrame);
await btnShowNestedModalFrame.tap();
}
loadedNestedModalFrame = async () => {
- const lblModalNested = await this._driver.findElementByText(modalNested);
+ const lblModalNested = await this._driver.findElementByAutomationText(modalNested);
assert.isTrue(await lblModalNested.isDisplayed());
console.log(modalNested + " loaded!");
}
closeModalNested = async () => {
- const btnCloseNestedModal = await this._driver.findElementByText(closeModalNested);
+ const btnCloseNestedModal = await this._driver.findElementByAutomationText(closeModalNested);
await btnCloseNestedModal.tap();
}
showNestedModalPage = async () => {
- const btnShowNestedModalPage = await this._driver.findElementByText(showNestedModalPage);
+ const btnShowNestedModalPage = await this._driver.findElementByAutomationText(showNestedModalPage);
await btnShowNestedModalPage.tap();
}
loadedNestedModalPage = async () => {
- const btnCloseModalNested = await this._driver.findElementByText(closeModalNested);
- assert.isTrue(await btnCloseModalNested.isDisplayed());
+ const btnCloseModalNested = await this._driver.findElementByAutomationText(closeModalNested);
+ assert.isTrue(await btnCloseModalNested.isDisplayed(), `${closeModalNested} is not shown`);
console.log(closeModalNested + " loaded!");
}
closeModal = async () => {
- const btnCloseModal = await this._driver.findElementByText(closeModal);
+ const btnCloseModal = await this._driver.waitForElement(closeModal, 10000);
await btnCloseModal.tap();
}
- loadModalNoFrame = async () => {
- try {
- await this.loadedModalNoFrame();
- } catch (err) {
- // should show modal with no frame
+ loadModalNoFrame = async (loadShowModalPageWithFrame: boolean) => {
+ if (loadShowModalPageWithFrame) {
await this.showModalNoFrame();
- await this.loadedModalNoFrame();
}
+
+ await this.loadedModalNoFrame();
}
- loadModalFrame = async () => {
- try {
- await this.loadedModalFrame();
- } catch (err) {
- // should show modal page with frame
+ loadModalFrame = async (loadShowModalPageWithFrame: boolean) => {
+ if (loadShowModalPageWithFrame) {
await this.showModalFrame();
- await this.loadedModalFrame();
}
+
+ await this.loadedModalFrame();
}
}
\ No newline at end of file
diff --git a/e2e/modal-navigation-ng/e2e/shared.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/shared.e2e-spec.ts
index f0c6e3192..54e9f6a90 100644
--- a/e2e/modal-navigation-ng/e2e/shared.e2e-spec.ts
+++ b/e2e/modal-navigation-ng/e2e/shared.e2e-spec.ts
@@ -1,9 +1,10 @@
-import { AppiumDriver, createDriver } from "nativescript-dev-appium";
+import { AppiumDriver } from "nativescript-dev-appium";
import { Screen } from "./screen"
const time = 1;
export const roots = ["setFrameRootView", "setLayoutRootView", "setTabRootView", "setNamedFrameRootView"];
+// export const roots = ["setTabRootView", "setNamedFrameRootView"];
export async function modalFrameBackground(driver: AppiumDriver, screen: Screen) {
await driver.backgroundApp(time);