chore(modal-navigation): Add Dialogs tests (#5943)

* fix(ios-dialogs): unable to show dialog from modal view

* tests(modal-navigation): add test that opens dialog inside modal view

* chore(modal-navigation): Add Dialogs tests
This commit is contained in:
Alexander Djenkov
2018-06-13 09:40:05 +03:00
committed by GitHub
parent 0b9d4aea0a
commit 0c3ecbc57b
6 changed files with 57 additions and 4 deletions

View File

@ -6,7 +6,8 @@ import {
testSecondPageBackground,
testSecondPageClose,
testNestedModalFrameBackground,
testNestedModalPageBackground
testNestedModalPageBackground,
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-frame:", () => {
@ -44,6 +45,10 @@ describe("modal-frame:", () => {
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
await testDialogBackground(driver, screen);
});
it("should run modal page with frame in background", async () => {
await modalFrameBackground(driver, screen);
});

View File

@ -6,7 +6,8 @@ import {
testSecondPageBackground,
testSecondPageClose,
testNestedModalFrameBackground,
testNestedModalPageBackground
testNestedModalPageBackground,
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-layout:", () => {
@ -47,6 +48,10 @@ describe("modal-layout:", () => {
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
await testDialogBackground(driver, screen);
});
it("should run modal layout in background", async () => {
await modalFrameBackground(driver, screen);
});

View File

@ -5,7 +5,8 @@ import {
modalPageBackground,
testSecondPageBackground,
testNestedModalFrameBackground,
testNestedModalPageBackground
testNestedModalPageBackground,
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-page:", () => {
@ -46,6 +47,10 @@ describe("modal-page:", () => {
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
await testDialogBackground(driver, screen, false);
});
it("should run modal page in background", async () => {
await modalPageBackground(driver, screen, false);
});

View File

@ -8,7 +8,8 @@ import {
testSecondPageClose,
testNestedModalFrameBackground,
testNestedModalPageBackground,
testSecondItemBackground
testSecondItemBackground,
testDialogBackground
} from "./shared.e2e-spec"
describe("modal-tab:", () => {
@ -49,6 +50,10 @@ describe("modal-tab:", () => {
await screen.loadedHome();
});
it("should show dialog confirm, run in background", async () => {
await testDialogBackground(driver, screen);
});
it("should run modal tab view in background", async () => {
await modalTabViewBackground(driver, screen);
});

View File

@ -5,6 +5,7 @@ const home = "Home"
const first = "First"
const modal = "Modal";
const modalFirst = "Modal First";
const dialogConfirm = "Dialog";
const modalSecond = "Modal Second";
const modalNested = "Modal Nested";
@ -13,6 +14,7 @@ const modalPage = "Show Modal Page";
const modalLayout = "Show Modal Layout";
const modalTabView = "Show Modal TabView";
const navToSecondPage = "Navigate To Second Page";
const showDialog = "Show Dialog";
const resetFrameRootView = "Reset Frame Root View";
const resetTabRootView = "Reset Tab Root View";
const resetLayoutRootView = "Reset Layout Root View";
@ -20,6 +22,8 @@ const resetLayoutRootView = "Reset Layout Root View";
const showNestedModalFrame = "Show Nested Modal Page With Frame";
const showNestedModalPage = "Show Nested Modal Page";
const confirmDialog = "Yes";
const confirmDialogMessage = "Message";
const closeModalNested = "Close Modal Nested";
const closeModal = "Close Modal";
const goBack = "Go Back";
@ -131,6 +135,11 @@ export class Screen {
await btnNavToSecondPage.tap();
}
showDialogConfirm = async () => {
const btnShowDialogConfirm = await this._driver.findElementByText(showDialog);
await btnShowDialogConfirm.tap();
}
navigateToFirstItem = async () => {
const itemModalFirst = await this._driver.findElementByText(modalFirst);
await itemModalFirst.tap();
@ -141,6 +150,12 @@ export class Screen {
await itemModalSecond.tap();
}
loadedConfirmDialog = async () => {
const lblDialogMessage = await this._driver.findElementByText(confirmDialogMessage);
assert.isTrue(await lblDialogMessage.isDisplayed());
console.log(dialogConfirm + " shown!");
}
loadedSecondPage = async () => {
const lblModalSecond = await this._driver.findElementByText(modalSecond);
assert.isTrue(await lblModalSecond.isDisplayed());
@ -159,6 +174,11 @@ export class Screen {
console.log("Second Item loaded!");
}
closeDialog = async () => {
const btnYesDialog = await this._driver.findElementByText(confirmDialog);
await btnYesDialog.tap();
}
goBackFromSecondPage = async () => {
const btnGoBackFromSecondPage = await this._driver.findElementByText(goBack);
await btnGoBackFromSecondPage.tap();

View File

@ -10,6 +10,19 @@ export async function modalFrameBackground(driver: AppiumDriver, screen: Screen)
await screen.loadedModalFrame();
}
export async function testDialogBackground(driver: AppiumDriver, screen: Screen, isInFrame: boolean = true) {
await screen.showDialogConfirm();
await screen.loadedConfirmDialog();
await driver.backgroundApp(time);
await screen.loadedConfirmDialog();
await screen.closeDialog();
if (isInFrame) {
await screen.loadedModalFrame();
}
}
export async function testSecondPageBackground(driver: AppiumDriver, screen: Screen) {
await screen.navigateToSecondPage();
await screen.loadedSecondPage();