FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore(modal-navigation): Add Dialogs tests (#5943) · NativeScript/NativeScript@0c3ecbc · GitHub

Commit 0c3ecbc

Browse files
authored
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
1 parent 0b9d4ae commit 0c3ecbc

6 files changed

Lines changed: 57 additions & 4 deletions

File tree

‎e2e/modal-navigation/e2e/modal-frame.e2e-spec.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
testSecondPageBackground,
77
testSecondPageClose,
88
testNestedModalFrameBackground,
9-
testNestedModalPageBackground
9+
testNestedModalPageBackground,
10+
testDialogBackground
1011
} from "./shared.e2e-spec"
1112

1213
describe("modal-frame:", () => {
@@ -44,6 +45,10 @@ describe("modal-frame:", () => {
4445
await screen.loadedHome();
4546
});
4647

48+
it("should show dialog confirm, run in background", async () => {
49+
await testDialogBackground(driver, screen);
50+
});
51+
4752
it("should run modal page with frame in background", async () => {
4853
await modalFrameBackground(driver, screen);
4954
});

‎e2e/modal-navigation/e2e/modal-layout.e2e-spec.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
testSecondPageBackground,
77
testSecondPageClose,
88
testNestedModalFrameBackground,
9-
testNestedModalPageBackground
9+
testNestedModalPageBackground,
10+
testDialogBackground
1011
} from "./shared.e2e-spec"
1112

1213
describe("modal-layout:", () => {
@@ -47,6 +48,10 @@ describe("modal-layout:", () => {
4748
await screen.loadedHome();
4849
});
4950

51+
it("should show dialog confirm, run in background", async () => {
52+
await testDialogBackground(driver, screen);
53+
});
54+
5055
it("should run modal layout in background", async () => {
5156
await modalFrameBackground(driver, screen);
5257
});

‎e2e/modal-navigation/e2e/modal-page.e2e-spec.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
modalPageBackground,
66
testSecondPageBackground,
77
testNestedModalFrameBackground,
8-
testNestedModalPageBackground
8+
testNestedModalPageBackground,
9+
testDialogBackground
910
} from "./shared.e2e-spec"
1011

1112
describe("modal-page:", () => {
@@ -46,6 +47,10 @@ describe("modal-page:", () => {
4647
await screen.loadedHome();
4748
});
4849

50+
it("should show dialog confirm, run in background", async () => {
51+
await testDialogBackground(driver, screen, false);
52+
});
53+
4954
it("should run modal page in background", async () => {
5055
await modalPageBackground(driver, screen, false);
5156
});

‎e2e/modal-navigation/e2e/modal-tab.e2e-spec.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
testSecondPageClose,
99
testNestedModalFrameBackground,
1010
testNestedModalPageBackground,
11-
testSecondItemBackground
11+
testSecondItemBackground,
12+
testDialogBackground
1213
} from "./shared.e2e-spec"
1314

1415
describe("modal-tab:", () => {
@@ -49,6 +50,10 @@ describe("modal-tab:", () => {
4950
await screen.loadedHome();
5051
});
5152

53+
it("should show dialog confirm, run in background", async () => {
54+
await testDialogBackground(driver, screen);
55+
});
56+
5257
it("should run modal tab view in background", async () => {
5358
await modalTabViewBackground(driver, screen);
5459
});

‎e2e/modal-navigation/e2e/screen.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const home = "Home"
55
const first = "First"
66
const modal = "Modal";
77
const modalFirst = "Modal First";
8+
const dialogConfirm = "Dialog";
89
const modalSecond = "Modal Second";
910
const modalNested = "Modal Nested";
1011

@@ -13,13 +14,16 @@ const modalPage = "Show Modal Page";
1314
const modalLayout = "Show Modal Layout";
1415
const modalTabView = "Show Modal TabView";
1516
const navToSecondPage = "Navigate To Second Page";
17+
const showDialog = "Show Dialog";
1618
const resetFrameRootView = "Reset Frame Root View";
1719
const resetTabRootView = "Reset Tab Root View";
1820
const resetLayoutRootView = "Reset Layout Root View";
1921

2022
const showNestedModalFrame = "Show Nested Modal Page With Frame";
2123
const showNestedModalPage = "Show Nested Modal Page";
2224

25+
const confirmDialog = "Yes";
26+
const confirmDialogMessage = "Message";
2327
const closeModalNested = "Close Modal Nested";
2428
const closeModal = "Close Modal";
2529
const goBack = "Go Back";
@@ -131,6 +135,11 @@ export class Screen {
131135
await btnNavToSecondPage.tap();
132136
}
133137

138+
showDialogConfirm = async () => {
139+
const btnShowDialogConfirm = await this._driver.findElementByText(showDialog);
140+
await btnShowDialogConfirm.tap();
141+
}
142+
134143
navigateToFirstItem = async () => {
135144
const itemModalFirst = await this._driver.findElementByText(modalFirst);
136145
await itemModalFirst.tap();
@@ -141,6 +150,12 @@ export class Screen {
141150
await itemModalSecond.tap();
142151
}
143152

153+
loadedConfirmDialog = async () => {
154+
const lblDialogMessage = await this._driver.findElementByText(confirmDialogMessage);
155+
assert.isTrue(await lblDialogMessage.isDisplayed());
156+
console.log(dialogConfirm + " shown!");
157+
}
158+
144159
loadedSecondPage = async () => {
145160
const lblModalSecond = await this._driver.findElementByText(modalSecond);
146161
assert.isTrue(await lblModalSecond.isDisplayed());
@@ -159,6 +174,11 @@ export class Screen {
159174
console.log("Second Item loaded!");
160175
}
161176

177+
closeDialog = async () => {
178+
const btnYesDialog = await this._driver.findElementByText(confirmDialog);
179+
await btnYesDialog.tap();
180+
}
181+
162182
goBackFromSecondPage = async () => {
163183
const btnGoBackFromSecondPage = await this._driver.findElementByText(goBack);
164184
await btnGoBackFromSecondPage.tap();

‎e2e/modal-navigation/e2e/shared.e2e-spec.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ export async function modalFrameBackground(driver: AppiumDriver, screen: Screen)
1010
await screen.loadedModalFrame();
1111
}
1212

13+
export async function testDialogBackground(driver: AppiumDriver, screen: Screen, isInFrame: boolean = true) {
14+
await screen.showDialogConfirm();
15+
await screen.loadedConfirmDialog();
16+
17+
await driver.backgroundApp(time);
18+
await screen.loadedConfirmDialog();
19+
20+
await screen.closeDialog();
21+
if (isInFrame) {
22+
await screen.loadedModalFrame();
23+
}
24+
}
25+
1326
export async function testSecondPageBackground(driver: AppiumDriver, screen: Screen) {
1427
await screen.navigateToSecondPage();
1528
await screen.loadedSecondPage();

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL