mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
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:

committed by
GitHub

parent
0b9d4aea0a
commit
0c3ecbc57b
@ -6,7 +6,8 @@ import {
|
|||||||
testSecondPageBackground,
|
testSecondPageBackground,
|
||||||
testSecondPageClose,
|
testSecondPageClose,
|
||||||
testNestedModalFrameBackground,
|
testNestedModalFrameBackground,
|
||||||
testNestedModalPageBackground
|
testNestedModalPageBackground,
|
||||||
|
testDialogBackground
|
||||||
} from "./shared.e2e-spec"
|
} from "./shared.e2e-spec"
|
||||||
|
|
||||||
describe("modal-frame:", () => {
|
describe("modal-frame:", () => {
|
||||||
@ -44,6 +45,10 @@ describe("modal-frame:", () => {
|
|||||||
await screen.loadedHome();
|
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 () => {
|
it("should run modal page with frame in background", async () => {
|
||||||
await modalFrameBackground(driver, screen);
|
await modalFrameBackground(driver, screen);
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,8 @@ import {
|
|||||||
testSecondPageBackground,
|
testSecondPageBackground,
|
||||||
testSecondPageClose,
|
testSecondPageClose,
|
||||||
testNestedModalFrameBackground,
|
testNestedModalFrameBackground,
|
||||||
testNestedModalPageBackground
|
testNestedModalPageBackground,
|
||||||
|
testDialogBackground
|
||||||
} from "./shared.e2e-spec"
|
} from "./shared.e2e-spec"
|
||||||
|
|
||||||
describe("modal-layout:", () => {
|
describe("modal-layout:", () => {
|
||||||
@ -47,6 +48,10 @@ describe("modal-layout:", () => {
|
|||||||
await screen.loadedHome();
|
await screen.loadedHome();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should show dialog confirm, run in background", async () => {
|
||||||
|
await testDialogBackground(driver, screen);
|
||||||
|
});
|
||||||
|
|
||||||
it("should run modal layout in background", async () => {
|
it("should run modal layout in background", async () => {
|
||||||
await modalFrameBackground(driver, screen);
|
await modalFrameBackground(driver, screen);
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,8 @@ import {
|
|||||||
modalPageBackground,
|
modalPageBackground,
|
||||||
testSecondPageBackground,
|
testSecondPageBackground,
|
||||||
testNestedModalFrameBackground,
|
testNestedModalFrameBackground,
|
||||||
testNestedModalPageBackground
|
testNestedModalPageBackground,
|
||||||
|
testDialogBackground
|
||||||
} from "./shared.e2e-spec"
|
} from "./shared.e2e-spec"
|
||||||
|
|
||||||
describe("modal-page:", () => {
|
describe("modal-page:", () => {
|
||||||
@ -46,6 +47,10 @@ describe("modal-page:", () => {
|
|||||||
await screen.loadedHome();
|
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 () => {
|
it("should run modal page in background", async () => {
|
||||||
await modalPageBackground(driver, screen, false);
|
await modalPageBackground(driver, screen, false);
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,8 @@ import {
|
|||||||
testSecondPageClose,
|
testSecondPageClose,
|
||||||
testNestedModalFrameBackground,
|
testNestedModalFrameBackground,
|
||||||
testNestedModalPageBackground,
|
testNestedModalPageBackground,
|
||||||
testSecondItemBackground
|
testSecondItemBackground,
|
||||||
|
testDialogBackground
|
||||||
} from "./shared.e2e-spec"
|
} from "./shared.e2e-spec"
|
||||||
|
|
||||||
describe("modal-tab:", () => {
|
describe("modal-tab:", () => {
|
||||||
@ -49,6 +50,10 @@ describe("modal-tab:", () => {
|
|||||||
await screen.loadedHome();
|
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 () => {
|
it("should run modal tab view in background", async () => {
|
||||||
await modalTabViewBackground(driver, screen);
|
await modalTabViewBackground(driver, screen);
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@ const home = "Home"
|
|||||||
const first = "First"
|
const first = "First"
|
||||||
const modal = "Modal";
|
const modal = "Modal";
|
||||||
const modalFirst = "Modal First";
|
const modalFirst = "Modal First";
|
||||||
|
const dialogConfirm = "Dialog";
|
||||||
const modalSecond = "Modal Second";
|
const modalSecond = "Modal Second";
|
||||||
const modalNested = "Modal Nested";
|
const modalNested = "Modal Nested";
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ const modalPage = "Show Modal Page";
|
|||||||
const modalLayout = "Show Modal Layout";
|
const modalLayout = "Show Modal Layout";
|
||||||
const modalTabView = "Show Modal TabView";
|
const modalTabView = "Show Modal TabView";
|
||||||
const navToSecondPage = "Navigate To Second Page";
|
const navToSecondPage = "Navigate To Second Page";
|
||||||
|
const showDialog = "Show Dialog";
|
||||||
const resetFrameRootView = "Reset Frame Root View";
|
const resetFrameRootView = "Reset Frame Root View";
|
||||||
const resetTabRootView = "Reset Tab Root View";
|
const resetTabRootView = "Reset Tab Root View";
|
||||||
const resetLayoutRootView = "Reset Layout 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 showNestedModalFrame = "Show Nested Modal Page With Frame";
|
||||||
const showNestedModalPage = "Show Nested Modal Page";
|
const showNestedModalPage = "Show Nested Modal Page";
|
||||||
|
|
||||||
|
const confirmDialog = "Yes";
|
||||||
|
const confirmDialogMessage = "Message";
|
||||||
const closeModalNested = "Close Modal Nested";
|
const closeModalNested = "Close Modal Nested";
|
||||||
const closeModal = "Close Modal";
|
const closeModal = "Close Modal";
|
||||||
const goBack = "Go Back";
|
const goBack = "Go Back";
|
||||||
@ -131,6 +135,11 @@ export class Screen {
|
|||||||
await btnNavToSecondPage.tap();
|
await btnNavToSecondPage.tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showDialogConfirm = async () => {
|
||||||
|
const btnShowDialogConfirm = await this._driver.findElementByText(showDialog);
|
||||||
|
await btnShowDialogConfirm.tap();
|
||||||
|
}
|
||||||
|
|
||||||
navigateToFirstItem = async () => {
|
navigateToFirstItem = async () => {
|
||||||
const itemModalFirst = await this._driver.findElementByText(modalFirst);
|
const itemModalFirst = await this._driver.findElementByText(modalFirst);
|
||||||
await itemModalFirst.tap();
|
await itemModalFirst.tap();
|
||||||
@ -141,6 +150,12 @@ export class Screen {
|
|||||||
await itemModalSecond.tap();
|
await itemModalSecond.tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadedConfirmDialog = async () => {
|
||||||
|
const lblDialogMessage = await this._driver.findElementByText(confirmDialogMessage);
|
||||||
|
assert.isTrue(await lblDialogMessage.isDisplayed());
|
||||||
|
console.log(dialogConfirm + " shown!");
|
||||||
|
}
|
||||||
|
|
||||||
loadedSecondPage = async () => {
|
loadedSecondPage = async () => {
|
||||||
const lblModalSecond = await this._driver.findElementByText(modalSecond);
|
const lblModalSecond = await this._driver.findElementByText(modalSecond);
|
||||||
assert.isTrue(await lblModalSecond.isDisplayed());
|
assert.isTrue(await lblModalSecond.isDisplayed());
|
||||||
@ -159,6 +174,11 @@ export class Screen {
|
|||||||
console.log("Second Item loaded!");
|
console.log("Second Item loaded!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeDialog = async () => {
|
||||||
|
const btnYesDialog = await this._driver.findElementByText(confirmDialog);
|
||||||
|
await btnYesDialog.tap();
|
||||||
|
}
|
||||||
|
|
||||||
goBackFromSecondPage = async () => {
|
goBackFromSecondPage = async () => {
|
||||||
const btnGoBackFromSecondPage = await this._driver.findElementByText(goBack);
|
const btnGoBackFromSecondPage = await this._driver.findElementByText(goBack);
|
||||||
await btnGoBackFromSecondPage.tap();
|
await btnGoBackFromSecondPage.tap();
|
||||||
|
@ -10,6 +10,19 @@ export async function modalFrameBackground(driver: AppiumDriver, screen: Screen)
|
|||||||
await screen.loadedModalFrame();
|
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) {
|
export async function testSecondPageBackground(driver: AppiumDriver, screen: Screen) {
|
||||||
await screen.navigateToSecondPage();
|
await screen.navigateToSecondPage();
|
||||||
await screen.loadedSecondPage();
|
await screen.loadedSecondPage();
|
||||||
|
Reference in New Issue
Block a user