Skip to content

Commit 652776a

Browse files
author
Zdravko
authored
Merge pull request #1791 from NativeScript/zbranzov/new-test
chore: add new test for #1771
2 parents 0332b8a + 4ce38fe commit 652776a

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ng-sample/app/**/*.js
3030
# Webpack configuration files
3131
webpack.config.js
3232
tsconfig.esm.json
33+
tsconfig.tns.json
3334

3435
# IDEs and editors
3536
/.idea

e2e/config/mocha.opts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--timeout 140000
1+
--timeout 60000
22
--recursive e2e
33
--reporter mocha-multi
44
--reporter-options spec=-,mocha-junit-reporter=test-results.xml

e2e/modal-navigation-ng/app/navigation/basic.navigation.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { ModalViewComponent } from "~/modal-shared/modal-view.component";
1616
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()" textAlignment="left"></Button>
1717
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()" textAlignment="left"></Button>
1818
<Button text="Show Shared Modal" (tap)="onRootModalTap()" textAlignment="left"></Button>
19+
<Button #popoverButtonComp text="Show shared 'popover' modal" (tap)="onPopoverModal()" textAlignment="left"></Button>
1920
<Button text="Show Dialog" (tap)="onShowDialog()" textAlignment="left"></Button>
20-
<Button #popoverButtonComp text="Show 'popover' modal" (tap)="onPopoverModal()" textAlignment="left"></Button>
2121
</StackLayout>`
2222
})
2323

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("modal-shared:", () => {
1515
});
1616

1717
roots.forEach(root => {
18-
describe("Shared modal from second and back", () => {
18+
describe("Shared modal from home component and back", () => {
1919

2020
before(async () => {
2121
await screen[root]();
@@ -46,6 +46,11 @@ describe("modal-shared:", () => {
4646
await screen.closeModal();
4747
});
4848

49+
it("should open/close shared modal with presentation style from home component", async () => {
50+
await screen.loadSharedModalWithPresentationStyle(true);
51+
await screen.closeModal();
52+
});
53+
4954
it("should find home component again", async () => {
5055
await screen.loadedHome();
5156
});

e2e/modal-navigation-ng/e2e/screens/screen.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppiumDriver } from "nativescript-dev-appium";
1+
import { AppiumDriver, SearchOptions } from "nativescript-dev-appium";
22
import { assert } from "chai";
33

44
const home = "Home Component"
@@ -165,6 +165,11 @@ export class Screen {
165165
await btnTap.click();
166166
}
167167

168+
private showSharedModalPresentationStyle = async () => {
169+
const btnTap = await this._driver.findElementByText("popover", SearchOptions.contains);
170+
await btnTap.click();
171+
}
172+
168173
loadedModalPage = async () => {
169174
const btnShowNestedModalPage = await this._driver.findElementByAutomationText(showNestedModalPage);
170175
assert.isTrue(await btnShowNestedModalPage.isDisplayed(), `${showNestedModalPage} is not displayed`);
@@ -212,6 +217,7 @@ export class Screen {
212217
}
213218

214219
loadedModalNoFrame = async () => {
220+
await this._driver.wait(2000);
215221
const btnShowDialogConfirm = await this._driver.waitForElement(showDialog);
216222
const btnCloseModal = await this._driver.waitForElement(closeModal);
217223
assert.isTrue(await btnShowDialogConfirm.isDisplayed());
@@ -309,4 +315,13 @@ export class Screen {
309315
const lbl = await this._driver.waitForElement(sharedModalView, 5000);
310316
assert.isTrue(await lbl.isDisplayed());
311317
}
318+
319+
loadSharedModalWithPresentationStyle = async (loadShowModalPageWithFrame: boolean) => {
320+
if (loadShowModalPageWithFrame) {
321+
await this.showSharedModalPresentationStyle();
322+
}
323+
324+
const lbl = await this._driver.waitForElement(sharedModalView, 5000);
325+
assert.isTrue(await lbl.isDisplayed());
326+
}
312327
}

0 commit comments

Comments
 (0)